Documentation |
Documentation -> Manuals -> Manual devel -> Script SyntaxPages for other versions: devel 3.5 3.4 Older versions: 3.3 3.2 3.1 3.0 2.4 2.3 2.2 2.1 1.11 1.10 1.9 1.8 1.7 1.6 1.5 1.4
Table of Content (hide) 1. Script FormatThe OpenSIPs configuration script has three main logical parts:
1.1 Global parametersUsually, in the first part, you declare the OpenSIPS global parameters - these global or core parameters are affecting the OpenSIPS core and possible the modules. Configuring the network listeners, available transport protocols, forking (and number of processes), the logging and other global stuff is provided by these global parameters. Example: disable_tcp = yes listen = udp:192.168.3.60:5060 listen = udp:192.168.3.60:5070 fork = yes children = 4 log_stderror = no 1.2 Modules sectionIn regards to the OpenSIPS modules,the modules that are to be loaded (no module is loaded by default) are specified by using the directive loadmodule. Modules are to be specified by name and an optional path (to the .so file). If no path is provided (and just the name of the module), the default path will be assumed for locating the loading the module (default path is /usr/lib/opensips/modules if not other one configured at compile time. For configuring a different path, either the path is pushed directly with the module name (to get control per module) or it can be globally (for all modules) configured via the mpath global parameter. Examples: loadmodule "modules/mi_datagram/mi_datagram.so" modparam("mi_datagram", "socket_name", "udp:127.0.0.1:4343") modparam("mi_datagram", "children_count", 3) or mpath="/usr/local/opensips_proxy/lib/modules" loadmodule "mi_datagram.so" modparam("mi_datagram", "socket_name", "udp:127.0.0.1:4343") modparam("mi_datagram", "children_count", 3) loadmodule "mi_fifo.so" modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo") 1.3 Routing logicThe routing logic is actually a sum of routes (script routes) that contain the OpenSIPS logic for routing SIP traffic. The description of OpenSIPS behavior in relation to the SIP traffic is done via this routes.
2. Data TypesThe OpenSIPS scripting language supports the following data types: Basic
Complex
3. Function Calling ConventionsAll OpenSIPS core and module functions internally share the same function interface, such that they benefit from the following calling convention:
ds_select_dst(1, 1); ... is equivalent to: $var(x) = 1; ds_select_dst($var(x), $var(x));
set_dlg_profile("caller", "$var(country_code)_$var(area)_$fU");
ds_count(1, "a", $var(out_result));
ds_select_dst("1", "1"); ds_select_dst(1, 1); |