mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +00:00
remove config in favor of env vars, other major changes
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
const Task = require('./task');
|
||||
const {TaskName} = require('../utils/constants');
|
||||
const makeTask = require('./make_task');
|
||||
const normalizeJamones = require('../utils/normalize-jamones');
|
||||
|
||||
/**
|
||||
* Manages an outdial made via REST API
|
||||
@@ -44,12 +46,17 @@ class TaskRestDial extends Task {
|
||||
this.req = null;
|
||||
const cs = this.callSession;
|
||||
cs.setDialog(dlg);
|
||||
const tasks = await cs.requestor.request(this.call_hook, cs.callInfo);
|
||||
if (tasks && Array.isArray(tasks)) {
|
||||
this.logger.debug({tasks: tasks}, `TaskRestDial: replacing application with ${tasks.length} tasks`);
|
||||
cs.replaceApplication(tasks);
|
||||
|
||||
try {
|
||||
const tasks = await cs.requestor.request(this.call_hook, cs.callInfo);
|
||||
if (tasks && Array.isArray(tasks)) {
|
||||
this.logger.debug({tasks: tasks}, `TaskRestDial: replacing application with ${tasks.length} tasks`);
|
||||
cs.replaceApplication(normalizeJamones(this.logger, tasks).map((tdata) => makeTask(this.logger, tdata)));
|
||||
}
|
||||
} catch (err) {
|
||||
this.logger.error(err, 'TaskRestDial:_onConnect error retrieving or parsing application, ending call');
|
||||
this.notifyTaskDone();
|
||||
}
|
||||
this.notifyTaskDone();
|
||||
}
|
||||
|
||||
_onCallStatus(status) {
|
||||
|
||||
Reference in New Issue
Block a user