When I unregister PJ_SIP endpoint or it goes offline Asterisk will know about it in 30 seconds.
How can I reduce these seconds?
My Asterisk version is 13.17.2.
Un-registering should be immediate. Are you sure the device really is cancelling its registration, rather than simply not re-registering next time a re-registration is due?
The problem you will have in getting much faster is that Asterisk has to allow for packets to be lost, and it takes time to be sure there ins nothing there any longer.
Sip.register method in my application is effected immediately, the peer number 200 immediately goes available, and I can call to this peer from other 201 peer, etc. from X-Lite.
But when in my application I call Sip.unregister method, it is affected in asterisk after ~30 seconds, and during this 30 seconds from my desktop 201 peer I still can ringing, but peer 200 not received the call. After 30 seconds I can’t call from 201 to 200 (Failed to established call).
Are you sure an unregister happened and actually went to Asterisk? If it did then it wouldn’t be possible to call the device, as Asterisk wouldn’t know where it was. Please provide the console output with SIP trace (pjsip set logger on) including register/unregister.
Thank you David and jcolp.
I solved the problem with late un-registration.
But now I have new problem. When my peer-200 disconnect from the internet, but still registered, asterisk detect this after 30 seconds. During this 30 seconds I can call from another peer-201 to peer-200, and I hear dialing beeps. After 30 seconds I try to recall to peer-200 and I get error Failed to established call.
It’s important for me, that asterisk detect offline peer fastly.
The qualify_frequency option can be used to configure the frequency at which we send an OPTIONS request to determine if a device is reachable or not. More frequently doing it incurs the cost of more traffic.
Isn’t even qualify subject to retransmission timeouts, setting a lower limit on the effective detection time.
It is, but you can tweak the timers too - with consequences. I wasn’t going to get into that because of the consequences.
Ultimately there is no way to know immediately.