No event is emitted when internet connection disconnects.

Skip to first unread message

Rishabh Chandra

Sep 23, 2021, 4:44:33 PM9/23/21
to JsSIP

When internet is temporarily disconnected, JsSIP user agent doesn't receive any event like disconnected or unregistered.
Also, it doesn't reinitiate registration/connection, because after internet is reconnected, incoming/outgoing calls don't work.

My use case is to let user notify about the status of connection, so basically I want to know when JsSIP is ready to make calls.
According to documentations, JsSIP has two methods exposed on JsSIP.UA, .isConnected() and .isRegistered() but unfortunately they return true even when internet is disconnected.

Apologies if I missed something in how SIP/JsSIP works.

nicoleta tuns

Sep 27, 2021, 7:34:45 AM9/27/21
to JsSIP
I also have this issue.
I feel like any "isConnected" function should always return the real status of a connection, not a cached one.

Also I am having trouble finding out how to "poke" the connection, such that I can get it to quickly update the status :(

I am also new JSSIP and SIP itself, so Im sure there's plenty I am missing.

Iñaki Baz Castillo

Sep 27, 2021, 7:52:57 AM9/27/21
Guys, you are blaming JsSIP instead of understanding how TCP (and hence WebSocket) works. TCP disconnection is just noticed when the endpoint tries to send something over it. This is Internet, there is not a physical cable that the endpoint can check to know whether the connection remains open or not. And that’s why SIP endpoints send OPTIONS or REGISTER every N seconds to ensure the connection is not closed.

You received this message because you are subscribed to the Google Groups "JsSIP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
Iñaki Baz Castillo
Message has been deleted

Iñaki Baz Castillo

Sep 28, 2021, 2:15:12 AM9/28/21
So instead of returning a Boolean, you say that isConnected() should send something and check that something is received so it should return a Promise, right? A Promise that may take even minutes before resolving or rejecting due to connection current conditions. Do you see the problem? This is like desiring a method that does magic without knowing its implications.

If you want to test that, make JsSIP send an OPTIONS and check the response or produced error.

El El mar, 28 sept 2021 a las 8:08, nicoleta tuns <> escribió:
But what I'm suggesting is that when calling "isConnected", JSSIP could try and send something over to verify that there actually is a valid connection. Or there should be another way to do it, a separate function for it. 
It could also be that I missed a way to do exactly that(since I am still learning about Websockets, TCP and JsSip).
I am bugfixing an app that I took over at work, since the original developer is no longer here, so that's the reason I'm diving head first in while flailing.

It might be too much to ask, but what's the difference between that and sending a "Ping" to an endpoint to check if there is a "Pong" returned? Can't JSSIP do this? Send a small poke to see if there is still a listening server alive?
Reply all
Reply to author
0 new messages