← Volver al índice de módulos

app_lua

This module allows executing Lua scripts from config file, implementing the KEMI framework and exporting Lua module 'KSR'. To read more about KEMI exports and available KSR submodules, see: * https://
⚙️ Scripting e Integración Kamailio 6.1 6 parámetros 8 funciones

Descripción general

This module allows executing Lua scripts from config file, implementing the KEMI framework and exporting Lua module 'KSR'. To read more about KEMI exports and available KSR submodules, see: * https://kamailio.org/docs/tutorials/devel/kamailio-kemi-framework/ Note: to have the old Lua module 'sr' available, load the 'app_lua_sr' Kamailio module. Lua (http://www.lua.org) is a fast and easy to embed scripting language. Exported API from SIP router to Lua is documented in the dokuwiki. The module has two Lua contexts: * first is used for functions lua_dofile() and lua_dostring(). * second is used for function lua_run() and parameter 'load'. Therefore lua_run() cannot execute functions from scripts loaded via lua_dofile() in config. This is kind of caching mode, avoiding reading file every time, but you must be sure you do not have something that is executed by default and requires access to SIP message. This is also the context used with KEMI framework.

Documentación oficial: https://www.kamailio.org/docs/modules/stable/modules/app_lua.html
Código fuente: https://github.com/kamailio/kamailio/tree/master/src/modules/app_lua

Parámetros de configuración

ParámetroTipoDescripción
load string 3.2. reload (boolean) 3.3. log_mode (int)
reload boolean 3.3. log_mode (int)
log_mode int 3.1. load (string)
load string Set the path to the Lua script to be loaded at startup. Then you can use lua_run(function, params) to execute a function from the script at runtime. The script can be in Lua-source or bytecode.
reload boolean If reload is 1 enables the ability to reload the scripts using the RPC app_lua.reload command. To disable reload feature, set this parameter to 0.
log_mode int Control what is printed in log messages. If bit 1 is set, then the module prints debug messages for each KEMI export.

Funciones exportadas

lua_dofile(path)

4.2. lua_dostring(script) 4.3. lua_run(func [, params]) 4.4. lua_runstring(script)

lua_dostring(script)

4.3. lua_run(func [, params]) 4.4. lua_runstring(script)

lua_run(func [, params])

4.4. lua_runstring(script)

lua_runstring(script)

4.1. lua_dofile(path)

lua_dofile(path)

Execute the Lua script stored in 'path'. The parameter can be a string with pseudo-variables evaluated at runtime.

lua_dostring(script)

Execute the Lua script stored in parameter. The parameter can be a string with pseudo-variables.

lua_run(func [, params])

Execute the Lua function 'func' giving 'params' as parameters. There can be up to 3 string parameters after 'func' (overall, max 4 params, first is the function). The function must exist in the Lua script loaded at startup via parameter 'load'. Param

lua_runstring(script)

Execute the Lua script stored in parameter. The parameter can be a string with pseudo-variables. The script is executed in Lua context specific to loaded Lua files at startup.

Autores y contribuidores

Daniel-Constantin MierlaDaniel-Constantin Mierla <miconda@gmail.com>

Copyright © 2010 Daniel-Constantin Mierla (asipto.com)

Módulos relacionados

app_perl app_python app_python3 app_python3s app_ruby app_ruby_proc async evapi