← Volver al índice de módulos

app_jsdt

This module allows executing JavaScript scripts from the Kamailio configuration file. It exports all KEMI functions to JavaScript in order to access the currently processed SIP message.
🔀 Enrutamiento y Proxy SIP Kamailio 6.1 6 parámetros 8 funciones

Descripción general

This module allows executing JavaScript scripts from the Kamailio configuration file. It exports all KEMI functions to JavaScript in order to access the currently processed SIP message. These functions are named within the JavaScript object 'KSR'. The module is based on the Duktape JavaScript engine (http://www.duktape.org), which is a fast and easy to embed JavaScript interpreter. The exported API from Kamailio to JavaScript is documented in the wiki. The module has two JavaScript contexts: * first is used for functions jsdt_dofile() and jsdt_dostring(). * second is used for function jsdt_run() and parameter 'load' and 'loaddir'. Therefore jsdt_run() cannot execute functions from scripts loaded via jsdt_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 environment is also used by KEMI framework for the config SIP routing functions.

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

Parámetros de configuración

ParámetroTipoDescripción
load str 3.2. loaddir (str) 3.3. mode (int)
loaddir str 3.3. mode (int)
mode int 3.1. load (str)
load str Set the path to the JavaScript file to be loaded at startup. Then you can use jsdt_run(function, params) to execute a function from the script at runtime. If you use it for KEMI configuration, then it
loaddir str Set the path to the folder containing JavaScript files to be loaded at startup. All .js files in the folder will be loaded and combined into a single javascript script. Then you can use jsdt_run(funct
mode int Control if the API to load JavaScript module (nodejs interface) is initialized or not.

Funciones exportadas

jsdt_dofile(path)

4.2. jsdt_dostring(script) 4.3. jsdt_run(function, params) 4.4. jsdt_runstring(script)

jsdt_dostring(script)

4.3. jsdt_run(function, params) 4.4. jsdt_runstring(script)

jsdt_run(function, params)

4.4. jsdt_runstring(script)

jsdt_runstring(script)

4.1. jsdt_dofile(path)

jsdt_dofile(path)

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

jsdt_dostring(script)

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

jsdt_run(function, params)

Execute the JS function 'func' giving params as parameters. There can be up to 3 string parameters. The function must exist in the script loaded at startup via parameter 'load'. Parameters can be strings with pseudo-variables that are evaluated at ru

jsdt_runstring(script)

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

Autores y contribuidores

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

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

Módulos relacionados

acc acc_diameter acc_json acc_radius alias_db carrierroute cfgt cfgutils