<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <tt>Hi Federico,<br>
      <br>
      This is an known issue with the older versions of OpenSIPS (not
      being able set an order for the records). In 2.1 this was solved
      by having a priority column which dictates the oder of usage of
      records.<br>
      <br>
      For versions before 2.1, you have to rely on the oder provided by
      DB :(.<br>
      <br>
      Regards,<br>
    </tt>
    <pre class="moz-signature" cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
    <div class="moz-cite-prefix">On 14.08.2015 20:49, Federico Edorna
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAKi1vHh+N4kAiCc9nnqOisFwPiZGmcgHZoaLdVBV2yaJOYwxow@mail.gmail.com"
      type="cite">
      <div dir="ltr">Hello Guys,
        <div>
          <div style="font-size:12.8000001907349px">I'm using dispatcher
            module with postgres database. The ds_select_dst function in
            the script file is used like this:</div>
          <div style="font-size:12.8000001907349px"><br>
          </div>
          <div style="font-size:12.8000001907349px">ds_select_dst("$(var(ds_set){<a
              moz-do-not-send="true" href="http://s.int/"
              target="_blank">s.int</a>})","8");<br>
          </div>
          <div style="font-size:12.8000001907349px"><br>
          </div>
          <div style="font-size:12.8000001907349px">that is, using
            "8" algorithm (first entry in set is chosen) because I need
            to use always the same destination in the set while it is
            up. If not, then the backup destination (next in the set) is
            used.</div>
          <div style="font-size:12.8000001907349px"><br>
          </div>
          <div style="font-size:12.8000001907349px">The problem I've
            found is that when the sets are read from database (opensips
            restart or fifo ds_reload), the select hasn't a "order"
            directive  in the sql statement, so the order is defined
            depending of the last tuple update. The postgres log shows
            this when doing a fifo ds_reload:</div>
          <div style="font-size:12.8000001907349px"><br>
          </div>
          <div style="font-size:12.8000001907349px">2015-08-14 11:36:53
            ART [23684]: [1-1] LOG:  duration: 0.582 ms  statement:
            select setid,destination,socket,state,weight,attrs from
            sbc.dispatcher<br>
          </div>
          <div style="font-size:12.8000001907349px"><br>
          </div>
          <div style="font-size:12.8000001907349px">And the syslog &amp;
            debug=6 shows:</div>
          <div style="font-size:12.8000001907349px"><br>
          </div>
          <div><span style="font-size:12.8000001907349px">DBG:db_postgres:db_postgres_submit_query:
              0x7f4344987010 PQsendQuery(select
              setid,destination,socket,state,weight,attrs from
              sbc.dispatcher )</span><br>
          </div>
          <div style="font-size:12.8000001907349px"><br>
          </div>
          <div style="font-size:12.8000001907349px">So, any sql update
            in any column will change the order in the set because we
            don't have the "order by priority" for example.</div>
          <div style="font-size:12.8000001907349px"><br>
          </div>
          <div style="font-size:12.8000001907349px">Is there any way to
            use the weight, priority or the id to have a fixed order in
            the set(s) destination?</div>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>Many Thanks!</div>
        <div>Federico</div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>