Documentation

Documentation.Script-Format History

Hide minor edits - Show changes to markup

May 28, 2013, at 08:23 PM by 109.99.235.212 -
Changed line 4 from:

Page for other versions: devel 1.9 1.8 old versions : 1.7 1.6 1.5 1.4

to:

Page for other versions: devel 1.9 1.8 old versions: 1.7 1.6 1.5 1.4

May 28, 2013, at 08:13 PM by 109.99.235.212 -
Changed line 1 from:
Documentation -> Manuals -> Manual trunk -> Script Format
to:
Documentation -> Manuals -> Manual devel -> Script Format
May 28, 2013, at 08:05 PM by 109.99.235.212 -
Changed lines 22-23 from:

Usually, in the first part, you declare the OpenSIPS global parameters - these global or core parameters are affecting the OpenSIPS core and possible the modules.

to:

Usually, in the first part, you declare the OpenSIPS global parameters - these global or core parameters are affecting the OpenSIPS core and possible the modules.

Changed lines 40-42 from:

In 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.

Once the modules are loaded, the parameters of the modules may be set using the modparam directive - to list of available parameters for each module, the type of parameter value (integer or string) can be found in the documentation of the modules, the Parameters section.

to:

In 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.

Once the modules are loaded, the parameters of the modules may be set using the modparam directive - to list of available parameters for each module, the type of parameter value (integer or string) can be found in the documentation of the modules, the Parameters section.

Changed line 69 from:

What are the existing top routes, when they are triggered, what kind of SIP messages is handled, what SIP operations are allowed and other are documented in the types of routes section.\\\

to:

What are the existing top routes, when they are triggered, what kind of SIP messages is handled, what SIP operations are allowed and other are documented in the types of routes section.\\\

Changed line 71 from:

See the description of the route directive.

to:

See the description of the route directive.

May 28, 2013, at 08:01 PM by 109.99.235.212 -
Changed line 1 from:
Documentation -> Manuals -> Manual trunk -> Script -> Format
to:
Documentation -> Manuals -> Manual trunk -> Script Format
May 28, 2013, at 08:00 PM by 109.99.235.212 -
Changed lines 1-2 from:
Documentation -> Manuals -> Manual 1.9 -> Script -> Format
to:
Documentation -> Manuals -> Manual trunk -> Script -> Format

(:title Script Format - ver devel :)


Page for other versions: devel 1.9 1.8 old versions : 1.7 1.6 1.5 1.4


Script Format devel
PrevNext
May 28, 2013, at 05:16 PM by 109.99.235.212 -
Added line 11:

Changed line 29 from:
to:

Added line 35:

Examples:

Added lines 42-43:

or

Changed lines 53-85 from:

Routing logic

to:

Routing logic

The 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.

There are different types of routes :

  1. top routes - routes that are directly triggered by OpenSIPs when some events occurs (like SIP request received, SIP reply received, transaction failed, etc)
  2. sub-routes - routes that are triggered / used from other routes in script.


What are the existing top routes, when they are triggered, what kind of SIP messages is handled, what SIP operations are allowed and other are documented in the types of routes section.

The sub-routes have names and they are to be called from any other route (top or sub) in the script via their names. The sub-routes may take parameters (when called) or return a numerical code (avoid returning 0 value as this will terminate your whole script. The sub-routes are similar to functions / procedure in any programing language. See the description of the route directive.

Example:

route { # top route triggered on incoming SIP requests
   if ( route(src_ip_is_gw) ) {
      xlog("request $rm comes from GW\n");
   }
}

onreply_route { # top route triggered on incoming SIP replies
   if ( route(src_ip_is_gw) ) {
      xlog("reply $rc comes from GW\n");
   }
}

route[src_ip_is_gw] { #sub-route
   if ($si=='11.22.33.44' || $si=='11.22.33.45')
      return 1;
   return -1;
}
May 28, 2013, at 04:55 PM by 109.99.235.212 -
Added lines 17-18:

Example:

Changed lines 31-32 from:

In regards to the OpenSIPS modules

to:

In 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.

Once the modules are loaded, the parameters of the modules may be set using the modparam directive - to list of available parameters for each module, the type of parameter value (integer or string) can be found in the documentation of the modules, the Parameters section.

loadmodule "modules/mi_datagram/mi_datagram.so"
modparam("mi_datagram", "socket_name", "udp:127.0.0.1:4343")
modparam("mi_datagram", "children_count", 3)
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")
May 28, 2013, at 04:37 PM by 109.99.235.212 -
Changed lines 7-32 from:
  1. global parameters - usually, in the first part, you declare the OpenSIPS global parameters - these global or core parameters are a
to:
  1. global parameters
  2. modules section
  3. routing logic

Global parameters

Usually, 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.

disable_tcp = yes
listen = udp:192.168.2.10:5060
listen = udp:192.168.2.10:5070
fork = yes
children = 4
log_stderror = no

Modules section

In regards to the OpenSIPS modules

Routing logic

May 28, 2013, at 01:59 PM by 109.99.235.212 -
Changed lines 3-7 from:

to:

The OpenSIPs configuration script has three main logical parts :

  1. global parameters - usually, in the first part, you declare the OpenSIPS global parameters - these global or core parameters are a
May 28, 2013, at 12:28 PM by 109.99.235.212 -
Added lines 1-3:
Documentation -> Manuals -> Manual 1.9 -> Script -> Format


Page last modified on May 28, 2013, at 08:23 PM