<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>If you are not sure that keepalives are configured properly or
      next hop gateways can reply promptly to OPTIONS keepalives, then
      just let dispatcher route calls anyhow to gateways and set a low
      value for retransmission timeout (see t_set_fr() from tm module).
      I noticed some old gateways forget to send reply to OPTIONS from
      time to time.</p>
    <p>You can also add event_route[...] blocks exposed by dispatcher
      module in kamailio.cfg and trigger alerts when a destination is
      detected inactive/back-active, making it easier to monitor what
      happens there.</p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <div class="moz-cite-prefix">On 08.10.20 15:29, Sergio Charrua
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CALZWR5wyXp3b4DK+BHOOaM4U-USESaY-ksTyBUFF-EwXcZ2MsQ@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div dir="ltr">
          <div dir="ltr">
            <div dir="ltr">Sorry for the late reply....
              <div><br>
              </div>
              <div>the dispatcher is set as follows:</div>
              <div><br>
              </div>
              <div>
                <div># ----- dispatcher params -----</div>
                <div>modparam("dispatcher", "list_file", DS_LIST)</div>
                <div>modparam("dispatcher", "flags", 2)</div>
                <div>modparam("dispatcher", "dst_avp", "$avp(AVP_DST)")</div>
                <div>modparam("dispatcher", "grp_avp", "$avp(AVP_GRP)")</div>
                <div>modparam("dispatcher", "cnt_avp", "$avp(AVP_CNT)")</div>
                <div>modparam("dispatcher", "sock_avp",
                  "$avp(AVP_SOCK)")</div>
                <div>modparam("dispatcher", "ds_hash_size", 9)</div>
                <div>modparam("dispatcher", "dstid_avp",
                  "$avp(dsdstid)")</div>
              </div>
              <div>modparam("dispatcher", "ds_ping_latency_stats", 1)  <br>
              </div>
              <div><br>
              </div>
              <div>I think it is correct, though what I wish is to set
                dispatcher on Load Balancing mode. </div>
              <div><br>
              </div>
              <div>
                <div>This is my dispatcher.list :</div>
                <div>
                  <div>1 <a class="moz-txt-link-freetext" href="sip:10.19.XXX.YYY:5060">sip:10.19.XXX.YYY:5060</a> 0 1
                    duid=sipgw01;maxload=100</div>
                  <div>1 <a class="moz-txt-link-freetext" href="sip:10.19.XXX.YYY:5060">sip:10.19.XXX.YYY:5060</a> 0 2
                    duid=sipgw02;maxload=100</div>
                  <div>1 <a class="moz-txt-link-freetext" href="sip:10.19.XXX.YYY:5060">sip:10.19.XXX.YYY:5060</a> 0 3
                    duid=sipgw03;maxload=100</div>
                  <div>1 <a class="moz-txt-link-freetext" href="sip:10.19.XXX.YYY:5060">sip:10.19.XXX.YYY:5060</a> 0 4
                    duid=sipgw04;maxload=100</div>
                </div>
                <div><br>
                </div>
                <div>This is my dispatch routes:</div>
                <div>
                  <div># Dispatch requests</div>
                  <div>route[DISPATCH] {</div>
                  <div>        </div>
                  <div>        if(!ds_select_dst("1", "10","4"))</div>
                  <div>        {</div>
                  <div>                xlog("L_INFO","no destination
                    selected from dispatcher list!");</div>
                  <div>                send_reply("404", "No
                    destination");</div>
                  <div>                exit;</div>
                  <div>        }</div>
                  <div><br>
                  </div>
                  <div>        xlog("L_INFO","going to <$ru> via
                    <$du>\n");</div>
                  <div><br>
                  </div>
                  <div>        t_on_failure("RTF_DISPATCH");</div>
                  <div>        route(RELAY);</div>
                  <div><br>
                  </div>
                  <div>        exit;</div>
                  <div><br>
                  </div>
                  <div>}</div>
                </div>
              </div>
              <div><br>
              </div>
              <div>Any clue? </div>
              <div><br clear="all">
                <div>
                  <div dir="ltr" class="gmail_signature">
                    <div dir="ltr">
                      <div dir="ltr">
                        <div dir="ltr">
                          <div dir="ltr">
                            <div dir="ltr">
                              <p
style="color:rgb(0,0,0);margin:0px;font-family:Calibri,sans-serif;background-color:rgb(253,253,253)"><b><span
                                    style="font-family:Arial,sans-serif">Sérgio
                                    Charrua</span></b><br>
                              </p>
                              <div>
                                <div dir="ltr">
                                  <p
style="font-size:11pt;color:rgb(0,0,0);margin:0px;font-family:Calibri,sans-serif;background-color:rgb(253,253,253)"><img
src="http://cdn.shopify.com/s/files/1/0380/5305/t/11/assets/logo.png?11469850511917603945"
                                      moz-do-not-send="true" width="96"
                                      height="32"><b><span
                                        style="font-size:9pt;font-family:Arial,sans-serif"><br>
                                      </span></b></p>
                                  <p
style="font-size:11pt;color:rgb(0,0,0);margin:0px;font-family:Calibri,sans-serif;background-color:rgb(253,253,253)"><b><span
style="font-size:9pt;font-family:Arial,sans-serif;color:red"><span
                                          style="color:rgb(0,0,0)"></span><span
                                          style="color:rgb(51,102,255)"><a
                                            href="http://www.voip.pt/"
                                            style="color:rgb(17,85,204)"
                                            target="_blank"
                                            moz-do-not-send="true">www.voip.pt</a></span></span></b><span
                                      style="font-size:x-small"><span
                                        style="font-family:Arial,sans-serif;color:rgb(136,136,136)"><br>
                                      </span><span
                                        style="font-family:Arial,sans-serif">Tel.: <span
                                          style="color:rgb(51,102,153)"><a
href="callto:+351+91+104+12+66"
                                            style="color:rgb(51,102,153);text-decoration:none"
                                            target="_blank"
                                            moz-do-not-send="true">+351 </a>21
                                          130 71 77<br>
                                        </span></span><span
                                        style="font-family:"Times
                                        New Roman",serif"></span></span></p>
                                  <p
style="font-size:11pt;color:rgb(0,0,0);margin:0px;font-family:Calibri,sans-serif;background-color:rgb(253,253,253)"><span
                                      style="font-size:x-small"><span
                                        style="font-family:Arial,sans-serif;color:rgb(187,187,187)"><span
                                          style="color:rgb(128,128,128)">Email
                                          : <strong><a
                                              href="mailto:sergio.charrua@voip.pt"
style="color:rgb(17,85,204)" target="_blank" moz-do-not-send="true">sergio.charrua@voip.pt</a></strong></span><br>
                                      </span></span></p>
                                  <table style="width:487.5pt"
                                    width="650" cellspacing="0"
                                    cellpadding="0" border="0">
                                    <tbody>
                                      <tr>
                                        <td style="padding:0cm">
                                          <p class="MsoNormal"><span
                                              style="font-family:"Vodafone
Rg";color:rgb(204,204,204)" lang="EN-US">This message and any files
                                              or documents attached are
                                              strictly confidential or
                                              otherwise legally
                                              protected. </span></p>
                                          <p class="MsoNormal"><span
                                              style="font-family:"Vodafone
Rg";color:rgb(204,204,204)" lang="EN-US">It is intended only for
                                              the individual or entity
                                              named. If you are not the
                                              named addressee or have
                                              received this email in
                                              error, please inform the
                                              sender immediately, delete
                                              it from your system and do
                                              not copy or disclose it or
                                              its contents or use it for
                                              any purpose. Please also
                                              note that transmission
                                              cannot be guaranteed to be
                                              secure or error-free. </span><span
style="font-family:"Times New Roman",serif" lang="EN-US"><span></span></span></p>
                                        </td>
                                      </tr>
                                    </tbody>
                                  </table>
                                  <p
style="color:rgb(0,0,0);margin:0px;font-family:Calibri,sans-serif;background-color:rgb(253,253,253)"><span
                                      style="font-family:"Times New
                                      Roman",serif"></span></p>
                                  <p class="MsoNormal"><span
                                      lang="EN-US"> </span></p>
                                  <p
style="color:rgb(0,0,0);margin:0px;font-family:Calibri,sans-serif;background-color:rgb(253,253,253)"> </p>
                                </div>
                              </div>
                              <div style="font-size:small"><br>
                                <br>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
                <br>
              </div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Thu, Sep 17, 2020 at 3:49
          AM Arsen Semenov <<a href="mailto:arsperger@gmail.com"
            moz-do-not-send="true">arsperger@gmail.com</a>> wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div dir="ltr">
            <div dir="ltr"><br>
            </div>
            Hi Sergio,<br>
            <br>
            Make sure your dispatcher probing parameters are set
            correctly. (reply codes as well).<br>
            <br>
            <div>And if it happens again you can catch OPTIONS traffic
              with sngrep  "CSeq: [0-9]+ OPTIONS"<br>
              and see what happens on this level.<br>
              Whether Kamailio does send pings, whether replies from gw
              are the same as expected, etc.  
              <div><br>
              </div>
              <div><br>
              </div>
              <div>Regards,</div>
              <div><br>
                <div class="gmail_quote">
                  <div dir="ltr" class="gmail_attr">On Wed, Sep 16, 2020
                    at 5:55 PM David Villasmil <<a
                      href="mailto:david.villasmil.work@gmail.com"
                      target="_blank" moz-do-not-send="true">david.villasmil.work@gmail.com</a>>
                    wrote:<br>
                  </div>
                  <blockquote class="gmail_quote" style="margin:0px 0px
                    0px 0.8ex;border-left:1px solid
                    rgb(204,204,204);padding-left:1ex">
                    <div dir="ltr">Hello 
                      <div><br>
                      </div>
                      <div>I would start by looking at the logs when
                        that happens. The gateway would only get marked
                        "ip" when there is no reply by the gateway or
                        when it replies with 500. Also OPTIONs not being
                        replied promptly.</div>
                      <div>Maybe add some logging right before
                        ds_mark_dst("ip").</div>
                      <div><br>
                      </div>
                      <div>Hope that helps,</div>
                      <div><br>
                      </div>
                      <div>Regards,<br>
                      </div>
                      <div>
                        <div>
                          <div dir="ltr">
                            <div dir="ltr">
                              <div><br>
                              </div>
                              David Villasmil
                              <div>email: <a
                                  href="mailto:david.villasmil.work@gmail.com"
                                  target="_blank" moz-do-not-send="true">david.villasmil.work@gmail.com</a></div>
                              <div>phone: +34669448337</div>
                            </div>
                          </div>
                        </div>
                        <br>
                      </div>
                    </div>
                    <br>
                    <div class="gmail_quote">
                      <div dir="ltr" class="gmail_attr">On Wed, Sep 16,
                        2020 at 11:40 AM Sergio Charrua <<a
                          href="mailto:sergio.charrua@voip.pt"
                          target="_blank" moz-do-not-send="true">sergio.charrua@voip.pt</a>>
                        wrote:<br>
                      </div>
                      <blockquote class="gmail_quote" style="margin:0px
                        0px 0px 0.8ex;border-left:1px solid
                        rgb(204,204,204);padding-left:1ex">
                        <div dir="ltr">
                          <div dir="ltr">
                            <div dir="ltr">
                              <div dir="ltr">
                                <div dir="ltr">
                                  <div dir="ltr">
                                    <div dir="ltr">
                                      <div dir="ltr">Hello,
                                        <div><br>
                                        </div>
                                        <div>Using Kamailio 5.1.6 for
                                          load balancing &
                                          failover, </div>
                                        <div>I noticed that from time
                                          to time, and very rarely, the
                                          dispatcher module stops
                                          dispatching to the Asterisk
                                          servers. </div>
                                        <div>I have to execute a "kamcmd
                                          dispatcher reload" for it to
                                          (re)start working.</div>
                                        <div><br>
                                        </div>
                                        <div>This is my dispatcher.list
                                          :</div>
                                        <div>
                                          <div>1 <a class="moz-txt-link-freetext" href="sip:10.19.XXX.YYY:5060">sip:10.19.XXX.YYY:5060</a>
                                            0 1 duid=sipgw01;maxload=100</div>
                                          <div>1 <a class="moz-txt-link-freetext" href="sip:10.19.XXX.YYY:5060">sip:10.19.XXX.YYY:5060</a>
                                            0 2 duid=sipgw02;maxload=100</div>
                                          <div>1 <a class="moz-txt-link-freetext" href="sip:10.19.XXX.YYY:5060">sip:10.19.XXX.YYY:5060</a>
                                            0 3 duid=sipgw03;maxload=100</div>
                                          <div>1 <a class="moz-txt-link-freetext" href="sip:10.19.XXX.YYY:5060">sip:10.19.XXX.YYY:5060</a>
                                            0 4 duid=sipgw04;maxload=100</div>
                                        </div>
                                        <div><br>
                                        </div>
                                        <div>This is my dispatch routes:</div>
                                        <div>
                                          <div># Dispatch requests</div>
                                          <div>route[DISPATCH] {</div>
                                          <div>        </div>
                                          <div>       
                                            if(!ds_select_dst("1",
                                            "10","4"))</div>
                                          <div>        {</div>
                                          <div>               
                                            xlog("L_INFO","no
                                            destination selected from
                                            dispatcher list!");</div>
                                          <div>               
                                            send_reply("404", "No
                                            destination");</div>
                                          <div>                exit;</div>
                                          <div>        }</div>
                                          <div><br>
                                          </div>
                                          <div>       
                                            xlog("L_INFO","going to
                                            <$ru> via
                                            <$du>\n");</div>
                                          <div><br>
                                          </div>
                                          <div>       
                                            t_on_failure("RTF_DISPATCH");</div>
                                          <div>        route(RELAY);</div>
                                          <div><br>
                                          </div>
                                          <div>        exit;</div>
                                          <div><br>
                                          </div>
                                          <div>}</div>
                                        </div>
                                        <div><br>
                                        </div>
                                        <div>
                                          <div># Sample failure route</div>
                                          <div>failure_route[RTF_DISPATCH]
                                            {</div>
                                          <div>        if
                                            (t_is_canceled()) {</div>
                                          <div>                exit;</div>
                                          <div>        }</div>
                                          <div>        xlog("L_INFO",
                                            "Media server $du failed to
                                            answer, selecting other
                                            one!");</div>
                                          <div>        # next DST - only
                                            for 500 or local timeout</div>
                                          <div>        if (
                                            t_check_status("500") ||
                                            (t_branch_timeout()
                                            &&
                                            !t_branch_replied()) )</div>
                                          <div>        {</div>
                                          <div>                #mark the
                                            destination Inactive and
                                            Probing</div>
                                          <div>               
                                            ds_mark_dst("ip");</div>
                                          <div>               
                                            if(ds_next_dst())</div>
                                          <div>                {</div>
                                          <div>                       
                                            t_on_failure("RTF_DISPATCH");</div>
                                          <div>                       
                                            route(RELAY);</div>
                                          <div>                       
                                            exit;</div>
                                          <div>                }</div>
                                          <div>        }</div>
                                          <div>}</div>
                                        </div>
                                        <div><br>
                                        </div>
                                        <div>I suspect that the
                                          ds_mark_dst("ip") command in
                                          RTF_DISPACTH is the cause. </div>
                                        <div>Is there any think I can
                                          improve on this? Or any know
                                          bug with the dispatcher in
                                          Kamailio 5.1.6 version?</div>
                                        <div><br>
                                        </div>
                                        <div>Thanks in advance,</div>
                                        <div><br>
                                        </div>
                                        <div><b
                                            style="color:rgb(0,0,0);font-family:Calibri,sans-serif"><span
style="font-family:Arial,sans-serif">Sérgio Charrua</span></b><br>
                                        </div>
                                        <div>
                                          <div>
                                            <div dir="ltr">
                                              <div dir="ltr">
                                                <div dir="ltr">
                                                  <div dir="ltr">
                                                    <div dir="ltr">
                                                      <div dir="ltr">
                                                        <div>
                                                          <div dir="ltr">
                                                          <p
style="font-size:11pt;color:rgb(0,0,0);margin:0px;font-family:Calibri,sans-serif;background-color:rgb(253,253,253)"><br>
                                                          </p>
                                                          </div>
                                                        </div>
                                                      </div>
                                                    </div>
                                                  </div>
                                                </div>
                                              </div>
                                            </div>
                                          </div>
                                        </div>
                                      </div>
                                    </div>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                        _______________________________________________<br>
                        Kamailio (SER) - Users Mailing List<br>
                        <a href="mailto:sr-users@lists.kamailio.org"
                          target="_blank" moz-do-not-send="true">sr-users@lists.kamailio.org</a><br>
                        <a
                          href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users"
                          rel="noreferrer" target="_blank"
                          moz-do-not-send="true">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
                      </blockquote>
                    </div>
                    _______________________________________________<br>
                    Kamailio (SER) - Users Mailing List<br>
                    <a href="mailto:sr-users@lists.kamailio.org"
                      target="_blank" moz-do-not-send="true">sr-users@lists.kamailio.org</a><br>
                    <a
                      href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users"
                      rel="noreferrer" target="_blank"
                      moz-do-not-send="true">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
                  </blockquote>
                </div>
                <br clear="all">
                <div><br>
                </div>
                -- <br>
                <div dir="ltr">
                  <div dir="ltr">
                    <div>Arsen Semenov<br>
                    </div>
                    <div><br>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
          _______________________________________________<br>
          Kamailio (SER) - Users Mailing List<br>
          <a href="mailto:sr-users@lists.kamailio.org" target="_blank"
            moz-do-not-send="true">sr-users@lists.kamailio.org</a><br>
          <a
            href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users"
            rel="noreferrer" target="_blank" moz-do-not-send="true">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
        </blockquote>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
Kamailio (SER) - Users Mailing List
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a>
<a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Funding: <a class="moz-txt-link-freetext" href="https://www.paypal.me/dcmierla">https://www.paypal.me/dcmierla</a></pre>
  </body>
</html>