<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hello,</p>
    <p>you have to set the priority field for each destination to ensure
      a particular order there. While with text file one can consider
      the order of appearance, this is no longer valid for database --
      the order in a table can be different that what is returned by
      "select * ...", therefore the priority field is the one that
      matter here.</p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <div class="moz-cite-prefix">On 26.02.19 16:40, Denys Pozniak wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CA+x3AxrEL8K-SOxOZ3qXuatLxOdKsRaVCRn1pcd2iLi-vQJJuw@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div dir="ltr"><br>
        </div>
        <div dir="ltr">kamcmd dispatcher.list shows gateways in reverse
          order (comparing to the file) and "last hope" gw is the last
          one here (URI: sip:<a href="http://10.6.3.122:5060"
            moz-do-not-send="true">10.6.3.122:5060</a>).</div>
        <div dir="ltr"><br>
        </div>
        <div dir="ltr">
          <div>
            <div>                SET: {</div>
            <div>                        ID: 4</div>
            <div>                        TARGETS: {</div>
            <div>                                DEST: {</div>
            <div>                                        URI: sip:<a
                href="http://10.6.3.5:5060" moz-do-not-send="true">10.6.3.5:5060</a></div>
            <div>                                        FLAGS: AX</div>
            <div>                                        PRIORITY: 0</div>
            <div>                                }</div>
            <div>                                DEST: {</div>
            <div>                                        URI: sip:<a
                href="http://10.6.3.4:5060" moz-do-not-send="true">10.6.3.4:5060</a></div>
            <div>                                        FLAGS: AX</div>
            <div>                                        PRIORITY: 0</div>
            <div>                                }</div>
            <div>                                DEST: {</div>
            <div>                                        URI: sip:<a
                href="http://10.6.3.3:5060" moz-do-not-send="true">10.6.3.3:5060</a></div>
            <div>                                        FLAGS: AX</div>
            <div>                                        PRIORITY: 0</div>
            <div>                                }</div>
            <div>                                DEST: {</div>
            <div>                                        URI: sip:<a
                href="http://10.6.3.2:5060" moz-do-not-send="true">10.6.3.2:5060</a></div>
            <div>                                        FLAGS: AX</div>
            <div>                                        PRIORITY: 0</div>
            <div>                                }</div>
            <div>                                DEST: {</div>
            <div>                                        URI: sip:<a
                href="http://10.6.3.1:5060" moz-do-not-send="true">10.6.3.1:5060</a></div>
            <div>                                        FLAGS: AX</div>
            <div>                                        PRIORITY: 0</div>
            <div>                                }</div>
            <div>                                DEST: {</div>
            <div>                                        URI: sip:<a
                href="http://10.6.3.122:5060" moz-do-not-send="true">10.6.3.122:5060</a></div>
            <div>                                        FLAGS: AX</div>
            <div>                                        PRIORITY: 0</div>
            <div>                                }</div>
            <div>                        }</div>
            <div>                }</div>
          </div>
          <div><br>
          </div>
          <div><br>
          </div>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">вт, 26 февр. 2019 г. в 17:24,
          Denys Pozniak <<a href="mailto:denys.pozniak@gmail.com"
            moz-do-not-send="true">denys.pozniak@gmail.com</a>>:<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">
                          <div dir="ltr">
                            <div dir="ltr">
                              <div dir="ltr">
                                <div dir="ltr">
                                  <div dir="ltr">
                                    <div>Hello!</div>
                                    <div><br>
                                    </div>
                                    <div>I use dispatcher with
                                      algorithm=1 (hashing over from
                                      URI) with module parameter
                                      use_default=1.</div>
                                    <div>So I am expecting that last
                                      string in dispatcher.list for
                                      specific set will be the "last
                                      hope" for call routing.</div>
                                    <div><br>
                                    </div>
                                    <div>dispatcher.list<br>
                                    </div>
                                    <div dir="ltr">
                                      <div>..</div>
                                      <div>
                                        <div>4 sip:<a
                                            href="http://10.6.3.122:5060"
                                            target="_blank"
                                            moz-do-not-send="true">10.6.3.122:5060</a><br>
                                        </div>
                                        <div>4 sip:<a
                                            href="http://10.6.3.1:5060"
                                            target="_blank"
                                            moz-do-not-send="true">10.6.3.1:5060</a></div>
                                        <div>4 sip:<a
                                            href="http://10.6.3.2:5060"
                                            target="_blank"
                                            moz-do-not-send="true">10.6.3.2:5060</a></div>
                                        <div>4 sip:<a
                                            href="http://10.6.3.3:5060"
                                            target="_blank"
                                            moz-do-not-send="true">10.6.3.3:5060</a></div>
                                        <div>4 sip:<a
                                            href="http://10.6.3.4:5060"
                                            target="_blank"
                                            moz-do-not-send="true">10.6.3.4:5060</a></div>
                                        <div>4 sip:<a
                                            href="http://10.6.3.5:5060"
                                            target="_blank"
                                            moz-do-not-send="true">10.6.3.5:5060</a></div>
                                      </div>
                                      <div><br>
                                      </div>
                                      <div>But as I see from logs
                                        dispatcher module takes first
                                        string as the "last hope":</div>
                                      <div><br>
                                      </div>
                                      <div>xlog("L_WARN", "TEST--
                                        $(avp(AVP_DST)[0])
                                        $(avp(AVP_DST)[1])
                                        $(avp(AVP_DST)[2])
                                        $(avp(AVP_DST)[3])
                                        $(avp(AVP_DST)[4]) 
                                        $(avp(AVP_DST)[5]) 
                                        $(avp(AVP_DST)[6]) \n");<br>
                                      </div>
                                      <div><br>
                                      </div>
                                      <div>
                                        <div>Feb 26 16:11:39 kamailio-2
                                          /usr/sbin/kamailio[28156]:
                                          WARNING: <script>:
                                          TEST-- sip:<a
                                            href="http://10.6.3.4:5060"
                                            target="_blank"
                                            moz-do-not-send="true">10.6.3.4:5060</a>
                                          sip:<a
                                            href="http://10.6.3.3:5060"
                                            target="_blank"
                                            moz-do-not-send="true">10.6.3.3:5060</a>
                                          sip:<a
                                            href="http://10.6.3.2:5060"
                                            target="_blank"
                                            moz-do-not-send="true">10.6.3.2:5060</a>
                                          sip:<a
                                            href="http://10.6.3.1:5060"
                                            target="_blank"
                                            moz-do-not-send="true">10.6.3.1:5060</a>
                                          sip:<a
                                            href="http://10.6.3.5:5060"
                                            target="_blank"
                                            moz-do-not-send="true">10.6.3.5:5060</a> 
                                          sip:<a
                                            href="http://10.6.3.122:5060"
                                            target="_blank"
                                            moz-do-not-send="true">10.6.3.122:5060</a> 
                                          <null><br>
                                        </div>
                                        <div>
                                          <div>Feb 26 16:11:58
                                            kamailio-2
                                            /usr/sbin/kamailio[28156]:
                                            WARNING: <script>:
                                            TEST-- sip:<a
                                              href="http://10.6.3.3:5060"
                                              target="_blank"
                                              moz-do-not-send="true">10.6.3.3:5060</a>
                                            sip:<a
                                              href="http://10.6.3.2:5060"
                                              target="_blank"
                                              moz-do-not-send="true">10.6.3.2:5060</a>
                                            sip:<a
                                              href="http://10.6.3.1:5060"
                                              target="_blank"
                                              moz-do-not-send="true">10.6.3.1:5060</a>
                                            sip:<a
                                              href="http://10.6.3.5:5060"
                                              target="_blank"
                                              moz-do-not-send="true">10.6.3.5:5060</a>
                                            sip:<a
                                              href="http://10.6.3.4:5060"
                                              target="_blank"
                                              moz-do-not-send="true">10.6.3.4:5060</a> 
                                            sip:<a
                                              href="http://10.6.3.122:5060"
                                              target="_blank"
                                              moz-do-not-send="true">10.6.3.122:5060</a> 
                                            <null></div>
                                        </div>
                                        <div>
                                          <div>Feb 26 16:11:59
                                            kamailio-2
                                            /usr/sbin/kamailio[28156]:
                                            WARNING: <script>:
                                            TEST-- sip:<a
                                              href="http://10.6.3.2:5060"
                                              target="_blank"
                                              moz-do-not-send="true">10.6.3.2:5060</a>
                                            sip:<a
                                              href="http://10.6.3.1:5060"
                                              target="_blank"
                                              moz-do-not-send="true">10.6.3.1:5060</a>
                                            sip:<a
                                              href="http://10.6.3.5:5060"
                                              target="_blank"
                                              moz-do-not-send="true">10.6.3.5:5060</a>
                                            sip:<a
                                              href="http://10.6.3.4:5060"
                                              target="_blank"
                                              moz-do-not-send="true">10.6.3.4:5060</a>
                                            sip:<a
                                              href="http://10.6.3.3:5060"
                                              target="_blank"
                                              moz-do-not-send="true">10.6.3.3:5060</a> 
                                            sip:<a
                                              href="http://10.6.3.122:5060"
                                              target="_blank"
                                              moz-do-not-send="true">10.6.3.122:5060</a> 
                                            <null></div>
                                        </div>
                                        <div>
                                          <div>Feb 26 16:12:08
                                            kamailio-2
                                            /usr/sbin/kamailio[28156]:
                                            WARNING: <script>:
                                            TEST-- sip:<a
                                              href="http://10.6.3.1:5060"
                                              target="_blank"
                                              moz-do-not-send="true">10.6.3.1:5060</a>
                                            sip:<a
                                              href="http://10.6.3.5:5060"
                                              target="_blank"
                                              moz-do-not-send="true">10.6.3.5:5060</a>
                                            sip:<a
                                              href="http://10.6.3.4:5060"
                                              target="_blank"
                                              moz-do-not-send="true">10.6.3.4:5060</a>
                                            sip:<a
                                              href="http://10.6.3.3:5060"
                                              target="_blank"
                                              moz-do-not-send="true">10.6.3.3:5060</a>
                                            sip:<a
                                              href="http://10.6.3.2:5060"
                                              target="_blank"
                                              moz-do-not-send="true">10.6.3.2:5060</a> 
                                            sip:<a
                                              href="http://10.6.3.122:5060"
                                              target="_blank"
                                              moz-do-not-send="true">10.6.3.122:5060</a> 
                                            <null></div>
                                        </div>
                                        <br
                                          class="gmail-m_6973636873582051115gmail-Apple-interchange-newline">
                                      </div>
                                      <div>According to the module
                                        explanation it should be "<span
style="color:rgb(0,0,0);font-family:Helvetica,Arial,sans-serif;font-size:15px;text-align:justify">the
                                          last address in destination
                                          set is used as a final option
                                          to send the request to</span>"</div>
                                      <div><span
                                          style="text-align:justify"><br>
                                        </span></div>
                                      <div><span
                                          style="text-align:justify"><br>
                                        </span></div>
                                      <div><span
                                          style="text-align:justify">version:
                                          kamailio 4.4.2 (x86_64/linux)
                                          892ad6</span><br>
                                      </div>
                                      <div>
                                        <div>flags: STATS: Off, USE_TCP,
                                          USE_TLS, USE_SCTP, TLS_HOOKS,
                                          USE_RAW_SOCKS, DISABLE_NAGLE,
                                          USE_MCAST, DNS_IP_HACK,
                                          SHM_MEM, SHM_MMAP, PKG_MALLOC,
                                          Q_MALLOC, F_MALLOC,
                                          TLSF_MALLOC, DBG_SR_MEMORY,
                                          USE_FUTEX,
                                          FAST_LOCK-ADAPTIVE_WAIT,
                                          USE_DNS_CACHE,
                                          USE_DNS_FAILOVER, USE_NAPTR,
                                          USE_DST_BLACKLIST,
                                          HAVE_RESOLV_RES</div>
                                        <div>ADAPTIVE_WAIT_LOOPS=1024,
                                          MAX_RECV_BUFFER_SIZE 262144,
                                          MAX_LISTEN 16, MAX_URI_SIZE
                                          1024, BUF_SIZE 65535, DEFAULT
                                          PKG_SIZE 8MB</div>
                                        <div>poll method support: poll,
                                          epoll_lt, epoll_et, sigio_rt,
                                          select.</div>
                                        <div>id: 892ad6</div>
                                        <div>compiled on 12:58:38 Aug 28
                                          2017 with gcc 4.8.5</div>
                                      </div>
                                      <div><br>
                                      </div>
                                      <div><br>
                                      </div>
                                      <div>-- <br>
                                      </div>
                                      <div dir="ltr"
                                        class="gmail-m_6973636873582051115gmail_signature">
                                        <div dir="ltr"><br>
                                          <div>
                                            <div>BR,</div>
                                            <div>Denys Pozniak<br>
                                            </div>
                                            <div><br>
                                            </div>
                                            <div><br>
                                            </div>
                                          </div>
                                        </div>
                                      </div>
                                    </div>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </blockquote>
      </div>
      <br clear="all">
      <div><br>
      </div>
      -- <br>
      <div dir="ltr" class="gmail_signature">
        <div dir="ltr"><br>
          <div>
            <div>BR,</div>
            <div>Denys Pozniak<br>
            </div>
            <div><br>
            </div>
            <div><br>
            </div>
          </div>
        </div>
      </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>
Kamailio World Conference - May 6-8, 2019 -- <a class="moz-txt-link-abbreviated" href="http://www.kamailioworld.com">www.kamailioworld.com</a>
Kamailio Advanced Training - Mar 4-6, 2019 in Berlin; Mar 25-27, 2019, in Washington, DC, USA -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a></pre>
  </body>
</html>