From 7f0e373e5f9d961acfaa4c699809784e9f9b3704 Mon Sep 17 00:00:00 2001 From: Prashanth <66916334+pgujjeti@users.noreply.github.com> Date: Tue, 17 May 2022 09:53:10 -0700 Subject: [PATCH] =?UTF-8?q?issue#=20107:=20on=20gather=20timeout,=20if=20m?= =?UTF-8?q?inDigits=20are=20collected,=20resolve=20wi=E2=80=A6=20(#111)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * issue# 107: on gather timeout, if minDigits are collected, resolve with dtmf-num-digits * gather timeout: use conditional instead of if/else Co-authored-by: Prashanth Gujjeti --- lib/tasks/gather.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/tasks/gather.js b/lib/tasks/gather.js index 49bde31a..c63f7485 100644 --- a/lib/tasks/gather.js +++ b/lib/tasks/gather.js @@ -349,7 +349,9 @@ class TaskGather extends Task { } assert(!this._timeoutTimer); this.logger.debug(`Gather:_startTimer: timeout ${this.timeout}`); - this._timeoutTimer = setTimeout(() => this._resolve('timeout'), this.timeout); + this._timeoutTimer = setTimeout(() => { + this._resolve(this.digitBuffer.length >= this.minDigits ? 'dtmf-num-digits' : 'timeout'); + }, this.timeout); } _clearTimer() {