Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dmq & dmq_usrloc : let server_address & notification_address use the same IP and port #1109

Closed
zhangst opened this issue May 2, 2017 · 2 comments

Comments

@zhangst
Copy link
Contributor

zhangst commented May 2, 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)

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.
@charlesrchance
Copy link
Member

Why do you need to set server_address and notification_address to be the same kamailio instance? Can you explain a little more your use case and what you are trying to achieve?

@zhangst
Copy link
Contributor Author

zhangst commented May 2, 2017

For example, I have four kamailio instance for register, one kamailio instance recv REGISTER, it copy to other three kamailio instance by dmq_usrloc.
In this scene, I set notification_address to domain sip:ka.ns.com:5060 which resolve to all for kamailio instance(which recv REGISTER).In this way, I do not need to build a separate kamailio cluster only for notification server.
The above test result, server_address & notification_address use the same IP and different port, one kamailio instance recv REGISTER will copy the reg info to itself by dmq_usrloc, this will make flag FL_RPL set to ucontact_t.
Thanks for the reply @charlesrchance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants