mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-19 04:17:44 +00:00
clear main timout when interdigit timeout is started, (#1351)
* clear main timout when interdigit timeout is started, also clear the asrTimeout when dtmf has taken priority * lint * lint
This commit is contained in:
@@ -395,6 +395,7 @@ class TaskGather extends SttTask {
|
||||
if (this.digitBuffer.length === 0 && this.needsStt) {
|
||||
// DTMF is higher priority than STT.
|
||||
this.removeCustomEventListeners();
|
||||
this._clearAsrTimer(); //clear ASR timer as we're now using dtmf
|
||||
this._stopTranscribing(ep);
|
||||
}
|
||||
this.digitBuffer += evt.dtmf;
|
||||
@@ -409,6 +410,7 @@ class TaskGather extends SttTask {
|
||||
const ms = this.interDigitTimeout * 1000;
|
||||
this.logger.debug(`starting interdigit timer of ${ms}`);
|
||||
this.interDigitTimer = setTimeout(() => this._resolve('dtmf-interdigit-timeout'), ms);
|
||||
this._clearTimer(); //clear main timer as we're now using interdigit dtmf timer
|
||||
}
|
||||
}
|
||||
|
||||
@@ -702,8 +704,8 @@ class TaskGather extends SttTask {
|
||||
this.logger.debug(`Starting timoutTimer of ${this.timeout}ms`);
|
||||
this._clearTimer();
|
||||
this._timeoutTimer = setTimeout(() => {
|
||||
// If continuousASR in use then extend by the asr window for more transcripts.
|
||||
if (this.isContinuousAsr) this._startAsrTimer();
|
||||
if (this.interDigitTimer) return; // let the inter-digit timer complete
|
||||
else {
|
||||
this._resolve(this.digitBuffer.length >= this.minDigits ? 'dtmf-num-digits' : 'timeout');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user