(temporary slow) DNS + SIP registration = permanent problem

I have my asterisk box connected to DSL thru another proxy/router LINUX system. On this router-LINUX, also a DNS server for my LAN is running.
However, in case this router-LINUX is very busy (because of active downloads for other clients etc.), when starting the asterisk box, it complains about DNS-problems when trying to register to my SIP-provider.
This most likely is because of slow response for DNS-requests from the asterisk box. So it looks, that some kind of time-out hits for the DNS-request on the asterisk box too early.
Is it possible to increase this DNS-timeout somewhere ?
I would even consider it a “bug”, because when the “busy” router-LINUX box calms down (no active downloads any more), the retries for SIP-registration still do not succeed.
In this case, I simply have to restart asterisk.

If the DNS server really is that slow you might consider installing BIND on the Asterisk server and making it into a caching DNS server in its own right. This will cache the names that you need after the first lookup (which you could perform separately before Asterisk starts by using dig/host/nslookup). Have a look at this linuxconfig.org/Configure_caching_DNS_server to see how to do it.

Thanx, leemason, you gave me the basics of a work-around. Anyway, there is still a bug in my asterisk version 1.4.17, regarding the DNS for registering with SIP-provider. I found out the following:

  • Simply a cache-only DNS server on my asterisk box did not change anything: No registration to SIP-provider during initial start of asterisk during boot.
    Even in case my LINUX-router/proxy is idle, SIP-registration thru this proxy does not work immediately after boot. However, after restarting my asterisk: Everything fine.
    Then I looked further on. I installed my asterisk from a package, downloaded at SuSE, for opensuse 10.3
    In file /etc/init.d/asterisk, in section
    #BEGIN-INIT-INFO
    #REQUIRED-START: zaptel

was listed only. Because of the special SUSE processing of loading services, asterisk+zaptel were loaded before network loading was initiated. (I found S0asterisk und S0zaptel, but S5network in /etc/initd/rc3.d)
So asterisk tried to register, but failed because network was not up.

So the first bug is in /etc/init.d/asterisk, at least in my version.
It should contain at least:
#REQUIRED-START: zaptel $network $named

But there is another bug: Obviously asterisk is somewhere looping, trying to register with my SIP-provider, but does not succeed, even when network is up later on after boot. The ping or dig to my SIP-provider had no problems later on afterboot, but asterisk still did not register, though:
Repeated errors from
sip_reg_timeout and create_addr

I have to stop/start asterisk, and all is fine.

So it looks like, asterisk starts too early to try to register (when network is not up already), and then enters a bad loop, trying to register, but not refreshing DNS-info within this loop.

Obviously you know this stuff, I am new to asterisk. Should I file a bug report ?

I posted two bug reports (12200, 12201) with digium. The very possibility of endless loop confirmed; however, not to be fixed because to be too complicated.

The incorrect /etc/init.d/asterisk, also filed as a bug, still open.
So anybody expiriencing a similar effect should at least modifiy /etc/init.d/asterisk according to my solution.

Hope, it helps somebody.