SIP.js icon indicating copy to clipboard operation
SIP.js copied to clipboard

Keepalive with OPTIONS message

Open InnovateAsterisk opened this issue 1 year ago • 0 comments

Is your feature request related to a problem? Please describe. There is currently a keep-alive system with an empty frame (or 0x9). However I'm not sure this is sufficient for all routers and servers. I want to be able to send a full OPTIONS message (at an interval) to the server over the existing transport. I understand the OPTIONS message is generally used for "Querying for Capabilities", but in the real world I see it used widely as a way to keep natted connections open and even a way to keep websocket server connections open that automatically close after an idle timeout. I could also use it to ensure that my server is responding to sip messages, and perform actions accordingly. Or I could time the response and make changes to the configuration according to the response.

Describe the solution you'd like A SipOptionsPingInterval. This may be a feature of the Transport object (transportOptions) https://github.com/onsip/SIP.js/blob/main/docs/api/sip.js.useragentoptions.transportoptions.md. (Btw transportOptions is not documented)

Describe alternatives you've considered The alternate would be to ask the server to perform this task, however i'm attempting to reduce the load on the server, and put the onus on you (the client) to keep your connection up (since you initiated a connection with us, its up to you to keep it that way).

Additional context

    // SIP WebSocket Clients and Servers may keep their WebSocket
    // connections open by sending periodic WebSocket "Ping" frames as
    // described in [RFC6455], Section 5.5.2.

InnovateAsterisk avatar Dec 08 '22 10:12 InnovateAsterisk