[SOLVED] How to clear dead SIP registrations?

Hi all,

This question might be very simple, but I did not manage to find any answer.
I am running Asterisk 13.9.1 with PJSIP stack. Various UACs (hard and soft phones) are registered dynamically.
If a network or application suddenly goes down, an UAC does not send the correct ‘deregistration’ message (REGISTER with zero expiration time), so that registration is lost from UAC’s prospecive but is kept on the server - pjsip show contacts clearly indicate this.

When this UAC goes online, it tries to register again from a new TCP port and legitimately receives 403 Forbidden due to max_contacts=1 directive.
Increasing max_contacts value would not solve the issue - UAC will register, but Asterisk will send incoming calls to the first (initial) registration which is dead.

I noticed that neither pjsip reload, nor even application restart do not clear such registrations.
Do you have any advice how to clear them?

Issue solved.

database deltree registrar/contact from CLI removes dynamic registrations.

1 Like

Simple but very useful information,

You can also use the remove_existing option to remove the previous contact upon the new registration.

3 Likes

Hello!
I had the same problem when I used sorcery with PJSIP and ARI like this:
sorcery.conf

[res_pjsip]
endpoint=astdb,ps_endpoints
auth=astdb,ps_auths
aor=astdb,ps_aors

And I got error res_pjsip.c:4262 endpt_send_request: Error 171060 "Unsupported transport (PJSIP_EUNSUPTRANSPORT)" on dead registration.

In database I had like this:

/ps_aors/aor/101                                  : 
{
    "minimum_expiration":"60",
    "default_expiration":"3600",
    "qualify_timeout":"3.000000",
    "mailboxes":"",
    "support_path":"true","max_contacts":"1", "contact": 
    "sips:101@192.168.1.10:58982;transport=ws;rtcweb-breaker=no",
    "authenticate_qualify":"false",
    "maximum_expiration":"7200",
    "qualify_frequency":"60",
    "remove_existing":"true",
    "outbound_proxy":""
}

I removed this database key and recreate this aor.

1 Like