bugfix: if enqeue task is killed because it is being replaced with new app supplied by LCC, ignore any app returned from the actionHook as LCC takes precedence

This commit is contained in:
Dave Horton
2021-06-23 11:14:19 -04:00
parent 08c53aa586
commit c0a29c7a64
3 changed files with 30 additions and 22 deletions

View File

@@ -1,6 +1,6 @@
const Emitter = require('events');
const fs = require('fs');
const {CallDirection, TaskPreconditions, CallStatus, TaskName} = require('../utils/constants');
const {CallDirection, TaskPreconditions, CallStatus, TaskName, KillReason} = require('../utils/constants');
const moment = require('moment');
const assert = require('assert');
const sessionTracker = require('./session-tracker');
@@ -351,7 +351,7 @@ class CallSession extends Emitter {
}
else {
/* we started a new app on the child leg, but nothing given for parent so hang him up */
this.currentTask.kill();
this.currentTask.kill(this);
}
}
@@ -488,7 +488,7 @@ class CallSession extends Emitter {
this.logger.info({tasks: listTaskNames(tasks)},
`CallSession:replaceApplication reset with ${tasks.length} new tasks, stack depth is ${this.stackIdx}`);
if (this.currentTask) {
this.currentTask.kill();
this.currentTask.kill(this, KillReason.Replaced);
this.currentTask = null;
}
}
@@ -497,7 +497,7 @@ class CallSession extends Emitter {
if (this.isConfirmCallSession) this.logger.debug('CallSession:kill (ConfirmSession)');
else this.logger.info('CallSession:kill');
if (this.currentTask) {
this.currentTask.kill();
this.currentTask.kill(this);
this.currentTask = null;
}
this.tasks = [];