[SR-Users] simple way to access RR headers/uris and to remove them
Klaus Darilion
klaus.mailinglists at pernau.at
Tue Jun 4 18:54:58 CEST 2013
Finally I found it myself. For the records:
To address a certain header (regardless if headers are in a single line
or in separate lines) use the @hf_value select. The trick is to load the
textopsx module (this select used to be in ser's textops module). Note,
header names must use '_' instead of '-'.
To delete or manipulate a certain header also use the functions from the
textopsx module, e.g: remove_hf_value(). Note, here '-' is used for
headers with '-'
For example, incoming message:
Record-Route: <sip:1.1.1.1;lr=on;nat=yes>
Record-Route: <sip:2.2.2.2:5060;lr;transport=udp>,
<sip:3.3.3.3:22506;lr;transport=udp>
Dump all headers:
xlog("$sel(@hf_value.Record_Route)");
Dump the first header:
xlog("$sel(@hf_value.Record_Route[1])");
Dump the second last header:
xlog("$sel(@hf_value.Record_Route[-2])");
Remove the last header:
remove_hf_value("Record-Route[-1]");
or in above case:
remove_hf_value("Record-Route[3]");
regards
Klaus
On 04.06.2013 17:18, Klaus Darilion wrote:
> Hi!
>
> Is there a simple way to:
> - retrieve the RR headers (or Route/Contact ...) and to
> - selectively remove them?
>
> E.g. retrieve <2> and delete <3>
>
> I do not want to care about the format, eg:
> Record-Route: <1>, <2>, <3>
> or
> Record-Route: <1>
> Record-Route: <2>
> Record-Route: <3>
>
> Thanks
> Klaus
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
More information about the sr-users
mailing list