while transferring the call to agent i'm facing th...
# ask-ai
b
while transferring the call to agent i'm facing this issue {"level": "INFO", "name": "app.agents.assistant", "message": "[USER (interim)]: And now", "timestamp": "2025-12-15T132240.155381+00:00"} 2025-12-15 185245,289 - app.agents.assistant - ERROR - Failed to transfer call: TwirpError(code=deadline_exceeded, message=twirp error unknown: request timed out, status=408) Traceback (most recent call last): File "D:\X\AgnoX V1\app\agents\assistant.py", line 455, in _execute_sip_transfer await self._job_ctx.api.sip.transfer_sip_participant( File "D:\X\venv\lib\site-packages\livekit\api\sip_service.py", line 815, in transfer_sip_participant return await self._client.request( File "D:\X\venv\lib\site-packages\livekit\api\twirp_client.py", line 129, in request raise TwirpError( livekit.api.twirp_client.TwirpError: TwirpError(code=deadline_exceeded, message=twirp error unknown: request timed out, status=408) {"level": "ERROR", "name": "app.agents.assistant", "message": "Failed to transfer call: TwirpError(code=deadline_exceeded, message=twirp error unknown: request timed out, status=408)", "exc_info": "Traceback (most recent call last):\n File \"D:\\X\\AgnoX V1\\app\\agents\\assistant.py\", line 455, in _execute_sip_transfer\n await self._job_ctx.api.sip.transfer_sip_participant(\n File \"D:\\X\\venv\\lib\\site-packages\\livekit\\api\\sip_service.py\", line 815, in transfer_sip_participant\n return await self._client.request(\n File \"D:\\X\\venv\\lib\\site-packages\\livekit\\api\\twirp_client.py\", line 129, in request\n raise TwirpError(\nlivekit.api.twirp_client.TwirpError: TwirpError(code=deadline_exceeded, message=twirp error unknown: request timed out, status=408)", "timestamp": "2025-12-15T132245.289390+00:00"} 2025-12-15 185246,694 - app.agents.assistant - INFO - Transfer requested: call=a81a36e8-88ed-4fe1-ab57-716c3a386e71, department=billing, reason=Caller requested to speak with a billing agent. {"level": "INFO", "name": "app.agents.assistant", "message": "Transfer requested: call=a81a36e8-88ed-4fe1-ab57-716c3a386e71, department=billing, reason=Caller requested to speak with a billing agent.", "timestamp": "2025-12-15T132246.694381+00:00"} 2025-12-15 185246,695 - app.agents.assistant - INFO - Attempting SIP transfer: participant=sip_1003, room=call-_1003_gqkRWeKn6LEr, destination=sip:billing@192.168.9.116 {"level": "INFO", "name": "app.agents.assistant", "message": "Attempting SIP transfer: participant=sip_1003, room=call-_1003_gqkRWeKn6LEr, destination=sip:billing@192.168.9.116", "timestamp": "2025-12-15T132246.695381+00:00"} 2025-12-15 185246,699 - livekit.agents - WARNING -
use_tts_aligned_transcript
is enabled but no agent transcript was returned from tts {"level": "WARNING", "name": "livekit.agents", "message": "`use_tts_aligned_transcript` is enabled but no agent transcript was returned from tts", "timestamp": "2025-12-15T132246.699382+00:00"} 2025-12-15 185247,294 - app.agents.assistant - INFO - Successfully transferred participant sip_1003 to sip:billing@192.168.9.116, reason: Caller requested to speak with a billing agent. {"level": "INFO", "name": "app.agents.assistant", "message": "Successfully transferred participant sip_1003 to sip:billing@192.168.9.116, reason: Caller requested to speak with a billing agent.", "timestamp": "2025-12-15T132247.294383+00:00"} 2025-12-15 185302,350 - app.agents.assistant - INFO - [USER (interim)]: Customer {"level": "INFO", "name": "app.agents.assistant", "message": "[USER (interim)]: Customer", "timestamp": "2025-12-15T132302.350096+00:00"} 2025-12-15 185304,122 - app.agents.assistant - INFO - [USER (final)]: Customer papa. {"level": "INFO", "name": "app.agents.assistant", "message": "[USER (final)]: Customer papa.", "timestamp": "2025-12-15T132304.122049+00:00"} 2025-12-15 185304,124 - transcripts - INFO - [CALLER] Customer papa. {"level": "INFO", "name": "transcripts", "message": "[CALLER] Customer papa.", "speaker": "caller", "is_final": true, "room": "call-_1003_gqkRWeKn6LEr", "timestamp": "2025-12-15T132304.124047+00:00"} 2025-12-15 185304,953 - livekit.agents - WARNING -
use_tts_aligned_transcript
is enabled but no agent transcript was returned from tts {"level": "WARNING", "name": "livekit.agents", "message": "`use_tts_aligned_transcript` is enabled but no agent transcript was returned from tts", "timestamp": "2025-12-15T132304.953043+00:00"}
t
Thanks for reaching out, Vishnu. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I reviewed the logs you posted (TwirpError deadline_exceeded / 408 during TransferSIPParticipant) and the follow-up messages. I’ll respond to the transfer timeout and next steps to diagnose and fix it. What the logs show • The transfer request timed out: TwirpError(code=deadline_exceeded, message=... status=408). • A later log says the participant was successfully transferred, which means the transfer may have completed asynchronously or after a retry. • Warnings about
use_tts_aligned_transcript
are unrelated to the SIP transfer timeout. Most likely causes • The target SIP URI (sip:billing@192.168.9.116) is unreachable from where LiveKit is running — that IP is a private address and won’t be reachable from LiveKit Cloud. • The remote endpoint or SIP trunk didn’t respond in time to the SIP REFER (transfer) request. • SIP REFER may not be supported or allowed by the SIP provider/endpoint. • Network issues (firewall/NAT, packet loss, or routing) causing delayed or dropped SIP signaling. Immediate checks to run • Confirm where LiveKit is hosted: ◦ LiveKit Cloud cannot reach private 192.168.x.x addresses. If you’re on LiveKit Cloud, the target must be publicly reachable (or behind a public SBC/proxy). ◦ If self-hosted, ensure LiveKit is on the same LAN or has network path to 192.168.9.116. • From the LiveKit host (or a host on the same network), test reachability to the SIP target (ping/traceroute and a SIP client test) to confirm it answers INVITE/REFER. • Verify the SIP endpoint and trunk accept SIP REFER (call transfer). Some providers (or trunks) require enabling transfer/PSTN-transfer features. • Check firewalls/SBCs for blocked SIP ports (5060/5061) and media ports; ensure NAT is handled. • Review SIP server logs at 192.168.9.116 for any incoming REFER or INVITE and any rejection/timeouts. Short-term mitigations • Add retry logic around TransferSIPParticipant (a few short retries with backoff) so transient network delays don’t cause immediate failure. • Monitor room/participant events to detect whether the participant actually left the room after a timed-out request. What I need from you to help further • Is LiveKit Cloud or self-hosted? • Is the SIP target on the same LAN as the LiveKit server or a private IP only available locally? • Which SIP provider or PBX is the destination (or is it an internal softswitch at 192.168.9.116)? • Can you reproduce the timeout consistently, or is it intermittent? If you share those details I’ll give specific configuration steps (SBC/proxy options, provider settings to enable REFER, and example retry code). Would you like retry code and a sample diagnostic SIP test next? Sources: SIP troubleshooting guide | LiveKit docs | SIP overview | LiveKit docs | Call forwarding | LiveKit docs | Make outbound calls | LiveKit docs
b
self-hosted 2. yes 3. freeswitch
t
Thanks — since you’re self-hosted and the target is FreeSWITCH on the same LAN, here are focused steps to diagnose and fix the Twirp 408 timeout during SIP transfer. Quick summary of likely causes • FreeSWITCH didn’t respond to the REFER quickly enough or rejected it. • Network/port/firewall/NAT issues between LiveKit and FreeSWITCH. • FreeSWITCH or its trunk isn’t configured to accept REFER (call transfer). • Transient delays; LiveKit call timed out before transfer completed. What to check now 1. Verify basic network reachability from the LiveKit host to FreeSWITCH (use the LiveKit machine): ◦ ping 192.168.9.116 ◦ telnet 192.168.9.116 5060 (or
nc -vz 192.168.9.116 5060
) 1. Confirm FreeSWITCH received the REFER/INVITE and how it responded: ◦ Check FreeSWITCH logs (fs_cli or log files) around the transfer timestamp for REFER/INVITE and response codes. 1. Ensure FreeSWITCH accepts REFER: ◦ Confirm mod_sofia/profile settings allow inbound REFER and that any dialplan logic handles a REFER to that destination. 1. SIP timers and transport: ◦ Confirm SIP transport (UDP/TCP/TLS) used by LiveKit matches FreeSWITCH config. ◦ If using UDP, consider switching to TCP for more reliable signaling on LAN. 1. Firewall / host OS: ◦ Ensure no iptables/ufw rules drop/slow SIP signaling between hosts. 1. Media path & RTP: ◦ Verify RTP ports and codecs match so FreeSWITCH will proceed with the transfer request. 1. Reproduce with a SIP tool: ◦ From the LiveKit host, attempt a manual REFER/invite using a SIP client or sipp/linphone to verify immediate behaviour. 1. Add retry and logging in LiveKit side: ◦ Retry TransferSIPParticipant (2–3 attempts with small backoff) and log full request/response bodies to capture timing and Twirp responses. Suggested debugging commands/examples • From LiveKit host: ◦ ping 192.168.9.116 ◦ nc -vz 192.168.9.116 5060 • On FreeSWITCH: ◦ Start fs_cli and tail logs while reproducing: fs_cli -x "log 7" ◦ Search logs for REFER or the call UUID and inspect response codes. Simple retry pattern (pseudo-Python)
Copy code
for i in range(3):
    try:
        await api.sip.transfer_sip_participant(...)
        break
    except TwirpError:
        await asyncio.sleep(1)
If after these checks you still get 408s, tell me: • Exact FreeSWITCH profile transport and port (e.g., sofia profile external uses UDP 5060) • A short paste of the FreeSWITCH log lines around the transfer attempt (REFER/INVITE and response codes) • Whether LiveKit uses UDP or TCP to FreeSWITCH I’ll then provide precise FreeSWITCH config changes (sofia/dialplan) or a tailored retry/timeout configuration for the LiveKit SIP call. Would you like that next?