Using qualify to detect hung endpoints and unregister them

Hello there

I am stuck today in a scenario; An endpoint registers to my Asterisk server. They “handshake” and now the endpoints shows on pjsip show endpoints.
If the endpoint does not send an UNREGISTER SIP packet, then the server does not ever release the hung endpoint’s slot. I simulate this by registering a soft phone and then killing its process.
Again using wireshark, I confirm that there is no UNREGISTER packet sent from the endpoint, and even when I am using pjsip qualify ${extension}, I can see OPTIONS packets not being replied to. After not getting any replies from the endpoint, it considers it unreachable.
The thing is that the server will keep sending OPTIONS packets seems indefinitely. What I want to happen, is for the server to unregister the endpoint that does not reply.

Is that even possible?

Here is my pjsip.conf:


type = transport
protocol = udp
bind =
external_media_address =
external_signaling_address =
local_net =



qualify_frequency=20     ; Interval at which to qualify an AoR via OPTIONS requests.
qualify_timeout=10.0      ; Qualify timeout in fractional seconds (default: "3.0")


type = auth
username = 7001
password = 123

auth = 7001
outbound_auth = 7001
aors = 7001
callerid=Woody <7001>


username = 7002
password = 456

auth = 7002
outbound_auth = 7002
aors = 7002
callerid=Buzz Lightyear <7002>

There is no functionality to do so. The Contact will remain, but will not be called. When the registration expiration is reached then it will be removed.

Ok, understood. Is there any way to tweak the registration expiration?

Expiration is configured on the AOR[1]. There are “default_expiration”, “minimum_expiration”, and “maximum_expiration” settings.


Nice. After they are removed, I suppose they need to register again?

Yes, that is how SIP registration works.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.