Call your Pipecat bot over websockets using Twilio
POST /
- Returns TwiML instructions to TwilioWebSocket /ws
- Handles the WebSocket connection for real-time audio<your server url>
with your server’s publicly accessible domain. The Pause
element keeps the call alive for a maximum of 40 seconds. Adjust this value based on your expected conversation length.run_bot
function creates and connects all the components in the Pipecat pipeline:
TwilioFrameSerializer
handles the protocol specifics for communicating with Twilio’s Media Streams:
account_sid
and auth_token
to the
TwilioFrameSerializer
, it will automatically end the call via Twilio’s REST
API when the pipeline ends. This ensures clean call termination when your bot
finishes its conversation.https://your-server.com/
)https://abc123.ngrok.io/
. Remember to update your TwiML template with the
correct WebSocket URL as well.-t
flag puts the server in testing mode, and the test client creates virtual clients that communicate with your server as if they were Twilio Media Streams.
TwilioFrameSerializer
, the call will be ended automatically when your pipeline ends: