Hello,

you can combine the two modes, there are functions exported by each KEMI
module that you can run snippets of code from native kamailio.cfg route
blocks.

For example, you keep the native scripting kamailio.cfg, then with
app_jsdt (load parameter) you can have the js script like:

function ksr_json_update()
{
    var rtdoc = "";
    var rtobj;


    rtdoc = KSR.pv.gete("$var(json)");
    rtobj = JSON.parse(rtdoc);

    // update the rtobj ...

    KSR.pv.sets("$var(json)", JSON.stringify(rtobj));
}

Then, in the route blocks of kamailio.cfg:

    $var(json) = '{"x": "a"}';
    if(!jsdt_run("ksr_json_update")) {
        xlog("failed to execute js function\n");
    }

    xinfo("new json: $var(json)\n");

KSR object is available, like in the case of having the routing blocks
written entirely in the javascript.

Then, the other way around is possible as well, write the routing blocks
in javascript (or lua, ...) and still define route[ABC] in kamailio.cfg
which can be executed with KSR.route("ABC") from the KEMI script.

Cheers,
Daniel

On 22.03.21 15:08, Jeremy McNamara wrote:
> Hi Daniel - Thank you I will look into that.   Is it possible with
> KEMI to delegate individual route[] blocks into KEMI but leave others
> as kamailio.cfg native? 
>
> For example, make all of my registration attempts get handled by KEMI,
> but the rest of the operations still live in kamailio.cfg.
>
>
> -Jeremy
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> [email protected]
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Funding: https://www.paypal.me/dcmierla

_______________________________________________
Kamailio (SER) - Users Mailing List
[email protected]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

Reply via email to