From 2e88ab1f55694907058af31036aab6cc09464996 Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Thu, 10 Feb 2022 12:15:25 -0500 Subject: [PATCH] bugfix: race condition on hangup sometimes resulted in outbound call attempt even though caller had hung up --- lib/tasks/dial.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/tasks/dial.js b/lib/tasks/dial.js index a1e3649b..a40c3845 100644 --- a/lib/tasks/dial.js +++ b/lib/tasks/dial.js @@ -147,7 +147,7 @@ class TaskDial extends Task { this.epOther.play(this.dialMusic).catch((err) => {}); } } - await this._attemptCalls(cs); + if (!this.killed) await this._attemptCalls(cs); await this.awaitTaskDone(); 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); @@ -367,6 +367,9 @@ class TaskDial extends Task { opts.headers['X-Requested-Carrier-Sid'] = voip_carrier_sid; } } + + if (this.killed) return; + const sd = placeCall({ logger: this.logger, application: cs.application,