mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
dial: make sure to clear max call timer when dial ends
This commit is contained in:
@@ -161,6 +161,10 @@ class TaskDial extends Task {
|
|||||||
async kill(cs, reason) {
|
async kill(cs, reason) {
|
||||||
super.kill(cs);
|
super.kill(cs);
|
||||||
this.killReason = reason || KillReason.Hangup;
|
this.killReason = reason || KillReason.Hangup;
|
||||||
|
if (this.timerMaxCallDuration) {
|
||||||
|
clearTimeout(this.timerMaxCallDuration);
|
||||||
|
this.timerMaxCallDuration = null;
|
||||||
|
}
|
||||||
this._removeDtmfDetection(cs.dlg);
|
this._removeDtmfDetection(cs.dlg);
|
||||||
this._removeDtmfDetection(this.dlg);
|
this._removeDtmfDetection(this.dlg);
|
||||||
this._killOutdials();
|
this._killOutdials();
|
||||||
@@ -171,7 +175,6 @@ class TaskDial extends Task {
|
|||||||
if (this.callSid) sessionTracker.remove(this.callSid);
|
if (this.callSid) sessionTracker.remove(this.callSid);
|
||||||
if (this.listenTask) await this.listenTask.kill(cs);
|
if (this.listenTask) await this.listenTask.kill(cs);
|
||||||
if (this.transcribeTask) await this.transcribeTask.kill(cs);
|
if (this.transcribeTask) await this.transcribeTask.kill(cs);
|
||||||
if (this.timerMaxCallDuration) clearTimeout(this.timerMaxCallDuration);
|
|
||||||
this.notifyTaskDone();
|
this.notifyTaskDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -458,7 +461,7 @@ class TaskDial extends Task {
|
|||||||
if (this.timeLimit) {
|
if (this.timeLimit) {
|
||||||
this.timerMaxCallDuration = setTimeout(() => {
|
this.timerMaxCallDuration = setTimeout(() => {
|
||||||
this.logger.info(`Dial:_selectSingleDial tearing down call as it has reached ${this.timeLimit}s`);
|
this.logger.info(`Dial:_selectSingleDial tearing down call as it has reached ${this.timeLimit}s`);
|
||||||
this.ep.unbridge();
|
this.ep && this.ep.unbridge();
|
||||||
this.kill(cs);
|
this.kill(cs);
|
||||||
}, this.timeLimit * 1000);
|
}, this.timeLimit * 1000);
|
||||||
}
|
}
|
||||||
@@ -468,7 +471,10 @@ class TaskDial extends Task {
|
|||||||
if (this.dlg) {
|
if (this.dlg) {
|
||||||
this.logger.debug('Dial:_selectSingleDial called party hungup, ending dial operation');
|
this.logger.debug('Dial:_selectSingleDial called party hungup, ending dial operation');
|
||||||
sessionTracker.remove(this.callSid);
|
sessionTracker.remove(this.callSid);
|
||||||
if (this.timerMaxCallDuration) clearTimeout(this.timerMaxCallDuration);
|
if (this.timerMaxCallDuration) {
|
||||||
|
clearTimeout(this.timerMaxCallDuration);
|
||||||
|
this.timerMaxCallDuration = null;
|
||||||
|
}
|
||||||
this.ep && this.ep.unbridge();
|
this.ep && this.ep.unbridge();
|
||||||
this.kill(cs);
|
this.kill(cs);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user