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? 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
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
> <-------------- sip.conf > > [general] > externip=<MY_HOSTNAME>.dyndns.orgLarry, 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
On Fri, 2004-11-05 at 08:08, steve@daviesfam.org wrote: [snip]> The problem is that the dns-lookup could block and take a while and foul > up other things that should be running on the thread. So its not really a > production-quality solution. > > Any case: does anyone want to take it and get the relookup to run on a > separate thread...?[snip] Hi Steve, Regarding the blocking, there has been some talk about asynchronous DNS queries in Asterisk. See bug #2662. Maybe you could give it a shot by turning it into an asynchronous version? Regards, Patrick