Description

Kamailio uses Ducktape 2 without module-node or module-ducktape, requiring all routing in a single file.

https://wiki.duktape.org/howtomodules

I'm attempting to add module-node support and creating this issue to track with PR.

Response from mailing list

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:

Cheers,
Daniel

Expected behavior

Include the required() JS file
var test = require('./test');

Actual observed behavior

Calling require() in a JSDT script throws TypeError: undefined not callable

Log Messages

ERROR: app_jsdt [app_jsdt_api.c:448]: jsdt_kemi_load_script(): failed running: TypeError: undefined not callable

Possible Solutions

I played around a little with module-duktape but wasn't smart enough to define a Duktape.modSearch() that would work as desired. I'm probably missing something obvious. I've recently been playing with asterisk/node-ari-client which got me curious if module-node might be more aligned with thinking.

Additional Information


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/issues/3037@github.com>