issue# 107: on gather timeout, if minDigits are collected, resolve wi… (#111)

* 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 <prashanth@minervacq.com>
This commit is contained in:
Prashanth
2022-05-17 09:53:10 -07:00
committed by GitHub
parent c3e5ffa52d
commit 7f0e373e5f

View File

@@ -349,7 +349,9 @@ class TaskGather extends Task {
} }
assert(!this._timeoutTimer); assert(!this._timeoutTimer);
this.logger.debug(`Gather:_startTimer: timeout ${this.timeout}`); 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() { _clearTimer() {