[SR-Users] pseudo variables in strings

Daniel-Constantin Mierla miconda at gmail.com
Tue Apr 5 07:36:04 CEST 2016


I added pv_evalx() function in pv module which evaluates twice a string
containing variables. No time to test it, so any feedback is
appreciated. It will be also good to stress test it and check if there
is a memory leak for pkg, as the result for first evaluation needs to be
parsed again for other variables -- pv caching should prevent a leak,
but to be safe is good to test if plans are to use in production.

Cheers,
Daniel

On 04/04/16 07:35, Daniel-Constantin Mierla wrote:
>
> On 02/04/16 10:09, Juha Heinanen wrote:
>> Alex Balashov writes:
>>
>>> Yes, either by separating the PV elements, e.g.
>>>
>>> $var(x) = $fU + "abc";
>> Alex,
>>
>> I cannot do that, because the string that contains pvs is result of
>> a dp_translate call.
> Dialplan can evaluate variables, is it a special case you need to return
> variables and then evaluate after dp_translate() again?
>
> It might work by returning a lua script string that you can evaluate
> with app_lua().
>
> Cheers,
> Daniel
>
>>> ... or with the newer $_s() PV created for this purpose:
>>>
>>> $var(x) = $_s($fUabc);
>> No luck with that either.  This test
>>
>>     $var(pv_string) = "foo$var(pv)bar";
>>     $var(pv) = "car";
>>     $var(res_string) = $_s($var(pv_string));
>>     xlog("L_INFO", "res_string is '$var(res_string)'\n");
>>
>> produces to syslog:
>>
>> Apr  2 11:07:26 lohi /usr/bin/sip-proxy[24536]: INFO: res_string is 'foo$var(pv)bar'
>>
>> when I need to get 'foocarbar'.
>>
>> -- Juha
>>
>> _______________________________________________
>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>> sr-users at lists.sip-router.org
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla
http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio World Conference, Berlin, May 18-20, 2016 - http://www.kamailioworld.com




More information about the sr-users mailing list