[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.

Simple but very useful information,

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


I had the same problem when I used sorcery with PJSIP and ARI like this:


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                                  : 
    "support_path":"true","max_contacts":"1", "contact": 

I removed this database key and recreate this aor.