bugfix: race condition on hangup sometimes resulted in outbound call attempt even though caller had hung up

This commit is contained in:
Dave Horton
2022-02-10 12:15:25 -05:00
parent 7f75a35515
commit 2e88ab1f55

View File

@@ -147,7 +147,7 @@ class TaskDial extends Task {
this.epOther.play(this.dialMusic).catch((err) => {}); this.epOther.play(this.dialMusic).catch((err) => {});
} }
} }
await this._attemptCalls(cs); if (!this.killed) await this._attemptCalls(cs);
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, this.killReason !== KillReason.Replaced); await this.performAction(this.results, this.killReason !== KillReason.Replaced);
@@ -367,6 +367,9 @@ class TaskDial extends Task {
opts.headers['X-Requested-Carrier-Sid'] = voip_carrier_sid; opts.headers['X-Requested-Carrier-Sid'] = voip_carrier_sid;
} }
} }
if (this.killed) return;
const sd = placeCall({ const sd = placeCall({
logger: this.logger, logger: this.logger,
application: cs.application, application: cs.application,