<p></p>
<h3 dir="auto">Description</h3>
<p dir="auto">Kamailio uses Ducktape 2 without module-node or module-ducktape, requiring all routing in a single file.</p>
<p dir="auto"><a href="https://wiki.duktape.org/howtomodules" rel="nofollow">https://wiki.duktape.org/howtomodules</a></p>
<p dir="auto">I'm attempting to add module-node support and creating this issue to track with PR.</p>
<p dir="auto">Response from mailing list</p>
<blockquote>
<p dir="auto">Hello,</p>
<p dir="auto">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:</p>
<ul dir="auto">
<li><a href="https://github.com/svaarala/duktape/tree/master/extras/module-duktape">https://github.com/svaarala/duktape/tree/master/extras/module-duktape</a><br>
The module-node sounds interesting, but not being familiar with node.js, looks it need more work to enable it:</li>
<li><a href="https://github.com/svaarala/duktape/tree/master/extras/module-node">https://github.com/svaarala/duktape/tree/master/extras/module-node</a></li>
</ul>
<p dir="auto">Cheers,<br>
Daniel</p>
</blockquote>
<h3 dir="auto">Expected behavior</h3>
<p dir="auto">Include the required() JS file<br>
<code>var test = require('./test');</code></p>
<h4 dir="auto">Actual observed behavior</h4>
<p dir="auto">Calling require() in a JSDT script throws TypeError: undefined not callable</p>
<h4 dir="auto">Log Messages</h4>
<pre><code>ERROR: app_jsdt [app_jsdt_api.c:448]: jsdt_kemi_load_script(): failed running: TypeError: undefined not callable
</code></pre>
<h3 dir="auto">Possible Solutions</h3>
<p dir="auto">I played around a little with <code>module-duktape</code> but wasn't smart enough to define a <code>Duktape.modSearch()</code> that would work as desired.  I'm probably missing something obvious.  I've recently been playing with <code>asterisk/node-ari-client</code> which got me curious if <code>module-node</code> might be more aligned with thinking.</p>
<h3 dir="auto">Additional Information</h3>
<ul dir="auto">
<li><strong>Kamailio Version</strong> - kamailio 5.5.4</li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/3037">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZOAD23SMW4Y7GXHEJ3U4TEXJANCNFSM5PEE5UNA">unsubscribe</a>.<br />Triage notifications on the go with GitHub Mobile for <a href="https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675">iOS</a> or <a href="https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub">Android</a>.
<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/ABO7UZNUHML5GT4PL5NYXGDU4TEXJA5CNFSM5PEE5UNKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4RDNHJKQ.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><kamailio/kamailio/issues/3037</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/3037",
"url": "https://github.com/kamailio/kamailio/issues/3037",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>