[SR-Users] remove_hf_re error on startup

Grant Bagdasarian gb at cm.nl
Tue Jun 27 11:30:27 CEST 2017


Too bad!
Your workaround works. 
I'll use that instead.
Thanks!

-----Original Message-----
From: sr-users [mailto:sr-users-bounces at lists.kamailio.org] On Behalf Of Daniel Tryba
Sent: dinsdag 27 juni 2017 11:09
To: Kamailio (SER) - Users Mailing List <sr-users at lists.kamailio.org>
Subject: Re: [SR-Users] remove_hf_re error on startup

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");
}


_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users at lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


More information about the sr-users mailing list