[SR-Users] Converting to kemi

Daniel-Constantin Mierla miconda at gmail.com
Sat Aug 19 07:58:31 CEST 2017


Hello,

KSR.pv.get("$T_branch_idx]") has a typo, the ']'at the end is wrong. I
think I corrected in some of the examples.

The KSR.pv.get() is working with a single variable.

There is a variable that evaluates a string with variables:
 
  -
https://www.kamailio.org/wiki/cookbooks/5.0.x/pseudovariables#s_format_-_evaluate_dynamic_format

There is also pv_printf(), but not yet exported to kemi -- will do it soon.

With devel version, xhttp can call its callback for event route in kemi,
see:

  -
http://www.kamailio.org/docs/modules/5.1.x/modules/xhttp.html#xhttp.p.event_callback

In general, when a module is executing event_route blocks, look for
event_callback parameter that should be defined with the name of the
function from kemi script to be executed.

No much testing was done there, so feedback is appreciated.

Cheers,
Daniel

On 18.08.17 21:21, James Cloos wrote:
> [I see I posted this to -dev instead of -users; fixing that -JimC]
>
> I'm working on converting some configs to kemi lua and have a couple of
> questions:
>
> First:
>
> Does KSR.pv.get() support multiple pseudos in a single call?
>
> The examples such as misc/examples/kemi/kamailio-basic-kemi-lua.lua
> make several calls, but also do things like KSR.pv.get("$T_branch_idx]")
> to avoid having the append "]" to the string.  That makes me wonder why
> that file has code like this:
>
> 	KSR.dbg("new branch [".. KSR.pv.get("$T_branch_idx]")
> 				.. " to ".. KSR.pv.get("$ru") .. "\n");
>
> instead of like:
>
>         KSR.pv.get("[$T_branch_idx] to $ru\n")
>
>
> Second:
>
> Is it still the case that, eg, event_route[xhttp:request] cannot be in
> the kemi lua code?
>
> There was another.  Perhaps I'll recall what it was... :(
>
> -JimC

-- 
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - www.asipto.com
Kamailio World Conference - www.kamailioworld.com




More information about the sr-users mailing list