Hi
Is there a way to remove an param from the top most rr header?
I add a rr param towards the B CPE to store some information which is sent back on the rr header of the reply from B.
So far this is what is intended and I also get this param in subsequent route headers from messages created by B and as the route header are remove towards A, this works fine.
Unfortunately, in a case of a reply, the parameter is passed to A which is then sending back the param in the route header which would make it somehow complicated to figure out which side sent that parameter. I'm only interested if sent from B.
So I wonder, is there a way to delete a rr param on replies to make sure I don't get it back in the ACK to the reply?
Hi You could try subst_hf() from textops to do it. I didn't find any simpler way to do it. It may be possible to do this with URI transformations, too, but I didn't experiment with those.
subst_hf("Record-Route", "/;zoink=[^;>]*//", "a");
It changed these header fields to these. Record-Route: sip:10.25.10.1;r2=on;lr;ftag=gK002f29d3;zoink=freddie;yoink=meatloaf Record-Route: sip:10.17.12.2;r2=on;lr;ftag=gK002f29d3;zoink=freddie
Record-Route: sip:10.25.10.1;r2=on;lr;ftag=gK002f29d3;yoink=meatloaf Record-Route: sip:10.17.12.2;r2=on;lr;ftag=gK002f29d3
By the way, the rr parameter for adding ftag to the RR header fields can later be used to see which direction (the is_direction() function) the request is going in, so you may not even need to change the Record-Route values if you use that. - https://kamailio.org/docs/modules/5.8.x/modules/rr.html#rr.p.append_fromtag_... - https://kamailio.org/docs/modules/5.8.x/modules/rr.html#rr.f.is_direction
James
On Fri, 13 Dec 2024 at 10:42, Benoît Panizzon via sr-users sr-users@lists.kamailio.org wrote:
Hi
Is there a way to remove an param from the top most rr header?
I add a rr param towards the B CPE to store some information which is sent back on the rr header of the reply from B.
So far this is what is intended and I also get this param in subsequent route headers from messages created by B and as the route header are remove towards A, this works fine.
Unfortunately, in a case of a reply, the parameter is passed to A which is then sending back the param in the route header which would make it somehow complicated to figure out which side sent that parameter. I'm only interested if sent from B.
So I wonder, is there a way to delete a rr param on replies to make sure I don't get it back in the ACK to the reply?
-- Mit freundlichen Grüssen
-Benoît Panizzon- @ HomeOffice und normal erreichbar
I m p r o W a r e A G - Leiter Commerce Kunden ______________________________________________________
Zurlindenstrasse 29 Tel +41 61 826 93 00 CH-4133 Pratteln Fax +41 61 826 93 01 Schweiz Web http://www.imp.ch ______________________________________________________ __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions -- sr-users@lists.kamailio.org To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender!
Hi James
I ended up first using:
$var(rr) = $(hfl(Record-Route){tobody.uri}{uri.param,rr}); to get my rr param I wanted to remove and then the s.rm function from textops.
And as I fear, there is no function to change 'one' header, I ended doing:
remove_hf("Record-Route");
And then re-insert the 'corrected' header in a while loop.
Well thinking about it just now, RR header should be at the beginning of he message, maybe I need to get $hflc and then do a reverse while loop and use insert_hf instead of append_hf
By the way, the rr parameter for adding ftag to the RR header fields can later be used to see which direction (the is_direction() function) the request is going in, so you may not even need to change the Record-Route values if you use that.
I am logging is_direction to find out how it exactly behaves. I also considered using this function but I am not yet sure i fully understand what it does, especially within replies.
Hi Benoît
The is_direction function works by checking the From tag in the From header and comparing it to the From tag in the Route header field. Mid-dialog requests that are in the opposite direction (from that of the original INVITE) have the To and From values swapped, so it's possible to tell from the Route header fields whether the mid-dialog request is from A to B or from B to A.
Anyway, getting the parameter, removing it, and then rebuilding the Route header fields may work for you. I don't think I'd use that, but it might work for you. You also need to be careful to not affect Route values that other proxy servers might have added. I didn't consider that in my first reply.
James
On Fri, 13 Dec 2024 at 15:32, Benoît Panizzon benoit.panizzon@imp.ch wrote:
Hi James
I ended up first using:
$var(rr) = $(hfl(Record-Route){tobody.uri}{uri.param,rr}); to get my rr param I wanted to remove and then the s.rm function from textops.
And as I fear, there is no function to change 'one' header, I ended doing:
remove_hf("Record-Route");
And then re-insert the 'corrected' header in a while loop.
Well thinking about it just now, RR header should be at the beginning of he message, maybe I need to get $hflc and then do a reverse while loop and use insert_hf instead of append_hf
By the way, the rr parameter for adding ftag to the RR header fields can later be used to see which direction (the is_direction() function) the request is going in, so you may not even need to change the Record-Route values if you use that.
I am logging is_direction to find out how it exactly behaves. I also considered using this function but I am not yet sure i fully understand what it does, especially within replies.
-- Mit freundlichen Grüssen
-Benoît Panizzon- @ HomeOffice und normal erreichbar
I m p r o W a r e A G - Leiter Commerce Kunden ______________________________________________________
Zurlindenstrasse 29 Tel +41 61 826 93 00 CH-4133 Pratteln Fax +41 61 826 93 01 Schweiz Web http://www.imp.ch ______________________________________________________
Hello Benoit,
the "is_direction" function is indeed the way to go if you just want to get the direction of a request. Its not needed to manually alter Record-Route headers.
The is_direction function only works on requests, not on replies.
Instead of altering the Record-Route header in the replies, what about just ignoring it when you are getting a request from the a-side? Or maybe encode a or b-side in the parameter name etc..
Cheers,
Henning
-----Original Message----- From: Benoît Panizzon via sr-users sr-users@lists.kamailio.org Sent: Friday, December 13, 2024 4:32 PM To: James Browne james@frideo.com Cc: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org; Benoît Panizzon benoit.panizzon@imp.ch Subject: [SR-Users] Re: How to remove rr param on a reply?
Hi James
I ended up first using:
$var(rr) = $(hfl(Record-Route){tobody.uri}{uri.param,rr}); to get my rr param I wanted to remove and then the s.rm function from textops.
And as I fear, there is no function to change 'one' header, I ended doing:
remove_hf("Record-Route");
And then re-insert the 'corrected' header in a while loop.
Well thinking about it just now, RR header should be at the beginning of he message, maybe I need to get $hflc and then do a reverse while loop and use insert_hf instead of append_hf
By the way, the rr parameter for adding ftag to the RR header fields can later be used to see which direction (the is_direction() function) the request is going in, so you may not even need to change the Record-Route values if you use that.
I am logging is_direction to find out how it exactly behaves. I also considered using this function but I am not yet sure i fully understand what it does, especially within replies.
-- Mit freundlichen Grüssen
-Benoît Panizzon- @ HomeOffice und normal erreichbar