For the records, I just pushed a patch implementing remove_hf_exp(match,
skip) in textops module, in which allows to provide two expressions: one
to match the header for removal and one to skip the header. Will be in
the next major release.
Otherwise, besides the workaround presented in this discussion, see also
keep_hf() from textopsx, it may help in some similar situations.
Cheers,
Daniel
On 27.06.17 11:30, Grant Bagdasarian wrote:
Too bad!
Your workaround works.
I'll use that instead.
Thanks!
-----Original Message-----
From: sr-users [mailto:sr-users-bounces@lists.kamailio.org] On Behalf Of Daniel Tryba
Sent: dinsdag 27 juni 2017 11:09
To: Kamailio (SER) - Users Mailing List <sr-users(a)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(a)lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users(a)lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla
www.twitter.com/miconda --
www.linkedin.com/in/miconda
Kamailio Advanced Training -
www.asipto.com
Kamailio World Conference -
www.kamailioworld.com