[sr-dev] runtime pv evaluation

Jasmin Schnatterbeck js at data-cmr.net
Thu May 3 23:33:08 CEST 2012


Hi Henning,

thanks for your message.

Unfortunately the pv_printf function is not what I am looking for.

When the pv $var(tmp) _contains_ the string "from is $fu and to-uri-user 
is $(tu{uri.user}) and cl is $cl"

and I use pv_printf:

pv_printf("$var(tmp2)","$var(tmp)");

Then - as far as I understand pv_printf(?) - $var(tmp2) contains
"from is $fu and to-uri-user is $(tu{uri.user}) and cl is $cl"
and not:
"from is sip:user at example.net and to-uri-user is user2 and cl is 1324"

So I need something like an "eval"-function, that
1. evaluates the string in the argument (as pv_printf does it)
2. evalutes the resulting string again (in the same way)

Kind Regards
Jasmin

Am 03.05.2012 18:51, schrieb Henning Westerholt:
> On Friday 27 April 2012, Jasmin Schnatterbeck wrote:
>> currently I am looking for an option to evaluate a string with
>> pseudo-variables at script runtime.
>>
>> For example when reading the following string (in script) from database
>> "from is $fu and to-uri-user is $(tu{uri.user}) and cl is $cl"
>> into a pseudo-variable $var(tmp)
>> I want kamailio to parse the _content_ of $var(tmp): replace the
>> "inside"-pvs with their values and perform transformations.
>>
>> Is there a function exported to script, that could do that?
>
> Hi Jasmin,
>
> maybe this is what you're looking for (avp_printf):
>
> http://kamailio.org/docs/modules/3.2.x/modules/avpops.html#id2496766
>
> Viele Grüße/ best regards,
>
> Henning Westerholt



More information about the sr-dev mailing list