mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
Fix/interdigit timeout (#554)
* fix interdtmf timeout * wip * wip * wip * remove all speech listener if dtmf is received
This commit is contained in:
@@ -319,6 +319,13 @@ class TaskGather extends SttTask {
|
|||||||
this._resolve('dtmf-terminator-key');
|
this._resolve('dtmf-terminator-key');
|
||||||
}
|
}
|
||||||
else if (this.input.includes('digits')) {
|
else if (this.input.includes('digits')) {
|
||||||
|
if (this.digitBuffer.length === 0 && this.needsStt) {
|
||||||
|
// DTMF is higher priority than STT.
|
||||||
|
this.removeSpeechListeners(ep);
|
||||||
|
ep.stopTranscription({vendor: this.vendor})
|
||||||
|
.catch((err) => this.logger.error({err},
|
||||||
|
` Received DTMF, Error stopping transcription for vendor ${this.vendor}`));
|
||||||
|
}
|
||||||
this.digitBuffer += evt.dtmf;
|
this.digitBuffer += evt.dtmf;
|
||||||
const len = this.digitBuffer.length;
|
const len = this.digitBuffer.length;
|
||||||
if (len === this.numDigits || len === this.maxDigits) {
|
if (len === this.numDigits || len === this.maxDigits) {
|
||||||
@@ -528,7 +535,9 @@ class TaskGather extends SttTask {
|
|||||||
this._clearTimer();
|
this._clearTimer();
|
||||||
this._timeoutTimer = setTimeout(() => {
|
this._timeoutTimer = setTimeout(() => {
|
||||||
if (this.isContinuousAsr) this._startAsrTimer();
|
if (this.isContinuousAsr) this._startAsrTimer();
|
||||||
else if (this.interDigitTimeout <= 0 || this.digitBuffer.length < this.minDigits || this.needsStt) {
|
else if (this.interDigitTimeout <= 0 ||
|
||||||
|
this.digitBuffer.length < this.minDigits ||
|
||||||
|
this.needsStt && this.digitBuffer.length === 0) {
|
||||||
this._resolve(this.digitBuffer.length >= this.minDigits ? 'dtmf-num-digits' : 'timeout');
|
this._resolve(this.digitBuffer.length >= this.minDigits ? 'dtmf-num-digits' : 'timeout');
|
||||||
}
|
}
|
||||||
}, this.timeout);
|
}, this.timeout);
|
||||||
|
|||||||
Reference in New Issue
Block a user