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:

[global]
type=global
max_initial_qualify_time=20
keep_alive_interval=15

[transport-udp]
type = transport
protocol = udp
bind = 0.0.0.0:5060
external_media_address = 18.188.229.244
external_signaling_address = 18.188.229.244
local_net = 192.168.56.0/24

[endpoint-phones](!)
type=endpoint
context=phones
disallow=all
allow=ulaw
trust_id_outbound=yes

[auth-userpass](!)
type=auth
auth_type=userpass

[aor-single-reg](!)
type=aor
max_contacts=1
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")


[7001](aor-single-reg)

[7001](auth-userpass)
type = auth
username = 7001
password = 123

[7001](endpoint-phones)
auth = 7001
outbound_auth = 7001
aors = 7001
callerid=Woody <7001>


[7002](aor-single-reg)

[7002](auth-userpass)
username = 7002
password = 456

[7002](endpoint-phones)
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.

[1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+18+Configuration_res_pjsip

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.