Summary:ASTERISK-03850: Registration fails when IP address of peer changes
Reporter:John Riordan (john)Labels:
Date Opened:2005-04-03 23:24:07Date Closed:2011-06-07 14:10:13
Versions:Frequency of
Description:When the IP address of a peer Asterisk is registering with changes, IAX (and DUNDi too apparently) do not pick up the IP address change via DNS even if the registration was specified by name in the config file.

For example,

register => username:password@iax.company.com

Asterisk registers just fine and then sometime later the IP of iax.company.com changes (local dns says so).

It looks like chan_iax2.c looks up the IP addresses of all registrations only once - at load time. It does a gethostbyname at load time and then puts the IP addresses of all the peers it is to register with in a linked list of iax2_registry structs. It looks like it never looks up the IP address of the hostnames again (unless reloaded/restarted).

It would seem that if one specifies the host to register with by name, a lookup should be done by name every time a registration is done. Alternatively, perhaps one should only be able to specify peers by IP address on a register=> line in the config file so there is a no mis-understanding of the registration behaviour.

Comments:By: Kevin P. Fleming (kpfleming) 2005-04-04 11:20:42

This is definitely a problem, and affects a number of areas in Asterisk.

I've been thinking that we need to create some sort of background thread to handle keeping hostname lookups current as Asterisk runs; when a module is given a hostname (rather than an IP) via it's configuration, it would 'register' that entry with the background thread, which would then keep it up to date using asynchronous DNS lookups. This could even be done using a configurable refresh interval.

Anyone who wants to help work on this, feel free to jump in!

By: Kevin P. Fleming (kpfleming) 2005-04-06 10:54:23

I have started building the infrastructure for this, and will probably commit a preliminary version to CVS some time today.

By: Michael Jerris (mikej) 2005-05-15 12:10:53

kpfleming, does the dns changes you made a few weeks ago affect this?

By: Kevin P. Fleming (kpfleming) 2005-05-15 13:04:11

Yes, the dnsmgr stuff I added is going to be the solution to this problem... but it has not yet been finished. Let's leave this one open until I can get some time to work on it again and the poster can test the fix.

By: Michael Jerris (mikej) 2005-06-27 23:16:51

I know there were a bunch of updates to the dnsmgr stuff.  Can you please confirm if this is still an issue?

By: Michael Jerris (mikej) 2005-07-25 23:17:11

kevin-  no response from the OP on this.  Is this still an issue to stay open?

By: Kevin P. Fleming (kpfleming) 2005-08-22 16:10:06

This one needs to be closed, the remaining work to get this problem solved properly will have to happen post-1.2.