<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hello,</p>
<p>indeed app_jsdt can load only one script file.</p>
<p>The reason was that javascript didn't seem to have the concept of
including files and, not being very familiar with the language and
the duktape interpreter, I was not sure what happens if executing
a file over another one in the same context. So I didn't spent
time to code something that might have been useless anyhow. If
someone wants to add it, then I am fine with it.<br>
</p>
<p>Duktape JS interpreter v1 had a require() function to import JS
modules from external files, but it was moved as an extension
module for duktape v2. Not sure if that would be useful either.<br>
</p>
<p>Cheers,<br>
Daniel<br>
</p>
<div class="moz-cite-prefix">On 04.06.20 14:25, Benjamín Visón
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAEtqadAUqQ9rDJgfN9OiX-qEHTnYd7-jOxJM_TZjELGPFQx7hQ@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">Thank you Henning!.
<div><br>
</div>
<div>Just as an FYI, I decided to continue using the original
.cfg of Kamailio and just do jsdt_run and work with KSR
whenever I need to do something in a scripting language. In
the end I couldn't find a way to load multiple .js and by
looking at the C code I believe it can't be done.
<div><br clear="all">
<div>
<div dir="ltr" data-smartmail="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">Regards,</div>
<div dir="ltr"><br>
<table
style="border-spacing:10px;background-color:transparent"
width="100%" cellspacing="10"
cellpadding="0" border="0">
<tbody>
<tr>
<td style="padding:0px"
width="10" valign="top"
align="left">
<p style="margin:0px 0px
10px;font-family:Helvetica,Arial,sans-serif;font-size:14px;line-height:16px"><a
href="https://www.facebook.com/bvisonl"
style="color:rgb(36,169,57);text-decoration:none;display:inline;background-color:transparent"
target="_blank"
moz-do-not-send="true"><img
src="https://s3.amazonaws.com/htmlsig-assets/polygon/facebook.png"
alt="Facebook"
style="border:none;vertical-align:middle;display:inline"
moz-do-not-send="true"
width="24" height="24"></a><a
href="https://twitter.com/benjaminvison"
style="color:rgb(36,169,57);text-decoration:none;display:inline;background-color:transparent"
target="_blank"
moz-do-not-send="true"><img
src="https://s3.amazonaws.com/htmlsig-assets/polygon/twitter.png"
alt="Twitter"
style="border:none;vertical-align:middle;display:inline"
moz-do-not-send="true"
width="24" height="24"></a><a
href="https://instagram.com/bvisonl/"
style="color:rgb(36,169,57);text-decoration:none;display:inline;background-color:transparent"
target="_blank"
moz-do-not-send="true"><img
src="https://s3.amazonaws.com/htmlsig-assets/polygon/instagram.png"
alt="Instagram"
style="border:none;vertical-align:middle;display:inline"
moz-do-not-send="true"
width="24" height="24"></a></p>
</td>
<td
style="padding:0px;width:6px"><br>
</td>
<td style="padding:0px"
valign="top" align="left">
<p style="margin:0px 0px
10px;font-size:14px;font-family:Helvetica,Arial,sans-serif;line-height:16px;color:rgb(33,33,33)"><span
style="font-weight:bold;display:inline">Benjamín Visón</span> <span
style="display:inline">/</span> <span
style="display:inline">IT
Engineer / Software
Developer</span><span
style="display:inline"><br>
</span><a
href="mailto:bvisonl@gmail.com"
style="color:rgb(36,169,57);text-decoration:none;display:inline;background-color:transparent"
target="_blank"
moz-do-not-send="true">bvisonl@gmail.com</a><span
style="display:inline"> /
(</span><span
style="display:inline">829)-664-5163</span></p>
<div><span
style="display:inline"><br>
</span></div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
</div>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Wed, Jun 3, 2020 at 1:59 PM
Henning Westerholt <<a href="mailto:hw@skalatan.de"
target="_blank" moz-do-not-send="true">hw@skalatan.de</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div lang="DE">
<div>
<p class="MsoNormal"><span>Hello Hector,</span></p>
<p class="MsoNormal"><span> </span></p>
<p class="MsoNormal"><span lang="EN-GB">just answering
about the performance part of the question – the
performance impact is for the large majority of
deployments outside not noticeable (for Lua, Python).
Lua is comparable to native script, python is a bit
slower. But you should not need to worry about it
until you are going into the +100.000s subscriber
range.
</span><span style="font-family:"Segoe UI
Emoji",sans-serif" lang="EN-GB">😉</span><span
lang="EN-GB"> In most of the cases you will wait for
IO (DB, DNS etc..) anyway.</span></p>
<p class="MsoNormal"><span lang="EN-GB"> </span></p>
<p class="MsoNormal"><span lang="EN-GB">There has been
some presentation from Daniel on past Kamailio World
editions about it, you find the details e.g. at
<a
href="https://www.kamailio.org/wiki/kemi/performance-tests/5.2.x"
target="_blank" moz-do-not-send="true">https://www.kamailio.org/wiki/kemi/performance-tests/5.2.x</a>
and also the scripts to do some benchmarking by
yourself.</span></p>
<p class="MsoNormal"><span lang="EN-GB"> </span></p>
<p class="MsoNormal"><span lang="EN-GB">Cheers,</span></p>
<p class="MsoNormal"><span lang="EN-GB"> </span></p>
<p class="MsoNormal"><span lang="EN-GB">Henning</span></p>
<p class="MsoNormal"><span lang="EN-GB"> </span></p>
<p class="MsoNormal"><span lang="EN-GB">-- </span></p>
<p class="MsoNormal"><span lang="EN-GB">Henning Westerholt
–
</span><span><a href="https://skalatan.de/blog/"
target="_blank" moz-do-not-send="true"><span
style="color:rgb(5,99,193)" lang="EN-GB">https://skalatan.de/blog/</span></a></span><span
lang="EN-GB"></span></p>
<p class="MsoNormal"><span lang="EN-GB">Kamailio services
–
</span><span><a href="https://gilawa.com/"
target="_blank" moz-do-not-send="true"><span
style="color:rgb(5,99,193)" lang="EN-GB">https://gilawa.com</span></a></span><span>
<span lang="EN-GB"></span></span></p>
<p class="MsoNormal"><span lang="EN-GB"> </span></p>
<div
style="border-right:none;border-bottom:none;border-left:none;border-top:1pt
solid rgb(225,225,225);padding:3pt 0cm 0cm">
<p class="MsoNormal" style="margin-left:35.4pt"><b>From:</b>
sr-users <<a
href="mailto:sr-users-bounces@lists.kamailio.org"
target="_blank" moz-do-not-send="true">sr-users-bounces@lists.kamailio.org</a>>
<b>On Behalf Of </b>Benjamín Visón<br>
<b>Sent:</b> Wednesday, June 3, 2020 6:45 PM<br>
<b>To:</b> <a
href="mailto:sr-users@lists.kamailio.org"
target="_blank" moz-do-not-send="true">sr-users@lists.kamailio.org</a><br>
<b>Cc:</b> Hector Ventura Reyes <<a
href="mailto:hectorvent@gmail.com" target="_blank"
moz-do-not-send="true">hectorvent@gmail.com</a>><br>
<b>Subject:</b> [SR-Users] Trouble loading multiple
javascripts with KEMI</p>
</div>
<p class="MsoNormal" style="margin-left:35.4pt"> </p>
<div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt">I am
using the module <b>app_jsdt
</b>with <b>KEMI </b>and I am having trouble
loading multiple javascript files. The interpreter
only notices the last file that's loaded.</p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"> </p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt">What I
am trying to do is separate my logic so that
everything is not inside the kamailio.conf.js (or
the main file the contains the necessary functions
if you will).</p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"> </p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt">modparam("app_jsdt",
"load", "/etc/kamailio/file1.js")<br>
modparam("app_jsdt", "load",
"/etc/kamailio/file2.js")</p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt">cfgengine
"jsdt"</p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"> </p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt">In the
example above, only functions in file2 are
recognized.</p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"> </p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt">I am
aware that I can use jsdt_run or jsdt_load but from
KEMI I don't see a clear way to link this with
things like events and timers or replies that don't
necessarily go through the
<b>request_route</b>.</p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><br>
(As a plus, I am wondering on performance on
Javascript vs Python/Lua and if it's viable on high
load, if anyone can throw 2 cents on that it would
be helpful!)</p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"> </p>
</div>
<p class="MsoNormal" style="margin-left:35.4pt"><br
clear="all">
</p>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"
style="margin-left:35.4pt">Saludos,</p>
</div>
<div>
<p class="MsoNormal"
style="margin-left:35.4pt"> </p>
<table
style="width:100%;margin-left:35.4pt;border-spacing:10px"
width="100%" cellspacing="10"
cellpadding="0" border="0">
<tbody>
<tr>
<td
style="width:18.75pt;padding:0cm"
width="25" valign="top">
<div>
<p class="MsoNormal"><img
style="width:
0.2604in; height:
0.2604in;"
id="gmail-m_6040937247107349834gmail-m_5144002134251769739Bild_x0020_1"
src="cid:part15.CABA07F4.EF683B1D@gmail.com" class="" width="25"
height="25"
border="0"></p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal"><img
style="width:
0.2604in; height:
0.2604in;"
id="gmail-m_6040937247107349834gmail-m_5144002134251769739Bild_x0020_2"
src="cid:part16.9DB5BEA1.CC1563C9@gmail.com" class="" width="25"
height="25"
border="0"></p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal"><img
style="width:
0.2604in; height:
0.2604in;"
id="gmail-m_6040937247107349834gmail-m_5144002134251769739Bild_x0020_3"
src="cid:part17.E2379323.03ABC74F@gmail.com" class="" width="25"
height="25"
border="0"></p>
</div>
</td>
</tr>
<tr>
<td
style="width:4.5pt;padding:0cm"
width="6"><br>
</td>
<td style="padding:0cm"
valign="top">
<p
style="margin-right:0cm;margin-bottom:7.5pt;margin-left:0cm;line-height:12pt"><b><span
style="font-size:10.5pt;font-family:Helvetica,sans-serif;color:rgb(33,33,33)">Benjamín
Visón</span></b><span
style="font-size:10.5pt;font-family:Helvetica,sans-serif;color:rgb(33,33,33)"> / IT
Engineer / Software
Developer<br>
<a
href="mailto:bvisonl@gmail.com"
target="_blank"
moz-do-not-send="true"><span
style="color:rgb(36,169,57);text-decoration:none">bvisonl@gmail.com</span></a> /
(829)-664-5163</span></p>
</td>
</tr>
</tbody>
</table>
</div>
<p class="MsoNormal"
style="margin-left:35.4pt"> </p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
_______________________________________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank"
moz-do-not-send="true">sr-users@lists.kamailio.org</a><br>
<a
href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users"
rel="noreferrer" target="_blank" moz-do-not-send="true">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</blockquote>
</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>