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/7dc2f5cb07221b2c682c5765f27d38713beb3405f6b88f6bcc1c361f39d2e531/kamailio/kamailio/commit/851a8c0f0c8f7cc7ab22cb905bdb3987e9fa461b]<https://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/7dc2f5cb07221b2c682c5765f27d38713beb3405f6b88f6bcc1c361f39d2e531/kamailio/kamailio/commit/851a8c0f0c8f7cc7ab22cb905bdb3987e9fa461b]<https://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.
__________________________________________________________
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

Reply via email to