<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hello,<br>
    <br>
    you have to set the priority field to get them ordered as desired.<br>
    <br>
    With text file is easier to know (or better said expect) the order
    as it is written, but for database, there is no guarantee that if
    you insert three destinations, will be returned in the order of
    inserting. Therefore, the loading of destinations is not caring of
    the order retrieved from the storage, will use priority to sort
    them.<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    <div class="moz-cite-prefix">On 21/09/15 13:13, Giovanni Maruzzelli
      wrote:<br>
    </div>
    <blockquote
cite="mid:CALXCt0rZ5G3nR3_t6--tMDEVoK0VrOQKjmZLPAJEmUVsmmAOGQ@mail.gmail.com"
      type="cite">
      <p dir="ltr">Anyone got this one ?</p>
      <p dir="ltr">sent from my mobile,<br>
        Giovanni Maruzzelli<br>
        cell: +39 347 266 56 18</p>
      <div class="gmail_quote">On Sep 19, 2015 7:58 PM, "Giovanni
        Maruzzelli" <<a moz-do-not-send="true"
          href="mailto:gmaruzz@gmail.com">gmaruzz@gmail.com</a>>
        wrote:<br type="attribution">
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <div dir="ltr">
            <div>
              <div>Hello,<br>
                <br>
              </div>
              <div>dispatcher gives me destination sets with entries in
                reverse order:<br>
              </div>
              <div><br>
                I have installed from Kamailio deb repository packages
                version 4.3.2+jessie.<br>
                <br>
                # kamailio -V<br>
                version: kamailio 4.3.2 (x86_64/linux) <br>
                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, F_MALLOC,
                DBG_F_MALLOC, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT,
                USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR,
                USE_DST_BLACKLIST, HAVE_RESOLV_RES<br>
                ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144,
                MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535,
                DEFAULT PKG_SIZE 8MB<br>
                poll method support: poll, epoll_lt, epoll_et, sigio_rt,
                select.<br>
                id: unknown <br>
                compiled with gcc 4.9.2<br>
                <br>
              </div>
              <div>I configured dispatcher:<br>
              </div>
              <div><br>
              </div>
              modparam("dispatcher", "use_default", 1)<br>
              modparam("dispatcher", "list_file",
              "/etc/kamailio/dispatcher.list")<br>
              modparam("dispatcher", "flags", 3)<br>
              modparam("dispatcher", "dst_avp", "$avp(AVP_DST)")<br>
              modparam("dispatcher", "grp_avp", "$avp(AVP_GRP)")<br>
              modparam("dispatcher", "cnt_avp", "$avp(AVP_CNT)")<br>
              modparam("dispatcher", "sock_avp", "$avp(AVP_SOCK)")<br>
              modparam("dispatcher", "ds_ping_interval", 5)<br>
              modparam("dispatcher", "ds_probing_mode", 1)<br>
              <br>
              I have this dispatcher.list:<br>
              <br>
              1 sip:<a moz-do-not-send="true"
                href="http://192.168.1.144:5060" target="_blank">192.168.1.144:5060</a>
              2<br>
              1 sip:<a moz-do-not-send="true"
                href="http://192.168.1.145:5060" target="_blank">192.168.1.145:5060</a>
              2<br>
              1 sip:<a moz-do-not-send="true"
                href="http://192.168.1.146:5060" target="_blank">192.168.1.146:5060</a>
              2<br>
              <br>
              2 sip:<a moz-do-not-send="true"
                href="http://192.168.1.146:5060" target="_blank">192.168.1.146:5060</a>
              2<br>
              2 sip:<a moz-do-not-send="true"
                href="http://192.168.1.145:5060" target="_blank">192.168.1.145:5060</a>
              2<br>
              <br>
            </div>
            So, I expect dispatcher to have:<br>
            <br>
            set 1 first two destinations in distribution via hash on
            callid, and third destination as failover <a
              moz-do-not-send="true" href="http://192.168.1.146:5060"
              target="_blank">(192.168.1.146</a>) .<br>
            <div>set 2 all traffic on first destination, and if first
              fails, all traffic will failover to second destination (<a
                moz-do-not-send="true" href="http://192.168.1.146:5060"
                target="_blank">192.168.1.145</a>).<br>
              <br>
            </div>
            <div>Instead reindex_dests shuffle the sets upside down:<br>
              <br>
              DEBUG: dispatcher [dispatch.c:375]: add_dest2list(): dest
              [1/1] <sip:<a moz-do-not-send="true"
                href="http://192.168.1.144:5060" target="_blank">192.168.1.144:5060</a>><br>
              DEBUG: dispatcher [dispatch.c:375]: add_dest2list(): dest
              [1/2] <sip:<a moz-do-not-send="true"
                href="http://192.168.1.145:5060" target="_blank">192.168.1.145:5060</a>><br>
              DEBUG: dispatcher [dispatch.c:375]: add_dest2list(): dest
              [1/3] <sip:<a moz-do-not-send="true"
                href="http://192.168.1.146:5060" target="_blank">192.168.1.146:5060</a>><br>
              DEBUG: dispatcher [dispatch.c:375]: add_dest2list(): dest
              [2/1] <sip:<a moz-do-not-send="true"
                href="http://192.168.1.146:5060" target="_blank">192.168.1.146:5060</a>><br>
              DEBUG: dispatcher [dispatch.c:375]: add_dest2list(): dest
              [2/2] <sip:<a moz-do-not-send="true"
                href="http://192.168.1.145:5060" target="_blank">192.168.1.145:5060</a>><br>
              DEBUG: dispatcher [dispatch.c:494]: reindex_dests(): found
              [2] dest sets<br>
              DEBUG: dispatcher [dispatch.c:139]: ds_print_sets():
              dst>> 2 sip:<a moz-do-not-send="true"
                href="http://192.168.1.145:5060" target="_blank">192.168.1.145:5060</a>
              2 0 (,0,0)<br>
              DEBUG: dispatcher [dispatch.c:139]: ds_print_sets():
              dst>> 2 sip:<a moz-do-not-send="true"
                href="http://192.168.1.146:5060" target="_blank">192.168.1.146:5060</a>
              2 0 (,0,0)<br>
              DEBUG: dispatcher [dispatch.c:139]: ds_print_sets():
              dst>> 1 sip:<a moz-do-not-send="true"
                href="http://192.168.1.146:5060" target="_blank">192.168.1.146:5060</a>
              2 0 (,0,0)<br>
              DEBUG: dispatcher [dispatch.c:139]: ds_print_sets():
              dst>> 1 sip:<a moz-do-not-send="true"
                href="http://192.168.1.145:5060" target="_blank">192.168.1.145:5060</a>
              2 0 (,0,0)<br>
              DEBUG: dispatcher [dispatch.c:139]: ds_print_sets():
              dst>> 1 sip:<a moz-do-not-send="true"
                href="http://192.168.1.144:5060" target="_blank">192.168.1.144:5060</a>
              2 0 (,0,0)<br>
              DEBUG: dispatcher [dispatcher.c:347]: mod_init(): loaded
              dispatching list<br>
              <br>
            </div>
            <div>So, Kamailio give me set 1 and set 2 as per
              post-reindex_dests, and failover is 192.168.1.144 for set
              1, and 192.168.1.146 for set 2.<br>
            </div>
            <div><br>
            </div>
            <div>Is this the expected behavior? <br>
            </div>
            <div>Am I doing something wrong in configuration?<br>
              <br>
            </div>
            <div>Thank you all in advance,<br>
              <br>
            </div>
            <div>-giovanni<br>
            </div>
            <div><br>
              <br clear="all">
              <div>
                <div>
                  <div>
                    <div>Sincerely,<br>
                      <br>
                      Giovanni Maruzzelli<br>
                      Cell : <a moz-do-not-send="true"
                        href="tel:%2B39-347-2665618"
                        value="+393472665618" target="_blank">+39-347-2665618</a><br>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </blockquote>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a>
Book: SIP Routing With Kamailio - <a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a>
Kamailio Advanced Training, Sep 28-30, 2015, in Berlin - <a class="moz-txt-link-freetext" href="http://asipto.com/u/kat">http://asipto.com/u/kat</a></pre>
  </body>
</html>