You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/realtime/guide.md
+29Lines changed: 29 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -156,6 +156,35 @@ Send audio to the session using [`session.send_audio(audio_bytes)`][agents.realt
156
156
157
157
For audio output, listen for`audio` events and play the audio data through your preferred audio library. Make sure to listen for`audio_interrupted` events to stop playback immediately and clear any queued audio when the user interrupts the agent.
158
158
159
+
##SIP integration
160
+
161
+
You can attach realtime agents to phone calls that arrive via the[Realtime Calls API](https://platform.openai.com/docs/guides/realtime-sip). The SDK provides[`OpenAIRealtimeSIPModel`][agents.realtime.openai_realtime.OpenAIRealtimeSIPModel], which reuses the same agent flow while negotiating media over SIP.
162
+
163
+
To use it, pass the model instance to the runner and supply the SIP`call_id` when starting the session. The call ID is delivered by the webhook that signals an incoming call.
164
+
165
+
```python
166
+
from agents.realtimeimport RealtimeAgent, RealtimeRunner
167
+
from agents.realtime.openai_realtimeimport OpenAIRealtimeSIPModel
When the caller hangs up, the SIP session ends and the realtime connection closes automatically. For a complete telephony example, see[`examples/realtime/twilio_sip`](https://github.com/openai/openai-agents-python/tree/main/examples/realtime/twilio_sip).
187
+
159
188
##Direct model access
160
189
161
190
You can access the underlying model to add custom listeners or perform advanced operations: