diff --git a/lib/tasks/gather.js b/lib/tasks/gather.js index 0ada516a..0de36db5 100644 --- a/lib/tasks/gather.js +++ b/lib/tasks/gather.js @@ -1113,13 +1113,21 @@ class TaskGather extends SttTask { if (!this.asrTimeout) this._sendHoundifyDone(this.ep); else this._startAsrTimer(); } else if (transcript) { - /* mode segmentation OFF: FS module filters partials by eoq/vad threshold, - * so any partial arriving here is an end-of-turn signal. */ this._houndifyLastPartial = evt; const segMode = this.data.recognizer?.houndifyOptions?.requestInfo?.segmentation?.mode !== 'none'; if (!segMode) { - if (!this.asrTimeout) this._sendHoundifyDone(this.ep); - else this._startAsrTimer(); + /* FS forwards two kinds of partials in mode OFF — + * end-of-turn (eoq >= threshold) → trigger Done / arm timer + * user-speaking (eoq < threshold) → reset asrTimer only */ + const eoqThreshold = this.data.recognizer?.houndifyOptions?.eoqThreshold ?? 0.5; + const eoq = evt.vendor?.evt?.eoq; + const isEndOfTurn = typeof eoq === 'number' && eoq >= eoqThreshold; + if (isEndOfTurn) { + if (!this.asrTimeout) this._sendHoundifyDone(this.ep); + else this._startAsrTimer(); + } else if (this.asrTimeout && this._asrTimer) { + this._startAsrTimer(); + } } } if (!transcript) emptyTranscript = true; diff --git a/lib/tasks/transcribe.js b/lib/tasks/transcribe.js index 2ed496ed..6e968edd 100644 --- a/lib/tasks/transcribe.js +++ b/lib/tasks/transcribe.js @@ -652,15 +652,23 @@ class TaskTranscribe extends SttTask { if (!this.asrTimeout) this._sendHoundifyDone(channel === 2 ? this.ep2 : this.ep, channel); else this._startAsrTimer(channel); } else if (transcript) { - /* mode segmentation OFF: FS module filters partials by eoq/vad threshold, - * so any partial arriving here is an end-of-turn signal. */ this._houndifyLastPartial = this._houndifyLastPartial || [null, null]; this._houndifyLastPartial[channel - 1] = evt; const segMode = this.data.recognizer?.houndifyOptions?.requestInfo?.segmentation?.mode !== 'none'; if (!segMode) { + /* FS forwards two kinds of partials in mode OFF — + * end-of-turn (eoq >= threshold) → trigger Done / arm timer + * user-speaking (eoq < threshold) → reset asrTimer only */ + const eoqThreshold = this.data.recognizer?.houndifyOptions?.eoqThreshold ?? 0.5; + const eoq = evt.vendor?.evt?.eoq; + const isEndOfTurn = typeof eoq === 'number' && eoq >= eoqThreshold; const ep = channel === 2 ? this.ep2 : this.ep; - if (!this.asrTimeout) this._sendHoundifyDone(ep, channel); - else this._startAsrTimer(channel); + if (isEndOfTurn) { + if (!this.asrTimeout) this._sendHoundifyDone(ep, channel); + else this._startAsrTimer(channel); + } else if (this.asrTimeout && this._asrTimers?.[channel - 1]) { + this._startAsrTimer(channel); + } } } }