mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-21 17:17:58 +00:00
add support for queueing commands sent over ws
This commit is contained in:
@@ -619,14 +619,21 @@ class CallSession extends Emitter {
|
||||
this.taskIdx = 0;
|
||||
}
|
||||
|
||||
_onCommand({msgid, command, call_sid, data}) {
|
||||
this.logger.info({msgid, command, call_sid, data}, 'CallSession:_onCommand - received command');
|
||||
_onCommand({msgid, command, queueCommand, data}) {
|
||||
this.logger.info({msgid, command, data}, 'CallSession:_onCommand - received command');
|
||||
switch (command) {
|
||||
case 'redirect':
|
||||
if (Array.isArray(data)) {
|
||||
const t = normalizeJambones(this.logger, data).map((tdata) => makeTask(this.logger, tdata));
|
||||
this.logger.info({tasks: listTaskNames(t)}, 'CallSession:_onCommand new task list');
|
||||
this.replaceApplication(t);
|
||||
if (!queueCommand) {
|
||||
this.logger.info({tasks: listTaskNames(t)}, 'CallSession:_onCommand new task list');
|
||||
this.replaceApplication(t);
|
||||
}
|
||||
else {
|
||||
this.logger.info({t, tasks: this.tasks}, 'CallSession:_onCommand - about to queue tasks');
|
||||
this.tasks.push(...t);
|
||||
this.logger.debug({tasks: this.tasks}, 'CallSession:_onCommand - tasks have been queued');
|
||||
}
|
||||
}
|
||||
else this._lccCallHook(data);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user