|
@@ -17,15 +17,16 @@
|
|
|
<section>
|
|
|
<title>Overview</title>
|
|
|
<para>
|
|
|
- This module allows executing JavaScript scripts from config file.
|
|
|
+ This module allows executing JavaScript scripts from the Kamailio
|
|
|
+ configuration file.
|
|
|
It exports all KEMI functions to JavaScript in order to access the
|
|
|
- current processed SIP message. These functions are within JavaScript
|
|
|
- object 'KSR'.
|
|
|
+ currently processed SIP message. These functions are named within
|
|
|
+ the JavaScript object 'KSR'.
|
|
|
</para>
|
|
|
<para>
|
|
|
- It includes the Duktape JavaScript engine (http://www.duktape.org),
|
|
|
- which is a fast and easy to embed JavaScript interpreter. Exported API
|
|
|
- from SIP router to JavaScript is documented in the dokuwiki.
|
|
|
+ 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.
|
|
|
</para>
|
|
|
<para>
|
|
|
The module has two JavaScript contexts:
|
|
@@ -42,7 +43,7 @@
|
|
|
and parameter 'load'. 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
|
|
|
+ you do not have someting 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.
|
|
|
</para>
|
|
@@ -74,7 +75,7 @@
|
|
|
<listitem>
|
|
|
<para>
|
|
|
<emphasis>libm</emphasis> - the math library (part of standard
|
|
|
- system libraries - it is needed to compile embedded Duktape JS
|
|
|
+ system libraries - it is needed to complile embedded Duktape JS
|
|
|
interpreter).
|
|
|
</para>
|
|
|
</listitem>
|
|
@@ -116,7 +117,7 @@ modparam("app_jsdt", "load", "/usr/local/etc/kamailio/js/myscript.js")
|
|
|
<function moreinfo="none">jsdt_dofile(path)</function>
|
|
|
</title>
|
|
|
<para>
|
|
|
- Execute the JS script stored in 'path'. The parameter can be
|
|
|
+ Execute the JavaScript script stored in 'path'. The parameter can be
|
|
|
a string with pseudo-variables evaluated at runtime.
|
|
|
</para>
|
|
|
<example>
|
|
@@ -134,7 +135,7 @@ jsdt_dofile("/usr/local/etc/kamailio/js/myscript.js");
|
|
|
<function moreinfo="none">jsdt_dostring(script)</function>
|
|
|
</title>
|
|
|
<para>
|
|
|
- Execute the Lua script stored in parameter. The parameter can be
|
|
|
+ Execute the JavaScript script stored in parameter. The parameter can be
|
|
|
a string with pseudo-variables.
|
|
|
</para>
|
|
|
<example>
|
|
@@ -248,7 +249,7 @@ if(!jsdt_runstring('KSR.dbg("Hello World from $fU\n")'))
|
|
|
<section>
|
|
|
<title>Example of usage</title>
|
|
|
<para>
|
|
|
- Create your JS script and stored on file system,
|
|
|
+ Create your JS script and store it on the file system,
|
|
|
say: '/usr/local/etc/kamailio/js/myscript.js'.
|
|
|
</para>
|
|
|
<programlisting format="linespecific">
|