From db986ecf76ca5a52eb5e7aaaa1b4403270cdbf8e Mon Sep 17 00:00:00 2001 From: tocmo0nlord Date: Sat, 4 Jul 2026 17:13:14 +0000 Subject: [PATCH] Allow transcription-triggered interruptions (fixes double-reply collision) Live call: caller said "this is Carlos", the reply started, caller continued "How are you doing today?" - with all interruptions off, both replies queued and played back-to-back (~10s of bot monologue answering two different things). Middle ground: VAD-triggered interruptions stay OFF (raw VAD fires on noise with no transcript - that was the dead-air bug), but transcription- triggered interruptions are back ON: only real transcribed caller speech can cancel a stale queued reply. Noise cannot produce a transcript, so the dead-air regression is structurally impossible. Co-Authored-By: Claude Opus 4.8 --- bot.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bot.py b/bot.py index 45ebae4..5243b8f 100644 --- a/bot.py +++ b/bot.py @@ -730,11 +730,18 @@ async def run_agent(transport, caller_number=None, call_sid=None, do_capture=Tru ) ) ] + # VAD start: interruptions OFF — raw VAD fires on breaths/noise with no transcript and + # used to silently cancel queued replies (20-35s dead air). Transcription start: + # interruptions ON — only REAL transcribed caller speech may cancel a stale queued + # reply. Noise can't produce a transcript, so the dead-air bug can't return; but when + # the caller keeps talking as a reply starts (live call 2026-07-04: "this is Carlos" / + # reply starts / "How are you doing today?"), the outdated reply is cancelled instead + # of both replies playing back-to-back. user_params = LLMUserAggregatorParams( user_turn_strategies=UserTurnStrategies( start=[ VADUserTurnStartStrategy(enable_interruptions=False), - TranscriptionUserTurnStartStrategy(enable_interruptions=False), + TranscriptionUserTurnStartStrategy(enable_interruptions=True), ] if HALF_DUPLEX else None, # None -> library defaults (interruptions on) stop=stop_strategies, ),