mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
fix: app_json is used for outbound call (#358)
* fix: app_json is used for outbound call * fix jslint * fix: app_json setter in rest:dial task
This commit is contained in:
@@ -23,6 +23,10 @@ class TaskRestDial extends Task {
|
||||
|
||||
get name() { return TaskName.RestDial; }
|
||||
|
||||
set appJson(app_json) {
|
||||
this.app_json = app_json;
|
||||
}
|
||||
|
||||
/**
|
||||
* INVITE has just been sent at this point
|
||||
*/
|
||||
@@ -84,7 +88,12 @@ class TaskRestDial extends Task {
|
||||
this.logger.info({err}, 'Rest:dial:Call established - Error calling startAmd');
|
||||
}
|
||||
}
|
||||
const tasks = await cs.requestor.request('session:new', this.call_hook, params, httpHeaders);
|
||||
let tasks;
|
||||
if (this.app_json) {
|
||||
tasks = JSON.parse(this.app_json);
|
||||
} else {
|
||||
tasks = await cs.requestor.request('session:new', this.call_hook, params, httpHeaders);
|
||||
}
|
||||
if (tasks && Array.isArray(tasks)) {
|
||||
this.logger.debug({tasks: tasks}, `TaskRestDial: replacing application with ${tasks.length} tasks`);
|
||||
cs.replaceApplication(normalizeJambones(this.logger, tasks).map((tdata) => makeTask(this.logger, tdata)));
|
||||
|
||||
Reference in New Issue
Block a user