Implementation:Openai Openai python Realtime Call Incoming Webhook
| Knowledge Sources | |
|---|---|
| Domains | API_Types, Python |
| Last Updated | 2026-02-15 00:00 GMT |
Overview
Concrete type for representing a realtime incoming SIP call webhook event provided by the openai-python SDK.
Description
RealtimeCallIncomingWebhookEvent is a Pydantic model class that represents the webhook payload sent when the Realtime API receives an incoming SIP call. It extends BaseModel and includes an event identifier, a Unix timestamp, a nested Data payload containing the call ID and a list of DataSipHeader objects (each with a name and value), a literal type field fixed to "realtime.call.incoming", and an optional object field fixed to "event". The DataSipHeader model captures individual SIP Invite headers associated with the call.
Usage
Import this type when building a webhook handler that needs to process incoming SIP call events from the OpenAI Realtime API. Use it to deserialize incoming webhook payloads, extract call metadata, and inspect SIP headers for routing or logging purposes.
Code Reference
Source Location
Signature
class DataSipHeader(BaseModel):
"""A header from the SIP Invite."""
name: str
value: str
class Data(BaseModel):
"""Event data payload."""
call_id: str
sip_headers: List[DataSipHeader]
class RealtimeCallIncomingWebhookEvent(BaseModel):
"""Sent when Realtime API Receives a incoming SIP call."""
id: str
created_at: int
data: Data
type: Literal["realtime.call.incoming"]
object: Optional[Literal["event"]] = None
Import
from openai.types.webhooks import RealtimeCallIncomingWebhookEvent
I/O Contract
Fields
| Name | Type | Required | Description |
|---|---|---|---|
| id | str | Yes | The unique ID of the event. |
| created_at | int | Yes | Unix timestamp (in seconds) of when the event was created. |
| data | Data | Yes | Event data payload containing call details. |
| data.call_id | str | Yes | The unique ID of the incoming call. |
| data.sip_headers | List[DataSipHeader] | Yes | Headers from the SIP Invite. |
| data.sip_headers[].name | str | Yes | Name of the SIP header. |
| data.sip_headers[].value | str | Yes | Value of the SIP header. |
| type | Literal["realtime.call.incoming"] | Yes | The type of the event. Always "realtime.call.incoming". |
| object | Optional[Literal["event"]] | No | The object of the event. Always "event" when present. |
Usage Examples
from openai.types.webhooks import RealtimeCallIncomingWebhookEvent
# Parse a webhook payload
event = RealtimeCallIncomingWebhookEvent.model_validate(payload)
print(f"Incoming call {event.data.call_id}")
for header in event.data.sip_headers:
print(f" SIP Header: {header.name} = {header.value}")