When making a call to the OpenAI Realtime API via SIP, the 200 OK response from the OpenAI endpoint is missing the Content-Type header. This results in immediate call teardown by clients such as Asterisk, which reply with ACK and BYE after receiving the incomplete response. The issue persists across different SIP clients and environments.
Details:
- SIP requests are correctly formatted and authentication is working.
- The problem occurs consistently, regardless of the client or environment used.
- Standard SIP behavior expects a Content-Type header in the 200 OK response.
- Without this header, clients are unable to handle the call properly.
- Expected Behavior: The 200 OK SIP response should include a valid Content-Type header (e.g., Content-Type: application/sdp).
- Actual Behavior: The Content-Type header is missing from the 200 OK SIP response.
- Impact: This prevents successful call setup and immediate call teardown by SIP clients such as Asterisk.
SIP/2.0 200 OK
Via: SIP/2.0/TLS <MY_PUBLIC_IP>:5061;rport=61954;branch=z9hG4bKPjfe7413d8-4ef1-4540-877b-3db608b5ba5d;alias;received=162.158.238.61
From: <sip:<MY_PROJECT_ID>@sip.api.openai.com>;tag=2f829524-0653-4fe3-8efa-25a1371c6d58
To: <sip:<MY_PROJECT_ID>@sip.api.openai.com>;tag=045b497c-630b-452c-b5f3-9c39bab68349
Call-ID: 184be81a-9b5e-4755-9753-22d52b83e37d
CSeq: 27205 INVITE
Content-Length: 208
Contact: <sip:OAI@sip.api.openai.com:5061>
v=0
o=- 2113971860 2113971862 IN IP4 52.247.124.219
s=OAI
c=IN IP4 52.247.124.219
t=0 0
m=audio 43955 RTP/AVP 0 101
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=rtpmap:0 PCMU/8000
The correct 200 OK response should look something like this:
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.88.50:5060;rport=5060;received=192.168.88.50;branch=z9hG4bK.ZfT4ph5~u
From: <sip:1001@192.168.88.242>;tag=kZDXQyhJk
To: <sip:1111@192.168.88.242>;tag=d7cb1a0e-3ddd-4224-9448-8f18ec882302
Call-ID: f9iiUceYdr
CSeq: 21 INVITE
Content-Type: application/sdp
Content-Length: 281
Contact: <sip:192.168.88.242:5060>
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, INFO, REFER, MESSAGE
Supported: 100rel, timer, replaces, norefersub
v=0
o=- 2814 3540 IN IP4 192.168.88.242
s=Asterisk
c=IN IP4 192.168.88.242
t=0 0
m=audio 13180 RTP/AVP 0 8 96 100
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:96 opus/48000/2
a=rtpmap:100 telephone-event/8000
a=fmtp:100 0-16
a=ptime:20
a=maxptime:60
a=sendrecv
I have full signaling log if needed, also there is a thread with this discussion called " Realtime API with SIP - missing Header in SIP - Asterisk"
(I don’t know how to paste links here)