Kamailio pseudo variables: Difference between revisions

From 탱이의 잡동사니
Jump to navigation Jump to search
(Created page with "== Overview == Kamailio pseudo variable 내용 정리 == Basic == Kamailio 에는 여러 가지 pseudo-variable 이 있다. == Reference == * https://www.kamailio.org/wiki/c...")
 
 
(5 intermediate revisions by the same user not shown)
Line 4: Line 4:
== Basic ==
== Basic ==
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.
<source lang=bash>
$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");
}
</source>
Setting a variable to $null is actually initializing the value to integer '0'. This type of script variable doesn't have &null value.
<source lang=bash>
$var(x) = $null
if ($var(x) == 0) { # this is true
  ...
}
</source>


== Reference ==
== Reference ==

Latest revision as of 15:56, 6 August 2019

Overview

Kamailio pseudo variable 내용 정리

Basic

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. <source lang=bash> $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");

} </source>

Setting a variable to $null is actually initializing the value to integer '0'. This type of script variable doesn't have &null value. <source lang=bash> $var(x) = $null

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

 ...

} </source>

Reference