Module: kamailio Branch: 4.2 Commit: 5e07d01aaae15d3441876d8ee154a53484d08682 URL: https://github.com/kamailio/kamailio/commit/5e07d01aaae15d3441876d8ee154a53484d08682
Author: Charles Chance <charles.cha...@sipcentric.com> Committer: Charles Chance <charles.cha...@sipcentric.com> Date: 2015-02-06T12:53:57Z dmq: add branches when replicating to multiple nodes - reported by Leonardo Arena (cherry picked from commit ff114281fc2f523ed7bf87ea31448ce7327fdf93) --- Modified: modules/dmq/dmq_funcs.c --- Diff: https://github.com/kamailio/kamailio/commit/5e07d01aaae15d3441876d8ee154a53484d08682.diff Patch: https://github.com/kamailio/kamailio/commit/5e07d01aaae15d3441876d8ee154a53484d08682.patch --- diff --git a/modules/dmq/dmq_funcs.c b/modules/dmq/dmq_funcs.c index 7430193..2ec32d2 100644 --- a/modules/dmq/dmq_funcs.c +++ b/modules/dmq/dmq_funcs.c @@ -24,6 +24,7 @@ #include "dmq_funcs.h" #include "notification_peer.h" +#include "../../dset.h" /** * @brief register a DMQ peer @@ -385,6 +386,7 @@ int cfg_dmq_t_replicate(struct sip_msg* msg, char* s) dmq_node_t* node; struct socket_info* sock; int i = 0; + int first = 1; /* avoid loops - do not replicate if message has come from another node * (override if optional parameter is set) @@ -413,10 +415,22 @@ int cfg_dmq_t_replicate(struct sip_msg* msg, char* s) node = node->next; continue; } + + if (!first) { + if (append_branch(msg, 0, 0, 0, Q_UNSPECIFIED, 0, sock, 0, 0, 0, 0) == -1) { + LM_ERR("failed to append a branch\n"); + node = node->next; + continue; + } + } else { + first = 0; + } + if(tmb.t_replicate(msg, &node->orig_uri) < 0) { LM_ERR("error calling t_replicate\n"); goto error; } + node = node->next; } lock_release(&node_list->lock); _______________________________________________ sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev