[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openser-users
Subject:    Re: [SR-Users] JS Kemi TypeError: undefined not callable (property 'ifdef' of [object Object])
From:       Huseyin Kaan Koyukan <hkoyu012 () uottawa ! ca>
Date:       2022-01-18 10:41:01
Message-ID: YT1PR01MB4709D7752A6D6C51D67ADCB5E8589 () YT1PR01MB4709 ! CANPRD01 ! PROD ! OUTLOOK ! COM
[Download RAW message or body]

[Attachment #2 (text/plain)]

Hello again,

From the e-mail thread, \
(https://www.mail-archive.com/sr-users@lists.kamailio.org/msg15732.html) I found out \
that, as I suspected, kx.ifdef was rather recently added. (July 14, 2021) whereas my \
kamailio was compiled on June 3rd 2021 😕

I replicated the functions from the commit \
(https://github.com/kamailio/kamailio/commit/851a8c0f0c8f7cc7ab22cb905bdb3987e9fa461b) \
and recompiled the kex module and now my kamailio starts without an issue.

Thanks,
Kaan
[https://opengraph.githubassets.com/7dc2f5cb07221b2c682c5765f27d38713beb3405f6b88f6bcc \
1c361f39d2e531/kamailio/kamailio/commit/851a8c0f0c8f7cc7ab22cb905bdb3987e9fa461b]<http \
                s://github.com/kamailio/kamailio/commit/851a8c0f0c8f7cc7ab22cb905bdb3987e9fa461b>
                
kemix: added KSR.kx.ifdef() and KSR.kx.ifndef()  · \
kamailio/kamailio@851a8c0<https://github.com/kamailio/kamailio/commit/851a8c0f0c8f7cc7ab22cb905bdb3987e9fa461b>
                
- return true/false if a specified id is defined or not
github.com



[https://opengraph.githubassets.com/7dc2f5cb07221b2c682c5765f27d38713beb3405f6b88f6bcc \
1c361f39d2e531/kamailio/kamailio/commit/851a8c0f0c8f7cc7ab22cb905bdb3987e9fa461b]<http \
                s://github.com/kamailio/kamailio/commit/851a8c0f0c8f7cc7ab22cb905bdb3987e9fa461b#>
                
kemix: added KSR.kx.ifdef() and KSR.kx.ifndef()  · \
kamailio/kamailio@851a8c0<https://github.com/kamailio/kamailio/commit/851a8c0f0c8f7cc7ab22cb905bdb3987e9fa461b#>
                
- return true/false if a specified id is defined or not
github.com

<https://www.mail-archive.com/sr-users@lists.kamailio.org/msg15732.html>
________________________________
From: Huseyin Kaan Koyukan
Sent: Tuesday, January 18, 2022 10:14 AM
To: sr-users@lists.kamailio.org <sr-users@lists.kamailio.org>
Subject: JS Kemi TypeError: undefined not callable (property 'ifdef' of [object \
Object])

Hello Everyone,

First of all, this is my first ever e-mail to the group so I'd like to thank all the \
developers who built this great product and thank everyone for the kind and helpful \
community. I've been using Kamailio for the past 8 months, I've had lots of fun with \
it.

My issue is I'm trying to set-up JS Kemi interpreter for my Kamailio-Asterisk box. I \
translated the config file to JS kemi, which wasn't too bad but I'm getting a type \
error for the "KSR.kx.ifdef("WITH_ASTERISK")" statement that I used.

Jan 17 15:11:26 anayurt kamailio[8261]:  0(8261) DEBUG: app_jsdt \
                [app_jsdt_api.c:1478]: dukopen_KSR(): module 'KSR' has been \
                initialized
Jan 17 15:11:26 anayurt kamailio[8261]:  0(8261) DEBUG: app_jsdt \
[app_jsdt_api.c:473]: jsdt_sr_init_child(): loading js script file: \
                /usr/local/etc/kamailio/kamailio-basic-kemi-jsdt.js
Jan 17 15:11:26 anayurt kamailio[8261]:  0(8261) ERROR: app_jsdt \
[app_jsdt_api.c:447]: jsdt_kemi_load_script(): failed running: TypeError: undefined \
                not callable (property 'ifdef' of [object Object])
Jan 17 15:11:26 anayurt kamailio[8261]:  0(8261) ERROR: <core> \
[core/sr_module.c:865]: init_mod_child(): error while initializing module app_jsdt \
                (/usr/local/lib64/kamailio/modules/app_jsdt.so) (idx: 0 rank: -127 \
                desc: [main])
Jan 17 15:11:26 anayurt kamailio[8261]:  0(8261) ERROR: <core> [main.c:1671]: \
main_loop(): error in init_child(PROC_INT) -- exiting

In syslog I can see that  kex.so module is loaded successfully and 'KSR' has been \
initialized. I don't know what I'm doing wrong. A few sample JS Kemi code that I \
could find did not use the kx.ifdef function. Was this a new addition to the \
interpreter? Perhaps my Kamailio version (kamailio 5.5.0 x86_64/linux) does not \
support it?

Thank you all in advance.

Kaan.


[Attachment #3 (text/html)]

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} \
</style> </head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; \
color: rgb(0, 0, 0);"> Hello again,<br>
<br>
From the e-mail thread, (<a \
href="https://www.mail-archive.com/sr-users@lists.kamailio.org/msg15732.html" \
style="margin:0px;background-color:rgb(255, 255, \
255)">https://www.mail-archive.com/sr-users@lists.kamailio.org/msg15732.html</a>) I \
found out that, as  I suspected,&nbsp;kx.ifdef was rather recently added. (July 14, \
2021) whereas my kamailio was compiled on June \
3<span><sup><span><sup>rd</sup>&nbsp;</span></sup>2021&nbsp;</span><span \
contenteditable="false" id="😕">😕</span>&nbsp;<br> <br>
I replicated the functions from the commit (<a \
href="https://github.com/kamailio/kamailio/commit/851a8c0f0c8f7cc7ab22cb905bdb3987e9fa461b" \
id="LPlnkOWALinkPreview">https://github.com/kamailio/kamailio/commit/851a8c0f0c8f7cc7ab22cb905bdb3987e9fa461b</a>) \
and  recompiled the kex module and now my kamailio starts without an issue.&nbsp;<br>
<br>
Thanks,<br>
Kaan<br>
<div class="_Entity _EType_OWALinkPreview _EId_OWALinkPreview _EReadonly_1">
<div id="LPBorder_GTaHR0cHM6Ly9naXRodWIuY29tL2thbWFpbGlvL2thbWFpbGlvL2NvbW1pdC84NTFhOGMwZjBjOGY3Y2M3YWIyMmNiOTA1YmRiMzk4N2U5ZmE0NjFi" \
class="LPBorder860172" style="width: 100%; margin-top: 16px; margin-bottom: 16px; \
position: relative; max-width: 800px; min-width: 424px;"> <table \
id="LPContainer860172" role="presentation" style="padding: 12px 36px 12px 12px; \
width: 100%; border-width: 1px; border-style: solid; border-color: rgb(200, 200, \
200); border-radius: 2px;"> <tbody>
<tr valign="top" style="border-spacing: 0px;">
<td>
<div id="LPImageContainer860172" style="position: relative; margin-right: 12px; \
height: 120px; overflow: hidden; width: 240px;"> <a target="_blank" \
id="LPImageAnchor860172" \
href="https://github.com/kamailio/kamailio/commit/851a8c0f0c8f7cc7ab22cb905bdb3987e9fa461b"><img \
id="LPThumbnailImageId860172" alt="" height="120" style="display: block;" width="240" \
src="https://opengraph.githubassets.com/7dc2f5cb07221b2c682c5765f27d38713beb3405f6b88f \
6bcc1c361f39d2e531/kamailio/kamailio/commit/851a8c0f0c8f7cc7ab22cb905bdb3987e9fa461b"></a></div>
 </td>
<td style="width: 100%;">
<div id="LPTitle860172" style="font-size: 21px; font-weight: 300; margin-right: 8px; \
font-family: wf_segoe-ui_light, &quot;Segoe UI Light&quot;, &quot;Segoe WP \
Light&quot;, &quot;Segoe UI&quot;, &quot;Segoe WP&quot;, Tahoma, Arial, sans-serif; \
margin-bottom: 12px;"> <a target="_blank" id="LPUrlAnchor860172" \
href="https://github.com/kamailio/kamailio/commit/851a8c0f0c8f7cc7ab22cb905bdb3987e9fa461b" \
style="text-decoration: none; color: var(--themePrimary);">kemix: added \
KSR.kx.ifdef() and KSR.kx.ifndef()  · kamailio/kamailio@851a8c0</a></div> <div \
id="LPDescription860172" style="font-size: 14px; max-height: 100px; color: rgb(102, \
102, 102); font-family: wf_segoe-ui_normal, &quot;Segoe UI&quot;, &quot;Segoe \
WP&quot;, Tahoma, Arial, sans-serif; margin-bottom: 12px; margin-right: 8px; \
                overflow: hidden;">
- return true/false if a specified id is defined or not</div>
<div id="LPMetadata860172" style="font-size: 14px; font-weight: 400; color: rgb(166, \
166, 166); font-family: wf_segoe-ui_normal, &quot;Segoe UI&quot;, &quot;Segoe \
WP&quot;, Tahoma, Arial, sans-serif;"> github.com</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br>
<br>
<br>
<div class="_Entity _EType_OWALinkPreview _EId_OWALinkPreview_1 _EReadonly_1">
<div id="LPBorder_GTaHR0cHM6Ly9naXRodWIuY29tL2thbWFpbGlvL2thbWFpbGlvL2NvbW1pdC84NTFhOGMwZjBjOGY3Y2M3YWIyMmNiOTA1YmRiMzk4N2U5ZmE0NjFiIw.." \
class="LPBorder370684" style="width: 100%; margin-top: 16px; margin-bottom: 16px; \
position: relative; max-width: 800px; min-width: 424px;"> <table \
id="LPContainer370684" role="presentation" style="padding: 12px 36px 12px 12px; \
width: 100%; border-width: 1px; border-style: solid; border-color: rgb(200, 200, \
200); border-radius: 2px;"> <tbody>
<tr valign="top" style="border-spacing: 0px;">
<td>
<div id="LPImageContainer370684" style="position: relative; margin-right: 12px; \
height: 120px; overflow: hidden; width: 240px;"> <a target="_blank" \
id="LPImageAnchor370684" \
href="https://github.com/kamailio/kamailio/commit/851a8c0f0c8f7cc7ab22cb905bdb3987e9fa461b#"><img \
id="LPThumbnailImageId370684" alt="" height="120" style="display: block;" width="240" \
src="https://opengraph.githubassets.com/7dc2f5cb07221b2c682c5765f27d38713beb3405f6b88f \
6bcc1c361f39d2e531/kamailio/kamailio/commit/851a8c0f0c8f7cc7ab22cb905bdb3987e9fa461b"></a></div>
 </td>
<td style="width: 100%;">
<div id="LPTitle370684" style="font-size: 21px; font-weight: 300; margin-right: 8px; \
font-family: wf_segoe-ui_light, &quot;Segoe UI Light&quot;, &quot;Segoe WP \
Light&quot;, &quot;Segoe UI&quot;, &quot;Segoe WP&quot;, Tahoma, Arial, sans-serif; \
margin-bottom: 12px;"> <a target="_blank" id="LPUrlAnchor370684" \
href="https://github.com/kamailio/kamailio/commit/851a8c0f0c8f7cc7ab22cb905bdb3987e9fa461b#" \
style="text-decoration: none; color: var(--themePrimary);">kemix: added \
KSR.kx.ifdef() and KSR.kx.ifndef()  · kamailio/kamailio@851a8c0</a></div> <div \
id="LPDescription370684" style="font-size: 14px; max-height: 100px; color: rgb(102, \
102, 102); font-family: wf_segoe-ui_normal, &quot;Segoe UI&quot;, &quot;Segoe \
WP&quot;, Tahoma, Arial, sans-serif; margin-bottom: 12px; margin-right: 8px; \
                overflow: hidden;">
- return true/false if a specified id is defined or not</div>
<div id="LPMetadata370684" style="font-size: 14px; font-weight: 400; color: rgb(166, \
166, 166); font-family: wf_segoe-ui_normal, &quot;Segoe UI&quot;, &quot;Segoe \
WP&quot;, Tahoma, Arial, sans-serif;"> github.com</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br>
<a href="https://www.mail-archive.com/sr-users@lists.kamailio.org/msg15732.html" \
id="LPlnk238211"></a></div> <div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" \
style="font-size:11pt" color="#000000"><b>From:</b> Huseyin Kaan Koyukan<br> \
<b>Sent:</b> Tuesday, January 18, 2022 10:14 AM<br> <b>To:</b> \
sr-users@lists.kamailio.org &lt;sr-users@lists.kamailio.org&gt;<br> <b>Subject:</b> \
JS Kemi TypeError: undefined not callable (property 'ifdef' of [object \
Object])</font> <div>&nbsp;</div>
</div>
<style type="text/css" style="display:none">
<!--
p
	{margin-top:0;
	margin-bottom:0}
-->
</style>
<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; \
color:rgb(0,0,0)"> Hello Everyone,
<div><br>
</div>
<div>First of all, this is my first ever e-mail to the group so I'd like to thank all \
the developers who built this great product and thank everyone for the kind and \
helpful community. I've been using Kamailio for the past 8 months, I've had lots of \
fun with  it.</div>
<div><br>
</div>
<div>My issue is I'm trying to set-up JS Kemi interpreter for my Kamailio-Asterisk \
box. I translated the config file to JS kemi, which wasn't too bad but I'm getting a \
type error for the &quot;KSR.kx.ifdef(&quot;WITH_ASTERISK&quot;)&quot; statement that \
I used. &nbsp;</div> <div><br>
</div>
<div>Jan 17 15:11:26 anayurt kamailio[8261]: &nbsp;0(8261) DEBUG: app_jsdt \
[app_jsdt_api.c:1478]: dukopen_KSR(): module 'KSR' has been initialized</div> \
<div>Jan 17 15:11:26 anayurt kamailio[8261]: &nbsp;0(8261) DEBUG: app_jsdt \
[app_jsdt_api.c:473]: jsdt_sr_init_child(): loading js script file: \
/usr/local/etc/kamailio/kamailio-basic-kemi-jsdt.js</div> <div>Jan 17 15:11:26 \
anayurt kamailio[8261]: &nbsp;0(8261) ERROR: app_jsdt [app_jsdt_api.c:447]: \
jsdt_kemi_load_script(): failed running: TypeError: undefined not callable (property \
'ifdef' of [object Object])</div> <div>Jan 17 15:11:26 anayurt kamailio[8261]: \
&nbsp;0(8261) ERROR: &lt;core&gt; [core/sr_module.c:865]: init_mod_child(): error \
while initializing module app_jsdt (/usr/local/lib64/kamailio/modules/app_jsdt.so) \
(idx: 0 rank: -127 desc: [main])</div> <div>Jan 17 15:11:26 anayurt kamailio[8261]: \
&nbsp;0(8261) ERROR: &lt;core&gt; [main.c:1671]: main_loop(): error in \
init_child(PROC_INT) -- exiting</div> <div><br>
</div>
<div>In syslog I can see that &nbsp;kex.so module is loaded successfully and 'KSR' \
has been initialized. I don't know what I'm doing wrong. A few sample JS Kemi code \
that I could find did not use the kx.ifdef function. Was this a new addition to the \
interpreter?  Perhaps my Kamailio version (kamailio 5.5.0 x86_64/linux) does not \
support it?</div> <div><br>
</div>
<div>Thank you all in advance.</div>
<div><br>
</div>
Kaan.<br>
</div>
</div>
</body>
</html>



__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
  * sr-users@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

--===============1279903837==--


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic