Integrations / Exotel
Exotel 🇮🇳 to an AI voice agent
Connect an Indian Exotel number to an AI voice agent over Exotel's bidirectional stream. Setu handles the Exotel dialect and hands the voice engine plain PCM16, including the flush that makes barge-in work.
path /exotel · 8 kHz · production-tested on live calls
What Exotel sends and expects
- Wire format
- JSON text frames, snake_case keys, base64 L16
- Sample rate
- 8 kHz
- Flush playback on interruption
{"event":"clear","stream_sid":…}Carriers queue seconds of audio ahead of the caller. Without this frame, an interrupted caller keeps hearing a sentence the agent gave up on two seconds ago.
The trap
Exotel discards any frame shorter than 100 ms or not a multiple of 320 bytes — and a voice engine emits audio in smaller pieces than that as it speaks. Send the engine's output straight through and the caller hears nothing at all. The adapter buffers to legal sizes before sending, which is the single reason this integration works.
Wiring it up
Configure the Voicebot applet on your Exotel flow to point at the bridge.
1 · run the bridge
export DVAARIK_API_KEY=dvk_live_...
export AGENT_PROMPT="You are Riya, the receptionist at Sunrise Dental."
npx @dvaarik/setu2 · point Exotel at it
Configure the Voicebot applet on your Exotel flow to point at the bridge. The bridge listens on /exotel, so the target is wss://your-host/exotel.
Then call the number. Audio goes to the Voice API, the agent answers from your prompt, and the reply streams back on the same socket — billed from your prepaid balance at ₹1.50 to ₹3.75 a minute depending on the voice grade. Nothing about your Exotel account changes: the number, the trunk and the per-minute connectivity stay billed by Exotel.
Prefer to write it yourself?
You do not have to use the bridge. The protocol reference is one REST call and one WebSocket, and Setu is MIT licensed — the exotel.ts adapter is about a hundred readable lines. Copy it, port it, or read it to find out what the vendor docs left out. There is also a complete Python and FastAPI implementation in the repository's examples folder, covering the whole protocol including barge-in.
Other providers