Realtime SIP & NAT no audio sent to client

Does anyone know, or has anyone got a call working, with the new realtime SIP endpoint where the SIP client is behind a NAT?

In my experiements with a SIP client on my local machine the signalling looks good and I get an OK response to the INVITE after doing the webhook dance but then no audio arrives. The IP address in my INVITE SDP is private and I suspect that could be the issue. It’s unusual for a public SIP server to not deal with NATted clients though.

1 Like

Does your call get terminated after ~4s or does it stay up? Mine gets a BYE from OpenAI after about that time. I am indeed behind NAT.

I don’t get a BYE but my SIP socket is NATted as well so it could be the request is just not getting thru (if there’s no NAT handling on the RTP I guess there might not be for SIP requests either).

The websocket that I set up to get the call events does disconnect after that sort of time so that would indicate the call is getting torn down for some reason.

I spun up a vm with a public IPv4 address on both the SIP and RTP sockets and got the same behaviour so it seems the it may not be NAT related, at least initially. I still don’t get a BYE from the OpenAI end though. I get a Trying response followed by OK after I send the HTTP POST request and that’s it.

Maybe the OpenAI server expects a valid TLS cert, username or some other thing. In those cases an error response would be expecred rather than OK. Mystery.

So far I have only been succesful by using Twilio as the ingress, where is certainly no NAT involved… It’d be great if they provided some logs in the dashboard…

Hey @saghul @aza this is fixed now!

SIP was open to the world, but RTP was only allowed from Twilio/Telnyx. I forgot to open it up after release. Thanks for using it and good to see you both :slight_smile:

3 Likes

Hi @Sean-Der good to cross paths again, small World!

Thanks for the fix. I can confirm audio is now flowing now on my SIP calls to the OpenAI server.

fantastic Sean, were struggling since the day it got released. Now without changing any settings from our SIP server side( Wildix) there is voice coming in, however there is a lot of nose. Any idea ?

@skrai4u Could you share a audio sample?

Is it completely static, or you hear audio but has corruption? What codec are you using? Could you try switching between Opus/PCMA/PCMU?

Hi @Sean-Der do you have any configuration example of how to setup SIP openai realtime with asterisk or any base repo for where I can check how to do it? Any help will be very helfully for me, thanks.

Hi @aza do you have any repo example for see how to do it? I am using asterisk and i would like to know how to do it. Right now I can not hear the audio even if i follow official documentation instructions

I haven’t tested with Asterisk but I think there are others here that have.

As far as the SIP signalling goes the only thing notable was that a TLS transport is required (not a bad thing). Other than the SIP side there is some co-ordination needed with the HTTP POST to accept the call and the web socket to manage it but both are described in the OpenAI docs.

In case it’s of any use here is my dotnet proof of concept. If a SIP trace would be useful let me know and I can post an example.

1 Like

Thanks @aza! Your implementation is very clear. The logic is similar to what I have already, but i still not have audio transmition and the call hung up in ~10s.