[asterisk-bugs] [JIRA] (ASTERISK-23813) DNS Manager (dnsmgr) does not restore port

David Herselman (JIRA) noreply at issues.asterisk.org
Tue Jun 3 02:44:56 CDT 2014


David Herselman created ASTERISK-23813:
------------------------------------------

             Summary: DNS Manager (dnsmgr) does not restore port
                 Key: ASTERISK-23813
                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-23813
             Project: Asterisk
          Issue Type: Bug
      Security Level: None
          Components: Core/General
    Affects Versions: 11.9.0
         Environment: IAX2 registration to dynamic hostname, using dnsmgr.
            Reporter: David Herselman


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 at 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 at sip ~]# iptables -D OUTPUT -p udp --dport 53 -j DROP
[root at 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}




--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list