<div dir="ltr"><div>We're running kamailio 4.2.3. Are there any changes to dispatcher in 4.2.x?</div><div>Thanks,</div><div><br></div><div># kamailio -V</div><div>version: kamailio 4.2.3 (x86_64/linux) 5596bd</div><div>flags: STATS: Off, USE_TCP, USE_TLS, 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</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: 5596bd</div><div>compiled on 09:32:37 May  6 2015 with gcc 4.4.7</div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 10, 2015 at 7:01 AM, Daniel-Constantin Mierla <span dir="ltr"><<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>></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>
    what version of kamailio are you using?<br>
    <br>
    Cheers,<br>
    Daniel<div><div class="h5"><br>
    <br>
    <div>On 09/06/15 20:51, Ding Ma wrote:<br>
    </div>
    </div></div><blockquote type="cite"><div><div class="h5">
      <div dir="ltr">I'm trying to set up kamailio dispatcher to
        distribute calls to 2 asterisk servers. So far, the failover
        case seems ok, but I cannot get the dispatcher to distribute
        load. All calls are going to the last destination entry in the
        dispatcher table even if I have set the maxload attributes. I'm
        using algorithm 10 for load distribution. The number of calls
        sent to one asterisk is well above the maxload. Hope someone
        more experienced in dispatcher can review my config and give me
        some recommendations. Thanks in advance.
        <div><br>
        </div>
        <div>Here is the content of dispatcher table in postgresql db.</div>
        <div><br>
          <div>
            <div>select * from dispatcher;</div>
            <div> id | setid |    destination     | flags | priority |  
                      attrs           | description</div>
            <div>----+-------+--------------------+-------+----------+---------------------------+-------------</div>
            <div>  1 |     1 | sip:<a href="http://10.0.1.31:5061" target="_blank">10.0.1.31:5061</a> |     0
              |        0 | duid=asterisk1;maxload=25 | Asterisk1</div>
            <div>  2 |     1 | sip:<a href="http://10.0.1.33:5061" target="_blank">10.0.1.33:5061</a> |     0
              |        0 | duid=asterisk2;maxload=25 | Asterisk2</div>
            <div>(2 rows)</div>
          </div>
        </div>
        <div><br>
        </div>
        <div>Here are the dispatcher sections in kamailio.cfg.</div>
        <div>
          <div># ----- dispatcher params -----</div>
          <div>#!ifdef WITH_DISPATCHER</div>
          <div>modparam("dispatcher", "db_url", DBASTURL)</div>
          <div>modparam("dispatcher", "table_name", "dispatcher")</div>
          <div>modparam("dispatcher", "force_dst", 1). </div>
          <div># If flag 2 is set, then failover support is enabled.<br>
          </div>
          <div>modparam("dispatcher", "flags", 3)</div>
          <div># the last address in destination set is used as a final
            option to send the request to</div>
          <div>modparam("dispatcher", "use_default", 1)</div>
          <div># load balancing fail over</div>
          <div>modparam("dispatcher", "dst_avp", "$avp(dsdst)")</div>
          <div>modparam("dispatcher", "grp_avp", "$avp(dsgrp)")</div>
          <div>modparam("dispatcher", "cnt_avp", "$avp(dscnt)")</div>
          <div>modparam("dispatcher", "dstid_avp", "$avp(dsdstid)")</div>
          <div>modparam("dispatcher", "attrs_avp", "$avp(dsattrs)")</div>
          <div># PVs for hashing</div>
          <div>modparam("dispatcher", "hash_pvar", "$fU@$ci")</div>
          <div># PVs to store results when calling ds_is_from_list</div>
          <div>modparam("dispatcher", "setid_pvname", "$var(setid)")</div>
          <div>modparam("dispatcher", "attrs_pvname", "$var(attrs)")</div>
          <div># method to probe the gateways</div>
          <div>modparam("dispatcher", "ds_ping_method", "OPTIONS")</div>
          <div>modparam("dispatcher", "ds_ping_from",
            <a>"sip:dispatcher@localhost"</a>)</div>
          <div>modparam("dispatcher", "ds_ping_interval", 30)</div>
          <div>modparam("dispatcher", "ds_probing_threshhold", 10)</div>
          <div>modparam("dispatcher", "ds_ping_reply_codes",
            "class=2;code=403;code=404;code=484;code=488;class=3")</div>
          <div>modparam("dispatcher", "ds_probing_mode", 1)</div>
          <div># size of hash table storing data for call load
            dispatching, power of two</div>
          <div>modparam("dispatcher", "ds_hash_size", 10)</div>
          <div># expiration time in seconds to remove the load on a
            destination if no BYE was received</div>
          <div>modparam("dispatcher", "ds_hash_expire", 3600)</div>
          <div># expiration time in seconds to remove the load on a
            destination if no 200 OK for INVITE was received</div>
          <div># and state updated with ds_load_update</div>
          <div>modparam("dispatcher", "ds_hash_initexpire", 60)</div>
          <div>modparam("dispatcher", "ds_hash_check_interval", 30)</div>
          <div>#!endif</div>
        </div>
        <div><br>
        </div>
        <div>
          <div>route[WITHINDLG] {</div>
          <div><span style="white-space:pre-wrap"> </span>if
            (has_totag()) {</div>
          <div><span style="white-space:pre-wrap"> </span>#
            sequential request withing a dialog should</div>
          <div><span style="white-space:pre-wrap"> </span># take
            the path determined by record-routing</div>
          <div><br>
          </div>
          <div>#!ifdef WITH_DISPATCHER</div>
          <div><span style="white-space:pre-wrap"> </span>if(is_method("BYE|CANCEL")
            && ds_is_from_list("1", "3"))</div>
          <div><span style="white-space:pre-wrap"> </span>ds_load_update();</div>
          <div>#!endif</div>
        </div>
        <div>......</div>
        <div>       }</div>
        <div>}</div>
        <div><br>
        </div>
        <div>
          <div>route[FROMASTERISK] {</div>
          <div>#!ifdef WITH_DISPATCHER<br>
          </div>
          <div><span style="white-space:pre-wrap"> </span>if(ds_is_from_list("1",
            "3")) {</div>
          <div><span style="white-space:pre-wrap"> </span>xlog("L_DBG","$rm
            from $fU@$si:$sp: Call from Asterisk cluster\n");</div>
          <div><span style="white-space:pre-wrap"> </span>return 1;</div>
          <div><span style="white-space:pre-wrap"> </span>}</div>
          <div><span style="white-space:pre-wrap"> </span>return
            -1;</div>
          <div>#!else</div>
          <div><span style="white-space:pre-wrap"> </span>if
            ($si==$sel(cfg_get.asterisk.bindip)) {</div>
          <div><span style="white-space:pre-wrap"> </span>return 1;</div>
          <div><span style="white-space:pre-wrap"> </span>}</div>
          <div><span style="white-space:pre-wrap"> </span>return
            -1;</div>
          <div>#!endif</div>
          <div>}</div>
        </div>
        <div><br>
        </div>
        <div>
          <div>onreply_route[MANAGE_REPLY] {</div>
          <div><span style="white-space:pre-wrap"> </span>xdbg("incoming
            reply\n");</div>
          <div>#!ifdef WITH_DISPATCHER</div>
          <div><span style="white-space:pre-wrap"> </span>if(is_method("INVITE")
            && ds_is_from_list("1", "3")) {</div>
          <div><span style="white-space:pre-wrap"> </span>if(status=~"2[0-9][0-9]")
            {</div>
          <div><span style="white-space:pre-wrap"> </span>ds_load_update();</div>
          <div><span style="white-space:pre-wrap"> </span>}</div>
          <div><span style="white-space:pre-wrap"> </span>else
            if(status=~"[3-7][0-9][0-9]") {</div>
          <div><span style="white-space:pre-wrap"> </span>ds_load_unset();</div>
          <div><span style="white-space:pre-wrap"> </span>}</div>
          <div><span style="white-space:pre-wrap"> </span>}</div>
          <div>#!endif</div>
          <div><span style="white-space:pre-wrap"> </span>if(status=~"[12][0-9][0-9]")</div>
          <div><span style="white-space:pre-wrap"> </span>route(NATMANAGE);</div>
          <div>}</div>
        </div>
        <div><br>
        </div>
        <div>
          <div>#!ifdef WITH_DISPATCHER</div>
          <div>failure_route[RTF_DISPATCH] {</div>
          <div><span style="white-space:pre-wrap"> </span>if
            (t_is_canceled()) {</div>
          <div><span style="white-space:pre-wrap"> </span>exit;</div>
          <div><span style="white-space:pre-wrap"> </span>}</div>
          <div><span style="white-space:pre-wrap"> </span># next
            DST - only for 500 or local timeout</div>
          <div><span style="white-space:pre-wrap"> </span>if
            (t_check_status("500") or (t_branch_timeout() and
            !t_branch_replied())) {</div>
          <div>                # mark the destination Inactive and
            Probing</div>
          <div><span style="white-space:pre-wrap"> </span>ds_mark_dst("IP");</div>
          <div>                # select the new destination</div>
          <div><span style="white-space:pre-wrap"> </span>if(ds_next_dst())
            {</div>
          <div><span style="white-space:pre-wrap"> </span>t_on_failure("RTF_DISPATCH");</div>
          <div><span style="white-space:pre-wrap"> </span>route(RELAY);</div>
          <div><span style="white-space:pre-wrap"> </span>exit;</div>
          <div><span style="white-space:pre-wrap"> </span>}</div>
          <div>                else {</div>
          <div>                        # last available node failed to
            reply, no other destinations available</div>
          <div>                        send_reply("404", "No
            destination");</div>
          <div>                        exit;</div>
          <div>                }</div>
          <div><span style="white-space:pre-wrap"> </span>}</div>
          <div>}</div>
          <div>#!endif</div>
        </div>
        <div><br>
        </div>
        <div>
          <div>route[TOASTERISK] {</div>
          <div>#!ifdef WITH_DISPATCHER</div>
          <div><span style="white-space:pre-wrap"> </span>#
            ds_mark_dst("IP");</div>
          <div><span style="white-space:pre-wrap"> </span># Call
            load distribution</div>
          <div><span style="white-space:pre-wrap"> </span>if(!ds_select_dst("1",
            "10")) {</div>
          <div><span style="white-space:pre-wrap"> </span>sl_send_reply("500",
            "Service Unavailable");</div>
          <div><span style="white-space:pre-wrap"> </span>xlog("L_INFO","$rm
            from $fU@$si:$sp: No destinations available for $rd\n");</div>
          <div>                exit;</div>
          <div>        }</div>
          <div><span style="white-space:pre-wrap"> </span>xlog("L_DBG",
            "--- SCRIPT: going to <$ru> via <$du>\n");</div>
          <div><span style="white-space:pre-wrap"> </span>t_on_failure("RTF_DISPATCH");</div>
          <div>#!else</div>
          <div><br>
          </div>
          <div>   <span style="white-space:pre-wrap"> </span>$du =
            "sip:" + $sel(cfg_get.asterisk.bindip) + ":"</div>
          <div><span style="white-space:pre-wrap"> </span>+
            $sel(cfg_get.asterisk.bindport);</div>
          <div>#!endif</div>
          <div><span style="white-space:pre-wrap"> </span>route(RELAY);</div>
          <div><span style="white-space:pre-wrap"> </span>exit;</div>
          <div>}</div>
        </div>
        <div><br>
        </div>
        <div>
          <div><br>
          </div>
          <div># Dispatcher detects a destination goes down</div>
          <div>event_route[dispatcher:dst-down] {</div>
          <div>    xlog("L_ERR", "Destination down: $rm $ru ($du)\n");</div>
          <div>}</div>
          <div><br>
          </div>
          <div># Dispatcher detects a destination comes up </div>
          <div>event_route[dispatcher:dst-up] {</div>
          <div>    xlog("L_ERR", "Destination up: $rm $ru\n");</div>
          <div>}</div>
        </div>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      </div></div><pre>_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a>
<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><span class="HOEnZb"><font color="#888888">
</font></span></pre><span class="HOEnZb"><font color="#888888">
    </font></span></blockquote><span class="HOEnZb"><font color="#888888">
    <br>
    <pre cols="72">-- 
Daniel-Constantin Mierla
<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>
Book: SIP Routing With Kamailio - <a href="http://www.asipto.com" target="_blank">http://www.asipto.com</a></pre>
  </font></span></div>

<br>_______________________________________________<br>
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
<a href="mailto:sr-users@lists.sip-router.org">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></div><br></div></div>