<div dir="ltr"><div>Hi</div><div><br></div><div>I am new to Kamailio and i am just trying to setup a kamailio (v4.2.3) dispatcher to distribute calls to 2 asterisk using the call load distribution algorithm (alg 10). I started to test and see how all it is working and in the logs appears that the call load record it cannot be found.</div><div><br></div><div><div>- ERROR: dispatcher [dispatch.c:1416]: ds_load_remove(): cannot find load for (call id generated by asterisk)</div></div><div><br></div><div>I am getting this error  trying a 2 call leg conversation when asterisk is creating the BYE message destinated to the callee after receiving a BYE message from the caller, and the BYE message by Asterisk reach Kamailio to then apply the ds_load_update function</div><div><br></div><div>From what i understand about ds_load_update it is that it sets the load to an specific destination if Kamailio receives a 2xx reply of an INVITE message, and removes it if Kamailio receives a BYE message based from the Call-id received in that message, where it is actually failing in my implementation at the moment</div><div><br></div><div>Here are the blocks of code of the dispatcher parameters and where the function ds_load_update() is being used:</div><div><div>#!ifdef WITH_LOADBALANCE</div><div><br></div><div>#Parameters using Dispatcher from DB</div><div># ----------</div><div>modparam("dispatcher", "db_url", DBURL)</div><div>modparam("dispatcher", "table_name", "dispatcher")</div><div># ----------</div><div><br></div><div>#Enabling failover mechanism</div><div># -----------</div><div>modparam("dispatcher", "flags", 2)</div><div># -----------</div><div><br></div><div>#Setting dispatcher parameters in AVP</div><div># -----------</div><div>modparam("dispatcher", "dst_avp", "$avp(AVP_DST)")</div><div>modparam("dispatcher", "grp_avp", "$avp(AVP_GRP)")</div><div>modparam("dispatcher", "cnt_avp", "$avp(AVP_CNT)")</div><div>modparam("dispatcher", "dstid_avp", "$avp(dsdstid)")</div><div># -----------</div><div><br></div><div>#Setting dispatcher result in PV variables</div><div># -----------</div><div>modparam("dispatcher", "attrs_pvname", "$var(attrs)")</div><div># -----------</div><div><br></div><div><br></div><div>#Enabling dispatcher algorithm according to call loads</div><div># -----------</div><div>modparam("dispatcher", "ds_hash_size",8)</div><div>modparam("dispatcher", "ds_hash_expire", 3600)</div><div>modparam("dispatcher", "ds_hash_initexpire", 60)</div><div># -----------</div><div><br></div><div># Setting parameters for probing dispatcher destinations</div><div># -----------</div><div>modparam("dispatcher", "ds_ping_interval", 20)</div><div>modparam("dispatcher", "ds_ping_from", "sip:kamailio1@<Kamailio IP>")</div><div>modparam("dispatcher", "ds_probing_mode", 1)</div><div>modparam("dispatcher", "ds_probing_threshhold", 2)</div><div>modparam("dispatcher", "ds_ping_reply_codes", "class=2;code=480;code=404")</div><div># -----------</div></div><div><br></div><div>...</div><div><div>route[WITHINDLG] {</div><div> if (has_totag()) {</div><div>  # sequential request withing a dialog should</div><div>  # take the path determined by record-routing</div><div><br></div><div>#!ifdef WITH_LOADBALANCE</div><div>        if(is_method("BYE|CANCEL")){</div><div>                xlog("L_ERROR","UBICAR BYE ds_load_update  requesturi=$ru from=$fu method=$rm callid=$ci to=$tu reply=$mt rrcode=$rr rcode=$rs\n");</div><div>                ds_load_update();</div><div>        }</div><div>#!endif</div></div><div>...</div><div>}</div><div><br></div><div>...</div><div><br></div><div><div>onreply_route[MANAGE_REPLY] {</div><div>#!ifdef WITH_LOADBALANCE</div><div>if(is_method("INVITE")) {</div><div>        if(status=~"2[0-9][0-9]") {</div><div>                xlog("L_ERROR","UBICAR setting ds_load_update  requesturi=$ru from=$fu method=$rm callid=$ci to=$tu reply=$mt rrcode=$rr rcode=$rs");</div><div>                ds_load_update();</div><div>        }else if(status=~"[3-7][0-9][0-9]") {</div><div>                ds_load_unset();</div><div>        }</div><div>}</div><div>#!endif</div><div><br></div><div>if(status=~"[12][0-9][0-9]"){</div><div>        route(NATMANAGE);</div></div><div> }</div><div>}</div><div><br></div><div><br></div><div>This is what i am getting from logs after the 2 call legs conversation completes:</div><div><br></div><div><div>kam1 /usr/sbin/kamailio[4082]: ERROR: <script>: UBICAR: FROMASTERISK <a href="mailto:70175143146f92975a5bff8876435911@192.168.10.194">70175143146f92975a5bff8876435911@192.168.10.194</a><br></div><div><br></div><div>kam1 /usr/sbin/kamailio[4082]: ERROR: <script>: UBICAR setting ds_load_update  requesturi=<null> from=<a href="mailto:sip%3A103@192.168.10.194">sip:103@192.168.10.194</a> method=INVITE callid=<a href="mailto:28d0f6e71625c9e87baec07f46167863@192.168.10.194">28d0f6e71625c9e87baec07f46167863@192.168.10.194</a> to=<a href="mailto:sip%3A104@192.168.10.194">sip:104@192.168.10.194</a> reply=2 rrcode=OK rcode=200</div><div><br></div><div>kam1 /usr/sbin/kamailio[4083]: ERROR: <script>: UBICAR setting ds_load_update  requesturi=<null> from=<a href="http://sip:103@192.168.10.194:5060">sip:103@192.168.10.194:5060</a> method=INVITE callid=<a href="mailto:1-3692@192.168.20.2">1-3692@192.168.20.2</a> to=<a href="http://sip:104@192.168.10.194:5060">sip:104@192.168.10.194:5060</a> reply=2 rrcode=OK rcode=200</div><div><br></div><div>kam1 /usr/sbin/kamailio[4084]: ERROR: <script>: UBICAR BYE ds_load_update  requesturi=<a href="http://sip:104@192.168.10.190:5060">sip:104@192.168.10.190:5060</a> from=<a href="http://sip:103@192.168.30.1:5060">sip:103@192.168.30.1:5060</a> method=BYE callid=<a href="mailto:1-3692@192.168.20.2">1-3692@192.168.20.2</a> to=<a href="http://sip:104@192.168.30.1:5060">sip:104@192.168.30.1:5060</a> reply=1 rrcode=<null> rcode=<null></div><div><br></div><div>kam1 /usr/sbin/kamailio[4085]: ERROR: <script>: UBICAR BYE ds_load_update  requesturi=sip:104@192.168.30.2:22523;transport=UDP from=<a href="mailto:sip%3A103@192.168.10.194">sip:103@192.168.10.194</a> method=BYE callid=<a href="mailto:28d0f6e71625c9e87baec07f46167863@192.168.10.194">28d0f6e71625c9e87baec07f46167863@192.168.10.194</a> to=<a href="mailto:sip%3A104@192.168.10.194">sip:104@192.168.10.194</a> reply=1 rrcode=<null> rcode=<null></div><div><br></div><div>kam1 /usr/sbin/kamailio[4085]: ERROR: dispatcher [dispatch.c:1416]: ds_load_remove(): cannot find load for (<a href="mailto:28d0f6e71625c9e87baec07f46167863@192.168.10.194">28d0f6e71625c9e87baec07f46167863@192.168.10.194</a>)</div></div><div><br></div><div>Kamailio IP: 192.168.10.194</div><div><br></div><div>Asterisk IP:</div><div><br></div><div><div>+----+-------+-------------------------+-------+----------+-------------------------------+-------------+</div><div>| id | setid | destination             | flags | priority | attrs                         | description |</div><div>+----+-------+-------------------------+-------+----------+-------------------------------+-------------+</div><div>|  1 |     0 | sip:<a href="http://192.168.10.190:5060">192.168.10.190:5060</a> |     2 |        0 | duid=PBX1;my=pbx1;maxload=200 | pbx1        |</div><div>|  2 |     0 | sip:<a href="http://192.168.10.191:5060">192.168.10.191:5060</a> |     2 |        0 | duid=PBX2;my=pbx2;maxload=200 | pbx2        |</div><div>+----+-------+-------------------------+-------+----------+-------------------------------+-------------+</div></div><div><br></div><div><br></div>
</div>