Thanks for correcting my answer, I failed to notice it was about kemi
scripts.
For kemi there is the option of KSR.kx.get_def("ID") to get the value of
a define, like:
#!define ID ABC
then KSR.kx.get_def("ID") return "ABC".
To see if a module is loaded, at least in lua you can check if
KSR.modname (e.g.,: KSR.tm) is set or not.
Cheers,
Daniel
On 13.07.21 09:09, Yuriy Gorlichenko wrote:
#define is a directive for the cfg scripting. So you
won't be able to
reach this definition from Lua/python/etc AFAIK.
But there are at least 2 possibilities how to achieve this:
1 - define global variables/constants in your script instead of #define.
It will be visible across all namespace of your script.
2 - use pv modparap setvar. Once you done #define put it into
variable on a modparam stage via this param. Then you can access those
vars via kemi.
On Tue, 13 Jul 2021, 08:55 Daniel-Constantin Mierla,
<miconda(a)gmail.com <mailto:miconda@gmail.com>> wrote:
Hello,
if you have:
#!define X
then you can have conditional blocks like:
#!ifdef X
#endif
or:
#!ifndef X
#endif
Or, are you looking for something else?
Cheers,
Daniel
On 12.07.21 14:17, Riccardo Villa wrote:
Hello guys,
do you know if it’s possible for a kemi script to know if a name
is defined
(with #!define) in kamailio.cfg? It would be useful to
modify kemi script logic depending on feature/module presence.
Thanks in advance for your help.
Regards,
Riccardo
--
--
NOTICE: This electronic mail transmission may contain confidential
information and is intended only for the person(s) named. Any
use, copying,
or disclosure by any other person is strictly
prohibited. If you
have
received this transmission in error, please
notify the sender
via e-mail.
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
* sr-users(a)lists.kamailio.org <mailto:sr-users@lists.kamailio.org>
Important: keep the mailing list in the recipients, do not reply
only to the
sender!
<https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users>
--
Daniel-Constantin Mierla --
www.asipto.com <http://www.asipto.com>
www.twitter.com/miconda <http://www.twitter.com/miconda> --
www.linkedin.com/in/miconda <http://www.linkedin.com/in/miconda>
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
* sr-users(a)lists.kamailio.org <mailto: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
<https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users>