[SR-Users] simple way to access RR headers/uris and to remove them

Klaus Darilion klaus.mailinglists at pernau.at
Tue Jun 18 11:46:35 CEST 2013


done

http://www.kamailio.org/wiki/tutorials/faq/main#how_to_remove_a_single_header_

On 06.06.2013 10:33, Daniel-Constantin Mierla wrote:
> Hello,
>
> it may be useful to add it in the faq or mini-howtos on the wiki,
> wherever you consider more appropriate:
>
> - https://www.kamailio.org/wiki/tutorials/faq/main
> - https://www.kamailio.org/wiki/tutorials/mini-howto-admin/main
>
> Cheers,
> Daniel
>
> On 6/4/13 6:54 PM, Klaus Darilion wrote:
>> 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
>>
>> _______________________________________________
>> 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