Hello,

you have to set the priority field for each destination to ensure a particular order there. While with text file one can consider the order of appearance, this is no longer valid for database -- the order in a table can be different that what is returned by "select * ...", therefore the priority field is the one that matter here.

Cheers,
Daniel

On 26.02.19 16:40, Denys Pozniak wrote:

kamcmd dispatcher.list shows gateways in reverse order (comparing to the file) and "last hope" gw is the last one here (URI: sip:10.6.3.122:5060).

                SET: {
                        ID: 4
                        TARGETS: {
                                DEST: {
                                        URI: sip:10.6.3.5:5060
                                        FLAGS: AX
                                        PRIORITY: 0
                                }
                                DEST: {
                                        URI: sip:10.6.3.4:5060
                                        FLAGS: AX
                                        PRIORITY: 0
                                }
                                DEST: {
                                        URI: sip:10.6.3.3:5060
                                        FLAGS: AX
                                        PRIORITY: 0
                                }
                                DEST: {
                                        URI: sip:10.6.3.2:5060
                                        FLAGS: AX
                                        PRIORITY: 0
                                }
                                DEST: {
                                        URI: sip:10.6.3.1:5060
                                        FLAGS: AX
                                        PRIORITY: 0
                                }
                                DEST: {
                                        URI: sip:10.6.3.122:5060
                                        FLAGS: AX
                                        PRIORITY: 0
                                }
                        }
                }



вт, 26 февр. 2019 г. в 17:24, Denys Pozniak <denys.pozniak@gmail.com>:
Hello!

I use dispatcher with algorithm=1 (hashing over from URI) with module parameter use_default=1.
So I am expecting that last string in dispatcher.list for specific set will be the "last hope" for call routing.

dispatcher.list
..

But as I see from logs dispatcher module takes first string as the "last hope":

xlog("L_WARN", "TEST-- $(avp(AVP_DST)[0]) $(avp(AVP_DST)[1]) $(avp(AVP_DST)[2]) $(avp(AVP_DST)[3]) $(avp(AVP_DST)[4])  $(avp(AVP_DST)[5])  $(avp(AVP_DST)[6]) \n");

Feb 26 16:11:39 kamailio-2 /usr/sbin/kamailio[28156]: WARNING: <script>: TEST-- sip:10.6.3.4:5060 sip:10.6.3.3:5060 sip:10.6.3.2:5060 sip:10.6.3.1:5060 sip:10.6.3.5:5060  sip:10.6.3.122:5060  <null>
Feb 26 16:11:58 kamailio-2 /usr/sbin/kamailio[28156]: WARNING: <script>: TEST-- sip:10.6.3.3:5060 sip:10.6.3.2:5060 sip:10.6.3.1:5060 sip:10.6.3.5:5060 sip:10.6.3.4:5060  sip:10.6.3.122:5060  <null>
Feb 26 16:11:59 kamailio-2 /usr/sbin/kamailio[28156]: WARNING: <script>: TEST-- sip:10.6.3.2:5060 sip:10.6.3.1:5060 sip:10.6.3.5:5060 sip:10.6.3.4:5060 sip:10.6.3.3:5060  sip:10.6.3.122:5060  <null>
Feb 26 16:12:08 kamailio-2 /usr/sbin/kamailio[28156]: WARNING: <script>: TEST-- sip:10.6.3.1:5060 sip:10.6.3.5:5060 sip:10.6.3.4:5060 sip:10.6.3.3:5060 sip:10.6.3.2:5060  sip:10.6.3.122:5060  <null>

According to the module explanation it should be "the last address in destination set is used as a final option to send the request to"


version: kamailio 4.4.2 (x86_64/linux) 892ad6
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, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, 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: 892ad6
compiled on 12:58:38 Aug 28 2017 with gcc 4.8.5


-- 

BR,
Denys Pozniak




--

BR,
Denys Pozniak



_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio World Conference - May 6-8, 2019 -- www.kamailioworld.com
Kamailio Advanced Training - Mar 4-6, 2019 in Berlin; Mar 25-27, 2019, in Washington, DC, USA -- www.asipto.com