El Miércoles, 23 de Diciembre de 2009, Brandon
Armstead escribió:
Hello,
I'm attempting to use the following in Kamailio:
$(hdr(from){re.subst,/(.*?);(.*)/\1/}) --- however it does not match /
replace, with this from header sample:
From:<sip:714364XXXX@XX.XX.XX.XX
;pstn-params=808282808882;cpc=unknown>;tag=gK0b53f6d9
However if this is fully pcre compatible, then I am a bit lost as I've
checked the results in php, perl, and python produces:
From:<sip:714364XXXX@XX.XX.XX.XX (expected result)
However, Kamailio does not match / replace / etc using the following:
xlog("L_INFO", "Test From Header Regex:
$(hdr(from){re.subst,/(.*?);(.*)/\1/})");
You are right. However, could you try by replacing "(.*?)" with
"([^;]*)" ?
The result should be the same.
I suspect that "*?" is not supported in Kamailio regular expressions.
the re.subst transformation uses Posix regexp for matching, only the
format of the command is perl-like. I implemented this because textops
has no dependency of extra libraries than core and I wanted to keep it so.
Maybe is good to add a pcre.subst transformation in regex module to be
able to use extended regexp formats given by libpcre.
Cheers,
Daniel
--
Daniel-Constantin Mierla
*