[Home]

Summary:ASTERISK-26458: res_pjsip: Insufficient handling of dynamic public IP address
Reporter:Andreas Wetzel (rakanishu)Labels:
Date Opened:2016-10-11 08:07:48Date Closed:
Priority:MinorRegression?
Status:Open/NewComponents:Resources/res_pjsip Resources/res_pjsip_outbound_registration
Versions:13.11.2 Frequency of
Occurrence
Constant
Related
Issues:
Environment:FreeBSD 10.3-RELEASE-p9 i386Attachments:
Description:I have a consumer DSL line which gets disconnected from the ISP's side every 24 hours. When that happens a number of things occur:

- My IP address changes
- DNS may return a different IP address for my ITSP's SIP server
- All outbound registrations need to be renewed, otherwise I get a '401 unauthorized response' from my ITSP's SIP server when trying to place an outbound call prior to the corresponding registration being renewed.

Currently none of the reloading mechanisms present in asterisk seem to make it refetch the machine's public IP address (the one that is shown in 'pjsip dump endpt' under 'published as'), or to force an immediate renewal of all configured outbound registrations. Only way is to do a full restart of asterisk i.e. 'core restart gracefully'.
Comments:By: Asterisk Team (asteriskteam) 2016-10-11 08:07:49.350-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.

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

By: Ray Crumrine (proftech) 2016-10-11 09:45:33.983-0500

I'm no expert and maybe I am missing something but wouldn't the use of dnsmgr solve this issue? If the ITSP's address is indeed changing, dnsmgr should run every little while and detect the change? As far as the users side [IP address] goes, if his IP is changing it would seem registration should be occurring every 3 minutes or so on all trunks used for inbound calls anyway(??) I use consumer DSL and never really thought about the ITSP address changing but started using dnsmgr because the SRV records also specify a port number which may be different than 5060. Also Callcentric has a setup that uses 25 or 30 [random?] IP addresses for security.

*edited* I think I understand more clearly now. If the ITSP requires you to be registered to make a call then you would get the error he refers to. All of the trunks I've been using for outbound don't require registration. But I would think the "error state" would only exist for a few minutes until the configured registration period would end. hmmm...

By: Joshua C. Colp (jcolp) 2016-10-11 09:48:42.038-0500

PJSIP does not store the ITSP address in a resolved state, each time a request is sent it is re-resolved. The only caching that exists is a DNS cache which is based on the TTL of the underlying records.

The real problem is that if the external address changes there's no easy way currently to cause a registration to get sent.

By: Andreas Wetzel (rakanishu) 2016-10-11 10:16:47.596-0500

There are two distinct problems here:

1) There does not seem to be a way to have asterisk refresh the public IP address. This is the one shown with 'pjsip dump endpt' under 'published as', which seems to be used for the 'o=' lines of the sdp and probably also for the 'c=' lines for all external communication with the ITSP.

2) The 'pjsip send register' command only allows to specify a single registration entry, but not to re-send all configured outbound registrations.

*edit*: registration expiry time seems to be the default of 3600 sec, and the response from the ITSP's server seems to indicate it even tolerates as much as 4500 sec. So it could take a while until the next registration is being sent out regularly.