Fix/dial unhandled rejection (#1239)

* fix bug with race condition in dial which could spike cpu due to unhandled exception

* update to 0.2.12 speech-utils with azure ssml fix

* minor
This commit is contained in:
Dave Horton
2025-06-11 11:40:51 +02:00
committed by GitHub
parent 2bea7e83e1
commit b70fea69cc
3 changed files with 24 additions and 10 deletions

View File

@@ -271,7 +271,12 @@ class TaskDial extends Task {
}
this._removeDtmfDetection(cs.dlg);
this._removeDtmfDetection(this.dlg);
await this._killOutdials();
try {
await this._killOutdials();
}
catch (err) {
this.logger.info({err}, 'Dial:kill - error killing outdials');
}
if (this.sd) {
const byeReasonHeader = this.killReason === KillReason.MediaTimeout ? 'Media Timeout' : undefined;
this.sd.kill(byeReasonHeader);
@@ -281,13 +286,22 @@ class TaskDial extends Task {
}
if (this.callSid) sessionTracker.remove(this.callSid);
if (this.listenTask) {
await this.listenTask.kill(cs);
this.listenTask.span.end();
try {
await this.listenTask.kill(cs);
this.listenTask?.span?.end();
}
catch (err) {
this.logger.error({err}, 'Dial:kill - error killing listen task');
}
this.listenTask = null;
}
if (this.transcribeTask) {
await this.transcribeTask.kill(cs);
this.transcribeTask.span.end();
try {
await this.transcribeTask.kill(cs);
this.transcribeTask?.span?.end();
} catch (err) {
this.logger.error({err}, 'Dial:kill - error killing transcribe task');
}
this.transcribeTask = null;
}
this.notifyTaskDone();