mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
verbhook on ws connection should be ended in next redirect command (#616)
* verbhook on ws connection should be ended in next redirect command * wip * wip * minor change for readability --------- Co-authored-by: Dave Horton <daveh@beachdognet.com>
This commit is contained in:
@@ -828,6 +828,10 @@ class CallSession extends Emitter {
|
||||
const task = this.tasks.shift();
|
||||
this.logger.info(`CallSession:exec starting task #${stackNum}:${taskNum}: ${task.name}`);
|
||||
this._notifyTaskStatus(task, {event: 'starting'});
|
||||
// Register verbhook span wait for end
|
||||
task.on('VerbHookSpanWaitForEnd', ({span}) => {
|
||||
this.verbHookSpan = span;
|
||||
});
|
||||
try {
|
||||
const resources = await this._evaluatePreconditions(task);
|
||||
let skip = false;
|
||||
@@ -1035,6 +1039,7 @@ class CallSession extends Emitter {
|
||||
/* we started a new app on the child leg, but nothing given for parent so hang him up */
|
||||
this.currentTask.kill(this);
|
||||
}
|
||||
this._endVerbHookSpan();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1306,6 +1311,7 @@ Duration=${duration} `
|
||||
kill(onBackgroundGatherBargein = false) {
|
||||
if (this.isConfirmCallSession) this.logger.debug('CallSession:kill (ConfirmSession)');
|
||||
else this.logger.info('CallSession:kill');
|
||||
this._endVerbHookSpan();
|
||||
if (this.currentTask) {
|
||||
this.currentTask.kill(this);
|
||||
this.currentTask = null;
|
||||
@@ -1410,6 +1416,7 @@ Duration=${duration} `
|
||||
switch (command) {
|
||||
case 'redirect':
|
||||
if (Array.isArray(data)) {
|
||||
this._endVerbHookSpan();
|
||||
const t = normalizeJambones(this.logger, data)
|
||||
.map((tdata) => makeTask(this.logger, tdata));
|
||||
if (!queueCommand) {
|
||||
@@ -2073,6 +2080,13 @@ Duration=${duration} `
|
||||
stopBackgroundTask(type) {
|
||||
this.backgroundTaskManager.stop(type);
|
||||
}
|
||||
|
||||
_endVerbHookSpan() {
|
||||
if (this.verbHookSpan) {
|
||||
this.verbHookSpan.end();
|
||||
this.verbHookSpan = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = CallSession;
|
||||
|
||||
Reference in New Issue
Block a user