added support for conference verb

This commit is contained in:
Dave Horton
2020-04-27 11:25:39 -04:00
parent d31c53d383
commit 8ee590172b
27 changed files with 888 additions and 133 deletions

View File

@@ -116,7 +116,7 @@ class TaskDial extends Task {
get name() { return TaskName.Dial; }
async exec(cs) {
super.exec(cs);
await super.exec(cs);
try {
if (cs.direction === CallDirection.Inbound) {
await this._initializeInbound(cs);
@@ -135,12 +135,12 @@ class TaskDial extends Task {
this._removeDtmfDetection(cs, this.ep);
} catch (err) {
this.logger.error({err}, 'TaskDial:exec terminating with error');
this.kill();
this.kill(cs);
}
}
async kill() {
super.kill();
async kill(cs) {
super.kill(cs);
this._removeDtmfDetection(this.cs, this.epOther);
this._removeDtmfDetection(this.cs, this.ep);
this._killOutdials();
@@ -149,8 +149,8 @@ class TaskDial extends Task {
this.sd = null;
}
if (this.callSid) sessionTracker.remove(this.callSid);
if (this.listenTask) await this.listenTask.kill();
if (this.transcribeTask) await this.transcribeTask.kill();
if (this.listenTask) await this.listenTask.kill(cs);
if (this.transcribeTask) await this.transcribeTask.kill(cs);
if (this.timerMaxCallDuration) clearTimeout(this.timerMaxCallDuration);
this.notifyTaskDone();
}
@@ -279,7 +279,7 @@ class TaskDial extends Task {
this.dials.delete(sd.callSid);
if (this.dials.size === 0 && !this.sd) {
this.logger.debug('Dial:_attemptCalls - all calls failed after call create err, ending task');
this.kill();
this.kill(cs);
}
})
.on('callStatusChange', (obj) => {
@@ -308,7 +308,7 @@ class TaskDial extends Task {
if (this.dials.size === 0 && !this.sd) {
this.logger.debug('Dial:_attemptCalls - all calls failed after call failure, ending task');
clearTimeout(timerRing);
this.kill();
this.kill(cs);
}
break;
}
@@ -322,7 +322,7 @@ class TaskDial extends Task {
this.dials.delete(sd.callSid);
if (this.dials.size === 0 && !this.sd) {
this.logger.debug('Dial:_attemptCalls - all calls failed after decline, ending task');
this.kill();
this.kill(cs);
}
});
} catch (err) {
@@ -367,7 +367,7 @@ class TaskDial extends Task {
this.timerMaxCallDuration = setTimeout(() => {
this.logger.info(`Dial:_selectSingleDial tearing down call as it has reached ${this.timeLimit}s`);
this.ep.unbridge();
this.kill();
this.kill(cs);
}, this.timeLimit * 1000);
}
sessionTracker.add(this.callSid, cs);
@@ -376,7 +376,7 @@ class TaskDial extends Task {
sessionTracker.remove(this.callSid);
if (this.timerMaxCallDuration) clearTimeout(this.timerMaxCallDuration);
this.ep.unbridge();
this.kill();
this.kill(cs);
});
Object.assign(this.results, {