Configure Twilio Elastic SIP Trunking
- Assign the phone number to your Twilio SIP trunk.
- Set the trunk’s Origination URI to:
sip:<OPENAI_PROJECT_ID>@sip.api.openai.com;transport=tls
- Use TLS on port 5061.
- Ensure
<OPENAI_PROJECT_ID>matches the OpenAI project where the webhook is configured. - Subscribe the OpenAI webhook endpoint to:
realtime.call.incoming
Troubleshooting Missing Events
If no webhook event appears, first inspect Twilio’s call logs and SIP response. A 4xx or 5xx response commonly indicates that:
![]()

-
The Request-URI sent to OpenAI does not contain the project ID.
- TLS is not configured correctly.
- The specified OpenAI project is incorrect.
Capture the outbound SIP INVITE and verify that its first line resembles:
INVITE sip:<OPENAI_PROJECT_ID>@sip.api.openai.com SIP/2.0
Also confirm that:
- The webhook is a project-level OpenAI webhook, not a Twilio webhook.
- The webhook endpoint is publicly reachable and returns a
2xxresponse quickly. - Webhook signature verification uses the unmodified raw request body.
- The API key used to accept the call belongs to the same OpenAI project.
Accept the Incoming Call
After receiving the event, accept the call with:
POST /v1/realtime/calls/{call_id}/accept
If the call is not accepted, OpenAI will eventually reject or terminate it.
Request-URI Rewriting
If Twilio replaces the Request-URI user portion with the called E.164 phone number, route the call through either:
- A TwiML
<Sip>destination, or - An SBC that preserves the OpenAI project ID in the destination URI.
