[SR-Users] remove_hf_re error on startup
Daniel Tryba
d.tryba at pocos.nl
Tue Jun 27 11:09:00 CEST 2017
On Tue, Jun 27, 2017 at 08:48:07AM +0000, Grant Bagdasarian wrote:
> I'm trying to remove all custom headers starting with X-, except a
> certain header, but Kamailio won't start due to an error. ERROR:
> <core> [route.c:1154]: fix_actions(): fixing failed (code=-1) at
> cfg:/etc/kamailio/kamailio.cfg:455
>
> remove_hf_re("^(?!X-ThisHeaderShouldNotBeRemoved)X-.*") or
> remove_hf_re("^(?!X- ThisHeaderShouldNotBeRemoved)X-")
>
> This is valid regex according to https://regex101.com/
>
> Any idea's why this won't compile?
Maybe because kamailio uses a regular expression lib that doesn't
support this syntax (since there is a seperate regex module that
supports PCRE it implies the "standard" regexes don't).
Easy work around is to remove all X- headers and add them again,
something like:
remove_hf_re("^X-");
if(is_present_hf("X-ThisHeaderShouldNotBeRemoved"))
{
append_hf("X-ThisHeaderShouldNotBeRemoved: $(hdr(X-ThisHeaderShouldNotBeRemoved))\r\n");
}
More information about the sr-users
mailing list