[Asterisk-Users] Dynamic DNS causes problems

Larry Hendrickson larryh at yannix.com
Sat Nov 6 01:40:00 MST 2004


Hi all,

Thank you so much for the help.  Since there seems to be a lot of
different suggestions, maybe it would help others (newbies like me!) to
explain what I did to get it working.  First, I use the highly
recommended ddclient Perl script for doing the dynamic DNS updates. 
http://ddclient.sourceforge.net
I've attached a patch to ddclient-3.6.3 (should patch 3.6.4 cleanly
also) that allows you to call an arbitrary script whenever the DNS
changes.  I've never written in Perl before, and I get almost no credit
for this either.  I implemented it based on a mail at:
http://freshmeat.net/projects/ddclient/?branch_id=1777&release_id=5523
(about 2/3 way down the page with subject line "Added Feature")

I just turned it into a patch and fixed one bug.

Anyway, if you then add a line like this to your ddclient.conf file:
postscript=/usr/local/bin/update_asterisk_ip.csh

and restart ddclient, it will call your script whenever your IP changes.

Here is the script I used:
<---------------- start /usr/local/bin/update_asterisk_ip.csh
#!/bin/csh -f

/usr/sbin/asterisk -rx "sip reload"
logger -t ddclient_postscript Running asterisk sip reload

<--------------- end

This trivial script tells asterisk to reconnect to the SIP server (I
guess) and logs it in the syslog.  

As for my externip= line in my sip.conf file, I left it alone as:
externip=<MY_HOSTNAME>.dyndns.org

and the "sip reload" command seems to have done the desired DNS lookup
to resolve the new IP address.  (Your mileage may vary!)

That's it!

(This email below suggests something about IAXy, but I am just using
Asterisk to connect to Broadvoice, so I don't think that the
reprovisioning suggestion or the external phone rebooting problem below
applies to me.)

Thanks again for all the suggestions and assistance!

Larry



On Fri, 5 Nov 2004 08:04:17 +0100
Wilson Pickett <wilson.pickett at gmail.com> wrote:

> > <-------------- sip.conf
> > 
> > [general]
> > externip=<MY_HOSTNAME>.dyndns.org
> 
> Larry, I had the exact same problem and here is what I did:
> 
> I have a little script running that refreshes the DDNS and when it
> detects that the ip has changed, it writes the line 
> "externip=123.123.123.123\n" to a file, let's say externip.inc
> 
> I have the statement in sip.conf:
> 
> #include "externip.inc"
> 
> The script running does a SIP RELOAD:
>  system("asterisk -rx \"sip reload\"");
> 
> Unfortunately, the IAXy has to be reprovisioned as well:
>   system("/etc/asterisk/reprov");
> 
> It then emails me and another person with a phone, since the
> Grandstreams only look at DNS when booted. The BT100 series needs to
> reboot after the asterisk server changes ip.
> 
> This has been working for months with no problem.
> 
> hth


-------------- next part --------------
A non-text attachment was scrubbed...
Name: ddclient.patch
Type: application/octet-stream
Size: 1785 bytes
Desc: not available
Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20041106/06a63140/ddclient.obj


More information about the asterisk-users mailing list