Upgrade 3CX to v18 and get it hosted free!

Asterisk SIP srvlookup

Author image

Synopsis

srvlookup = yes | no

Default

  • srvlookup=yes (As of version 1.4.14*)
  • srvlookup=no (Prior to version 1.4.14)

If srvlookup is turned on, Asterisk supports DNS SRV lookups partially. Currently, Asterisk only reads the first SRV entry without bothering with priorities and weights. This option is NOT turned on by default!!! A SRV lookup is only performed when the FQDN hostname is specified in the Dial() command; if instead in Dial() you specify a peername (as defined in sip.conf with host=…) a SRV lookup will not be performed! For more information on asterisk srvlookup go here.

As of Asterisk 1.4.26.3, SRV lookups appear to be performed when dialing via a peername.

Note

Enabling this option can break things in unexpected ways.

Testing on 1.2.14 If you have any “register =>” statements in sip.conf, then a SRV lookup is also performed, even if you explicitly specify both the IP address and port number.

Also, there appears to be a bug in the hints code that causes spurious DNS lookups. This may not be related to srvlookup itself, but more of a DNS issue with asterisk SIP channel.

Note that you need to have a very robust DNS service (preferably local instance of caching resolver/BIND) to accommodate all these (mostly spurious) SRV lookups, because if asterisk cannot resolve DNS requests, then the SIP service completely grinds to a halt, and subsequent registration attempts fail, as currently asterisk’s DNS lookups are blocking. (As noted in dns.h)

It seems to affect us when we have more than about 8 register => statements in sip.conf, as all of these dns requests have to time out, by which time the SIP keepalives have timed out, and then another registration attempt begins resulting in a continuous state of clients being unable to register (This is worse if you have qualify= set) for SIP handset registration entries, as asterisk sends out the qualify packets, but is then unable to process the incoming responses, and so it marks the SIP peer as UNREACHABLE.)

Attention

This option is not turned on by default (in versions prior to 1.4.14), I spend 3 days in researching for solution for this error:

ttechgroup*CLI>
Apr 13 22:03:15 NOTICE[2553]: chan_sip.c:5473 sip_reg_timeout: — Registration for '[email protected]' timed out, trying again (Attempt #1)
Apr 13 22:03:35 NOTICE[2553]: chan_sip.c:5473 sip_reg_timeout: — Registration for '[email protected]' timed out, trying again (Attempt #2)
ttechgroup*CLI>

When I added to my sip.conf:

[general]
srvlookup=yes

The problem was solved.


Asterisk | Asterisk channels | Asterisk config files | Asterisk SIP configuration

Related Posts:

Get 3CX - Absolutely Free!
Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.