Summary:ASTERISK-18353: SIP registration doesn't use round-robin DNS.
Reporter:David Woodhouse (dwmw2)Labels:
Date Opened:2011-08-27 04:50:40Date Closed:
Versions: 13.18.4 Frequency of
is related toASTERISK-21752 Asterisk peers with host= do not accept calls from all hosts in dnsname's multiple host SRV record set
Environment:Asterisk, Fedora 15Attachments:
Description:When there are multiple IP addresses in DNS for a given host, chan_sip only seems to try one of them, repeatedly. It doesn't fall back to the others.

This is especially noticeable when RFC3484 puts an IPv6 address top in the list but the server doesn't respond on that address (which is a bug, but happens).

But it's true even for purely Legacy IP setups; if there are multiple servers listed in round-robin, it should try them all before failing.

But it doesn't. It just tries the *same* host again:

[Aug 27 10:44:43] NOTICE[16688]: chan_sip.c:12654 sip_reg_timeout:    -- Registration for '01799xxxxxx@c.speechless.aaisp.net.uk' timed out, trying again (Attempt #1782)
Really destroying SIP dialog '12474a89554cf44a1c33b0cf07c70413@[2001:8b0:10b:1:240:f4ff:fe28:959d]' Method: REGISTER
Retransmitting #1 (no NAT) to [2001:8b0:0:30:225:90ff:fe05:11ac]:5060:

(This is for registration; presumably the same problem exists elsewhere.)
Comments:By: David Woodhouse (dwmw2) 2011-08-27 19:02:22.970-0500

At least for registration, a possible solution for this might be to have a list of 'failed addresses' in the sip_registry. When we get that "Registration for %s timed out, trying again" message and transmit_register() is called again, it can skip the already-failed address(es) and use the next one in the resolver's list. We'd probably then want to expire each entry on that 'failed' list with a timeout, and also wipe the whole list (and start again with the first host) once *every* address has failed...

By: Leif Madsen (lmadsen) 2011-09-12 13:33:41.630-0500

Features requests are no longer submitted to or accepted through the issue tracker. Features requests are openly discussed on the mailing lists [1] and Asterisk IRC channels and made note of by Bug Marshals.

[1] http://www.asterisk.org/support/mailing-lists

This is a known issue with Asterisk, and would require additional coding in the DNS area.

By: Olle Johansson (oej) 2013-05-02 07:42:56.634-0500

The bug is that there's no new DNS query for EVERY transaction, which there should be. RFC 3263 covering the use of DNS to find the next hop says "The procedures here MUST be done exactly once per transaction". Now, multiple IP entries for one host name is not the recommendation in SIP, since we do have SRV records.

SO there is definitely a bug here. Leif is right, that part of this is a feature request, but not all. For REGISTER to work we need to restart DNS every time we transmit a new REGISTER request.

By: Olle Johansson (oej) 2013-05-02 07:43:47.745-0500

There is a bug here this issue should NOT have been closed.

By: Olle Johansson (oej) 2013-05-02 07:45:46.788-0500

Btw, I do not agree that with round robin DNS we should try all of the addresses. We should only try one but will get different ones every time we look it up. SRV is DNS the solution that has both load balancing and fail over defined.

By: Olle Johansson (oej) 2013-05-02 08:37:59.777-0500

Reading stuff like http://www.dslreports.com/forum/r23342155-Another-asterisk-question I realise that even if it's technically incorrect, we will have to support round-robin DNS as well in the same way. It has to be an option though. And for it to happen funding will be needed.