David, There is a difference between sequential branches and parallel branches. Just because you only have one branch at a time, does not mean that you aren’t creating multiple branches, as you’ve seen from your working script.
This solution is almost the best way to do it, except that removing the header in the second branch route is not necessary. Message changes made in branch route only exist in that branch, see the note here [1]. So after the 302 reply the header will already be gone from the next branch. [1] - https://opensips.org/docs/modules/3.2.x/sipmsgops.html#func_append_hf Ben Newlin From: Users <[email protected]> on behalf of David Villasmil <[email protected]> Date: Monday, June 14, 2021 at 7:43 PM To: OpenSIPS users mailling list <[email protected]> Subject: Re: [OpenSIPS-Users] Remove previously added header Ok i stumbled on to your email from back 2009 asking just about the same thing (https://users.opensips.narkive.com/W78SWsO9/opensips-users-remove-hf-doesn-t-always-work<https://users.opensips.narkive.com/W78SWsO9/opensips-users-remove-hf-doesn-t-always-work>) I ended up doing t_on_branch("1") # Add the header before sending it out the parameter server branch_route[1] { append_hf("X-MyHeader: 1\r\n"); } then when actually sending it out to the termination provider: t_on_branch("2"); # Remove the header before seding it out to the termination branch_route[2] { remove_hf("X-MyHeader"); } That's working perfectly! Is this right or is there a more efficient/easier way to do it? Thanks! Regards, David Villasmil email: [email protected]<mailto:[email protected]> phone: +34669448337 On Tue, Jun 15, 2021 at 12:10 AM David Villasmil <[email protected]<mailto:[email protected]>> wrote: Thanks Jeff, That's not going to work for me, I don't want to add new branches. What I'm doing is forwarding the call to a sip server that replies with a 302 and some extra headers. I then need to get these headers and continue routing normally, one single branch. Regards, David Villasmil email: [email protected]<mailto:[email protected]> phone: +34669448337 On Mon, Jun 14, 2021 at 11:12 PM Jeff Pyle <[email protected]<mailto:[email protected]>> wrote: Add it in a branch_route. That way if you have to route advance, it'll already be gone because you'll be on a new branch. - Jeff On Mon, Jun 14, 2021 at 5:52 PM David Villasmil <[email protected]<mailto:[email protected]>> wrote: Hello guys, So, I'm appending a header (append_hf("header")) to a forward. That forward fails and I'm trying to remove it with remove_hf("header"), but it's not getting removed for some reason, what am I doing wrong? Thanks everyone! David Villasmil email: [email protected]<mailto:[email protected]> phone: +34669448337 _______________________________________________ Users mailing list [email protected]<mailto:[email protected]> http://lists.opensips.org/cgi-bin/mailman/listinfo/users<http://lists.opensips.org/cgi-bin/mailman/listinfo/users> _______________________________________________ Users mailing list [email protected]<mailto:[email protected]> http://lists.opensips.org/cgi-bin/mailman/listinfo/users<http://lists.opensips.org/cgi-bin/mailman/listinfo/users>
_______________________________________________ Users mailing list [email protected] http://lists.opensips.org/cgi-bin/mailman/listinfo/users
