Dialt
Get API key

Developer guide

Twilio

Use the maintained Python reference bridge for PSTN calls. Twilio owns the phone number and call; Dialt owns the realtime voice conversation.

← Choose another integration

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.

  1. Download the maintained Twilio example from Dialt developer docs.
  2. Copy env.example to .env, then set DIALT_API_KEY, TWILIO_AUTH_TOKEN and the exact external PUBLIC_BASE_URL.
  3. Run the locked standalone project behind public HTTPS:
mkdir dialt-twilio
cd dialt-twilio
curl -fsSLO https://dialt.com/docs/api/examples/twilio/README.md
curl -fsSLO https://dialt.com/docs/api/examples/twilio/bridge.py
curl -fsSLO https://dialt.com/docs/api/examples/twilio/env.example
curl -fsSLO https://dialt.com/docs/api/examples/twilio/requirements.txt
cp env.example .env
uv venv
uv pip install -r requirements.txt
uv run uvicorn bridge:app --env-file .env --host 0.0.0.0 --port 8000
  1. 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.