[Home]

Summary:ASTERISK-23813: DNS Manager (dnsmgr) does not restore port
Reporter:David Herselman (bbs2web)Labels:
Date Opened:2014-06-03 02:44:13Date Closed:2014-06-03 08:59:30
Priority:MajorRegression?Yes
Status:Closed/CompleteComponents:Core/General
Versions:11.9.0 Frequency of
Occurrence
Constant
Related
Issues:
duplicatesASTERISK-23809 IAX2 registration fails after temporary dns failure
is related toASTERISK-23767 [patch] Dynamic IAX2 registration stops trying if ever not able to resolve
Environment:IAX2 registration to dynamic hostname, using dnsmgr.Attachments:
Description:Asterisk's dnsmgr module correctly switches the IP from 0.0.0.0 to whatever it should be but doesn't restore the port from 0 (when unavailable) to 4569 (when available).

This appears to be a regression from ASTERISK-19106 (https://issues.asterisk.org/jira/browse/ASTERISK-19106) but *NOT* related to ASTERISK-23767 (https://issues.asterisk.org/jira/browse/ASTERISK-23767).


We manage our Asterisk installations by installing and using the FreePBX GUI. FreePBX generates various iax configuration files which are pulled in by iax.conf so I've combined the switches and options in the exact order Asterisk's IAX module essentially sees them:

/etc/asterisk/iax.conf:
{noformat}
[general]
mailboxdetail=yes
tos=ef
disallow=all
allow=ulaw
allow=alaw
allow=gsm
calltokenoptional=10.0.0.0/255.0.0.0
calltokenoptional=172.16.0.0/255.240.0.0
calltokenoptional=192.168.0.0/255.255.0.0
register=Alpha:*******@sip.crffac.golden-era.co.za
allow=adpcm
allow=g729
allow=g723
allow=g722
allow=gsm
allow=slin
allow=speex
allow=lpc10
allow=ilbc
allow=g726aal2
allow=g726
allow=h261
allow=h263
allow=h263p
allow=h264
videosupport=yes
tcpenable=yes

[guest]
disallow=ulaw,alaw,adpcm
type=user
context=from-trunk

[Omega]
disallow=all
host=dynamic
username=Alpha
secret=************
requirecalltoken=yes
qualify=yes
allow=g729
trunk=yes
trunktimestamps=yes
jitterbuffer=yes
transfer=no
type=friend
context=from-internal
{noformat}

/etc/asterisk/dnsmgr.conf:
{noformat}
[general]
enable=yes
refreshinterval=300
{noformat}


To reproduce:
1. Create a DNS record with a short (eg 60 second) TTL (or simply reference sip.crffac.golden-era.co.za).
2. Don't bother configuring a trunk, the issue affects Asterisk's ability to perform a remote registration so simply add the following to /etc/asterisk/iax.conf (yes, use it 'as is' with the 'InvalidUser' and 'InvalidPassword'):
{noformat}
register=InvalidUser:InvalidPassword@sip.crffac.golden-era.co.za
{noformat}
3. Issue 'iax2 reload' to have Asterisk reload the configuration file and verify that Asterisk is attempting the registration with the 'iax2 show registry' command:
{noformat}
sip*CLI> iax2 show registry
Host                  dnsmgr  Username    Perceived             Refresh  State
165.145.108.145:4569  Y       InvalidUse  <Unregistered>             60  Request Sent
1 IAX2 registrations.
{noformat}

4. Break your DNS resolution and wait about 2 minutes for the DNS record to expire and for Asterisk to retry the registration. Perhaps simply load a firewall rule to drop outgoing DNS requests:
{noformat}
iptables -I OUTPUT -p udp --dport 53 -j DROP
{noformat}

5. Review the Asterisk registration configuration:
{noformat}
sip*CLI> module unload chan_iax2
Unloaded chan_iax2
sip*CLI> module load chan_iax2
Loaded chan_iax2
[2014-06-03 08:42:24] ERROR[24332]: netsock2.c:269 ast_sockaddr_resolve: getaddrinfo("sip.crffac.golden-era.co.za", "(null)", ...): Temporary failure in name resolution
[2014-06-03 08:42:24] WARNING[24332]: acl.c:833 resolve_first: Unable to lookup 'sip.crffac.golden-era.co.za'
sip*CLI> iax2 show registry
Host                  dnsmgr  Username    Perceived             Refresh  State
(null)                Y       InvalidUse  <Unregistered>             60  Unregistered
1 IAX2 registrations.
{noformat}

6. Restore DNS resolution:
{noformat}
[root@sip ~]# iptables -D OUTPUT -p udp --dport 53 -j DROP
[root@sip ~]# host sip.crffac.golden-era.co.za
sip.crffac.golden-era.co.za is an alias for dynamic2.crffac.golden-era.co.za.
dynamic2.crffac.golden-era.co.za has address 165.145.108.250
{noformat}

7. Asterisk's dnsmgr restores the IP but leaves the port as 0:
{noformat}
[2014-06-03 08:43:14] NOTICE[28314]: dnsmgr.c:215 dnsmgr_refresh: dnssrv: host 'sip.crffac.golden-era.co.za' changed from (null) to 165.145.108.145:0
sip*CLI> iax2 show registry
Host                  dnsmgr  Username    Perceived             Refresh  State
165.145.108.145:0     Y       InvalidUse  <Unregistered>             60  Request Sent
1 IAX2 registrations.
{noformat}
Comments:By: Michael L. Young (elguero) 2014-06-03 06:20:01.158-0500

Does this still occur with the patch from the other issue (ASTERISK-23767)?

By: David Herselman (bbs2web) 2014-06-03 07:14:53.075-0500

Yes, unfortunately... The information above virtually replicates the steps in ASTERISK-23767 but with dnsmgr enabled. The results are the same with or without the patch applied so it looks to be a separate, related issue.

ie: I can work around this bug, due to the working patch provided in ASTERISK-23767, by simply not using dnsmgr but wanted to bring the dnsmgr bug to the attention of developers.

By: Michael L. Young (elguero) 2014-06-03 08:21:41.061-0500

Thanks for the feedback.  I actually tested this with the patch on ASTERISK-23767 before uploading it on the other issue.  That is why I was surprised that this was still an issue... I am going to test again and if I am unable to reproduce it, we will need a full debug log to help with troubleshooting.

By: Michael L. Young (elguero) 2014-06-03 08:59:30.410-0500

Closing this out since the updated patch on ASTERISK-23767 should resolve this issue.  Discussions of this issue and the patch should be done on ASTERISK-23767.

Thank you