Module: kamailio
Branch: master
Commit: 7558e50c551c172079d44a7a95774575aa5e5eea
URL:
https://github.com/kamailio/kamailio/commit/7558e50c551c172079d44a7a9577457…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-03-17T17:22:00+01:00
dmq: build_node_str() makes uri with transport if not udp
---
Modified: src/modules/dmq/dmqnode.c
---
Diff:
https://github.com/kamailio/kamailio/commit/7558e50c551c172079d44a7a9577457…
Patch:
https://github.com/kamailio/kamailio/commit/7558e50c551c172079d44a7a9577457…
---
diff --git a/src/modules/dmq/dmqnode.c b/src/modules/dmq/dmqnode.c
index 2eb3b1c373..edc42e1f27 100644
--- a/src/modules/dmq/dmqnode.c
+++ b/src/modules/dmq/dmqnode.c
@@ -397,8 +397,10 @@ int update_dmq_node_status(dmq_node_list_t *list, dmq_node_t *node,
int status)
*/
int build_node_str(dmq_node_t *node, char *buf, int buflen)
{
- /* sip:host:port;status=[status] */
+ /* sip:host:port;protocol=abcd;status=[status] */
int len = 0;
+ str sproto = STR_NULL;
+
if(buflen < node->orig_uri.len + 32) {
LM_ERR("no more space left for node string\n");
return -1;
@@ -411,6 +413,18 @@ int build_node_str(dmq_node_t *node, char *buf, int buflen)
len += 1;
memcpy(buf + len, node->uri.port.s, node->uri.port.len);
len += node->uri.port.len;
+ if(node->uri.proto!=PROTO_NONE && node->uri.proto!=PROTO_UDP
+ && node->uri.proto!=PROTO_OTHER) {
+ if(get_valid_proto_string(node->uri.proto, 1, 0, &sproto)<0) {
+ LM_WARN("unknown transport protocol - fall back to udp\n");
+ sproto.s = "udp";
+ sproto.len = 3;
+ }
+ memcpy(buf + len, TRANSPORT_PARAM, TRANSPORT_PARAM_LEN);
+ len += TRANSPORT_PARAM_LEN;
+ memcpy(buf + len, sproto.s, sproto.len);
+ len += sproto.len;
+ }
memcpy(buf + len, ";", 1);
len += 1;
memcpy(buf + len, "status=", 7);