mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
bugfix: continuous asr - if ended by dtmf allow collection of final transcript
This commit is contained in:
@@ -101,7 +101,7 @@ class TaskConfig extends Task {
|
|||||||
cs.disableBotMode();
|
cs.disableBotMode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.record) cs.notifyRecordOptions(this.record);
|
if (this.record.action) cs.notifyRecordOptions(this.record);
|
||||||
}
|
}
|
||||||
|
|
||||||
async kill(cs) {
|
async kill(cs) {
|
||||||
|
|||||||
@@ -251,7 +251,8 @@ class TaskGather extends Task {
|
|||||||
this.logger.info(`continuousAsr triggered with dtmf ${this.asrDtmfTerminationDigit}`);
|
this.logger.info(`continuousAsr triggered with dtmf ${this.asrDtmfTerminationDigit}`);
|
||||||
this._clearAsrTimer();
|
this._clearAsrTimer();
|
||||||
this._clearTimer();
|
this._clearTimer();
|
||||||
this._resolve(this._bufferedTranscripts.length > 0 ? 'speech' : 'timeout');
|
this._startFinalAsrTimer();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (!resolved && this.interDigitTimeout > 0 && this.digitBuffer.length >= this.minDigits) {
|
if (!resolved && this.interDigitTimeout > 0 && this.digitBuffer.length >= this.minDigits) {
|
||||||
/* start interDigitTimer */
|
/* start interDigitTimer */
|
||||||
@@ -403,6 +404,20 @@ class TaskGather extends Task {
|
|||||||
this._asrTimer = null;
|
this._asrTimer = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_startFinalAsrTimer() {
|
||||||
|
this._clearFinalAsrTimer();
|
||||||
|
this._finalAsrTimer = setTimeout(() => {
|
||||||
|
this.logger.debug('_startFinalAsrTimer - final asr timer went off');
|
||||||
|
this._resolve(this._bufferedTranscripts.length > 0 ? 'speech' : 'timeout');
|
||||||
|
}, 1000);
|
||||||
|
this.logger.debug('_startFinalAsrTimer: set for 1 second');
|
||||||
|
}
|
||||||
|
|
||||||
|
_clearFinalAsrTimer() {
|
||||||
|
if (this._finalAsrTimer) clearTimeout(this._finalAsrTimer);
|
||||||
|
this._finalAsrTimer = null;
|
||||||
|
}
|
||||||
|
|
||||||
_killAudio(cs) {
|
_killAudio(cs) {
|
||||||
if (!this.sayTask && !this.playTask && this.bargein) {
|
if (!this.sayTask && !this.playTask && this.bargein) {
|
||||||
if (this.ep?.connected && !this.playComplete) {
|
if (this.ep?.connected && !this.playComplete) {
|
||||||
@@ -466,6 +481,10 @@ class TaskGather extends Task {
|
|||||||
this.logger.info({evt}, 'TaskGather:_onTranscription - got transcript during continous asr');
|
this.logger.info({evt}, 'TaskGather:_onTranscription - got transcript during continous asr');
|
||||||
this._bufferedTranscripts.push(evt);
|
this._bufferedTranscripts.push(evt);
|
||||||
this._clearTimer();
|
this._clearTimer();
|
||||||
|
if (this._finalAsrTimer) {
|
||||||
|
this._clearFinalAsrTimer();
|
||||||
|
return this._resolve(this._bufferedTranscripts.length > 0 ? 'speech' : 'timeout');
|
||||||
|
}
|
||||||
this._startAsrTimer();
|
this._startAsrTimer();
|
||||||
return this._startTranscribing(ep);
|
return this._startTranscribing(ep);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user