<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Courier;
        panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:344329969;
        mso-list-type:hybrid;
        mso-list-template-ids:-1630906524 -1656431456 202113027 202113029 202113025 202113027 202113029 202113025 202113027 202113029;}
@list l0:level1
        {mso-level-start-at:0;
        mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Symbol;
        mso-fareast-font-family:Calibri;
        mso-bidi-font-family:"Times New Roman";}
@list l0:level2
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l0:level3
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Wingdings;}
@list l0:level4
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Symbol;}
@list l0:level5
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l0:level6
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Wingdings;}
@list l0:level7
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Symbol;}
@list l0:level8
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l0:level9
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Wingdings;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
--></style>
</head>
<body lang="FR-CA" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Hello,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-US">I use DNS failover feature for routing some calls, and I wonder about its limitations.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I noticed that INVITE and ReINVITE requests are correctly routed based on SRV priority/weight in case of failure, but ACK requests do not use them.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Let’s say I have Kamailio A relaying requests to a pool of Kamailios B1 and B2 in TLS.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">DNS records are the below ones.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:Courier">kamailiob.net.            60 NAPTR 20   100  S SIPS+D2T _sips._tcp.kamailiob.net.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:Courier">_sips._tcp.kamailiob.net.   60 SRV 1    10   5061       kamailiob-1.net.    
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:Courier">_sips._tcp.kamailiob.net.   60 SRV 2    10   5061       kamailiob-2.net.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">If B1 is down, I expect requests being relayed to B2 (because of priority 2 in the SRV record).<o:p></o:p></span></p>
<ul style="margin-top:0cm" type="disc">
<li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo1"><span lang="EN-US">For initial INVITEs: R-URI is
<a href="sip:kamailiob.net">sip:kamailiob.net</a> <o:p></o:p></span>
<ul style="margin-top:0cm" type="circle">
<li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level2 lfo1"><span lang="EN-US">If B1 is down, the request is retried to B2 => OK<o:p></o:p></span></li></ul>
</li><li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo1"><span lang="EN-US">For in-dialog requests: Route header in incoming request is
<a href="sip:kamailiob.net">sip:kamailiob.net</a> so it is set as next destination with
<i>loose</i>_<i>route</i> function<o:p></o:p></span>
<ul style="margin-top:0cm" type="circle">
<li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level2 lfo1"><span lang="EN-US">If B1 is down, the request is retried to B2 for ReINVITE => OK<o:p></o:p></span></li><li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level2 lfo1"><span lang="EN-US">But once the ACK comes in, with the same Route header (<a href="sip:kamailiob.net">sip:kamailiob.net</a>), Kamailio tries to send it to B1 only (no retries to B2,
 and even no retransmissions to B1 either).<o:p></o:p></span></li><li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level2 lfo1"><span lang="EN-US">When B1 is back UP again a few seconds later, Kamailio does not try to relay the ACK again. The ACK request is attempted to be retransmitted only once to B1. It
 fails and no more retries after that.<o:p></o:p></span></li></ul>
</li></ul>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Is it the expected behavior? Or is it something misconfigured on Kamailio A? Or is it a TLS connection issue?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Here is the DNS configuration on Kamailio A (TM module is enabled):<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:Courier">dns_try_naptr=yes<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:Courier">use_dns_failover=yes<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:Courier">use_dns_cache=yes<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:Courier">dns_srv_lb=yes<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:Courier"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:Courier">enable_tls=yes<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:Courier">tcp_max_connections=4096<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:Courier">tls_max_connections=4096<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:Courier">tcp_reuse_port=yes<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:Courier">tcp_connect_timeout=10<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:Courier">tcp_send_timeout=10<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:Courier">tcp_connection_lifetime=3600<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:Courier"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I had a look into the DNS tutorial (<a href="https://github.com/kamailio/kamailio/blob/master/doc/tutorials/dns.txt">https://github.com/kamailio/kamailio/blob/master/doc/tutorials/dns.txt</a>) without finding any hint
 about this.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">If anyone has already played with SIP DNS failover in Kamailio, your help would be appreciated, thanks!<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Julien<o:p></o:p></span></p>
</div>
</body>
</html>