<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hello,</p>
<p>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.</p>
<p>For example, you keep the native scripting kamailio.cfg, then
with app_jsdt (load parameter) you can have the js script like:<br>
</p>
<p>function ksr_json_update()<br>
{<br>
var rtdoc = "";<br>
var rtobj;<br>
<br>
<br>
rtdoc = KSR.pv.gete("$var(json)");<br>
rtobj = JSON.parse(rtdoc);<br>
<br>
// update the rtobj ...</p>
<p> KSR.pv.sets("$var(json)", JSON.stringify(rtobj));<br>
}</p>
<p>Then, in the route blocks of kamailio.cfg:</p>
<p> $var(json) = '{"x": "a"}';<br>
if(!jsdt_run("ksr_json_update")) {<br>
xlog("failed to execute js function\n");<br>
}</p>
<p> xinfo("new json: $var(json)\n");</p>
<p>KSR object is available, like in the case of having the routing
blocks written entirely in the javascript.</p>
<p>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.</p>
<p>Cheers,<br>
Daniel<br>
</p>
<div class="moz-cite-prefix">On 22.03.21 15:08, Jeremy McNamara
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAO0X5JTqaDQuiVLpO+uTsy5Tm_Av+1w=F5z0ugGv7CVo=hj7+A@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div dir="ltr">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? </div>
<div dir="ltr"><br>
</div>
<div>For example, make all of my registration attempts get
handled by KEMI, but the rest of the operations still live in
kamailio.cfg.</div>
<div><br>
</div>
<div><br>
</div>
<div>-Jeremy</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Kamailio (SER) - Users Mailing List
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a>
<a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
Daniel-Constantin Mierla -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Funding: <a class="moz-txt-link-freetext" href="https://www.paypal.me/dcmierla">https://www.paypal.me/dcmierla</a></pre>
</body>
</html>