Search code examples
dnsasteriskfailoversrv

DNS SRV failover not working in asterisk


I have added following two DNS SRV records (with TTL 10 seconds) for testing:

_sip._udp.example.com.  SRV   1   0  5060   sip101.example.com.
_sip._udp.example.com.  SRV   2   0  5060   sip102.example.com.

Both sip101.example.com and sip102.example.com are valid A records of two Asterisk servers(version 11.17.1).

I am sending call from another Asterisk server (version 11.17.1) with IP X.X.X.X with following dialplan:

[default]
exten => 0900,1,NoOP(This is test call for checking DNS SRV example.com)
exten => 0900,n,Dial(SIP/[email protected])

Following is the configuration of extension which is sending calls:

[XXXX]
type=friend
username=XXXX
secret=temp
host=dynamic
context=default
canreinvite=no
srvlookup=yes
qualify=yes
nat=force_rport,comedia

For testing failover of DNS SRV, I have disabled Asterisk on sip101.example.com which is on first priroty; so after no response till 10 seconds on sip101.example.com, it should failover to sip102.example.com.

But its not failing over to second priority Asterisk but times out as following:

== Using SIP RTP CoS mark 5
-- Executing [0900@default:1] NoOp("SIP/XXXX-0000014e", "This is test call for checking DNS SRV example.com") in new stack
-- Executing [0900@deafult:2] Dial("SIP/XXXX-0000014e", "SIP/[email protected]") in new stack
== Using SIP RTP CoS mark 5
-- Called SIP/[email protected]
-- SIP/example.com-0000014f is circuit-busy
== Everyone is busy/congested at this time (1:0/1/0)
-- Auto fallthrough, channel 'SIP/XXXX-0000014e' status is 'CONGESTION'
-- Executing [h@default:1] Hangup("SIP/XXXX-0000014e", "") in new stack
== Spawn extension (default, h, 1) exited non-zero on 'SIP/XXXX-0000014e'
[Jan  3 13:48:43] WARNING[3168]: chan_sip.c:4024 retrans_pkt: Retransmission timeout reached on transmission [email protected]:5060 for seqno 102 (Critical Request) -- See https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions
Packet timed out after 32000ms with no response

Can anyone help me with this issue?


Solution

  • Some googling (1, 2, 3, 4) suggests that in older versions:

    Asterisk only reads the first SRV entry without bothering with priorities and weights.

    So you may want to try it with Asterisk 13 and PJSIP.