This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
cookbooks:devel:pseudovariables [2020/06/05 09:52] miconda |
cookbooks:devel:pseudovariables [2021/05/15 09:26] miconda [$sel(name) - Selects] |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Pseudo-Variables ====== | ||
+ | |||
+ | Version: Kamailio SIP Server v5.6.x (devel) | ||
+ | |||
{{ : | {{ : | ||
- | ====== Kamailio SIP Server v5.4.x (devel): Pseudo-Variables ====== | ||
===== Introduction ===== | ===== Introduction ===== | ||
Line 193: | Line 196: | ||
**$dd** - reference to domain of destination uri (without port) | **$dd** - reference to domain of destination uri (without port) | ||
+ | ==== $def(name) - Defined Value ==== | ||
+ | **$def(name)** - return a defined value. | ||
+ | |||
+ | Example: | ||
+ | |||
+ | <code c> | ||
+ | #!define ABC xyz | ||
+ | |||
+ | xlog(" | ||
+ | </ | ||
+ | |||
+ | ==== $defn(name) - Defined Value As Number ==== | ||
+ | |||
+ | **$defn(name)** - return a defined value as a signed integer. | ||
+ | |||
+ | Example: | ||
+ | |||
+ | <code c> | ||
+ | #!define FLT_ACC 1 | ||
+ | |||
+ | xlog(" | ||
+ | </ | ||
==== $di - Diversion header URI ==== | ==== $di - Diversion header URI ==== | ||
Line 243: | Line 268: | ||
**$fd** - reference to domain in URI of ' | **$fd** - reference to domain in URI of ' | ||
+ | |||
+ | <fc # | ||
==== $fn - From display name ==== | ==== $fn - From display name ==== | ||
Line 411: | Line 438: | ||
**$retcode** - same as **$rc** | **$retcode** - same as **$rc** | ||
+ | Note that the value of $rc is overwritten by each new function call. | ||
+ | |||
+ | Example of use: | ||
+ | |||
+ | <code c> | ||
+ | lookup(" | ||
+ | $var(rc) = $rc; | ||
+ | if ($var(rc) < 0) { | ||
+ | t_newtran(); | ||
+ | switch ($var(rc)) { | ||
+ | case -1: | ||
+ | case -3: | ||
+ | send_reply(" | ||
+ | exit; | ||
+ | case -2: | ||
+ | send_reply(" | ||
+ | exit; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | </ | ||
==== $rd - Domain in R-URI ==== | ==== $rd - Domain in R-URI ==== | ||
Line 1007: | Line 1055: | ||
<code c> | <code c> | ||
xlog(" | xlog(" | ||
+ | </ | ||
+ | |||
+ | ===== $ccp(key) - Config Custom Parameters ===== | ||
+ | |||
+ | Get the value for global custom parameters: | ||
+ | |||
+ | * https:// | ||
+ | |||
+ | |||
+ | Example: | ||
+ | |||
+ | <code c> | ||
+ | gv.sval = " | ||
+ | gv.ival = 10 desc "ten var" | ||
+ | |||
+ | request_route { | ||
+ | xinfo(" | ||
+ | } | ||
</ | </ | ||
Line 1048: | Line 1114: | ||
event_route[core: | event_route[core: | ||
xlog(" | xlog(" | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ==== $rpl(key) ==== | ||
+ | |||
+ | Attributes of the SIP reply processed at that moment. The variables must be used during SIP reply processing, otherwise it returns $null. | ||
+ | |||
+ | The key can be: | ||
+ | |||
+ | * duri - SIP URI corresponding to the address where the SIP reply is going to be sent based on 2nd via | ||
+ | * dhost - host part of duri | ||
+ | * dport - port part of duri | ||
+ | * dproto - proto part of duri | ||
+ | * dprotoid - proto id of duri | ||
+ | * cntvia - the number of Via header bodies | ||
+ | |||
+ | Example of usage: | ||
+ | |||
+ | <code c> | ||
+ | reply_route{ | ||
+ | xinfo(" | ||
} | } | ||
</ | </ | ||
Line 1558: | Line 1645: | ||
==== $T_branch_idx ==== | ==== $T_branch_idx ==== | ||
- | * the index (starting with 1 for the first branch) of the branch for which is executed the branch_route[]. | + | * the index (starting with 0 for the first branch) of the branch for which is executed the branch_route[]. |
+ | * in failure_route[] block, the value is the number of completed branches added to the number of new new branches | ||
+ | * in request_route block, the value is number of created branches | ||
+ | * in onreply_route[], | ||
+ | * if used outside of transaction processing, the value is '-1' | ||
==== $T_reply_ruid ==== | ==== $T_reply_ruid ==== |