[asterisk-users] srv records not being honoured properly

Brian J. Murrell brian at interlinx.bc.ca
Sun Oct 19 14:30:28 CDT 2008


On Sun, 2008-10-19 at 21:14 +0300, Kevin P. Fleming wrote:
> 
> Never mind... I was mistaken. The srv_callback() function puts the
> records returned by the DNS lookup into priority order (lowest numbers
> first),

Yes, I can see that function and while I have not audited it detail, it
looks as though it was at least intended to sort by priority.

> So, in both Asterisk 1.4 and 1.6, the SRV record lookups
> should choose the lowest-priority, highest-weight entry returned by the
> DNS lookup.

So it seems.  I wonder why I have evidence that it is not actually
working.  Asterisk even told me:

    -- ast_get_srv: SRV lookup for '_sip._udp.tollfree.sip-happens.com.' mapped to host ares.sip-happens.com, port 5070

And while unfortunately those SRV records don't exist any more (because
I complained to the sip-happens.com guys about their ares server not
working and they just removed the ares record rather than having it at a
lower priority) so we can't test it again, I am positive when I manually
inspected the SRV records sometimes.sip-happens.com had a lower priority
(the first of the two numbers in the RR right?) than
ares.sip-happens.com.

It might be worthwhile writing a small unit test for ast_get_srv that
just calls it 100 times on a set of dns records that should replicate
the problem and see how many times it's correct vs. not correct.  Except
for having to cobble up an "ast_channel *" it might not be that terribly
difficult.  On second thought (or having tried at least) maybe not.
Just trying to pull main/srv.o into a unit test unravels a whole nest of
dependencies.

> There still isn't any failover, but we are least choosing
> the correct single record from the list in DNS.

Right, which would be the minimum requirement in my mind.  Anything less
and one shouldn't even implement it.

b.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20081019/0d40197d/attachment.pgp 


More information about the asterisk-users mailing list