Twilio Conversation Relay for AI Voice Agents: Failover and Turn Detection
An AI phone agent that drops the call when a speech provider fails, or cuts callers off mid-sentence, loses bookings no matter how good the model is. Twilio added provider failover and new turn detection controls to Conversation Relay in November 2026. Set them up deliberately, then test the failure cases before real callers find them.
On this page · 12
- What you will take away
- What Conversation Relay does
- Before you start
- Step 1: Check that Conversation Relay is the right layer
- Step 2: Settle compliance scope first
- Step 3: Add provider failover
- Step 4: Tune turn detection for your callers
- Step 5: Hand off, write back, then test the failures
- Known limits
- Frequently asked questions
- Harden one voice agent call flow
- Sources
What you will take away
- Decide whether Conversation Relay is the right layer for your voice agent
- Add speech provider failover and know its limits
- Tune turnMinSilence, speechTimeout and eotThreshold for how your callers actually talk
- Hand a call to a person with handoffData, and handle silent callers yourself
- Run a failure test list before go-live
What Conversation Relay does
Term: Twilio Conversation Relay
Definition
A Twilio service, started with the ConversationRelay noun inside the Connect verb in TwiML, that handles the live parts of an AI phone call: speech-to-text, text-to-speech and session management. Your application receives the caller's transcribed speech over a WebSocket and sends replies back as text, which Twilio speaks to the caller.
Example
A home services company points its Twilio number at TwiML with ConversationRelay. Its server receives each caller turn as text, asks a model what to do, calls a scheduling tool, and sends the reply text back.
Before you start
- A Twilio account that has completed Conversation Relay onboarding and accepted Twilio's Predictive and Generative AI/ML Features Addendum
- A WebSocket server reachable over wss://
- Your chosen primary speech-to-text and text-to-speech providers, voices and languages
- A decision on PCI and HIPAA scope for the calls, before you turn on Turn Detection
- A person or queue who takes calls the agent should not handle
Step 1: Check that Conversation Relay is the right layer
| Approach | Who handles speech | Fits when | Trade-off |
|---|---|---|---|
| Twilio Conversation Relay | Twilio runs speech-to-text, text-to-speech and the session. Your app receives caller text over a WebSocket and sends replies as text | You want your own agent logic and tools, on Twilio numbers, without building audio handling | You still host the WebSocket server, the model calls and every integration |
| A managed voice agent platform (for example Retell AI or Vapi) | The platform runs speech, the model loop and telephony options | You want an agent configured mostly in a dashboard, with built-in tools | Less control over the loop, and behavior depends on the platform's features |
| Raw audio streaming from Twilio | Your code handles audio, speech recognition and synthesis | You need full control of the audio pipeline | The most engineering work, including latency and turn-taking |
If you already run an agent on Conversation Relay, the two November 2026 changes are worth adding now. If you are still choosing, our notes on voice agent latency cover where response time goes in each layer.
Expected result: A clear decision on which layer runs speech, and which runs your agent logic.
Step 2: Settle compliance scope first
Twilio's ConversationRelay reference says Conversation Relay can support PCI-compliant voice workflows when configured with PCI-compliant TTS and transcription providers, and is a HIPAA Eligible Service when configured properly with a signed Business Associate Agreement. It also says Turn Detection is not PCI compliant or a HIPAA Eligible Service, so do not set the turnDetection attribute on calls subject to those rules.
Keep payment card data out of TwiML attributes such as welcomeGreeting and hints, and out of handoffData.
Expected result: A written note on which call flows may use Turn Detection.
Step 3: Add provider failover
Since 18 November 2026, Conversation Relay can switch to a backup provider when the speech-to-text or text-to-speech provider fails. Add one Failover element inside ConversationRelay. An empty element uses Twilio's default backups for every language in the session. Nested Language entries let you protect specific languages and name the backup provider, voice and model. Twilio recommends naming backups explicitly.
What to know before relying on it:
- STT and TTS fail over independently, at call setup or mid-call, and the caller stays on the same WebSocket connection.
- The backup voice speaks any text not yet spoken. Speech recognition restarts, so a few words during the switch can be missed.
- Failover happens once for TTS and once for STT per call. If the backup also fails, the call ends.
- It is set in TwiML and cannot be changed during the call.
- Some languages have no default backup. With an empty element, a missing default makes Twilio reject the call with error 64101.
Subscribe to the config-updated event to receive a configUpdated message naming the new provider, and log it.
Expected result: Failover configured per language, with switches logged.
Step 4: Tune turn detection for your callers
Twilio's turn detection update added turnMinSilence, the minimum silence before Conversation Relay ends a caller's turn. It accepts 100 to 2000 milliseconds and defaults to 300. Raise it if callers pause mid-thought and get cut off. Lower it for faster replies.
With Turn Detection on, speechTimeout now defaults to 2000 milliseconds, up from 1500. It ends a turn the model is not certain about. Twilio's reference says to set it at least 300 milliseconds above turnMinSilence. eotThreshold sets the confidence needed to end a turn, from 0.5 to 0.9, with a default of 0.8. You can change these during a call with a config WebSocket message.
One gap to plan for: the speech timer starts only after the caller speaks. If a caller never speaks, no prompt is sent, so run your own silence timer.
Expected result: Settings chosen from recorded test calls, not guessed.
Step 5: Hand off, write back, then test the failures
When the caller asks for a person, or the agent cannot continue, your app sends an end message with handoffData. Twilio passes that data to the action URL on your Connect verb, which can route the call to a queue or a phone number.
Only confirm a booking after the tool that writes it has succeeded. We cover why in the webhook that could not answer back.
Run these tests before go-live:
| Test | What should happen |
|---|---|
| Primary TTS or STT provider unavailable at call start | The call connects on the backup, and a configUpdated message names the provider in use |
| Provider fails mid-call | The backup voice speaks any unspoken text in order. The agent asks the caller to repeat if speech was missed during the switch |
| Backup provider also fails | The call ends. Your action URL records it, and someone follows up |
| Caller pauses mid-sentence | The turn is not cut off at your turnMinSilence setting |
| Caller says nothing after the greeting | Your own silence timer prompts or ends the call, because Conversation Relay does not report silence |
| Caller asks for a person | Your app sends an end message with handoffData, and the action callback routes the call |
| A booking tool fails | The agent does not confirm the booking, and the failure reaches a person |
Expected result: A test record for each row, kept with the TwiML version you tested.
Known limits
- Failover is one switch per direction per call: Pick a backup from a different provider than the primary where possible, and treat a second failure as a call to follow up on, not a silent loss.
- Turn Detection is outside PCI and HIPAA scope: Leave turnDetection off on regulated call flows and tune speechTimeout for those calls instead.
- Silence is not reported: Run a silence timer in your application that prompts the caller, then ends or transfers the call.
- Conversation Relay does not run your business logic: Bookings, CRM updates and transfers are still your code and your integrations. Test them with the same care as the voice settings.
Frequently asked questions
Do I have to change my app to use failover?
Only the TwiML. Twilio says failover is automatic once the Failover element is in place, and the WebSocket connection stays the same. Subscribing to config-updated events is optional but useful for logging.
Does turnMinSilence apply to Deepgram Flux?
No. Twilio's reference says turnMinSilence applies only when turnDetection is true, and not with Deepgram Flux. The speechTimeout default change also does not affect Deepgram Flux.
Can I lower latency by setting turnMinSilence to the minimum?
Replies come faster, and callers who pause get interrupted more often. Test with recordings of your own callers. For other latency levers, see our Twilio Voice latency practices.
Harden one voice agent call flow
If you run a voice agent on Twilio and want one call flow hardened with failover, turn settings, a human handoff and a tested booking write, book a one-workflow scoping call. The live Automation Sprint page lists the current Sprint prices, including a quoted Starter after a scope review, a fixed Production price, and Complex work quoted from a starting figure. Re-check the page before you budget. Tool subscriptions, API usage and hosting are billed to your own accounts.
Sources
- TwiML Voice: ConversationRelay, Twilio
- Provider failover for Conversation Relay, Twilio
- Conversation Relay WebSocket messages, Twilio
- Conversation Relay now supports STT and TTS provider failover, Twilio
- Turn Detection for Conversation Relay: new tuning controls, Twilio
- Voice agent latency: where the seconds go, Octacer
- Reduce Twilio Voice API latency, Octacer
- Why a voice agent must never confirm before the write, Octacer
- AI agents and app integrations, Octacer
- Automation Sprint, Octacer
Keep going
More guides
Want it running on your stack?
We implement this guide for clients, tailored to your stack, your data, and your team's workflow, and handed over documented.