[SR-Users] Use AVP as regex in avp_subst

Daniel-Constantin Mierla miconda at gmail.com
Thu Jul 8 10:55:37 CEST 2010


Hello,

On 7/7/10 11:06 PM, Uriel Rozenbaum wrote:
> Hey guys,
>
> I'm using Kamailio 1.5.3-notls and need to apply some re operation to an AVP.
>
> The problem I have is that my re expression is held in an AVP, so the
> parser is not recognizing it :(
>
> Would it be very hard to change that behavior? Any ideas/tips to implement?
>
> This code
>    route[16]
>    {
>      ...
>    avp_subst("$avp(s:ANI)/$avp(s:ANIegress)", "$avp(s:carrierAniRegex)");
>      ...
>    }
>
> returns this error
>    ERROR:avpops:fixup_subst: avpops: bad subst re $avp(s:carrierAniRegex)
>
> This code
> route[16]
>    {
>      ...
>    avp_subst("$avp(s:ANI)/$avp(s:ANIegress)", $avp(s:carrierAniRegex));
>      ...
>    }
>
> returns this error
>    CRITICAL:core:yyerror: parse error in config file, line 751, column
> 51-74: syntax error
>    CRITICAL:core:yyerror: parse error in config file, line 751, column
> 74-75: bad arguments
>
> Do you think some other way I can achieve this? Be aware I'm using
> SQLops to get realtime the value of the expression...
>    

avp_subst() cannot help here, there is no support for taking the 
substitution expression from a variable.

What you can do in 1.5 is either look at dialplan to see if it fits your 
needs (it can do such substitution with expressions taken from db at 
startup, which can be reloaded at runtime), otherwise try using perl 
module (or exec in 1.5+ and lua/python in devel).

Cheers,
Daniel

-- 
Daniel-Constantin Mierla
http://www.asipto.com/




More information about the sr-users mailing list