Module: kamailio
Branch: master
Commit: a9a8bb31ed8f3d08579fc1d8b4e3b598c77c93be
URL:
https://github.com/kamailio/kamailio/commit/a9a8bb31ed8f3d08579fc1d8b4e3b59…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-04-21T10:49:39+02:00
dmq: exposed the server socket to modparam list
---
Modified: src/modules/dmq/dmq.c
---
Diff:
https://github.com/kamailio/kamailio/commit/a9a8bb31ed8f3d08579fc1d8b4e3b59…
Patch:
https://github.com/kamailio/kamailio/commit/a9a8bb31ed8f3d08579fc1d8b4e3b59…
---
diff --git a/src/modules/dmq/dmq.c b/src/modules/dmq/dmq.c
index 27e950e472..fea60e0cc4 100644
--- a/src/modules/dmq/dmq.c
+++ b/src/modules/dmq/dmq.c
@@ -118,6 +118,7 @@ static param_export_t params[] = {
{"num_workers", INT_PARAM, &dmq_num_workers},
{"ping_interval", INT_PARAM, &dmq_ping_interval},
{"server_address", PARAM_STR, &dmq_server_address},
+ {"server_socket", PARAM_STR, &dmq_server_socket},
{"notification_address", PARAM_STR|USE_FUNC_PARAM,
dmq_add_notification_address},
{"notification_channel", PARAM_STR, &dmq_notification_channel},
{"multi_notify", INT_PARAM, &dmq_multi_notify},
@@ -229,10 +230,12 @@ static int mod_init(void)
return -1;
}
- /* create socket string out of the server_uri */
- if(make_socket_str_from_uri(&dmq_server_uri, &dmq_server_socket) < 0) {
- LM_ERR("failed to create socket out of server_uri\n");
- return -1;
+ if(dmq_server_socket.s==NULL || dmq_server_socket.len<=0) {
+ /* create socket string out of the server_uri */
+ if(make_socket_str_from_uri(&dmq_server_uri, &dmq_server_socket) < 0) {
+ LM_ERR("failed to create socket out of server_uri\n");
+ return -1;
+ }
}
if(lookup_local_socket(&dmq_server_socket) == NULL) {
LM_ERR("server_uri is not a socket the proxy is listening on\n");
@@ -354,9 +357,6 @@ static void destroy(void)
dmq_self_node->status = DMQ_NODE_DISABLED;
request_nodelist(dmq_notification_node, 1);
}
- if(dmq_server_socket.s) {
- pkg_free(dmq_server_socket.s);
- }
if(dmq_init_callback_done) {
shm_free(dmq_init_callback_done);
}