Thank you Daniel for the info.
Very helpful since I have another scenario where I need to "insert"
digits based on the pattern match.
--
Zahid
On Aug 2, 2007, at 6:05 AM, Daniel-Constantin Mierla wrote:
Hello,
indeed there seems to be an issue with interpreting the strings in
config file, before getting to avpops function parameters. When the
config file is parsed, inside the string, \[0-7]{2,3} is
interpreted as a ASCII code in octal base and replaced with its
code. Try:
avp_subst("$avp(s:fromuri)","/^(sip:)([134][0-9]{4}@.*)/\\\x01121285
\2/");
However, in 1.2 you can achieve same by:
$avp(s:fromuri) ="sip:121285"+$(avp(s:fromuri){uri.user}) + "@" + $
(avp(s:fromuri){uri.domain});
Cheers,
Daniel
On 08/01/07 19:06, Zahid Mehmood wrote:
> Hi,
> I am trying to rewrite a 5 digit number to a 11 digit number by
> adding a prefix "121285". To achieve that I use the following:
>
>
> avp_subst("$avp(s:fromuri)","/^(sip:)([134][0-9]{4}@.*)/\1+121285
> \2/");
>
> in openser.log new fromuri = sip:+12128512345@host.columbia.edu
>
> It works fine because of the "+" after \1
>
> This avp_subst does not work properly if the "+" is taken out.
> How can I use "\1" followed by another digit?
>
> avp_subst("$avp(s:fromuri)","/^(sip:)([134][0-9]{4}@.*)/\1121285
> \2/");
>
> in openser.log: new fromuri = J128512345(a)host.columbia.edu
>
>
> What am i doing wrong?
>
> Thanks in advance for your help.
>