Lack of realtime websocket CLOSE frame

I use SIP to connect a Twilio caller to gpt-realtime, then monitor the call with a websocket connection. I’ve noticed that when the call ends (like when the caller hangs up) the websocket is not sent a CLOSE frame, it just exits suddenly with EOF. This makes an unintentional disconnect indistinguishable from an intentional disconnect at the end of a call. My current workaround is to attempt to reconnect the websocket every time there is a disconnect, and if the call has ended I’ll get a 404 error because the call_id is no longer valid. But ideally the websocket connection would be terminated nicely so that I could distinguish between accidental disconnects that need reconnecting and intentional disconnects that don’t.

3 Likes

Great idea! I will add that. Will drop a message here when complete

3 Likes