Table of Contents
List of Tables
List of Examples
The time needed when writing a new OpenSIPS module unfortunately is quite high, while the options provided by the configuration file are limited to the features implemented in the modules.
With this Lua module, you can easily implement your own OpenSIPS extensions in Lua.
This Lua module is loaded in opensips.cfg (just like all the other modules) with loadmodule("/path/to/lua.so");.
For the Lua module to compile, you need a recent version of Lua (tested with 5.1) linked dynamically. The default version of your favorite Linux distribution should work fine.
With the Lua module, you can access to lua function on the OpenSIPS side. You need to define a file to load and call a function from it. Write a function "mongo_alias" and then write in your opensips.cfg
... if (lua_exec("mongo_alias")) { ... } ...
On the Lua side, you have access to opensips functions and variables (AVP, pseudoVar, ...). Read the documentation below for further informations.
The following libraries or applications must be installed before running OpenSIPS with this module loaded:
Lua 5.1.x or later
memcached
This module has been developed and tested with Lua 5.1.?, but should work with any 5.1.x release. Earlier versions do not work.
On current Debian systems, at least the following packages should be installed:
lua5.1
liblua5.1-0-dev
libmemcached-dev
libmysqlclient-dev
It was reported that other Debian-style distributions (such as Ubuntu) need the same packages.
On OpenBSD systems, at least the following packages should be installed:
Lua
This is the file name of your script. This may be set once only, but it may include an arbitary number of functions and "use" as many Lua module as necessary.
The default value is "/etc/opensips/opensips.lua"
Example 1.1. Set luafilename parameter
... modparam("lua", "luafilename", "/etc/opensips/opensips.lua") ...
Define this value to 1 if you want to reload automatically the lua script. Disabled by default.
When you call a function via moduleFunc() you could have a memleak. Enable this warns you when you're doing it. Enabled by default.
Calls a Lua function with passing it the current SIP message. This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, ONREPLY_ROUTE and BRANCH_ROUTE.
Parameters:
func (string) - Lua function name
param (string, optional) - Parameter to be passed to the Lua function.
This module provides access to a limited number of OpenSIPS core functions.
Logs the message with OpenSIPS's logging facility. The logging level is one of the following:
ALERT
CRIT
ERR
WARN
NOTICE
INFO
DBG
Test if the host and optionally the port represent one of the addresses that OpenSIPS listens on.
Table 3.1. Top contributors by DevScore(1), authored commits(2) and lines added/removed(3)
Name | DevScore | Commits | Lines ++ | Lines -- | |
---|---|---|---|---|---|
1. | Arnaud Chong + Eric Gouyer | 37 | 1 | 4335 | 0 |
2. | Razvan Crainea (@razvancrainea) | 32 | 25 | 263 | 219 |
3. | Vlad Patrascu (@rvlad-patrascu) | 24 | 16 | 320 | 274 |
4. | Liviu Chircu (@liviuchircu) | 13 | 10 | 15 | 63 |
5. | Bogdan-Andrei Iancu (@bogdan-iancu) | 8 | 6 | 9 | 3 |
6. | Vlad Paiu (@vladpaiu) | 5 | 3 | 7 | 9 |
7. | Maksym Sobolyev (@sobomax) | 3 | 1 | 6 | 3 |
8. | Julián Moreno Patiño | 3 | 1 | 1 | 1 |
9. | Peter Lemenkov (@lemenkov) | 3 | 1 | 1 | 1 |
(1) DevScore = author_commits + author_lines_added / (project_lines_added / project_commits) + author_lines_deleted / (project_lines_deleted / project_commits)
(2) including any documentation-related commits, excluding merge commits. Regarding imported patches/code, we do our best to count the work on behalf of the proper owner, as per the "fix_authors" and "mod_renames" arrays in opensips/doc/build-contrib.sh. If you identify any patches/commits which do not get properly attributed to you, please submit a pull request which extends "fix_authors" and/or "mod_renames".
(3) ignoring whitespace edits, renamed files and auto-generated files
Table 3.2. Most recently active contributors(1) to this module
Name | Commit Activity | |
---|---|---|
1. | Vlad Patrascu (@rvlad-patrascu) | May 2017 - Jun 2023 |
2. | Maksym Sobolyev (@sobomax) | Feb 2023 - Feb 2023 |
3. | Razvan Crainea (@razvancrainea) | Feb 2012 - Feb 2023 |
4. | Bogdan-Andrei Iancu (@bogdan-iancu) | May 2014 - Jan 2020 |
5. | Liviu Chircu (@liviuchircu) | Mar 2014 - Mar 2019 |
6. | Peter Lemenkov (@lemenkov) | Jun 2018 - Jun 2018 |
7. | Julián Moreno Patiño | Feb 2016 - Feb 2016 |
8. | Vlad Paiu (@vladpaiu) | Feb 2012 - Jun 2012 |
9. | Arnaud Chong + Eric Gouyer | Dec 2011 - Dec 2011 |
(1) including any documentation-related commits, excluding merge commits
Last edited by: Vlad Patrascu (@rvlad-patrascu), Razvan Crainea (@razvancrainea), Peter Lemenkov (@lemenkov), Liviu Chircu (@liviuchircu), Vlad Paiu (@vladpaiu), Arnaud Chong + Eric Gouyer.
Documentation Copyrights:
Copyright © 2006-2011 Arnaud Chong, Eric Gouyer