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 <noreply@anthropic.com>
This commit is contained in:
tocmo0nlord
2026-07-04 17:13:14 +00:00
parent bbfff482a3
commit db986ecf76

9
bot.py
View File

@@ -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_params = LLMUserAggregatorParams(
user_turn_strategies=UserTurnStrategies( user_turn_strategies=UserTurnStrategies(
start=[ start=[
VADUserTurnStartStrategy(enable_interruptions=False), VADUserTurnStartStrategy(enable_interruptions=False),
TranscriptionUserTurnStartStrategy(enable_interruptions=False), TranscriptionUserTurnStartStrategy(enable_interruptions=True),
] if HALF_DUPLEX else None, # None -> library defaults (interruptions on) ] if HALF_DUPLEX else None, # None -> library defaults (interruptions on)
stop=stop_strategies, stop=stop_strategies,
), ),