Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kami Lua retrieving variable in configuration file #2822

Closed
jpskriver opened this issue Aug 12, 2021 · 2 comments
Closed

Kami Lua retrieving variable in configuration file #2822

jpskriver opened this issue Aug 12, 2021 · 2 comments

Comments

@jpskriver
Copy link

Description

Suppose that there is an variable define in kamailio-basic-kemi.cfg with:

#!define MYVAR 1.2.3.4

Then in the kamailio-basic-kemi-lua.lua

  • How can we get that variable?

Possible Solutions

Is there any alternative solution like set global via app_lua parameter, example:

modparam("app_lua", "load", "/usr/local/etc/kamailio/lua/myscript.lua")
modparam("app_lua", "varset", "pstngw=s:sip:10.10.10.10")
@arsperger
Copy link
Contributor

for KEMI there is an option which was recently merged to the master
you can get value of #!defined by using KSR.kx.get_def("VAR")

#!define MYVAR 1234

then in your script you can use
KSR.kx.get_def("MYVAR")

there was a mail thread on this topic in users list

@henningw
Copy link
Contributor

As mentioned from @arsperger, should be already implemented with 851a8c0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants