Thanks Sir,<div>Doing a static or even a run-time mapping of same UID calls to destination server is what I thought about this type of case almost an year ago. </div><div><br></div><div>What I am thinking is : create a table for UID/Destination Mapping; for a unique UID see if there is any destination in that table. If it exists just jump to that server directly. If no UID/destination entry is found for that UID then invoke Dispatcher; select destination, make call to it, and store this in UID/destination map table !!</div>
<div><br>Let me know if there could be any improvement in this.</div><div><br></div><div>Thanks</div><div>Best Regards,</div><div>Sammy G.</div><div><br><div class="gmail_quote">On Tue, Jun 12, 2012 at 2:43 PM, Daniel-Constantin Mierla <span dir="ltr">&lt;<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    Hello,<br>
    <br>
    if you are using integer UID, I would suggest you use modulo
    operation to select the destination address -- this will require
    config operations only.<br>
    <br>
    Another option you can map an UID to a dispatcher set id (e.g., via
    mtree or htable) and then you can do the alg 8.<br>
    <br>
    Cheers,<br>
    Daniel<div><div class="h5"><br>
    <br>
    <div>On 6/7/12 1:37 PM, SamyGo wrote:<br>
    </div>
    <blockquote type="cite">Hi again,
      <div>yes my scenario is quiet simple. I&#39;ve  lots of users  and
        groups of those users are defined by UIDs, one UID means 70
        users of one client whereas other UID could&#39;ve 3 users of
        another client. </div>
      <div>
        So what I am trying to implement here is that calls from one
        same UID are always routed to exactly one same destination
        server. That&#39;ll help in issues like call-parking, call-pickup,
        conference calls etc.</div>
      <div><br>
      </div>
      <div>I hope I&#39;ve explained the scenario in simpler terms here.</div>
      <div><br>
      </div>
      <div>Regards,</div>
      <div>Sammy Go.</div>
      <div><br>
        <br>
        <div class="gmail_quote">On Thu, Jun 7, 2012 at 4:20 PM,
          Daniel-Constantin Mierla <span dir="ltr">&lt;<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>&gt;</span> wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div bgcolor="#FFFFFF" text="#000000"> Hello,<br>
              <br>
              that hash function is intended for hashing alpha-numeric
              usernames and has a fair distribution for such cases.<br>
              <br>
              I don&#39;t think is good for hashing numbers, at the end of a
              day, a number is already like a hash code. You can use in
              the config file modulo operation to select a particular
              destination based on a number.<br>
              <br>
              Maybe if you explain what is your target to implement, we
              can provide the right hints to do it.<br>
              <br>
              Cheers,<br>
              Daniel
              <div>
                <div><br>
                  <br>
                  <div>On 6/6/12 6:09 PM, SamyGo wrote:<br>
                  </div>
                  <blockquote type="cite">Sorry for late reply: this
                    wasn&#39;t very helpful. I think Hashing algo code needs
                    to get bit smarter. If there is any possibility can
                    you please let me know. !
                    <div> <br>
                      <br>
                      <div class="gmail_quote">On Mon, Jun 4, 2012 at
                        3:33 PM, Daniel-Constantin Mierla <span dir="ltr">&lt;<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>&gt;</span>
                        wrote:<br>
                        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">To make the life
                          easier to spot the hash code in such case, I
                          just committed a small patch to print it for
                          alg 7:<br>
                          <br>
                          <a href="http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=83a558fbad700198a8667ef01f756269d7e2c310" target="_blank">http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=83a558fbad700198a8667ef01f756269d7e2c310</a><br>

                          <br>
                          Should be easy to backport if other version is
                          used.<br>
                          <br>
                          Cheers,<br>
                          Daniel
                          <div>
                            <div><br>
                              <br>
                              On 6/4/12 12:23 PM, Carsten Bock wrote:<br>
                              <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> It&#39;s hard
                                to say, most likely not. You find the
                                used hash-function here:<br>
                                <br>
                                 841 unsigned int ds_get_hash(str *x,
                                str *y)<br>
                                <a href="http://git.sip-router.org/cgi-bin/gitweb.cgi?p=sip-router;a=blob;f=modules_k/dispatcher/dispatch.c;h=ae0c51b122d34e29b3474957a64b24ff492cfcd5;hb=HEAD" target="_blank">http://git.sip-router.org/cgi-bin/gitweb.cgi?p=sip-router;a=blob;f=modules_k/dispatcher/dispatch.c;h=ae0c51b122d34e29b3474957a64b24ff492cfcd5;hb=HEAD</a><br>

                                <br>
                                It was originally implemented to
                                distribute usernames to servers,<br>
                                which worked fine.<br>
                                <br>
                                Carsten<br>
                                <br>
                                2012/6/4 SamyGo &lt;<a href="mailto:govoiper@gmail.com" target="_blank">govoiper@gmail.com</a>&gt;:<br>
                                <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> Thanks Sir,<br>
                                  <br>
                                  Thats what I expected. Do you think
                                  this will change if I use only two<br>
                                  values with huge difference in each
                                  other, lets say {26000,29000} ?<br>
                                  <br>
                                  Regards,<br>
                                  Sammy<br>
                                  <br>
                                  On Mon, Jun 4, 2012 at 3:05 PM,
                                  Carsten Bock &lt;<a href="mailto:carsten@ng-voice.com" target="_blank">carsten@ng-voice.com</a>&gt;

                                  wrote:<br>
                                  <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> Hi,<br>
                                    <br>
                                    this functionality uses a generic
                                    &quot;hash&quot; function to generate an<br>
                                    Integer-Value of the PVAR and then
                                    reduces this to the number hosts in<br>
                                    your destination set.<br>
                                    If you have only using two different
                                    values of the PVAR and only two<br>
                                    hosts in the dispatcher list, it can
                                    likely happen, that the same host<br>
                                    is choosen. You should try a wider
                                    range of values for your PVAR...<br>
                                    (e.g. try 1000 different values),
                                    then you should see a distribution.<br>
                                    <br>
                                    Carsten<br>
                                    <br>
                                    2012/6/4 SamyGo &lt;<a href="mailto:govoiper@gmail.com" target="_blank">govoiper@gmail.com</a>&gt;:<br>
                                    <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> Hi,<br>
                                      <br>
                                      No, nothing at all. I haven&#39;t went
                                      too deep into debug logs but no<br>
                                      internal<br>
                                      error was appearing. Everything
                                      was as calm as ever and I only get
                                      one<br>
                                      destination uri.<br>
                                      <br>
                                      So maybe what I&#39;m getting from
                                      your email is that , for this to
                                      work the<br>
                                      way<br>
                                      I expect is to have more unique
                                      and random values in my hash_pvar
                                      to get<br>
                                      the<br>
                                      required functionality.<br>
                                      <br>
                                      Thanks once again,<br>
                                      BR<br>
                                      SG<br>
                                      <br>
                                      On Mon, Jun 4, 2012 at 11:52 AM,
                                      Daniel-Constantin Mierla<br>
                                      &lt;<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>&gt;

                                      wrote:<br>
                                      <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> Hello,<br>
                                        <br>
                                        do you get any errors in the
                                        log?<br>
                                        <br>
                                        Be aware that hash functions may
                                        return same code for different
                                        input<br>
                                        values. A hash function is
                                        guaranteed to return same code
                                        for same<br>
                                        input<br>
                                        value, but there can be
                                        collisions of codes for
                                        different values.<br>
                                        <br>
                                        Cheers,<br>
                                        Daniel<br>
                                        <br>
                                        <br>
                                        On 6/3/12 3:41 PM, SamyGo wrote:<br>
                                        <br>
                                        Hello,<br>
                                        <br>
                                        I&#39;m having trouble using
                                        algorithm 7 in dispatcher
                                        module. Here is my<br>
                                        kamailio version. The problem is
                                        that despite multiple dispatcher<br>
                                        entries<br>
                                        corresponding to one set all
                                        calls go only to only one
                                        destination.<br>
                                        <br>
                                        <br>
                                        [root@control1 ~]# kamailio -V<br>
                                        version: kamailio 3.2.3
                                        (x86_64/linux) 59f87e<br>
                                        flags: STATS: Off, USE_IPV6,
                                        USE_TCP, USE_TLS, TLS_HOOKS,<br>
                                        USE_RAW_SOCKS,<br>
                                        DISABLE_NAGLE, USE_MCAST,
                                        DNS_IP_HACK, SHM_MEM, SHM_MMAP,
                                        PKG_MALLOC,<br>
                                        DBG_QM_MALLOC, USE_FUTEX,
                                        FAST_LOCK-ADAPTIVE_WAIT,
                                        USE_DNS_CACHE,<br>
                                        USE_DNS_FAILOVER, USE_NAPTR,
                                        USE_DST_BLACKLIST,
                                        HAVE_RESOLV_RES<br>
                                        ADAPTIVE_WAIT_LOOPS=1024,
                                        MAX_RECV_BUFFER_SIZE 262144,
                                        MAX_LISTEN 16,<br>
                                        MAX_URI_SIZE 1024, BUF_SIZE
                                        65535, DEFAULT PKG_SIZE 4MB<br>
                                        poll method support: poll,
                                        epoll_lt, epoll_et, sigio_rt,
                                        select.<br>
                                        id: 59f87e<br>
                                        compiled on 18:04:08 Apr 19 2012
                                        with gcc 4.1.2<br>
                                        [root@control1 ~]#<br>
                                        <br>
                                        Here is the dipacther module
                                        params.<br>
                                        <br>
                                        <br>
                                        <br>
                                        # ------- Load-balancer params
                                        ------<br>
                                        modparam(&quot;dispatcher&quot;, &quot;db_url&quot;,
                                        DBURL)<br>
                                        modparam(&quot;dispatcher&quot;,
                                        &quot;table_name&quot;, &quot;dispatcher&quot;)<br>
                                        modparam(&quot;dispatcher&quot;,
                                        &quot;setid_col&quot;, &quot;setid&quot;)<br>
                                        modparam(&quot;dispatcher&quot;,
                                        &quot;destination_col&quot;,
                                        &quot;destination&quot;)<br>
                                        modparam(&quot;dispatcher&quot;,
                                        &quot;force_dst&quot;, 1)<br>
                                        modparam(&quot;dispatcher&quot;, &quot;flags&quot;,
                                        3)<br>
                                        modparam(&quot;dispatcher&quot;,
                                        &quot;dst_avp&quot;, &quot;$avp(i:271)&quot;)<br>
                                        modparam(&quot;dispatcher&quot;,
                                        &quot;cnt_avp&quot;, &quot;$avp(i:273)&quot;)<br>
                                        modparam(&quot;dispatcher&quot;,
                                        &quot;ds_ping_from&quot;, <a>&quot;sip:proxy@109.XXX.2XX.XX&quot;</a>)<br>
                                        modparam(&quot;dispatcher&quot;,
                                        &quot;ds_ping_interval&quot;,15)<br>
                                        modparam(&quot;dispatcher&quot;,
                                        &quot;ds_probing_mode&quot;, 1)<br>
                                        modparam(&quot;dispatcher&quot;,
                                        &quot;ds_ping_reply_codes&quot;,<br>
&quot;class=2;code=403;code=404;code=484;class=3&quot;)<br>
                                        modparam(&quot;dispatcher&quot;,
                                        &quot;hash_pvar&quot;, &quot;$avp(i:274)&quot;)<br>
                                        modparam(&quot;dispatcher&quot;,
                                        &quot;ds_hash_size&quot;, 9)<br>
                                        modparam(&quot;dispatcher&quot;,
                                        &quot;ds_hash_initexpire&quot;, 60)<br>
                                        <br>
                                        <br>
                                        <br>
                                        Below is the function call based
                                        on avp(i:274)<br>
                                        <br>
                                        <br>
                                        <br>
                                        avp_db_query(&quot;select uid from
                                        uid_did_map where accountcode =<br>
                                        &#39;$fU&#39;&quot;,&quot;$avp(i:274)&quot;);<br>
                                        xlog(&quot;L_INFO&quot;,&quot;$rm from $fu
                                        (IP:$si:$sp) ---------<br>
UID:&#39;$avp(i:274)-----------&#39;\n&quot;);<br>
                                                ds_load_update();<br>
                                               
                                        if(!ds_select_dst(&quot;1&quot;,&quot;7&quot;)) {<br>
                                                               
                                        sl_send_reply(&quot;500&quot;, &quot;No
                                        destination<br>
                                        available&quot;);<br>
                                                               
                                        xlog(&quot;route[MAIN] : $rm : No
                                        destinations<br>
                                        available for $rd&quot;);<br>
                                                                exit;<br>
                                                }<br>
                                        <br>
                                        <br>
                                        I&#39;m getting two different values
                                        for avp(i:274) {26,29} but the<br>
                                        destination are not hashed on
                                        its base.<br>
                                        <br>
                                        Please help.<br>
                                        <br>
                                        Regards,<br>
                                        Sammy G.<br>
                                        <br>
                                        <br>
                                        <br>
_______________________________________________<br>
                                        SIP Express Router (SER) and
                                        Kamailio (OpenSER) - sr-users
                                        mailing list<br>
                                        <a href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a><br>
                                        <a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
                                        <br>
                                        <br>
                                        --<br>
                                        Daniel-Constantin Mierla - <a href="http://www.asipto.com" target="_blank">http://www.asipto.com</a><br>
                                        <a href="http://twitter.com/#%21/miconda" target="_blank">http://twitter.com/#!/miconda</a>
                                        - <a href="http://www.linkedin.com/in/miconda" target="_blank">http://www.linkedin.com/in/miconda</a><br>
                                        Kamailio Advanced Training,
                                        Seattle, USA, Sep 23-26, 2012 -<br>
                                        <a href="http://asipto.com/u/katu" target="_blank">http://asipto.com/u/katu</a><br>
                                        Kamailio Practical Workshop,
                                        Netherlands, Sep 10-12, 2012 -<br>
                                        <a href="http://asipto.com/u/kpw" target="_blank">http://asipto.com/u/kpw</a><br>
                                        <br>
                                        <br>
                                        <br>
                                      </blockquote>
                                      <br>
_______________________________________________<br>
                                      SIP Express Router (SER) and
                                      Kamailio (OpenSER) - sr-users
                                      mailing list<br>
                                      <a href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a><br>
                                      <a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
                                      <br>
                                    </blockquote>
                                    <br>
                                    <br>
                                    --<br>
                                    Carsten Bock<br>
                                    CEO (Geschäftsführer)<br>
                                    <br>
                                    ng-voice GmbH<br>
                                    Schomburgstr. 80<br>
                                    D-22767 Hamburg / Germany<br>
                                    <br>
                                    <a href="http://www.ng-voice.com" target="_blank">http://www.ng-voice.com</a><br>
                                    mailto:<a href="mailto:carsten@ng-voice.com" target="_blank">carsten@ng-voice.com</a><br>
                                    <br>
                                    Mobile <a href="tel:%2B49%20179%202021244" value="+491792021244" target="_blank">+49 179 2021244</a><br>
                                    Office <a href="tel:%2B49%2040%2034927219" value="+494034927219" target="_blank">+49 40 34927219</a><br>
                                    Fax <a href="tel:%2B49%2040%2034927220" value="+494034927220" target="_blank">+49 40 34927220</a><br>
                                    <br>
                                    Sitz der Gesellschaft: Hamburg<br>
                                    Registergericht: Amtsgericht
                                    Hamburg, HRB 120189<br>
                                    Geschäftsführer: Carsten Bock<br>
                                    Ust-ID: DE279344284<br>
                                    <br>
                                    Hier finden Sie unsere
                                    handelsrechtlichen Pflichtangaben:<br>
                                    <a href="http://www.ng-voice.com/imprint/" target="_blank">http://www.ng-voice.com/imprint/</a><br>
                                    <br>
_______________________________________________<br>
                                    SIP Express Router (SER) and
                                    Kamailio (OpenSER) - sr-users
                                    mailing list<br>
                                    <a href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a><br>
                                    <a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
                                  </blockquote>
                                  <br>
                                  <br>
_______________________________________________<br>
                                  SIP Express Router (SER) and Kamailio
                                  (OpenSER) - sr-users mailing list<br>
                                  <a href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a><br>
                                  <a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
                                  <br>
                                </blockquote>
                                <br>
                                <br>
                              </blockquote>
                              <br>
                              -- <br>
                              Daniel-Constantin Mierla - <a href="http://www.asipto.com" target="_blank">http://www.asipto.com</a><br>
                              <a href="http://twitter.com/#%21/miconda" target="_blank">http://twitter.com/#!/miconda</a>
                              - <a href="http://www.linkedin.com/in/miconda" target="_blank">http://www.linkedin.com/in/miconda</a><br>
                              Kamailio Advanced Training, Seattle, USA,
                              Sep 23-26, 2012 - <a href="http://asipto.com/u/katu" target="_blank">http://asipto.com/u/katu</a><br>
                              Kamailio Practical Workshop, Netherlands,
                              Sep 10-12, 2012 - <a href="http://asipto.com/u/kpw" target="_blank">http://asipto.com/u/kpw</a><br>
                              <br>
                              <br>
                              <br>
                              <br>
_______________________________________________<br>
                              SIP Express Router (SER) and Kamailio
                              (OpenSER) - sr-users mailing list<br>
                              <a href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a><br>
                              <a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
                            </div>
                          </div>
                        </blockquote>
                      </div>
                      <br>
                    </div>
                  </blockquote>
                  <br>
                  <pre cols="72">-- 
Daniel-Constantin Mierla - <a href="http://www.asipto.com" target="_blank">http://www.asipto.com</a>
<a href="http://twitter.com/#%21/miconda" target="_blank">http://twitter.com/#!/miconda</a> - <a href="http://www.linkedin.com/in/miconda" target="_blank">http://www.linkedin.com/in/miconda</a>
Kamailio Advanced Training, Seattle, USA, Sep 23-26, 2012 - <a href="http://asipto.com/u/katu" target="_blank">http://asipto.com/u/katu</a>
Kamailio Practical Workshop, Netherlands, Sep 10-12, 2012 - <a href="http://asipto.com/u/kpw" target="_blank">http://asipto.com/u/kpw</a></pre>
                  <br>
                  <br>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
    <pre cols="72">-- 
Daniel-Constantin Mierla - <a href="http://www.asipto.com" target="_blank">http://www.asipto.com</a>
<a href="http://twitter.com/#!/miconda" target="_blank">http://twitter.com/#!/miconda</a> - <a href="http://www.linkedin.com/in/miconda" target="_blank">http://www.linkedin.com/in/miconda</a>
Kamailio Advanced Training, Seattle, USA, Sep 23-26, 2012 - <a href="http://asipto.com/u/katu" target="_blank">http://asipto.com/u/katu</a>
Kamailio Practical Workshop, Netherlands, Sep 10-12, 2012 - <a href="http://asipto.com/u/kpw" target="_blank">http://asipto.com/u/kpw</a></pre>
    <br>
    <br>
  </div></div></div>

</blockquote></div><br></div>