Vision Agents requires a Stream account for real-time transport.
Prerequisites
- Twilio account with a phone number
- ngrok for local development (exposes your server to Twilio)
- Stream API credentials
Installation
Environment Variables
Inbound Calls
Twilio sends a webhook when someone calls your number. Validate the request, create a call registry entry, and return TwiML to start the media stream.https://your-ngrok-url/twilio/voice.
Outbound Calls
Use the Twilio REST API to initiate calls programmatically.Key Components
| Component | Description |
|---|---|
TwilioCallRegistry | Manages pending calls and tokens |
TwilioMediaStream | Handles WebSocket audio from Twilio |
attach_phone_to_call | Connects phone audio to Stream call |
verify_twilio_signature | FastAPI dependency for webhook security |
create_media_stream_response | Returns TwiML for bidirectional streaming |

