Table of Contents
List of Examples
exec parameterTable of Contents
The module executes event route blocks or KEMI functions on dedicated processes at startup. The execution can be delayed for a specified interval of time.
The actions in the event route should be a loop or other tasks that run forever.
The following modules must be loaded before this module:
No dependencies on other Kamailio modules.
The definition of an exec task. The value of the parameter must have the following format:
"name=_string_;wait=_number_;workers=_number_"
The parameter can be set multiple times to get more exec tasks in same configuration file.
name - name of the event route to be executed. When used with a KEMI embedded language, this has to be the name of a function from the KEMI script. The function must have a string parameter, which will retrieve the index of the works in string format.
workers - if set to 0 or 1 the task is executed in a dedicated process. Any number > 1 will create more dedicated processes, each of them executing the task.
wait - timer interval in micro-seconds to wait inside the dedicated process before executing the task.
Default value is NULL.
Example 1.1. Set exec parameter
...
modparam("evrexec", "exec", "name=evrexec:timer;wait=1000;workers=1;")
...
event_route[evrexec:timer] {
$var(x) = 0;
while(1) {
xlog("$$var(x) is $var(x)\n");
$var(x) = $var(x) + 1;
sleep("600");
}
}
...
Run an event_route block or a KEMI function upon an RPC command.
Name: evroute.run
Parameters:
evname
- the name of the event route block or the KEMI function.evdata
- (optional) - arbitrary data passed as a string, which is made available inside event route block as $evr(data).
RPC Command Format:
...
event_route[evrexec:test] {
xlog("rpc command data: $evr(data)\n");
}
...
kamctl rpc evroute.run evroute:test
kamctl rpc evroute.run evroute:test mydata
...