Receiving SIP 400 Bad Request when sending an INVITE from Twilio to OpenAI

This was working until recently…not sure when it started. I just went to test it and the agent didn’t pickup.

Here’s what my INVITE looks like:

INVITE sip:[my email].com5061;transport=tls SIP/2.0
Record-Route: sip:146.190.253.188:5060;ftag=72967813_c3356d0b_abd33a97-7932-4bf3-a4bf-8b8ef5392806;did=2ca.f0e1;lr
Record-Route: sip:54.244.51.1;lr
From: sip:+19475176566@dsiptest.pstn.twilio.com:5060;tag=72967813_c3356d0b_abd33a97-7932-4bf3-a4bf-8b8ef5392806
To: sip:proj_LiCooyUxqKrHxGckhR34dpHR@sip.api.openai.com:5061
CSeq: 653169 INVITE
Max-Forwards: 56
P-Asserted-Identity: sip:+19475176566@152.189.56.77:5060
Diversion: sip:+13132468974@twilio.com;reason=unconditional
Call-ID: 5e738ab29fc36b12545376c1a2e01be6@0.0.0.0
Via: SIP/2.0/TLS 146.190.253.188:4443;branch=z9hG4bK0978.1694df1f229d89305ca3a39f59785ae8.0
Via: SIP/2.0/UDP 54.244.51.1:5060;rport=5060;branch=z9hG4bK0978.36b189d55511ac38e6aeb8326c405b0b.0
Via: SIP/2.0/UDP 172.18.65.22:5060;rport=5060;branch=z9hG4bKabd33a97-7932-4bf3-a4bf-8b8ef5392806_c3356d0b_600-11975037437518736540
Contact: sip:+19475176566@54.244.51.1:5060;transport=udp
Allow: INVITE,ACK,CANCEL,BYE,OPTIONS,REFER,NOTIFY
X-Twilio-VerStat: TN-Validation-Passed-A
X-Twilio-AccountSid: AC118a91cc5fde635396e58367f3af5a9e
User-Agent: Twilio Gateway
Content-Type: application/sdp
X-Twilio-CallSid: CA953caa0857881a5baf6502ba3ea5cbd5
Content-Length: 293
P-hint: inbound

v=0

o=root 464558629 464558629 IN IP4 146.190.253.188
s=Twilio Media Gateway
c=IN IP4 146.190.253.188
t=0 0
m=audio 16452 RTP/AVP 0 8 101
a=maxptime:20
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=sendrecv
a=rtcp:16453
a=ptime:20
||||||||||||||||||||

The 400 Bad Request looks like this and it has an error code of 504 in the body:

SIP/2.0 400 Bad Request
Record-Route: <sip:146.190.253.188:5060;lr;ftag=72967813_c3356d0b_abd33a97-7932-4bf3-a4bf-8b8ef5392806;did=2ca.f0e1>
Record-Route: <sip:54.244.51.1;lr>
Via: SIP/2.0/UDP 54.244.51.1:5060;rport=5060;branch=z9hG4bK0978.36b189d55511ac38e6aeb8326c405b0b.0
Via: SIP/2.0/UDP 172.18.65.22:5060;rport=5060;branch=z9hG4bKabd33a97-7932-4bf3-a4bf-8b8ef5392806_c3356d0b_600-11975037437518736540
From: <sip:+19475176566@dsiptest.pstn.twilio.com:5060>;tag=72967813_c3356d0b_abd33a97-7932-4bf3-a4bf-8b8ef5392806
To: <sip:proj_LiCooyUxqKrHxGckhR34dpHR@sip.api.openai.com:5061>;tag=c533e38a-a301-42bb-989e-15c82d31831b
Call-ID: 5e738ab29fc36b12545376c1a2e01be6@0.0.0.0
CSeq: 653169 INVITE
Content-Length: 15
Content-Type: application/json
Contact: <sips:OAI@sip.api.openai.com:5061>

error code: 504||||||||||||||||||||

Hi really sorry about this @Mack_Hendricks we are having an issue with an internal service that is impacting Realtime API. Working on this now!

I will update when when I have a fix.

3 Likes

This is fixed ~hr ago!

Authentication was failing internally between two services. Now that it has been fixed SIP connectivity should return to normal. If anyone else has issues please mention me!

1 Like

Hey @Sean-Der,

I’m still getting the same error message:

@Sean-Der I figured out the issue. It was my certificate - it was expired. Once, I updated the cert things started working again.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.