lively-horse-90722
12/08/2025, 12:15 PMtall-airline-16756
12/08/2025, 12:15 PMtall-airline-16756
12/08/2025, 12:16 PMTwirpError(code=deadline_exceeded, message=... request timed out, status=408) when using Twilio.
Key checks and actions
1. Enable SIP REFER / PSTN transfer on your Twilio trunk
• Transfers rely on SIP REFER. In the Twilio Console → Elastic SIP Trunking → your trunk → Features → enable Call Transfer (SIP REFER) and Enable PSTN Transfer. Or update via CLI with your trunk SID.
1. Verify the transfer destination is reachable
• Confirm the phone number or SIP URI accepts calls and answers. Test calling the destination directly (outside LiveKit) to rule out destination-side issues.
1. Confirm trunk configuration and credentials
• Ensure LiveKit is using the correct Twilio SIP domain (e.g., your-trunk.pstn.twilio.com), credentials, and that the trunk allows outbound/transfer calls.
1. Avoid long synchronous waits / handle dialing asynchronously
• If you use wait_until_answered: true or block while dialing the supervisor, that increases timeout risk. Consider async dialing with status polling and a retry/backoff strategy.
1. Add retries for transient network/provider delays
• Implement retry with exponential backoff for transfers — intermittent carrier or network delays often resolve on retry.
Diagnostics to gather if this persists
• Twilio debugging logs for the trunk: check whether a REFER (or outbound INVITE) was sent and how the destination responded.
• Timestamped LiveKit server logs around the transfer attempt.
• Exact transfer flow used (CreateSIPParticipant + MoveParticipant vs. TransferSIPParticipant) and any wait_until_answered setting.
If you’d like, tell me:
• Which transfer API call you use (warm transfer flow steps),
• Whether you enabled SIP REFER on your trunk,
• A recent Twilio debug log excerpt or timestamps —
and I’ll suggest the next targeted step.
Sources: SIP troubleshooting guide | LiveKit docs | Call forwarding | LiveKit docs | server-sdk-go | livekit/livekit_composite | DeepWiki | Create and configure a Twilio SIP trunk | LiveKit docs | Make outbound calls | LiveKit docstall-airline-16756
12/08/2025, 12:19 PMtransfer_sip_participant with a tel: URI, which is the correct structure. I'll focus on the likely causes and the next concrete checks to resolve the Twirp 408 timeout.
What I’m answering: why TwirpError(code=deadline_exceeded, ... status=408) happens for your transfer_sip_participant(...) call and what to verify next.
Immediate checks (do these first)
• Confirm SIP REFER is enabled on your Twilio trunk:
◦ Twilio Console → Elastic SIP Trunking → your trunk → Features → enable Call Transfer (SIP REFER) and Enable PSTN Transfer.
◦ Or run the CLI update with your trunk SID: twilio api trunking v1 trunks update --sid <twilio-trunk-sid> --transfer-mode enable-all --transfer-caller-id from-transferee.
• Verify transfer_to is E.164 with the + (your tel:+... format is correct). Ensure the number is reachable and can accept PSTN calls.
• Confirm the participant is still active in room_name when you call transfer — a disconnected participant will fail.
Additional diagnostics to run
• Check Twilio debug logs for the trunk at the transfer timestamp: is a REFER/INVITE sent, and what response or SIP status (if any) is returned?
• Inspect LiveKit server logs at the same timestamp for any SIP-related metadata returned by the Twirp error (SIP status code or message).
• Try transferring that destination number outside LiveKit (directly via Twilio) to see if the trunk/destination behaves the same.
Code-side suggestions
• Ensure number normalization to E.164 before calling:
transfer_to = f"tel:+{phone_number.lstrip('+')}"
• Add retry with exponential backoff for transient 408s.
• Optionally avoid synchronous waiting (e.g., wait_until_answered) to reduce timeout exposure; consider async dialing + status polling.
If you run the checks above, share:
• Whether SIP REFER/PSTN Transfer are enabled on the trunk,
• A Twilio debug log snippet or the trunk-side SIP status returned at the transfer time,
• LiveKit log lines around the transfer attempt (timestamps help).
With those details I can point to the exact next step. Would you like help parsing the Twilio debug log if you paste the relevant entries?
Sources: SIP troubleshooting guide | LiveKit docs | Call forwarding | LiveKit docs | SIP APIs | LiveKit docslively-horse-90722
12/08/2025, 12:21 PMtall-airline-16756
12/08/2025, 12:21 PMTwirpError(code=deadline_exceeded, ... status=408) in LiveKit.
Next focused checks
• LiveKit server logs: check the exact timestamp of the transfer call and look for Twirp/TCP timeouts, RPC retry attempts, or any SIP-related metadata on the error (e.g., sip_status_code, sip_status). Paste the 5–10 log lines around the transfer timestamp if you want help parsing them.
• Network latency between LiveKit and Twilio: look for spikes or transient connection resets at the same timestamp (firewall/NAT timeouts, proxy, or packet loss can cause RPC deadline_exceeded).
• RPC deadline settings: confirm your client-side call isn’t using an overly short timeout for the Twirp call. If possible, increase the Twirp/RPC deadline for transfers and retry.
• Confirm LiveKit processed the downstream event: even if Twilio completed the REFER, LiveKit must receive and process the SIP event. Search LiveKit logs for the participant move/transfer handling after the REFER response.
Quick actions to try
• Retry the transfer once after a short delay to see if it’s transient.
• Temporarily increase the transfer RPC deadline on the client and test again.
• Correlate Twilio transfer completion timestamp with the LiveKit log timestamp to see which side lagged.
If you can share:
• The LiveKit log lines around the transfer timestamp (including any Twirp error stack or metadata),
• The RPC timeout/deadline setting you use for transfer_sip_participant,
I’ll point to the exact field to change or the log entries that indicate whether it’s a network/RPC timeout vs. processing delay. Would you like me to help parse those logs?lively-horse-90722
12/08/2025, 12:31 PMThe RPC timeout/deadline setting you use fortransfer_sip_participant
I haven't provided anything.tall-airline-16756
12/08/2025, 12:31 PMsip_status_code, sip_status) included with the Twirp error.
• Check network latency or connection resets between LiveKit and Twilio at the transfer time (NAT/firewall/proxy timeouts can drop ACKs).
• Retry test: attempt the same transfer again; transient provider/network issues sometimes resolve on retry.
• As a fallback, test performing the transfer directly via Twilio (outside LiveKit) to verify identical behavior.
If you paste the LiveKit log snippet around the transfer timestamp and the Twilio debug lines for the same time, I’ll parse them and point to the exact cause and next fix.
Sources: SIP troubleshooting guide | LiveKit docs | Call forwarding | LiveKit docs | Remote method calls | LiveKit docslively-horse-90722
12/08/2025, 12:37 PMtall-airline-16756
12/08/2025, 12:37 PMdeadline_exceeded (408) even though Twilio completed the transfer, please provide both of the following log excerpts for the same transfer attempt (timestamps must overlap):
• 5–10 LiveKit server log lines spanning ~5 seconds before and after the transfer timestamp (include any Twirp error stack or metadata).
• The Twilio debug log entries for that transfer (INVITE/REFER/200/ACK or related SIP messages) around the same timestamps.
Also tell me:
• The participant identity and room_name used (or scrubbed IDs) so I can correlate logs.
• Whether you see any sip_status_code or sip_status fields in the LiveKit error metadata.
With those, I’ll parse the SIP transaction flow and point to the exact step that caused the timeout and the concrete fix.tall-airline-16756
12/08/2025, 12:40 PMsip_status_code or sip_status fields shown in the LiveKit Twirp error metadata.
Also confirm once: SIP REFER and PSTN Transfer are enabled on your Twilio trunk.
Send those and I’ll parse the SIP transaction flow and point to the exact cause and next fix.lively-horse-90722
12/08/2025, 12:41 PMtall-airline-16756
12/08/2025, 12:41 PMdeadline_exceeded (408) even though Twilio shows the transfer completed:
• 5–10 LiveKit server log lines spanning ~5 seconds before and after the transfer timestamp (include any Twirp error stack/metadata).
• Twilio debug log entries for the same transfer (INVITE/REFER/200/ACK or related SIP messages) around the same timestamps.
• Participant identity used in the transfer (or a scrubbed ID to correlate).
• Whether sip_status_code or sip_status appear in the LiveKit error metadata.
• Confirm SIP REFER and PSTN Transfer are enabled on your Twilio trunk.
If you prefer, paste the LiveKit and Twilio log snippets and I’ll parse them and point to the exact step causing the timeout.