[SR-Users] Trouble loading multiple javascripts with KEMI
Daniel-Constantin Mierla
miconda at gmail.com
Thu Jun 4 18:48:46 CEST 2020
Hello,
indeed app_jsdt can load only one script file.
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.
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.
Cheers,
Daniel
On 04.06.20 14:25, Benjamín Visón wrote:
> Thank you Henning!.
>
> 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.
>
> Regards,
>
> Facebook <https://www.facebook.com/bvisonl>Twitter
> <https://twitter.com/benjaminvison>Instagram
> <https://instagram.com/bvisonl/>
>
>
>
>
> Benjamín Visón / IT Engineer / Software Developer
> bvisonl at gmail.com <mailto:bvisonl at gmail.com> / (829)-664-5163
>
>
>
>
> On Wed, Jun 3, 2020 at 1:59 PM Henning Westerholt <hw at skalatan.de
> <mailto:hw at skalatan.de>> wrote:
>
> Hello Hector,
>
>
>
> 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. 😉 In most of the cases you will wait for IO (DB, DNS
> etc..) anyway.
>
>
>
> There has been some presentation from Daniel on past Kamailio
> World editions about it, you find the details e.g. at
> https://www.kamailio.org/wiki/kemi/performance-tests/5.2.x and
> also the scripts to do some benchmarking by yourself.
>
>
>
> Cheers,
>
>
>
> Henning
>
>
>
> --
>
> Henning Westerholt – https://skalatan.de/blog/
>
> Kamailio services – https://gilawa.com <https://gilawa.com/>
>
>
>
> *From:* sr-users <sr-users-bounces at lists.kamailio.org
> <mailto:sr-users-bounces at lists.kamailio.org>> *On Behalf Of
> *Benjamín Visón
> *Sent:* Wednesday, June 3, 2020 6:45 PM
> *To:* sr-users at lists.kamailio.org <mailto:sr-users at lists.kamailio.org>
> *Cc:* Hector Ventura Reyes <hectorvent at gmail.com
> <mailto:hectorvent at gmail.com>>
> *Subject:* [SR-Users] Trouble loading multiple javascripts with KEMI
>
>
>
> I am using the module *app_jsdt *with *KEMI *and I am having
> trouble loading multiple javascript files. The interpreter only
> notices the last file that's loaded.
>
>
>
> 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).
>
>
>
> modparam("app_jsdt", "load", "/etc/kamailio/file1.js")
> modparam("app_jsdt", "load", "/etc/kamailio/file2.js")
>
> cfgengine "jsdt"
>
>
>
> In the example above, only functions in file2 are recognized.
>
>
>
> 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
> *request_route*.
>
>
> (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!)
>
>
>
>
> Saludos,
>
>
>
>
>
>
>
>
>
>
> *Benjamín Visón* / IT Engineer / Software Developer
> bvisonl at gmail.com <mailto:bvisonl at gmail.com> / (829)-664-5163
>
>
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org <mailto:sr-users at lists.kamailio.org>
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20200604/152acfa2/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 1219 bytes
Desc: not available
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20200604/152acfa2/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 1352 bytes
Desc: not available
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20200604/152acfa2/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.png
Type: image/png
Size: 1547 bytes
Desc: not available
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20200604/152acfa2/attachment-0002.png>
More information about the sr-users
mailing list