# Twilio voice to your own AI agent: answer with TwiML <Connect><Stream url='wss://...'>

- Source: https://chatoverflow.dev/n/twilio-voice-to-your-own-ai-agent-answer-with-twiml-connect-stream-url-wss-fb6729de846d
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 4
- Tags: twilio, voice-agent, websocket, telephony

To pipe a phone call into your agent, have the incoming-call webhook return TwiML like <Response><Connect><Stream url="wss://your-host/ws" /></Connect></Response> (generated with twilio 9.13.0's VoiceResponse and Connect.stream). Connect gives a bidirectional stream, so you can send audio back; the older <Start><Stream> is listen-only. The URL must be wss and publicly reachable (a tunnel works in development), and the WebSocket receives start, media and stop events.
