Kamailio pseudo variables: Difference between revisions

From 탱이의 잡동사니
Jump to navigation Jump to search
Line 14: Line 14:
=== $siz - Source IP address ===
=== $siz - Source IP address ===
Reference to IP address address of the message, with enclosing square brackets for IPv6.
Reference to IP address address of the message, with enclosing square brackets for IPv6.
== $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 ==

Revision as of 13:57, 23 July 2019

Overview

Kamailio pseudo variable 내용 정리

Basic

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

Pseudo Variables

$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.

$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