agentchat.realtime_agent
agentchat.realtime_agent.twilio_observer
TwilioAudioAdapter
Adapter for streaming audio from Twilio to OpenAI Realtime API and vice versa.
__init__
Adapter for streaming audio from Twilio to OpenAI Realtime API and vice versa.
Arguments:
websocket
- WebSocket the websocket connection to the Twilio service
update
Receive events from the OpenAI Realtime API, send audio back to Twilio.
handle_speech_started_event
Handle interruption when the caller’s speech starts.
send_mark
Send a mark of audio interruption to the Twilio websocket.
run
Run the adapter.
Start reading messages from the Twilio websocket and send audio to OpenAI.
initialize_session
Control initial session with OpenAI.