The exec module allows external commands to be executed from a Kamailio script. The commands may be any valid shell commands--the command string is passed to the shell using “popen” command. Kamailio passes additional information about the request in environment variables: * SIP_HF_<hf_name> contains value of each header field in request. If a header field occurred multiple times, values are concatenated and comma-separated. <hf_name> is in capital letters. Ff a header-field name occurred in compact form, <hf_name> is canonical. * SIP_TID is transaction identifier. All request retransmissions or CANCELs/ACKs associated with a previous INVITE result in the same value. * SIP_DID is dialog identifier, which is the same as to-tag. Initially, it is empty. * SIP_SRCIP is source IP address from which request came. * SIP_ORURI is the original request URI. * SIP_RURI is current request URI (if unchanged, equal to original). * SIP_USER is userpart of current request URI. * SIP_OUSER is userpart of original request URI. NOTE: The environment variables must be specified with double $ (e.g., $$SIP_OUSER) in the parameters given to exec functions. Otherwise they will be evaluated as Kamailio pseudo-variables, throwing errors. WARNING: if the exec functions are passed variables that might include malicious input, then remote attackers may abuse the exec functions to execute arbitrary code. Specifically, this may result in OS command injection. In such cases, input validation is required to
| Parámetro | Tipo | Descripción |
|---|---|---|
| setvars | integer | 3.2. time_to_kill (integer) |
| time_to_kill | integer | 3.1. setvars (integer) |
| setvars | integer | Turn off to disable setting environment variables for executed commands. |
| time_to_kill | integer | Specifies the longest time a program is allowed to execute. If the time is exceeded, the program is killed. |
4.2. exec_msg(command) 4.3. exec_avp(command [, avplist]) 4.4. exec_cmd(command)
4.3. exec_avp(command [, avplist]) 4.4. exec_cmd(command)
4.4. exec_cmd(command)
4.1. exec_dset(command)
Executes an external command. Current URI is passed to the command as parameter. Output of the command is considered URI set (separated by lines).
Executes an external command. The whole message is passed to it in input, no command-line parameters are added, output of the command is not processed.
Executes an external command. Each line from output of the command is saved in an AVP from 'avplist'. If 'avplist' is missing, the AVPs are named 1, 2, 3, ...
Executes an external command. It is a lightweight version, which does not pass the SIP message as parameter, does not set the environment variables and it does not use the output of the command.
Copyright © 2003 FhG FOKUS