[SR-Users] dispatcher.list reversed by dispatch.c reindex_dests()

Daniel-Constantin Mierla miconda at gmail.com
Mon Sep 21 13:38:41 CEST 2015


Hello,

you have to set the priority field to get them ordered as desired.

With text file is easier to know (or better said expect) the order as it
is written, but for database, there is no guarantee that if you insert
three destinations, will be returned in the order of inserting.
Therefore, the loading of destinations is not caring of the order
retrieved from the storage, will use priority to sort them.

Cheers,
Daniel

On 21/09/15 13:13, Giovanni Maruzzelli wrote:
>
> Anyone got this one ?
>
> sent from my mobile,
> Giovanni Maruzzelli
> cell: +39 347 266 56 18
>
> On Sep 19, 2015 7:58 PM, "Giovanni Maruzzelli" <gmaruzz at gmail.com
> <mailto:gmaruzz at gmail.com>> wrote:
>
>     Hello,
>
>     dispatcher gives me destination sets with entries in reverse order:
>
>     I have installed from Kamailio deb repository packages version
>     4.3.2+jessie.
>
>     # kamailio -V
>     version: kamailio 4.3.2 (x86_64/linux)
>     flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, 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: unknown
>     compiled with gcc 4.9.2
>
>     I configured dispatcher:
>
>     modparam("dispatcher", "use_default", 1)
>     modparam("dispatcher", "list_file", "/etc/kamailio/dispatcher.list")
>     modparam("dispatcher", "flags", 3)
>     modparam("dispatcher", "dst_avp", "$avp(AVP_DST)")
>     modparam("dispatcher", "grp_avp", "$avp(AVP_GRP)")
>     modparam("dispatcher", "cnt_avp", "$avp(AVP_CNT)")
>     modparam("dispatcher", "sock_avp", "$avp(AVP_SOCK)")
>     modparam("dispatcher", "ds_ping_interval", 5)
>     modparam("dispatcher", "ds_probing_mode", 1)
>
>     I have this dispatcher.list:
>
>     1 sip:192.168.1.144:5060 <http://192.168.1.144:5060> 2
>     1 sip:192.168.1.145:5060 <http://192.168.1.145:5060> 2
>     1 sip:192.168.1.146:5060 <http://192.168.1.146:5060> 2
>
>     2 sip:192.168.1.146:5060 <http://192.168.1.146:5060> 2
>     2 sip:192.168.1.145:5060 <http://192.168.1.145:5060> 2
>
>     So, I expect dispatcher to have:
>
>     set 1 first two destinations in distribution via hash on callid,
>     and third destination as failover (192.168.1.146
>     <http://192.168.1.146:5060>) .
>     set 2 all traffic on first destination, and if first fails, all
>     traffic will failover to second destination (192.168.1.145
>     <http://192.168.1.146:5060>).
>
>     Instead reindex_dests shuffle the sets upside down:
>
>     DEBUG: dispatcher [dispatch.c:375]: add_dest2list(): dest [1/1]
>     <sip:192.168.1.144:5060 <http://192.168.1.144:5060>>
>     DEBUG: dispatcher [dispatch.c:375]: add_dest2list(): dest [1/2]
>     <sip:192.168.1.145:5060 <http://192.168.1.145:5060>>
>     DEBUG: dispatcher [dispatch.c:375]: add_dest2list(): dest [1/3]
>     <sip:192.168.1.146:5060 <http://192.168.1.146:5060>>
>     DEBUG: dispatcher [dispatch.c:375]: add_dest2list(): dest [2/1]
>     <sip:192.168.1.146:5060 <http://192.168.1.146:5060>>
>     DEBUG: dispatcher [dispatch.c:375]: add_dest2list(): dest [2/2]
>     <sip:192.168.1.145:5060 <http://192.168.1.145:5060>>
>     DEBUG: dispatcher [dispatch.c:494]: reindex_dests(): found [2]
>     dest sets
>     DEBUG: dispatcher [dispatch.c:139]: ds_print_sets(): dst>> 2
>     sip:192.168.1.145:5060 <http://192.168.1.145:5060> 2 0 (,0,0)
>     DEBUG: dispatcher [dispatch.c:139]: ds_print_sets(): dst>> 2
>     sip:192.168.1.146:5060 <http://192.168.1.146:5060> 2 0 (,0,0)
>     DEBUG: dispatcher [dispatch.c:139]: ds_print_sets(): dst>> 1
>     sip:192.168.1.146:5060 <http://192.168.1.146:5060> 2 0 (,0,0)
>     DEBUG: dispatcher [dispatch.c:139]: ds_print_sets(): dst>> 1
>     sip:192.168.1.145:5060 <http://192.168.1.145:5060> 2 0 (,0,0)
>     DEBUG: dispatcher [dispatch.c:139]: ds_print_sets(): dst>> 1
>     sip:192.168.1.144:5060 <http://192.168.1.144:5060> 2 0 (,0,0)
>     DEBUG: dispatcher [dispatcher.c:347]: mod_init(): loaded
>     dispatching list
>
>     So, Kamailio give me set 1 and set 2 as per post-reindex_dests,
>     and failover is 192.168.1.144 for set 1, and 192.168.1.146 for set 2.
>
>     Is this the expected behavior?
>     Am I doing something wrong in configuration?
>
>     Thank you all in advance,
>
>     -giovanni
>
>
>     Sincerely,
>
>     Giovanni Maruzzelli
>     Cell : +39-347-2665618 <tel:%2B39-347-2665618>
>
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Book: SIP Routing With Kamailio - http://www.asipto.com
Kamailio Advanced Training, Sep 28-30, 2015, in Berlin - http://asipto.com/u/kat

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20150921/3413ea9b/attachment.html>


More information about the sr-users mailing list