[Home]

Summary:ASTERISK-29038: res_pjsip_registrar: Request to remove Contact fails
Reporter:Edi (edmond_dobrova@hotmail.com)Labels:
Date Opened:2020-08-21 08:31:05Date Closed:2020-08-25 08:08:07
Priority:MinorRegression?
Status:Closed/CompleteComponents:Resources/res_pjsip_registrar
Versions:16.11.1 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) pjsip_log.txt
Description:Hi, i have setup extension pjsip with 4 Max contacts.If i register with 4 devices and than i disconnect to 3 devices and i leave only 1 device online after that i can not reconnect again with those devices, i get this message:

[2020-08-21 13:09:10] WARNING[6154]: res_pjsip_registrar.c:680 register_aor_core: Registration attempt from endpoint '199' to AOR '199' will exceed max contacts of 4
AFTER I EXIT MY SOFTPHONE I GET THIS MESSAGE:
   -- Attempted to remove non-existent contact 'sip:199@30.1.99.243:5060;x-ast-orig-host=10.10.61.1:5060' from AOR '199' by request

And this i what i see on the asterisk info:

Contact:  199/sip:199@30.1.99.243:53625;x-ast-orig-h 537e44ce63 Unavail         nan
Contact:  199/sip:199@175.120.245.98:15775           a081532541 Avail       104.981
Contact:  199/sip:199@175.120.245.98:53625           a0dc228849 Unavail         nan
Contact:  199/sip:199@96.217.168.133:53625           f4816d7705 Unavail         nan

So it does not remove those Unavailable contacts that is why i can not register anymore .
Comments:By: Asterisk Team (asteriskteam) 2020-08-21 08:31:07.078-0500

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution. Please note that log messages and other files should not be sent to the Sangoma Asterisk Team unless explicitly asked for. All files should be placed on this issue in a sanitized fashion as needed.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

By: Joshua C. Colp (jcolp) 2020-08-21 08:37:19.050-0500

This is on purpose. A contact going unavailable does not remove it, as it may be a transient temporary issue and it can come back. It is only when the contact expiration time is met that they are removed.

The actual request to remove a contact should have likely worked though. Please attach a complete SIP trace (pjsip set logger on) showing the attempt.

By: Joshua C. Colp (jcolp) 2020-08-21 08:37:37.674-0500

It is also highly suggested that remove_existing be used for these reasons.

By: Edi (edmond_dobrova@hotmail.com) 2020-08-25 02:57:36.832-0500

I did Maximum Expiration to 70 seconds and i think that fixed the issue. Is it good to leave Minimum Expiration to 60 seconds and Maximum Expiration to 70 seconds ?

By: Joshua C. Colp (jcolp) 2020-08-25 04:31:18.276-0500

It should be fine to do so. Are you not able to provide the information I asked for?

By: Edi (edmond_dobrova@hotmail.com) 2020-08-25 04:35:12.565-0500

i will try it now

By: Edi (edmond_dobrova@hotmail.com) 2020-08-25 06:56:14.313-0500

attached you have pjsip loger you may want to look at ip 30.30.30.30 (i have replaced with my real ip) that is my public ip that could not connect from my mobile. The issue is that if i use soft phone in my mobile and if i connect to wifi or disconnect and connect it with 4g and vice versa than it fills up the max contacts and it doesnt work until the Max Expiration reaches

By: Joshua C. Colp (jcolp) 2020-08-25 07:07:40.046-0500

The problem is that the request from the client to remove a registration is coming from a different IP address and port, and you have "rewrite_contact" enabled to overcome NAT. As a result the Contact is updated to that source IP address and port which is not registered, so unregistering fails. If "rewrite_contact" has to be enabled for your deployment to work, then I'm not sure what can be done within Asterisk to help.

A lower expiration as you've done is probably the best option.

By: Joshua C. Colp (jcolp) 2020-08-25 07:09:10.288-0500

I'm putting this into feedback so you can test with your lowered expiration and see how things work. Alternatively having a separate endpoint and AOR, only allowing a single contact, may work too.

By: Edi (edmond_dobrova@hotmail.com) 2020-08-25 07:37:48.903-0500

yes with lower expiration it works because if i set to 70 seconds it removes after 70 seconds so you dont have to wait 7200 seconds like it is by default. I know with 1 contact there is no problem but is it ok to set all of my extensions that has 1 contact with max expiration from 7200 to 70 seconds ?

By: Joshua C. Colp (jcolp) 2020-08-25 07:42:08.388-0500

It will ultimately cause more SIP traffic as things have to REGISTER more often, but in practice is likely fine.

By: Edi (edmond_dobrova@hotmail.com) 2020-08-25 08:05:44.226-0500

i was thinking if i set lower expiration does it help me reconnecting the soft phone if my internet goes from primary to backup or there is internet issue, because if i have problem with internet i want my softphone to reconnect as soon as possible when switching to backup internet or when internet comes back online. Thanks

By: Asterisk Team (asteriskteam) 2020-08-25 08:05:44.389-0500

This issue has been reopened as a result of your commenting on it as the reporter. It will be triaged once again as applicable.