[sr-dev] [kamailio/kamailio] dmq & dmq_usrloc : let server_address & notification_address use the same IP and port (#1109)

张顺通 notifications at github.com
Tue May 2 05:22:18 CEST 2017


if server_address & notification_address use same ip and different port(see below),in dmq.list_nodes will have two node for one kamailio(one node for notify_server 5360 and one for dmq local 5260), question is when send REGISTER to port 5160, REGISTER will copy from port 5260 to 5360 on the same kamailio,this is not what i want.

dmq & dmq_usrloc cfg(**different port**):
listen=eth0:5160
listen=eth0:5260
listen=eth0:5360

modparam("dmq", "server_address", "sip:10.6.1.200:5260")
modparam("dmq", "notification_address", "sip:10.6.1.200:5360")
modparam("dmq", "multi_notify", 1)
modparam("dmq", "num_workers", 2)

# ----- dmq_usrloc params -----
modparam("dmq_usrloc", "enable", 1)
modparam("dmq_usrloc", "sync", 1)
modparam("dmq_usrloc", "batch_msg_contacts", 50)
modparam("dmq_usrloc", "batch_msg_size", 500000)

And when I let server_address & notification_address use same IP & Port, check in function add_server_and_notify will report error("error adding notification node"),child_init will return failed.

So I suggest that the following changes, let server_address & notification_address can use the same IP and port:
@@ -315,11 +315,15 @@ dmq_node_t* add_server_and_notify(str *paddr)
                for (index = 0; index < host_cnt; index++) {
                        pstr->s = puri_list [index];
                        pstr->len = strlen (puri_list [index]);
-                       if (!find_dmq_node_uri(node_list, pstr)) { // check for duplicates
+                       if (!(pnode = find_dmq_node_uri(node_list, pstr))) { // check for duplicates
                                pnode = add_dmq_node (node_list, pstr);
                                if (pnode && !pfirst)
                                        { pfirst = pnode; }
-                       }
+                       } else {
+                             if (!pfirst) {
+                                     pfirst = pnode;
+                             }
+                       }
                }
        }

After Such A change,  dmq.list_nodes will only have on node for (notify_server & server_addr(local)).
Is there any problem with this modification? Thanks


$./sbin/kamailio -v
version: kamailio 5.0.1 (x86_64/linux) 
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, 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.



-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1109
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20170501/be15de2b/attachment.html>


More information about the sr-dev mailing list