From 205783c24b9bd1ed3e09f2cc0fa1dc6462790f4e Mon Sep 17 00:00:00 2001 From: Manas Narra Date: Fri, 15 May 2026 08:57:40 +0530 Subject: [PATCH] fix: Fix warm transfer not working --- .../handlers/internal/warm_transfer.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/app/ai/voice/agents/breeze_buddy/handlers/internal/warm_transfer.py b/app/ai/voice/agents/breeze_buddy/handlers/internal/warm_transfer.py index 09f8fe898..d4c487b72 100644 --- a/app/ai/voice/agents/breeze_buddy/handlers/internal/warm_transfer.py +++ b/app/ai/voice/agents/breeze_buddy/handlers/internal/warm_transfer.py @@ -172,6 +172,25 @@ async def connect_to_live_agent( context.lead.metaData = {} context.lead.metaData["transfer"] = transfer_meta + # For Plivo: suppress the serializer's auto hang-up before ending + # the conversation. When end_conversation pushes EndFrame through + # the pipeline the Plivo serializer would normally call _hang_up_call(), + # which drops the caller from the conference. Setting _hangup_attempted=True + # tells the serializer that a hang-up has already been handled so it + # skips the API call. + if context.provider == CallProvider.PLIVO: + try: + plivo_serializer = context.bot.transport.output()._params.serializer + if plivo_serializer is not None: + plivo_serializer._hangup_attempted = True + logger.info( + f"[transfer_to_agent] Suppressed Plivo auto-hangup for call {context.call_sid}" + ) + except Exception as suppress_err: + logger.warning( + f"[transfer_to_agent] Could not suppress Plivo hangup: {suppress_err}" + ) + # End the AI conversation await end_conversation(context, None)