Kamailio pseudo variables

From 탱이의 잡동사니
Jump to: navigation, search


Kamailio pseudo variable 내용 정리


Kamailio 에는 여러 가지 pseudo-variable 이 있다.

Pseudo Variables

$rs - SIP reply code

Reference to reply's status (status-code, response-code, reply-code).

$ru - Request URI

Reference to request's URI(address in the first line of a SIP request). It is R/W variable(you can assign values to it directly in configuration file).

$rU - Username in R-URI

Reference to username in request's URI or to the Namespace Identifier of a URN(See RFC 2141).

$si - Source IP address

Reference to IP source address of the message - See also $siz.

$sid - Server ID

The value for server ID(server_id parameter).

$siz - Source IP address

Reference to IP address address of the message, with enclosing square brackets for IPv6.

$ua - User agent header

Reference to user agent header field.

$var(name) - Private memory variable(zero)

$var(name) refers to variables that can be used in configuration script, having integer or string value. This kind of variables are faster than AVPs, being referenced directly to memory location.

$var(a) = 2; #-- sets the value of variable 'a' to integer '2'
$var(a) = "2" #-- sets the value of variable 'a' to string '2'
$var(a) = "sip:" + $au + "@" + $fd; #-- compose a value from authentication username and From URI domain.
$var(a) = 3 + (7&(~2));
if( $var(a) & 4 ) {
  xlog("var a has third bit set\n");

Setting a variable to $null is actually initializing the value to integer '0'. This type of script variable doesn't have &null value.

$var(x) = $null
if ($var(x) == 0) { # this is true