[SR-Users] KEMI jsdt CommonJS-based module

Ian Carlson ian at xantek.net
Tue Mar 1 02:05:12 CET 2022


I added a comment to the PR. I’m not entirely confident with my answers but I did some basic testing to try and verify.

 

  * one can load another JS file in the Kamailio KEMI JS file, but this another JS file has its content following the node.js module specs, right? It cannot be just any JS code

I think yes.

 

* does it allow loading any node.js modules available out there that do not require the node.js core modules (which are embedded (compiled) in node.js binary)?

I think no as currently implemented.

 

 

 

Cheers,

Ian

 

From: Daniel-Constantin Mierla <miconda at gmail.com> 
Sent: Thursday, February 24, 2022 11:42 PM
To: Ian Carlson <ian at xantek.net>; 'Kamailio (SER) - Users Mailing List' <sr-users at lists.kamailio.org>
Subject: Re: [SR-Users] KEMI jsdt CommonJS-based module

 

Hello,

I just merged the pull request, thanks!

I had some remarks/questions in a comment made on PR, let me post them here for discussing further:

  * one can load another JS file in the Kamailio KEMI JS file, but this another JS file has its content following the node.js module specs, right? It cannot be just any JS code

  * does it allow loading any node.js modules available out there that do not require the node.js core modules (which are embedded (compiled) in node.js binary)?

Cheers,
Daniel

On 23.02.22 13:55, Ian Carlson wrote:

Greetings,

 

Thanks for the feedback. Since this was something I requested, I thought I'd have a go. I was able to log messages from nested require() via JSDT loaded file. I'm barely literate in C, so hopefully, I'm doing something helpful and not wasting everyone's time. If I happen to be on a good track, I'll try to keep going with a bit of guidance. 

 

https://github.com/kamailio/kamailio/issues/3037

https://github.com/kamailio/kamailio/pull/3038

 

Cheers,

Ian

 

 

From: Daniel-Constantin Mierla  <mailto:miconda at gmail.com> <miconda at gmail.com> 
Sent: Monday, February 21, 2022 4:44 AM
To: Kamailio (SER) - Users Mailing List  <mailto:sr-users at lists.kamailio.org> <sr-users at lists.kamailio.org>; Ian Carlson  <mailto:ian at xantek.net> <ian at xantek.net>
Subject: Re: [SR-Users] KEMI jsdt CommonJS-based module

 

Hello,

I didn't notice that require() was not in the duktape 2.x, I will try to add support for module-duktape when I get a chance. If someone wants to do it, pull requests are welcome -- it does not seem to be complex:

  * https://github.com/svaarala/duktape/tree/master/extras/module-duktape

The module-node sounds interesting, but not being familiar with node.js, looks it need more work to enable it:

  * https://github.com/svaarala/duktape/tree/master/extras/module-node

Cheers,
Daniel

On 20.02.22 00:50, Ian Carlson wrote:

Greetings,

 

I’m new to Kamailio and working to add Kamailio to an existing Asterisk solution.  I’m attracted to the idea of routing via KEMI jsdt since our Asterisk ARI is using nodejs.  Playing with KEMI jsdt I was trying to use require() to break up the monolithic routing script.  It seems that Kamailio uses Ducktape 2 without module-node or module-ducktape, requiring all routing in a single file?  I’d appreciate any suggested practices for managing Kamailio configurations.

 

Cheers,

Ian

 

 






__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
  * sr-users at lists.kamailio.org <mailto:sr-users at lists.kamailio.org> 
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe:
  * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla -- www.asipto.com <http://www.asipto.com> 
www.twitter.com/miconda <http://www.twitter.com/miconda>  -- www.linkedin.com/in/miconda <http://www.linkedin.com/in/miconda> 
Kamailio Advanced Training - Online
  Feb 21-24, 2022 (America Timezone)
  * https://www.asipto.com/sw/kamailio-advanced-training-online/

-- 
Daniel-Constantin Mierla -- www.asipto.com <http://www.asipto.com> 
www.twitter.com/miconda <http://www.twitter.com/miconda>  -- www.linkedin.com/in/miconda <http://www.linkedin.com/in/miconda> 
Kamailio Advanced Training - Online
  March 28-31, 2022 (Europe Timezone)
  * https://www.asipto.com/sw/kamailio-advanced-training-online/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20220228/e2fcfa81/attachment.htm>


More information about the sr-users mailing list