Summary:ASTERISK-05040: IAX Hostname Resolving
Reporter:lth (lth)Labels:
Date Opened:2005-09-09 22:33:47Date Closed:2011-06-07 14:10:46
Versions:Frequency of
Environment:Attachments:( 0) dnsmgr.conf
Description:Dear Everybody,

I have noticed that IAX seems to resolve hostnames in iax.conf only on startup.  While this is probably the normal way to do things, it would be neat if IAX would at least resolve the hostname again if the connection disappear.

I run (as mentioned in other bug report regarding one way audio on iax transfer) a few systems that simply cannot get a static public IP address.  I currently solve the problem by passing the call through a system with a public IP followed by a transfer, but I DO run a dynamic DNS on those systems, so alternative would be if asterisk could reconnect to the host when it changes it's IP address (and the DNS is updated).

Anybody care to look into this?
Comments:By: mochouinard (mochouinard) 2005-09-09 22:48:48

Could try to enable the DNS manager dnsmgr.conf.  It should refresh the DNS at a certain interval, and also TRY(not fully working) not to lock * if it doesn't resolv hostname

By: Michael Jerris (mikej) 2005-09-10 01:52:23

as stated.. it's already there.:  http://cvsweb.digium.com/index.cgi/asterisk/configs/dnsmgr.conf.sample?rev=1.1

By: lth (lth) 2005-10-02 21:29:51

I admit I hadn't noticed the dnsmgr :)  Asterisk just get so many new features and this one I hadn't noticed.  Anyway - it does _not_ seem to work with IAX.  As mentioned - got a few boxes on dynamic IP.  DNS records expires in 5 minutes tops and I set dnsmgr to refresh every 5 minutes too (the IP changes a few times a week that's all).  Yet:

dev2*CLI> iax2 show peers
Name/Username    Host                 Mask             Port          Status    
v5v3/v5v3    (S)  4569          UNREACHABLE

That host is defined as v5.netcompartner.com.  Dig on the same machine resolve to:

dev2:~# dig v5.netcompartner.com
v5.netcompartner.com.   38400   IN      CNAME   ncpsrv01.dynamic.netcompartner.c
ncpsrv01.dynamic.netcompartner.com. 600 IN A

So it does seem that IAX keep the IP address that resolved on startup only.

By: Kevin P. Fleming (kpfleming) 2005-10-04 20:03:28

Please post your dnsmgr.conf file; when that code went into the tree it was tested in exactly the scenario you are describing and it worked...

By: lth (lth) 2005-10-04 20:33:40

Well - not much to that one :)  It's enabled and it refreshes every 300 seconds.

The only thing I can think of which is slightly unusual in my setup is that the hostname is a CNAME record that aliases an A record (the dynamic one) as you can see in the "dig" output.  Could this be the reason?

By: Kevin P. Fleming (kpfleming) 2005-10-13 20:36:21

It's possible, it depends on how your resolver libraries are set up on your system (and which particular ones are in use as well). There is also the matter of the TTL of the DNS records as well; if they are set with a reasonably long TTL, the resolver won't re-do the lookup even if we ask it to.

One thing you can do is edit dnsmgr.c to set the 'verbose' field in master_refresh_info to a non-zero value, and then run with 'set verbose 3' or higher. That should show you each time the background thread attempts to refresh the lookups.

By: Olle Johansson (oej) 2005-10-20 01:48:40

Any response on kpfleming's latest suggestion?

By: Kevin P. Fleming (kpfleming) 2005-10-31 18:27:06.000-0600

Suspending due to lack of response... please re-open if you have additional information to add.