List of Tables
List of Examples
This module provides a simple way for handling different events, triggered through the OpenSIPS Event Interface, directly from the OpenSIPS script. For a specific event, a special route (event_route) has to be declared in the script, and should contain the code that handles the event. The route is executed by the module when the corresponding event is raised by the OpenSIPS Event Interface.Since version 1.12, the way an event is handlend (sync/async) should be specified from the configuration script with the desired keyword following the name of the event (event_route[e, sync]).
In order to retrieve the parameters of an event, the fetch_event_params(pvar_list) function is used. It receives a single parameter, that consists of a list of parameters names (optional) and the pseudo-variable where the values will be stored. The grammar is:
[ param_name= ] pvar [; [ param_name= ] pvar ]*
Example:
fetch_event_params("$avp(first_param)"); fetch_event_params("ip=$avp(pike_ip)"); fetch_event_params("source=$avp(src);destination=$avp(dst)");
If the name of the parameter is not specified, the avp will be populated according to the order of the parameters, as exported by the event. The following code will populate the $avp(first) avp with the first parameter of the event, $avp(second) with the second one and so on.
fetch_event_params("$avp(first);$avp(second);$avp(third)");
NOTE: An event may be triggered within a different event, leading to nested processing. This function will retrieve the parameters of the currently processed event.
The event name can contain any non-quoted string character, but it is recommended to follow the syntax: E_MODULE_NAME_EXTRA_NAME
In order to handle the E_PIKE_BLOCKED event, the following snippet can be used:
Example 1.1. EVENT_ROUTE usage
event_route[E_PIKE_BLOCKED] { fetch_event_params("ip=$avp(pike-ip)"); xlog("IP $avp(pike-ip) has been blocked\n"); }
As the OpenSIPS Event Interface requires, the event_route module uses a specific socket syntax:
'route:' event_name
Example:
route:E_PIKE_BLOCKED
The following modules must be loaded before this module:
No dependencies on other OpenSIPS modules.
Retrieves the parameters of the event. For more information, please read Section 1.2, “ROUTE events parameters”.
The the pseudo variables list as described in Section 1.2, “ROUTE events parameters”.
This function can be used from REQUEST_ROUTE and EVENT_ROUTE.
Example 1.2. fetch_event_params
usage
... fetch_event_params("$avp(first_param)"); # fetch the first parameter of an event fetch_event_params("ip=$avp(pike_ip)"); # fetch the ip parameter fetch_event_params("source=$avp(src);destination=$avp(dst)"); # fetch the source and destination parameters ...
2.1. | Can I declare more routes for handling the same event? |
No, only a single event_route can be used for a particular event. | |
2.2. | Where can I find more about OpenSIPS? |
Take a look at https://opensips.org/. | |
2.3. | Where can I post a question about this module? |
First at all check if your question was already answered on one of our mailing lists:
E-mails regarding any stable OpenSIPS release should be sent to
If you want to keep the mail private, send it to
| |
2.4. | How can I report a bug? |
Please follow the guidelines provided at: https://github.com/OpenSIPS/opensips/issues. |
Table 3.1. Top contributors by DevScore(1), authored commits(2) and lines added/removed(3)
Name | DevScore | Commits | Lines ++ | Lines -- | |
---|---|---|---|---|---|
1. | Razvan Crainea (@razvancrainea) | 28 | 20 | 859 | 31 |
2. | Liviu Chircu (@liviuchircu) | 11 | 9 | 20 | 41 |
3. | Ionut Ionita (@ionutrazvanionita) | 8 | 5 | 138 | 51 |
4. | Ovidiu Sas (@ovidiusas) | 7 | 2 | 384 | 9 |
5. | Bogdan-Andrei Iancu (@bogdan-iancu) | 6 | 4 | 13 | 19 |
6. | Ionel Cerghit (@ionel-cerghit) | 3 | 1 | 5 | 6 |
7. | Vlad Paiu (@vladpaiu) | 2 | 1 | 1 | 0 |
8. | Vlad Patrascu (@rvlad-patrascu) | 2 | 1 | 1 | 0 |
9. | Walter Doekes (@wdoekes) | 1 | 1 | 0 | 0 |
(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. | Bogdan-Andrei Iancu (@bogdan-iancu) | Oct 2014 - Dec 2020 |
2. | Razvan Crainea (@razvancrainea) | Dec 2012 - Jan 2020 |
3. | Liviu Chircu (@liviuchircu) | Mar 2014 - Jun 2018 |
4. | Vlad Patrascu (@rvlad-patrascu) | May 2017 - May 2017 |
5. | Vlad Paiu (@vladpaiu) | Jun 2016 - Jun 2016 |
6. | Ionel Cerghit (@ionel-cerghit) | Jun 2015 - Jun 2015 |
7. | Ionut Ionita (@ionutrazvanionita) | Oct 2014 - Oct 2014 |
8. | Ovidiu Sas (@ovidiusas) | Jul 2014 - Jul 2014 |
9. | Walter Doekes (@wdoekes) | May 2014 - May 2014 |
(1) including any documentation-related commits, excluding merge commits
Last edited by: Bogdan-Andrei Iancu (@bogdan-iancu), Liviu Chircu (@liviuchircu), Ionut Ionita (@ionutrazvanionita), Ovidiu Sas (@ovidiusas), Razvan Crainea (@razvancrainea).
doc copyrights:
Copyright © 2012 www.opensips-solutions.com