[SR-Users] Weight balancing with dispatcher module

Ben Bliss ben at enta.net
Thu Oct 15 18:11:40 CEST 2015


Hi,

I am having issues getting the dispatcher to work using weighting. I 
have been digging through old posts to the list, and tried all that I 
have found, but am still having no luck at all.

So, information...

version: kamailio 4.2.4 (amd64/freebsd) be62bd
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_PTHREAD_MUTEX, USE_DNS_CACHE, 
USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 
65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, select, kqueue.
id: be62bd

Dispatcher configuration...

modparam("dispatcher", "db_url", DBURL)
modparam("dispatcher", "table_name", "dispatcher")
modparam("dispatcher", "flags", 3)
modparam("dispatcher", "force_dst", 1)
modparam("dispatcher", "dst_avp", "$avp(AVP_DST)")
modparam("dispatcher", "grp_avp", "$avp(AVP_GRP)")
modparam("dispatcher", "cnt_avp", "$avp(AVP_CNT)")

Dialplan config..

route[DISPATCH] {
         if(!ds_select_dst("1", "9"))
         {
                 send_reply("404", "No destination");
                 exit;
         }
         xlog("L_DBG", "--- SCRIPT: going to <$ru> via <$du>\n");
         t_on_failure("RTF_DISPATCH");
         return;

I am loading the values from a database, which are being loaded fine, 
and appear to be being formatted correctly aswell..

+----+-------+-------------------------+-------+----------+------------+----------------------+
| id | setid | destination             | flags | priority | attrs      | 
description          |
+----+-------+-------------------------+-------+----------+------------+----------------------+
|  1 |     1 | sipx.x.x.106:5060 |     8 |        1 | weight=100 |    
                             |
|  2 |     1 | sip:x.x.x.107:5060 |     8 |        1 | weight=0   |    
                              |
+----+-------+-------------------------+-------+----------+------------+----------------------+

The IP's are public, so i've masked them... The following is from kamcmd..

{
         NRSETS: 1
         RECORDS: {
                 SET: {
                         ID: 1
                         TARGETS: {
                                 DEST: {
                                         URI: sip:x.x.x.107:5060
                                         FLAGS: AP
                                         PRIORITY: 1
                                         ATTRS: {
                                                 BODY: weight=0
                                                 DUID:
                                                 MAXLOAD: 0
                                                 WEIGHT: 0
                                         }
                                 }
                                 DEST: {
                                         URI: sip:x.x.x106:5060
                                         FLAGS: AP
                                         PRIORITY: 1
                                         ATTRS: {
                                                 BODY: weight=100
                                                 DUID:
                                                 MAXLOAD: 0
                                                 WEIGHT: 100
                                         }
                                 }
                         }
                 }
         }
}

However, when any call is placed, it will always goto the server ending 
107 (with weight 0, which means, as far as I understand, it should be 
ignored). I've tried with ; after the weights, this made no change either.

When set to round robin, or via priority, it appears to work fine.

Any ideas?

-- 
Kind Regards,

---------
Ben




More information about the sr-users mailing list