BackSlash
12/13/2025, 2:38 PMAI Evy
12/13/2025, 2:38 PMAI Evy
12/13/2025, 2:38 PM"If the user indicates they prefer to speak Spanish, use the agent_transfer tool to transfer to the Spanish Agent."
- "At the start of the call, ask the user their preferred language. If they say Spanish, transfer to the Spanish Agent." [(1) ]()
Key benefits for language routing:
- The transition is near-instant (lower latency than call transfer) [(1) ]() [(2) ]()
- The destination agent has access to the full conversation history
- No separate phone numbers needed for each language agentAI Evy
12/13/2025, 2:38 PMAI Evy
12/13/2025, 2:38 PMBackSlash
12/13/2025, 2:45 PMAI Evy
12/13/2025, 2:45 PMAI Evy
12/13/2025, 2:45 PMAI Evy
12/13/2025, 2:45 PMAI Evy
12/13/2025, 2:45 PMBackSlash
12/13/2025, 2:55 PMAI Evy
12/13/2025, 2:55 PMAI Evy
12/13/2025, 2:55 PMtranscript field in the WebSocket events
2. Implement transfer logic in your response - Your custom LLM can send a response with end_call: true and handle the routing logic on your backend, or you can use the Register Phone Call API to initiate a new call to a different agent [(2) ]()
3. Use agent_override when registering calls - You can dynamically select which agent configuration to use at call registration time
The Custom LLM WebSocket gives you full control over what the agent says and actions like ending the call. [(1) ]() However, the built-in Agent Transfer Node/Tool available in Conversation Flow and Single/Multi Prompt modes may not be directly accessible when using a fully custom LLM setup.
Alternative approach: Consider using Retell's Response Engine with Custom LLM integration for specific tasks while keeping the built-in transfer capabilities. [(3) ]()
Check out these potentially useful sources:
- [Integrate LLM]()
- [LLM WebSocket]()
- [Register Phone Call]()
Would you like a geAI Evy
12/13/2025, 2:55 PMAI Evy
12/13/2025, 2:55 PMAI Evy
12/13/2025, 2:55 PMBackSlash
12/13/2025, 2:58 PMAI Evy
12/13/2025, 2:59 PMAI Evy
12/13/2025, 2:59 PMdisconnection_reason. Common error reasons include:
[(1) ]()
- error_llm_websocket_open - LLM websocket did not open between Retell server and your backend
- error_llm_websocket_lost_connection - LLM websocket connection broke during the call
- error_no_audio_received - Has not received audio from Twilio for a while after connection has established
- registered_call_timeout - Phone call is 30s or more apart from registration
2. Verify your WebSocket URL protocol
[(2) ]()
- For HTTPS endpoints, use wss:// prefix
- For HTTP endpoints, use ws:// prefix
3. Check for trailing slash issues
- Correct: `
- Incorrect (sometimes) : `
4. Add logging to your server
- Add logging in your websocket code to see if the websocket is connected
- Add logging in your websocket message code to check if you receive messages from Retell server
- Check if you're accidentally sending end_call=true at any point
5. Verify your server supports WebSocket
Some server setups don't support WebSocket (e.g., Vercel edge functions and serverless functions cannot act as a websocket server) .
6. Check for timeout issues
Some server vendors automatically timeout connections (e.g., Replit non-reserved instances timeout at 5min) .
Can you share what disconnection_reason you're seeing in the call details?AI Evy
12/13/2025, 2:59 PMAI Evy
12/13/2025, 2:59 PMBackSlash
12/13/2025, 3:00 PMBackSlash
12/13/2025, 3:00 PMAI Evy
12/13/2025, 3:00 PMAI Evy
12/13/2025, 3:00 PMjavascript
import Retell from 'retell-sdk';
const client = new Retell({
apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const phoneCallResponse = await client.call.registerPhoneCall({
agent_id: 'oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD',
}) ;
console.log(phoneCallResponse.agent_id) ;AI Evy
12/13/2025, 3:00 PMregistered_call_timeout issue - Phone calls must connect within 30 seconds of registration, otherwise they timeout.
3. Whitelist Retell's IP - For incoming requests, only allow Retell IP address: 100.20.5.228 [(2) ]()
4. Verify your WebSocket endpoint - Your server should have a websocket endpoint at {your-server-websocket-endpoint}/{call_id} that Retell connects to. [(3) ]()
Troubleshooting steps:
- Add logging to confirm the Register Phone Call API is being called and returning successfully
- Check if you're receiving the call_id back from registration
- Verify your Twilio webhook is correctly triggering your backend to register the call with Retell
Can you confirm whether your backend is successfully calling the Register Phone Call API when Twilio receives the inbound call?AI Evy
12/13/2025, 3:00 PMAI Evy
12/13/2025, 3:00 PMBackSlash
12/13/2025, 3:02 PMBackSlash
12/13/2025, 3:02 PMAI Evy
12/13/2025, 3:02 PMAI Evy
12/13/2025, 3:02 PM{your-server-websocket-endpoint}/{call_id} - Retell initiates this connection when starting the call. [(1) ]()
Potential causes for your scenario:
1. Custom LLM URL configuration - The Custom LLM WebSocket URL in your Retell agent configuration must be accessible and correctly pointing to your server. If using dynamic URLs (like ngrok or Cloudflare tunnels) , the URL must be updated in the agent settings each time it changes. [(2) ]()
2. Timing between registration and connection - The registered_call_timeout error occurs when the phone call is 30 seconds or more apart from registration. [(1) ]()
3. Transport/SIP configuration - For custom telephony, Retell's SIP server is sip:sip.retellai.com with IP block 18.98.16.120/30 for whitelisting. [(3) ]()
Why SIP works but the Dial-to-SIP + Custom LLM flow doesn't:
With Elastic SIP Trunking, Retell handles the telephony layer directly. When using Dial-to-SIP with Custom LLM, your server must handle both the telephony webhook AND the LLM WebSocket connection - and Retell must successfully connect to your WebSocket endpoint before audio flows.
Possible workaround:
If you need multiple language agents with one number using SIP, consider using override_agent_id when creating/registering calls to dynamically select the agentAI Evy
12/13/2025, 3:02 PMAI Evy
12/13/2025, 3:02 PMAI Evy
12/13/2025, 3:02 PMAI Evy
12/13/2025, 3:06 PMAI Evy
12/13/2025, 3:06 PMoverride_agent_id via SIP URI parameters in the format you described (sip:user@retell.com?override_agent_id=xxx) .
What IS supported:
For inbound calls, you can use the Inbound Webhook to dynamically override the agent. When Retell receives an inbound call, it sends a request to your webhook, and you can respond with override parameters including override_agent_id. [(1) ]()
json
{
"call_inbound": {
"override_agent_id": "agent_12345",
"override_agent_version": 1,
You can also add custom SIP headers to transfers, but all header names must start with X-. [(2) ]()
For your language-routing use case:
The recommended approach appears to be using the inbound webhook. When Retell receives the SIP call, your webhook can inspect the call details and return the appropriate override_agent_id based on your IVR selection logic. [(1) ]()
This does require your server to be "in the middle" for the webhook response, but it's a lightweight HTTP request/response—not a persistent WebSocket connection.
Check out these potentially useful sources:
- [Inbound webhook]()
- [Create Phone Call]()
For confirmation on SIP URI parameter support specifically, you may want to reach out via [Contact Sales]() or check [) .AI Evy
12/13/2025, 3:06 PMAI Evy
12/13/2025, 3:06 PM