From a3d3878218276b7a0338e820bc91ea43c0e5879e Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Tue, 28 Sep 2021 09:58:59 -0400 Subject: [PATCH] bugfix: cs not passed to kill() --- lib/tasks/gather.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/tasks/gather.js b/lib/tasks/gather.js index 30f401d1..8c1dd53a 100644 --- a/lib/tasks/gather.js +++ b/lib/tasks/gather.js @@ -94,7 +94,7 @@ class TaskGather extends Task { } if (this.input.includes('digits')) { - ep.on('dtmf', this._onDtmf.bind(this, ep)); + ep.on('dtmf', this._onDtmf.bind(this, cs, ep)); } await this.awaitTaskDone(); @@ -108,19 +108,19 @@ class TaskGather extends Task { kill(cs) { super.kill(cs); - this._killAudio(); + this._killAudio(cs); this.ep.removeAllListeners('dtmf'); this._resolve('killed'); } - _onDtmf(ep, evt) { + _onDtmf(cs, ep, evt) { this.logger.debug(evt, 'TaskGather:_onDtmf'); if (evt.dtmf === this.finishOnKey) this._resolve('dtmf-terminator-key'); else { this.digitBuffer += evt.dtmf; if (this.digitBuffer.length === this.numDigits) this._resolve('dtmf-num-digits'); } - this._killAudio(); + this._killAudio(cs); } async _initSpeech(cs, ep) { @@ -191,14 +191,14 @@ class TaskGather extends Task { } } - _killAudio() { + _killAudio(cs) { if (this.sayTask && !this.sayTask.killed) { this.sayTask.removeAllListeners('playDone'); - this.sayTask.kill(); + this.sayTask.kill(cs); } if (this.playTask && !this.playTask.killed) { this.playTask.removeAllListeners('playDone'); - this.playTask.kill(); + this.playTask.kill(cs); } }