Hello,
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?
(Background: I would like to make the lcr-module a bit more flexible: read "template"-string for fromuri, touri, ruri from database instead of ruri-strip, ruri-prefix etc.)
Kind Regards Jasmin
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
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@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