[sr-dev] Append branches in module
Daniel-Constantin Mierla
miconda at gmail.com
Fri Feb 6 11:01:23 CET 2015
If you want to replicate the request keeping same r-uri on all
replications, then it is fine.
Cheers,
Daniel
On 05/02/15 12:31, Charles Chance wrote:
>
> Hi,
>
> No, the original r-uri is untouched. We loop over each node, adding a
> branch then calling t_replicate() from the tm API, passing the
> destination uri as a parameter.
>
> We have to add a branch for each replication node, otherwise tm
> complains there are none available.
>
> The API method t_replicate() maps to t_replicate_uri(), which
> eventually calls t_relay_to(), setting the replicate/local_trans bit
> so that replies are ignored.
>
> Cheers,
>
> Charles
>
>
> On 5 Feb 2015 10:54, "Daniel-Constantin Mierla" <miconda at gmail.com
> <mailto:miconda at gmail.com>> wrote:
>
> Hello,
>
> so how is the full code for this case, first you change the r-uri
> and then call append_branch()?
>
> Cheers,
> Daniel
>
> On 05/02/15 11:46, Charles Chance wrote:
>>
>> Hi Daniel,
>>
>> I believe this is expected, since we are simply replicating the
>> original message to other (multiple, hence the additional
>> branches) nodes so they have a copy. Should we in fact change the
>> r-uri in this case? I'm not sure. It all seems to test ok.
>>
>> All the best,
>>
>> Charles
>>
>> On 5 Feb 2015 09:41, "Daniel-Constantin Mierla"
>> <miconda at gmail.com <mailto:miconda at gmail.com>> wrote:
>>
>> Hello,
>>
>> haven't looked at the whole function, but what you are using
>> now is adding the r-uri as a branch. Do you want that? At the
>> end it might be that the r-ruri and the last branch have the
>> same address.
>>
>> You can look inside registrar module at lookup() function to
>> see how first location record is added as r-uri and the rest
>> as branches.
>>
>> Cheers,
>> Daniel
>>
>> On 04/02/15 13:29, Charles Chance wrote:
>>> Hi All,
>>>
>>> Can anyone confirm, is this safe? Primary use case is
>>> replication of REGISTER after local save().
>>>
>>>
>>> diff --git a/modules/dmq/dmq_funcs.c b/modules/dmq/dmq_funcs.c
>>> index b31deba..a3611e8 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);
>>>
>>>
>>> Many thanks,
>>>
>>> Charles
>>>
>>>
>>> www.sipcentric.com <http://www.sipcentric.com/>
>>>
>>> Follow us on twitter @sipcentric <http://twitter.com/sipcentric>
>>>
>>> Sipcentric Ltd. Company registered in England & Wales no.
>>> 7365592. Registered office: Faraday Wharf, Innovation
>>> Birmingham Campus, Holt Street, Birmingham Science Park,
>>> Birmingham B7 4BB.
>>>
>>>
>>> _______________________________________________
>>> sr-dev mailing list
>>> sr-dev at lists.sip-router.org <mailto:sr-dev at lists.sip-router.org>
>>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
>>
>> --
>> Daniel-Constantin Mierla
>> http://twitter.com/#!/miconda <http://twitter.com/#%21/miconda> - http://www.linkedin.com/in/miconda
>> Kamailio World Conference, May 27-29, 2015
>> Berlin, Germany - http://www.kamailioworld.com
>>
>>
>> _______________________________________________
>> sr-dev mailing list
>> sr-dev at lists.sip-router.org <mailto:sr-dev at lists.sip-router.org>
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
>>
>>
>> www.sipcentric.com <http://www.sipcentric.com/>
>>
>> Follow us on twitter @sipcentric <http://twitter.com/sipcentric>
>>
>> Sipcentric Ltd. Company registered in England & Wales no.
>> 7365592. Registered office: Faraday Wharf, Innovation Birmingham
>> Campus, Holt Street, Birmingham Science Park, Birmingham B7 4BB.
>
> --
> Daniel-Constantin Mierla
> http://twitter.com/#!/miconda <http://twitter.com/#%21/miconda> - http://www.linkedin.com/in/miconda
> Kamailio World Conference, May 27-29, 2015
> Berlin, Germany - http://www.kamailioworld.com
>
>
> www.sipcentric.com <http://www.sipcentric.com/>
>
> Follow us on twitter @sipcentric <http://twitter.com/sipcentric>
>
> Sipcentric Ltd. Company registered in England & Wales no.
> 7365592. Registered office: Faraday Wharf, Innovation Birmingham
> Campus, Holt Street, Birmingham Science Park, Birmingham B7 4BB.
--
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio World Conference, May 27-29, 2015
Berlin, Germany - http://www.kamailioworld.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20150206/48c6fe0f/attachment.html>
More information about the sr-dev
mailing list