We're running kamailio 4.2.3. Are there any changes to dispatcher in 4.2.x? Thanks,
# kamailio -V version: kamailio 4.2.3 (x86_64/linux) 5596bd 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 ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB poll method support: poll, epoll_lt, epoll_et, sigio_rt, select. id: 5596bd compiled on 09:32:37 May 6 2015 with gcc 4.4.7 On Wed, Jun 10, 2015 at 7:01 AM, Daniel-Constantin Mierla <mico...@gmail.com > wrote: > Hello, > > what version of kamailio are you using? > > Cheers, > Daniel > > > On 09/06/15 20:51, Ding Ma wrote: > > 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. > > Here is the content of dispatcher table in postgresql db. > > select * from dispatcher; > id | setid | destination | flags | priority | attrs > | description > > ----+-------+--------------------+-------+----------+---------------------------+------------- > 1 | 1 | sip:10.0.1.31:5061 | 0 | 0 | > duid=asterisk1;maxload=25 | Asterisk1 > 2 | 1 | sip:10.0.1.33:5061 | 0 | 0 | > duid=asterisk2;maxload=25 | Asterisk2 > (2 rows) > > Here are the dispatcher sections in kamailio.cfg. > # ----- dispatcher params ----- > #!ifdef WITH_DISPATCHER > modparam("dispatcher", "db_url", DBASTURL) > modparam("dispatcher", "table_name", "dispatcher") > modparam("dispatcher", "force_dst", 1). > # If flag 2 is set, then failover support is enabled. > modparam("dispatcher", "flags", 3) > # the last address in destination set is used as a final option to send > the request to > modparam("dispatcher", "use_default", 1) > # load balancing fail over > modparam("dispatcher", "dst_avp", "$avp(dsdst)") > modparam("dispatcher", "grp_avp", "$avp(dsgrp)") > modparam("dispatcher", "cnt_avp", "$avp(dscnt)") > modparam("dispatcher", "dstid_avp", "$avp(dsdstid)") > modparam("dispatcher", "attrs_avp", "$avp(dsattrs)") > # PVs for hashing > modparam("dispatcher", "hash_pvar", "$fU@$ci") > # PVs to store results when calling ds_is_from_list > modparam("dispatcher", "setid_pvname", "$var(setid)") > modparam("dispatcher", "attrs_pvname", "$var(attrs)") > # method to probe the gateways > modparam("dispatcher", "ds_ping_method", "OPTIONS") > modparam("dispatcher", "ds_ping_from", "sip:dispatcher@localhost") > modparam("dispatcher", "ds_ping_interval", 30) > modparam("dispatcher", "ds_probing_threshhold", 10) > modparam("dispatcher", "ds_ping_reply_codes", > "class=2;code=403;code=404;code=484;code=488;class=3") > modparam("dispatcher", "ds_probing_mode", 1) > # size of hash table storing data for call load dispatching, power of two > modparam("dispatcher", "ds_hash_size", 10) > # expiration time in seconds to remove the load on a destination if no BYE > was received > modparam("dispatcher", "ds_hash_expire", 3600) > # expiration time in seconds to remove the load on a destination if no 200 > OK for INVITE was received > # and state updated with ds_load_update > modparam("dispatcher", "ds_hash_initexpire", 60) > modparam("dispatcher", "ds_hash_check_interval", 30) > #!endif > > route[WITHINDLG] { > if (has_totag()) { > # sequential request withing a dialog should > # take the path determined by record-routing > > #!ifdef WITH_DISPATCHER > if(is_method("BYE|CANCEL") && ds_is_from_list("1", "3")) > ds_load_update(); > #!endif > ...... > } > } > > route[FROMASTERISK] { > #!ifdef WITH_DISPATCHER > if(ds_is_from_list("1", "3")) { > xlog("L_DBG","$rm from $fU@$si:$sp: Call from Asterisk cluster\n"); > return 1; > } > return -1; > #!else > if ($si==$sel(cfg_get.asterisk.bindip)) { > return 1; > } > return -1; > #!endif > } > > onreply_route[MANAGE_REPLY] { > xdbg("incoming reply\n"); > #!ifdef WITH_DISPATCHER > if(is_method("INVITE") && ds_is_from_list("1", "3")) { > if(status=~"2[0-9][0-9]") { > ds_load_update(); > } > else if(status=~"[3-7][0-9][0-9]") { > ds_load_unset(); > } > } > #!endif > if(status=~"[12][0-9][0-9]") > route(NATMANAGE); > } > > #!ifdef WITH_DISPATCHER > failure_route[RTF_DISPATCH] { > if (t_is_canceled()) { > exit; > } > # next DST - only for 500 or local timeout > if (t_check_status("500") or (t_branch_timeout() and > !t_branch_replied())) { > # mark the destination Inactive and Probing > ds_mark_dst("IP"); > # select the new destination > if(ds_next_dst()) { > t_on_failure("RTF_DISPATCH"); > route(RELAY); > exit; > } > else { > # last available node failed to reply, no other > destinations available > send_reply("404", "No destination"); > exit; > } > } > } > #!endif > > route[TOASTERISK] { > #!ifdef WITH_DISPATCHER > # ds_mark_dst("IP"); > # Call load distribution > if(!ds_select_dst("1", "10")) { > sl_send_reply("500", "Service Unavailable"); > xlog("L_INFO","$rm from $fU@$si:$sp: No destinations available for > $rd\n"); > exit; > } > xlog("L_DBG", "--- SCRIPT: going to <$ru> via <$du>\n"); > t_on_failure("RTF_DISPATCH"); > #!else > > $du = "sip:" + $sel(cfg_get.asterisk.bindip) + ":" > + $sel(cfg_get.asterisk.bindport); > #!endif > route(RELAY); > exit; > } > > > # Dispatcher detects a destination goes down > event_route[dispatcher:dst-down] { > xlog("L_ERR", "Destination down: $rm $ru ($du)\n"); > } > > # Dispatcher detects a destination comes up > event_route[dispatcher:dst-up] { > xlog("L_ERR", "Destination up: $rm $ru\n"); > } > > > _______________________________________________ > SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing > listsr-us...@lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users > > > -- > Daniel-Constantin Mierlahttp://twitter.com/#!/miconda - > http://www.linkedin.com/in/miconda > Book: SIP Routing With Kamailio - http://www.asipto.com > > > _______________________________________________ > SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list > sr-users@lists.sip-router.org > http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users > >
_______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users