Twilio inbound calls
The Python reference bridge terminates a bidirectional Twilio Media Stream and opens one Dialt session per call. Twilio remains responsible for the phone number and call; your service owns deployment and application tools.
- Get the maintained Twilio recipe from the public
dialt-ai/dialt-recipesrepository. - Copy
env.exampleto.env, then setDIALT_API_KEY,TWILIO_AUTH_TOKENand the exact externalPUBLIC_BASE_URL. Editinstructions.mdto give your agent its role. - Run the locked project behind public HTTPS:
git clone https://github.com/dialt-ai/dialt-recipes.git
cd dialt-recipes/examples/integrations/twilio
cp env.example .env
uv sync --frozen
uv run uvicorn bridge:app --env-file .env --host 0.0.0.0 --port 8000
- Point the Twilio number's incoming Voice webhook at
POST https://your-host/voice.
The bridge validates Twilio signatures, converts 8 kHz G.711 mu-law audio, and maps Twilio mark/clear playback state onto Dialt interruption events. Add your tool schemas and handlers in tool_manifest() and execute_tool(). The recipe README is the source of truth for configuration, tests and operational boundaries.
Optional human handoff
Set TWILIO_ACCOUNT_SID and an HTTPS TWILIO_HUMAN_HANDOFF_URL to enable the permission-gated request_human_handoff tool. When the caller approves a handoff, the bridge redirects the active Twilio call to that customer-owned TwiML endpoint. The endpoint can route to a number, queue, conference, Flex flow or TaskRouter workflow; the destination is configuration and is never supplied by the model.
TWILIO_ACCOUNT_SID=ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
TWILIO_HUMAN_HANDOFF_URL=https://voice.example.com/handoff
This is a cold-transfer reference. The tool provides a reason and concise summary to execute_tool(); persist them by CallSid in your application before redirecting if the receiving agent needs context.