Auto reload when IP address changes

What would be the best way to have Asterisk ‘reload’ the config files automatically when the router’s IP address changes?

I am using Asterisk 1.2.2 behind a NAT firewall with SIP. Everything works fine as long as my external IP address does not change. When it does change, I do not get audio until I do a ‘reload’ from the CLI. This must be because Asterisk translate’s my dynamic domain name into an IP address only at the time sip.conf is loaded. It would be nice if Asterisk translated the dynamic domain name into a IP address each time a new SIP connection started but it doesn’t.

I know that I could write a little shell script that checks the external IP address periodically and if it changes, connect to the Manager Interface and do a reload. I was just wondering if something like this already exists.

the solution found at the link below doesn’t first check whether the IP address has changed but it’s an easy solution.

voxilla.com/index.php?name=PNphp … d&start=15