I think the require() must be a node.js, but not sure from my reading of https://github.com/svaarala/duktape/tree/master/extras/module-node. My local testing looks like this:

var test_include = require('./test');

function ksr_request_route()
{
    test_include();

./test.js

module.exports = function test_include()
{
  KSR.info('LOG FROM INCLUDED test FUNCTION--------');
};

My testing includes do not work as expected without module.exports.


I tried testing using a simple NPM module with a relative include and kamailio would not start with error
jsdt_kemi_load_script(): failed running: SyntaxError: expected identifier
I think this indicates as currently implemented not just any node.js module can be used. This PR does not try to resolve package names and only tries to resolve relative and absolute files.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.Message ID: <kamailio/kamailio/pull/3038/c1054866552@github.com>