diff --git a/lib/session/call-session.js b/lib/session/call-session.js index 3a2e82bc..b3e5adfc 100644 --- a/lib/session/call-session.js +++ b/lib/session/call-session.js @@ -1034,6 +1034,11 @@ class CallSession extends Emitter { const t = normalizeJambones(this.logger, tasks).map((tdata) => makeTask(this.logger, tdata)); this.logger.info({tasks: listTaskNames(t)}, 'CallSession:_lccCallHook new task list'); this.replaceApplication(t); + if (this.wakeupResolver) { + //this.logger.debug({resolution}, 'CallSession:_onCommand - got commands, waking up..'); + this.wakeupResolver({reason: 'lcc: new tasks'}); + this.wakeupResolver = null; + } } else { /* we started a new app on the child leg, but nothing given for parent so hang him up */ @@ -1412,7 +1417,7 @@ Duration=${duration} ` _onCommand({msgid, command, call_sid, queueCommand, data}) { this.logger.info({msgid, command, queueCommand, data}, 'CallSession:_onCommand - received command'); - const resolution = {reason: 'received command', queue: queueCommand, command}; + let resolution; switch (command) { case 'redirect': if (Array.isArray(data)) { @@ -1433,6 +1438,7 @@ Duration=${duration} ` this.tasks.push(...t); this.logger.info({tasks: listTaskNames(this.tasks)}, 'CallSession:_onCommand - updated task list'); } + resolution = {reason: 'received command, new tasks', queue: queueCommand, command}; resolution.command = listTaskNames(t); } else this._lccCallHook(data); @@ -1483,7 +1489,7 @@ Duration=${duration} ` default: this.logger.info(`CallSession:_onCommand - invalid command ${command}`); } - if (this.wakeupResolver) { + if (this.wakeupResolver && resolution) { //this.logger.debug({resolution}, 'CallSession:_onCommand - got commands, waking up..'); this.wakeupResolver(resolution); this.wakeupResolver = null;