cookbooks:3.2.x:pseudovariables
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
cookbooks:3.2.x:pseudovariables [2011/11/30 08:27] – [$shtcv(htable=>regexp)] 85.178.74.216 | cookbooks:3.2.x:pseudovariables [2012/05/03 11:35] (current) – [AVPs] klaus3000 | ||
---|---|---|---|
Line 9: | Line 9: | ||
There is a set of predefined pseudo-variables, | There is a set of predefined pseudo-variables, | ||
- | Pseudo-Variables are implemented by various modules, most of them are provided by [b]pv[/b]. | + | Pseudo-Variables are implemented by various modules, most of them are provided by **pv**. |
===== Pseudo-variables usage ===== | ===== Pseudo-variables usage ===== | ||
Line 112: | Line 112: | ||
**$br** - reference to request' | **$br** - reference to request' | ||
- | <hi #d0d0d0>It is R/W variable, you can assign values to it directly in configuration file (will add a new branch).</ | + | <fc #0000ff>It is R/W variable, you can assign values to it directly in configuration file (will add a new branch).</ |
==== Request' | ==== Request' | ||
Line 190: | Line 190: | ||
$du is also set if lookup() function of ' | $du is also set if lookup() function of ' | ||
- | <hi #d0d0d0>It is R/W variable (you can assign values to it directly in configuration file)</hi> | + | <fc #0000ff>It is R/W variable (you can assign values to it directly in configuration file)</fc> |
To reset $du: | To reset $du: | ||
Line 244: | Line 244: | ||
**$mf** - reference to message/ | **$mf** - reference to message/ | ||
- | <hi #d0d0d0>It is R/W variable (you can assign values to it directly in configuration file)</hi> | + | <fc #0000ff>It is R/W variable (you can assign values to it directly in configuration file)</fc> |
==== Flags in hexadecimal ==== | ==== Flags in hexadecimal ==== | ||
Line 250: | Line 250: | ||
**$mF** -reference to message/ | **$mF** -reference to message/ | ||
- | <hi #d0d0d0>It is R/W variable (you can assign values to it directly in configuration file)</hi> | + | <fc #0000ff>It is R/W variable (you can assign values to it directly in configuration file)</fc> |
==== SIP message id ==== | ==== SIP message id ==== | ||
Line 259: | Line 259: | ||
**$ml** - reference to SIP message length | **$ml** - reference to SIP message length | ||
+ | |||
+ | ==== SIP Message Type ==== | ||
+ | |||
+ | **$mt** - returns 1 if the sip message is a request, returns 2 if the sip message is a reply | ||
+ | |||
==== Domain in SIP Request' | ==== Domain in SIP Request' | ||
Line 310: | Line 315: | ||
**$rd** - reference to domain in request' | **$rd** - reference to domain in request' | ||
- | <hi #d0d0d0>It is R/W variable (you can assign values to it directly in configuration file)</hi> | + | <fc #0000ff>It is R/W variable (you can assign values to it directly in configuration file)</fc> |
==== Body of request/ | ==== Body of request/ | ||
Line 331: | Line 336: | ||
**$rm** - reference to request' | **$rm** - reference to request' | ||
+ | |||
+ | ==== Request Method ID ==== | ||
+ | |||
+ | **$rmid** - returns internal integer representation of SIP method type | ||
+ | |||
==== SIP request' | ==== SIP request' | ||
Line 336: | Line 346: | ||
**$rp** - reference to port of R-URI | **$rp** - reference to port of R-URI | ||
- | <hi #d0d0d0>It is R/W variable (you can assign values to it directly in configuration file)</hi> | + | <fc #0000ff>It is R/W variable (you can assign values to it directly in configuration file)</fc> |
==== Transport protocol of SIP request URI ==== | ==== Transport protocol of SIP request URI ==== | ||
Line 358: | Line 368: | ||
**$ru** - reference to request' | **$ru** - reference to request' | ||
- | <hi #d0d0d0>It is R/W variable (you can assign values to it directly in configuration file)</hi> | + | <fc #0000ff>It is R/W variable (you can assign values to it directly in configuration file)</fc> |
==== Username in SIP Request' | ==== Username in SIP Request' | ||
Line 364: | Line 374: | ||
**$rU** - reference to username in request' | **$rU** - reference to username in request' | ||
- | <hi #d0d0d0>It is R/W variable (you can assign values to it directly in configuration file)</hi> | + | <fc #0000ff>It is R/W variable (you can assign values to it directly in configuration file)</fc> |
+ | |||
+ | ==== URI Scheme of Request URI ==== | ||
+ | |||
+ | **$rz** - returns R-URI scheme, possible values: sip, sips, tel and tels, R-URI scheme parsing error should be reflected by value: none | ||
==== Received IP address ==== | ==== Received IP address ==== | ||
Line 399: | Line 413: | ||
**$fs** - reference to the forced socket for message sending (if any) in the form proto: | **$fs** - reference to the forced socket for message sending (if any) in the form proto: | ||
- | <hi #d0d0d0>It is R/W variable (you can assign values to it directly in configuration file)</hi> | + | <fc #0000ff>It is R/W variable (you can assign values to it directly in configuration file)</fc> |
==== To URI Domain ==== | ==== To URI Domain ==== | ||
Line 462: | Line 476: | ||
The ' | The ' | ||
- | * "[si]:name" - name is the id of an AVP; ' | + | |
- | * " | + | * " |
+ | * pseudo variable - if value of pv is integer, id is integer, if string, id is string | ||
$(avp(id)[0]) can be written in shorter form as $avp(id) and $avp(s: | $(avp(id)[0]) can be written in shorter form as $avp(id) and $avp(s: | ||
- | AVPs are special variables that are attached to SIP transactions. It is a list of pairs (name, | + | AVPs are special variables that are attached to SIP transactions. It is a list of pairs (name, |
To delete the first AVP with name ' | To delete the first AVP with name ' | ||
Line 481: | Line 496: | ||
To overwrite the value of the AVP with name ' | To overwrite the value of the AVP with name ' | ||
<code c> | <code c> | ||
- | $(avp(id)[*]) = newvalue; | + | $(avp(id)[*]) = newvalue; |
</ | </ | ||
Line 491: | Line 506: | ||
$avp(x) = 1; # assign of integer value | $avp(x) = 1; # assign of integer value | ||
$avp(x) = 2; | $avp(x) = 2; | ||
+ | $avp(x) = 3; | ||
+ | # now: $avp(x) = $(avp(x)[0]) = 3, $(avp(x)[1]) = 2, $(avp(x)[2]) = 1 | ||
$avp(y) = " | $avp(y) = " | ||
- | if($(avp(x)[1])==1) { | + | if($(avp(x)[2])==1) { # TRUE |
... | ... | ||
} | } | ||
- | $(avp(x)[1]) = $null; | + | $(avp(x)[1]) = $null; |
+ | # now: $avp(x) = $(avp(x)[0]) = 2, $(avp(x)[1]) = 1 | ||
+ | $(avp(x)[*]) = $null; # all AVPs ' | ||
</ | </ | ||
Line 520: | Line 539: | ||
</ | </ | ||
- | <hi #d0d0d0>It is read-only variable. You can remove or add headers using functions from textops module.</ | + | <fc #0000ff>It is read-only variable. You can remove or add headers using functions from textops module.</ |
===== Script private variables ===== | ===== Script private variables ===== | ||
Line 543: | Line 562: | ||
**Note:** A script variable persists over the SIP-Router process in which it was initialized, | **Note:** A script variable persists over the SIP-Router process in which it was initialized, | ||
- | <hi #d0d0d0>It is R/W variable (you can assign values to it directly in configuration file)</hi> | + | <fc #0000FF>It is R/W variable (you can assign values to it directly in configuration file)</fc> |
- | [b]pv[/b] module can be used to initialise | + | **pv** module can be used to initialize |
===== Script shared variables ===== | ===== Script shared variables ===== | ||
Line 563: | Line 582: | ||
</ | </ | ||
- | <hi #d0d0d0>It is R/W variable (you can assign values to it directly in configuration file)</hi> | + | <fc #0000ff>It is R/W variable (you can assign values to it directly in configuration file)</fc> |
===== Broken-down time ===== | ===== Broken-down time ===== | ||
Line 590: | Line 609: | ||
</ | </ | ||
+ | ===== Strftime Formatted Time ===== | ||
+ | |||
+ | **$timef(format)** - return current time as formatted by strftime ' | ||
+ | |||
+ | Example: | ||
+ | |||
+ | <code c> | ||
+ | xlog(" | ||
+ | </ | ||
===== Selects ===== | ===== Selects ===== | ||
Line 642: | Line 670: | ||
Return the attribute of the current processed dialog. | Return the attribute of the current processed dialog. | ||
- | <hi #d0d0d0>It is R/O variable.</ | + | <fc #0000ff>It is R/O variable.</ |
The ' | The ' | ||
Line 672: | Line 700: | ||
Return the attribute of the context for current processed dialog. | Return the attribute of the context for current processed dialog. | ||
- | <hi #d0d0d0>It is R/W variable.</ | + | <fc #0000ff>It is R/W variable.</ |
The ' | The ' | ||
Line 687: | Line 715: | ||
Access hash table entries. | Access hash table entries. | ||
- | <hi #d0d0d0>It is R/W variable, you can assign values to it directly in configuration file.</hi> | + | <fc #0000ff>It is R/W variable, you can assign values to it directly in configuration file.</fc> |
The “htname” must be a hash table name defined via “htable” parameter. | The “htname” must be a hash table name defined via “htable” parameter. | ||
Line 709: | Line 737: | ||
Access hash table entry expire value. Value represents the seconds until the htable entry will expire and be deleted from htable. | Access hash table entry expire value. Value represents the seconds until the htable entry will expire and be deleted from htable. | ||
- | <hi #d0d0d0>It is R/W variable, you can assign values to it directly in configuration file.</hi> | + | <fc #0000ff>It is R/W variable, you can assign values to it directly in configuration file.</fc> |
The “htname” must be a hash table name defined via “htable” parameter and have auto-expire greater than 0. | The “htname” must be a hash table name defined via “htable” parameter and have auto-expire greater than 0. | ||
Line 780: | Line 808: | ||
Access hash table entries stored in the memcached server. | Access hash table entries stored in the memcached server. | ||
- | <hi #d0d0d0>It is R/W variable, you can assign values to it directly in configuration file.</hi> | + | <fc #0000ff>It is R/W variable, you can assign values to it directly in configuration file.</fc> |
The “key” can be: | The “key” can be: | ||
Line 802: | Line 830: | ||
Do a atomic increment operation on the value stored in memcached. You need to add a value previously. | Do a atomic increment operation on the value stored in memcached. You need to add a value previously. | ||
- | <hi #d0d0d0>It is R/W variable, you can assign values to it directly in configuration file.</hi> | + | <fc #0000ff>It is R/W variable, you can assign values to it directly in configuration file.</fc> |
The “key” can be: | The “key” can be: | ||
Line 821: | Line 849: | ||
Do a atomic decrement operation on the value stored in memcached. You need to add a value previously. | Do a atomic decrement operation on the value stored in memcached. You need to add a value previously. | ||
- | <hi #d0d0d0>It is R/W variable, you can assign values to it directly in configuration file.</hi> | + | <fc #0000ff>It is R/W variable, you can assign values to it directly in configuration file.</fc> |
The “key” can be: | The “key” can be: | ||
Line 918: | Line 946: | ||
* reply_code - alias to $T_reply_code | * reply_code - alias to $T_reply_code | ||
* branch_index - alias to $T_branch_idx | * branch_index - alias to $T_branch_idx | ||
+ | * reply_type - 1 if it is a local generated reply, 0 - if no reply for transaction or it is a received reply | ||
Note: the pair (id_index, | Note: the pair (id_index, |
cookbooks/3.2.x/pseudovariables.1322641679.txt.gz · Last modified: 2011/11/30 08:27 by 85.178.74.216