<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Thanks for correcting my answer, I failed to notice it was about
kemi scripts.</p>
<p>For kemi there is the option of KSR.kx.get_def("ID") to get the
value of a define, like:</p>
<p>#!define ID ABC</p>
<p>then KSR.kx.get_def("ID") return "ABC".</p>
<p>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.</p>
<p>Cheers,<br>
Daniel<br>
</p>
<div class="moz-cite-prefix">On 13.07.21 09:09, Yuriy Gorlichenko
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CABSP_VdfrjtT72ieNZWbXHgs_Bz42f8YZmTN4gP6ozOex-o+7g@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="auto">
<div>#define is a directive for the cfg scripting. So you won't
be able to reach this definition from Lua/python/etc AFAIK.
<div dir="auto"><br>
</div>
<div dir="auto">But there are at least 2 possibilities how to
achieve this:</div>
<div dir="auto">1 - define global variables/constants in your
script instead of #define.</div>
<div dir="auto">It will be visible across all namespace of
your script.</div>
<div dir="auto">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.</div>
<br>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Tue, 13 Jul 2021, 08:55
Daniel-Constantin Mierla, <<a
href="mailto:miconda@gmail.com" moz-do-not-send="true">miconda@gmail.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
if you have:<br>
<br>
#!define X<br>
<br>
then you can have conditional blocks like:<br>
<br>
#!ifdef X<br>
<br>
#endif<br>
<br>
or:<br>
<br>
#!ifndef X<br>
<br>
#endif<br>
<br>
Or, are you looking for something else?<br>
<br>
Cheers,<br>
Daniel<br>
<br>
On 12.07.21 14:17, Riccardo Villa wrote:<br>
> Hello guys,<br>
><br>
> 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.<br>
><br>
> Thanks in advance for your help.<br>
><br>
> Regards,<br>
><br>
> Riccardo<br>
><br>
><br>
> -- <br>
> --<br>
> NOTICE: This electronic mail transmission may contain
confidential <br>
> information and is intended only for the person(s)
named. Any use, copying, <br>
> or disclosure by any other person is strictly
prohibited. If you have <br>
> received this transmission in error, please notify
the sender via e-mail.<br>
><br>
>
__________________________________________________________<br>
> Kamailio - Users Mailing List - Non Commercial
Discussions<br>
> * <a href="mailto:sr-users@lists.kamailio.org"
target="_blank" rel="noreferrer" moz-do-not-send="true">sr-users@lists.kamailio.org</a><br>
> Important: keep the mailing list in the recipients,
do not reply only to the sender!<br>
> Edit mailing list options or unsubscribe:<br>
> * <a
href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users"
rel="noreferrer noreferrer" target="_blank"
moz-do-not-send="true">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
<br>
-- <br>
Daniel-Constantin Mierla -- <a
href="http://www.asipto.com" rel="noreferrer noreferrer"
target="_blank" moz-do-not-send="true">www.asipto.com</a><br>
<a href="http://www.twitter.com/miconda" rel="noreferrer
noreferrer" target="_blank" moz-do-not-send="true">www.twitter.com/miconda</a>
-- <a href="http://www.linkedin.com/in/miconda"
rel="noreferrer noreferrer" target="_blank"
moz-do-not-send="true">www.linkedin.com/in/miconda</a><br>
<br>
<br>
__________________________________________________________<br>
Kamailio - Users Mailing List - Non Commercial Discussions<br>
* <a href="mailto:sr-users@lists.kamailio.org"
target="_blank" rel="noreferrer" moz-do-not-send="true">sr-users@lists.kamailio.org</a><br>
Important: keep the mailing list in the recipients, do not
reply only to the sender!<br>
Edit mailing list options or unsubscribe:<br>
* <a
href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users"
rel="noreferrer noreferrer" target="_blank"
moz-do-not-send="true">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</blockquote>
</div>
</div>
</div>
</blockquote>
<pre class="moz-signature" cols="72">--
Daniel-Constantin Mierla -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a></pre>
</body>
</html>