mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
fixed call hangup as call is await for new task and received ws command (#619)
* fixed call hangup as call is await for new task and received ws command * wi
This commit is contained in:
@@ -1034,6 +1034,11 @@ class CallSession extends Emitter {
|
|||||||
const t = normalizeJambones(this.logger, tasks).map((tdata) => makeTask(this.logger, tdata));
|
const t = normalizeJambones(this.logger, tasks).map((tdata) => makeTask(this.logger, tdata));
|
||||||
this.logger.info({tasks: listTaskNames(t)}, 'CallSession:_lccCallHook new task list');
|
this.logger.info({tasks: listTaskNames(t)}, 'CallSession:_lccCallHook new task list');
|
||||||
this.replaceApplication(t);
|
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 {
|
else {
|
||||||
/* we started a new app on the child leg, but nothing given for parent so hang him up */
|
/* 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}) {
|
_onCommand({msgid, command, call_sid, queueCommand, data}) {
|
||||||
this.logger.info({msgid, command, queueCommand, data}, 'CallSession:_onCommand - received command');
|
this.logger.info({msgid, command, queueCommand, data}, 'CallSession:_onCommand - received command');
|
||||||
const resolution = {reason: 'received command', queue: queueCommand, command};
|
let resolution;
|
||||||
switch (command) {
|
switch (command) {
|
||||||
case 'redirect':
|
case 'redirect':
|
||||||
if (Array.isArray(data)) {
|
if (Array.isArray(data)) {
|
||||||
@@ -1433,6 +1438,7 @@ Duration=${duration} `
|
|||||||
this.tasks.push(...t);
|
this.tasks.push(...t);
|
||||||
this.logger.info({tasks: listTaskNames(this.tasks)}, 'CallSession:_onCommand - updated task list');
|
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);
|
resolution.command = listTaskNames(t);
|
||||||
}
|
}
|
||||||
else this._lccCallHook(data);
|
else this._lccCallHook(data);
|
||||||
@@ -1483,7 +1489,7 @@ Duration=${duration} `
|
|||||||
default:
|
default:
|
||||||
this.logger.info(`CallSession:_onCommand - invalid command ${command}`);
|
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.logger.debug({resolution}, 'CallSession:_onCommand - got commands, waking up..');
|
||||||
this.wakeupResolver(resolution);
|
this.wakeupResolver(resolution);
|
||||||
this.wakeupResolver = null;
|
this.wakeupResolver = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user