[Asterisk-Users] Dynamic DNS causes problems

Seth Remington sremington at saberlogic.com
Thu Nov 4 08:13:45 MST 2004


On Thu, 2004-11-04 at 02:58, Larry Hendrickson wrote:
> Hi all,
> 
> This is my first post to this list, so I apologize if it is a newbie
> question.  I did quite a bit of reading and a number of Google searches
> for answers and found people with dynamic DNS problems, but not the
> same one.
> 
> I just recently set up Asterisk as a pbx system for my home using
> Broadvoice.  I would first like to say thank-you for an incredibly
> effective program (it took me a while to get used to it, but now I am
> quite impressed).  
> 
> The only remaining problem comes from the fact that I have an ADSL
> connection at my home and the pppoe changes my IP address every once in
> a while.  I have set my sip.conf 'host=' command up with a dyndns
> hostname and everything works when I start *.  The moment the IP address
> changes, though, incoming calls continue to work but outgoing calls give
> me a "maximum retries exceeded" error, and my Dial command exits after
> about 3 seconds with "NOANSWER".  I have confirmed that this is caused
> by the change in IP address by restarting *, successfully making a call,
> rebooting my DSL router to have it get a new IP address, waiting for
> dyndns to register the change (and confirming that this is correct), and
> then immediately making another call that has this problem.  When the IP
> address doesn't change, I have confirmed that outgoing calls work after
> several days.  A 'service asterisk restart' always gets the outgoing
> calls working again, but it seems odd that I would have to restart * so
> regularly. 
> 
> I am assuming that either * or the remote computer is either doing the
> DNS lookup once and caching the IP address or there is a socket that is
> opened and kept open through the IP address change and not reconnected
> afterward (shouldn't the socket on both ends figure out that the
> connection is no longer good and reconnect?).
> 
> As an ugly hack, I am tempted to have a cron job check for changes in
> the ip address and restart *.  The problem with this (or one of them) is
> that I have to somehow make sure that it isn't in the middle of a phone
> call when it does this.  Is there a more elegant way of doing this?

I'm not sure about more elegant, but...

Have your cron job issue an "asterisk -rx 'restart when convenient'"
command instead of a hard restart. That will wait until there are no
active channels to restart. Also, issuing a 'sip reload' instead of
restarting * is probably sufficient to re-register with Broadvoice.

-Seth


> Am I doing something wrong?
> 
> (And although getting a static IP would be the most elegant solution,
> that really isn't an option now.)
> 
> Thank-you in advance,
> Larry
> 
> 
> <-------------- sip.conf
> 
> [general]
> externip=<MY_HOSTNAME>.dyndns.org
> bindaddr = 0.0.0.0
> port=5060
> localnet=192.168.0.0/255.255.255.0
> disallow=all
> allow=gsm
> allow=slinear
> allow=ulaw
> allow=alaw
> context=incoming
> dtmfmode=inband
> register => <MY_NAME>:<MY_PASSWD>@sip.broadvoice.com
> tos=0x18
> srvlookup=yes
> nat=no
> 
> [Broadvoice]
> type=peer
> username=<MY_NAME>
> fromuser=<MY_NAME>
> secret=<MY_PASSWD>
> host=147.135.8.129
> context=sip
> fromdomain=sip.broadvoice.com
> canreinvite=no
> dtmfmode=inband
> nat=no
> 
> [broadvoice-incoming]
> type=peer
> dtmfmode=inband
> host=147.135.8.128
> context=incoming
> qualify=yes
> canreinvite=no
> disallow=all
> allow=gsm
> allow=slinear
> allow=ulaw
> allow=alaw
> insecure=yes
> nat=no
> 
> [broadvoice-incoming2]
> type=peer
> dtmfmode=inband
> host=147.135.0.128
> context=incoming
> qualify=yes
> canreinvite=no
> disallow=all
> allow=gsm
> allow=slinear
> allow=ulaw
> allow=alaw
> insecure=yes
> nat=no
> 
> 
> <----------------------- the extension I am calling on
> [trunkld]
> ;
> ; US long distance context accessed through trunk
> ;
> 
> ;Pattern match US long distance calls
> exten => _NXXXXXXXXX,1,Dial(SIP/1${EXTEN}@broadvoice,20)
> exten => _NXXXXXXXXX,2,Goto(error-${DIALSTATUS},1)
> exten => _NXXXXXXXXX,3,Congestion
> exten => _NXXXXXXXXX,102,Busy 

-- 
Seth Remington
SaberLogic, LLC
661-B Weber Drive
Wadsworth, Ohio 44281
Phone: (330)335-6442
Fax: (330)336-8559




More information about the asterisk-users mailing list