Files
jambonz-feature-server/lib/tasks
Dave HortonandClaude Opus 5.5 baf97dabc2 fix(gather): clear a finalized deepgram interim word so UtteranceEnd is not deferred forever (#1588)
* fix(gather): clear a finalized deepgram interim word so UtteranceEnd is not deferred forever

The #1088 check defers UtteranceEnd while an interim word newer than
last_word_end is pending. The marker was only cleared by a non-empty
is_final, so an interim word that Deepgram later dropped (e.g. line
noise, followed by an empty final) left it set: the gather waited for
the caller to speak again and merged both utterances.

Clear the marker on any Deepgram is_final result whose window
(start + duration) covers it. A word that Deepgram carries into the
next segment still defers UtteranceEnd.

Port of jambonz/feature-server#223.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(gather): return the buffer when a deferred deepgram UtteranceEnd is satisfied

Clearing the unprocessed-word marker only helps if the covering final
arrives before UtteranceEnd. If it arrives after, UtteranceEnd has
already been deferred and Deepgram sends no further UtteranceEnd until
new speech, so the next utterance is still merged in.

Remember a deferred UtteranceEnd, and when a later final clears the
marker, return the buffered transcript once that final has been
handled (setImmediate, since _onTranscription has early returns).

Port of jambonz/feature-server#225.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(gather): only an empty final ends a gather early after a deferred UtteranceEnd

A final with words means the caller resumed talking after the pause;
Deepgram will send a new UtteranceEnd after those words, so keep the
existing flow instead of cutting the caller off mid-sentence (or
skipping the asrTimeout wait). Only a final that drops the pending word
(empty) leaves nothing else to end the gather.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 17:45:27 -04:00
..
2026-07-14 09:18:25 -04:00
2026-03-29 16:07:08 -04:00
2024-03-23 16:23:57 -04:00
2022-08-09 15:23:55 +02:00
2022-08-09 15:23:55 +02:00
2023-08-22 09:22:01 -04:00
2025-07-10 07:39:42 -04:00
2022-08-09 15:23:55 +02:00
2026-03-29 16:07:08 -04:00
2022-08-09 15:23:55 +02:00
2026-03-29 16:07:08 -04:00
2022-08-09 15:23:55 +02:00
2026-03-29 16:07:08 -04:00
2022-08-09 15:23:55 +02:00
2023-11-17 08:48:17 -05:00
2026-03-29 16:07:08 -04:00