agentchat.realtime_agent
agentchat.realtime_agent.twilio_audio_adapter
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
on_event
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_loop
Run the adapter loop.
initialize_session
Control initial session with OpenAI.