mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-22 01:27:55 +00:00
bugfix for enqueue and dial when these tasks are replaced by LCC
This commit is contained in:
@@ -1,6 +1,13 @@
|
|||||||
const Task = require('./task');
|
const Task = require('./task');
|
||||||
const makeTask = require('./make_task');
|
const makeTask = require('./make_task');
|
||||||
const {CallStatus, CallDirection, TaskName, TaskPreconditions, MAX_SIMRINGS} = require('../utils/constants');
|
const {
|
||||||
|
CallStatus,
|
||||||
|
CallDirection,
|
||||||
|
TaskName,
|
||||||
|
TaskPreconditions,
|
||||||
|
MAX_SIMRINGS,
|
||||||
|
KillReason
|
||||||
|
} = require('../utils/constants');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const placeCall = require('../utils/place-outdial');
|
const placeCall = require('../utils/place-outdial');
|
||||||
const sessionTracker = require('../session/session-tracker');
|
const sessionTracker = require('../session/session-tracker');
|
||||||
@@ -140,7 +147,7 @@ class TaskDial extends Task {
|
|||||||
await this.awaitTaskDone();
|
await this.awaitTaskDone();
|
||||||
|
|
||||||
this.logger.debug({callSid: this.cs.callSid}, 'Dial:exec task is done, sending actionHook if any');
|
this.logger.debug({callSid: this.cs.callSid}, 'Dial:exec task is done, sending actionHook if any');
|
||||||
await this.performAction(this.results);
|
await this.performAction(this.results, this.killReason !== KillReason.Replaced);
|
||||||
this._removeDtmfDetection(cs, this.epOther);
|
this._removeDtmfDetection(cs, this.epOther);
|
||||||
this._removeDtmfDetection(cs, this.ep);
|
this._removeDtmfDetection(cs, this.ep);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -149,8 +156,9 @@ class TaskDial extends Task {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async kill(cs) {
|
async kill(cs, reason) {
|
||||||
super.kill(cs);
|
super.kill(cs);
|
||||||
|
this.killReason = reason || KillReason.Hangup;
|
||||||
this._removeDtmfDetection(this.cs, this.epOther);
|
this._removeDtmfDetection(this.cs, this.epOther);
|
||||||
this._removeDtmfDetection(this.cs, this.ep);
|
this._removeDtmfDetection(this.cs, this.ep);
|
||||||
this.logger.debug({callSid: this.cs.callSid}, 'Dial:kill removed dtmf listeners');
|
this.logger.debug({callSid: this.cs.callSid}, 'Dial:kill removed dtmf listeners');
|
||||||
|
|||||||
@@ -63,8 +63,9 @@ class TaskEnqueue extends Task {
|
|||||||
|
|
||||||
async kill(cs, reason) {
|
async kill(cs, reason) {
|
||||||
super.kill(cs);
|
super.kill(cs);
|
||||||
this.logger.info(`TaskEnqueue:kill ${this.queueName}`);
|
this.killReason = reason || KillReason.Hangup;
|
||||||
this.emitter.emit('kill', reason || KillReason.Hangup);
|
this.logger.info(`TaskEnqueue:kill ${this.queueName} with reason ${this.killReason}`);
|
||||||
|
this.emitter.emit('kill');
|
||||||
this.notifyTaskDone();
|
this.notifyTaskDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,8 +239,7 @@ class TaskEnqueue extends Task {
|
|||||||
ep.unbridge().catch((err) => {});
|
ep.unbridge().catch((err) => {});
|
||||||
resolve();
|
resolve();
|
||||||
})
|
})
|
||||||
.on('kill', (reason) => {
|
.on('kill', () => {
|
||||||
this.killReason = reason;
|
|
||||||
this.logger.info(`TaskEnqueue:_bridgeLocal ending with ${this.killReason}`);
|
this.logger.info(`TaskEnqueue:_bridgeLocal ending with ${this.killReason}`);
|
||||||
ep.unbridge().catch((err) => {});
|
ep.unbridge().catch((err) => {});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user