[SR-Users] get defined names in kemi script

Yuriy Gorlichenko ovoshlook at gmail.com
Tue Jul 13 09:09:24 CEST 2021


#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 at 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 at 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
>
> --
> Daniel-Constantin Mierla -- www.asipto.com
> www.twitter.com/miconda -- www.linkedin.com/in/miconda
>
>
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions
>   * sr-users at 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20210713/555ff017/attachment.htm>


More information about the sr-users mailing list