[sr-dev] Why sip_msg_apply_changes can't be executed from BRANCH_FAILURE_ROUTE?

Daniel-Constantin Mierla miconda at gmail.com
Wed Jul 7 08:10:41 CEST 2021


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 at 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




More information about the sr-dev mailing list