[OpenSIPS-Users] Stripping unwanted hex characters from headers

Răzvan Crainea razvan at opensips.org
Mon Mar 18 15:28:40 CET 2013


Hi, Jock

This doesn't seem to be an OpenSIPS issue, but rather a regular 
expression one :). The 'replace' and 'substr' functions in OpenSIPS use 
the POSIX regular expressions[1]. I am not an regexp master, and I don't 
know how they work in perl either, so I can't conclude if you can 
achieve this in OpenSIPS, but I think the link below is a good starting 
point.

[1] http://man7.org/linux/man-pages/man7/regex.7.html

Best regards,

Razvan Crainea
OpenSIPS Core Developer
http://www.opensips-solutions.com

On 03/15/2013 03:23 PM, Jock McKechnie wrote:
> Greetings;
>
> I've got a bit of an oddity. We have a TDM media convertor putting a
> $00 (NUL) at the end of the Remote-Party-ID header which is killing
> one of our proprietary (and unfixable) SIP stacks. For the life of me
> I can't figure out how to get OpenSIPS to strip this - it appears like
> the textops features don't work with a hex character like it would in,
> say, perl... but I might be using the tooling completely wrong.
>
> I've tried the following without apparent success:
> if (is_present_hf("Remote-Party-ID")) {
>     # Either:
>     substr('/\x00//g');
>
>     # Or:
>     replace("\x00", "");
>     }
>
> Am I using this completely incorrectly? Or does OpenSIPS not work
> escape hex characters in this manner? Or not at all?
>
> My thanks for your time!
>
>   - Jock
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users




More information about the Users mailing list