Hello,

 

does you actually tried it without msg_apply_changes? This are the actual docs:

 

“Note: it may be required that msg_apply_changes() from textopsx module has to be executed if there are other operations over the new body.”

 

So I think if you do not need any further modifications on the new body, it should be fine.

 

Cheers,

 

Henning

 

--

Henning Westerholt – https://skalatan.de/blog/

Kamailio services – https://gilawa.com

 

From: sr-dev <sr-dev-bounces@lists.kamailio.org> On Behalf Of Ivan Ribakov
Sent: Monday, July 19, 2021 4:09 PM
To: sr-dev@lists.kamailio.org
Subject: Re: [sr-dev] Why sip_msg_apply_changes can't be executed from BRANCH_FAILURE_ROUTE?

 

Still looking for an answer to how make body multipart for each of the forked INVITEs or a confirmation of the fact that this can not be done due to the complications around TX + msg_apply_changes().

 

Regards,

Ivan



On 14 Jul 2021, at 13:24, Ivan Ribakov <i.ribakov@zaleos.net> wrote:

 

Does anyone have any idea about this?



On 7 Jul 2021, at 15:04, Ivan Ribakov <i.ribakov@zaleos.net> wrote:

 

Hi Daniel,

 

According to textops module documentation, use of “set_body_multipart” requires the execution of “msg_apply_changes()” (tested) - https://kamailio.org/docs/modules/5.2.x/modules/textops.html#textops.f.set_body_multipart

 

Also tested patching Kamailio to allow execution of “msg_apply_changes()” from branch route but that caused a core dump so didn’t look further in that direction. 

 

Can you recommend a way to add different body parts to egress INVITEs depending on the branch?

 

Regards,

Ivan



On 7 Jul 2021, at 08:10, Daniel-Constantin Mierla <miconda@gmail.com> wrote:

 

Hello,

you do not need to use explicitly msg_apply_changes(), the modifications
done to sip message are applied when it is sent out.

The restriction to use msg_apply_changes() after transaction is created
comes from the complexity of transaction structure and its states. There
can be retransmissions at various stages for outgoing branches, internal
callbacks executed, timer checks, ... referencing to the message that
created the transaction. msg_apply_changes() will change it, impacting
everything.

But again, you can add/remove headers, etc ... in branch routes and
changes will be applied when sending out.

Cheers,
Daniel

On 06.07.21 15:34, Ivan Ribakov wrote:

Hi all,

I need to modify headers and body of the ingress INVITE in the BRANCH_FAILURE_ROUTE block to reflect failure to deliver message to the first destination and include some additional information. However checking the documentation of the “sip_msg_apply_changes” (https://github.com/kamailio/kamailio/blob/master/src/core/msg_translator.c#L3342-L3345) I can see that it can only be executed from request and reply routes. That seems overly restrictive. Can someone shine some light on why is that and whether it’s safe to patch this part of the code to allow function execution from  BRANCH_FAILURE_ROUTE as well?

Thanks in advance,
Ivan
_______________________________________________
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


--
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda