cookbooks:5.3.x:pseudovariables
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
cookbooks:5.3.x:pseudovariables [2019/11/15 13:59] – [Other read-only variables] giavac | cookbooks:5.3.x:pseudovariables [2020/04/06 16:09] (current) – typo in xavp example pojogas | ||
---|---|---|---|
Line 12: | Line 12: | ||
Pseudo-Variables are implemented by various modules, most of them are provided by **pv** (if there is no special reference to a module, expect that the pseudo-variable is provided by **pv** module). | Pseudo-Variables are implemented by various modules, most of them are provided by **pv** (if there is no special reference to a module, expect that the pseudo-variable is provided by **pv** module). | ||
- | ===== Pseudo-variables usage ===== | ||
+ | |||
+ | ===== Pseudo-variables usage ===== | ||
Pseudo-variables can be used with many modules, among them: | Pseudo-variables can be used with many modules, among them: | ||
Line 447: | Line 448: | ||
**$ru** - reference to request' | **$ru** - reference to request' | ||
+ | |||
+ | INVITE <fc # | ||
<fc # | <fc # | ||
+ | |||
==== $rU - Username in R-URI ==== | ==== $rU - Username in R-URI ==== | ||
**$rU** - reference to username in request' | **$rU** - reference to username in request' | ||
+ | |||
+ | INVITE sip:<fc # | ||
<fc # | <fc # | ||
+ | |||
==== $rv - SIP message version ==== | ==== $rv - SIP message version ==== | ||
Line 575: | Line 582: | ||
**$tn** - reference to display name of ' | **$tn** - reference to display name of ' | ||
+ | |||
+ | To: "< | ||
==== $tt - To tag ==== | ==== $tt - To tag ==== | ||
Line 590: | Line 599: | ||
**$tu** - reference to URI of ' | **$tu** - reference to URI of ' | ||
+ | |||
+ | To: " | ||
==== $tU - To URI Username ==== | ==== $tU - To URI Username ==== | ||
**$tU** - reference to username in URI of ' | **$tU** - reference to username in URI of ' | ||
+ | |||
+ | To: " | ||
==== $Tb - Startup timestamp ==== | ==== $Tb - Startup timestamp ==== | ||
Line 709: | Line 722: | ||
===== $xavp(id) - XAVPs ===== | ===== $xavp(id) - XAVPs ===== | ||
- | xavp - extended AVP' | + | **xavp** - eXtended AVPs - are variables |
+ | |||
+ | They work like a stack, | ||
+ | |||
+ | Each xavp has a string | ||
+ | |||
+ | To assign a single | ||
<code c> | <code c> | ||
- | $xavp(root=> | + | $xavp(root)=" |
+ | $xavp(root)=intnumber; | ||
+ | </code> | ||
+ | |||
+ | To assign a named value use: | ||
+ | |||
+ | <code c> | ||
+ | $xavp(root=> | ||
+ | $xavp(root=> | ||
</ | </ | ||
Like avps, xavp act like a stack. To refer to an existing value, use an index. The newest xavp has index zero [0]. | Like avps, xavp act like a stack. To refer to an existing value, use an index. The newest xavp has index zero [0]. | ||
+ | |||
<code c> | <code c> | ||
- | $xavp(root[0]=> | + | $xavp(root[0]=> |
</ | </ | ||
If you assign a value without an index, a new xavp is allocated and the old one is pushed up the stack, becoming index [1]. Old index [1] becomes [2] etc. | If you assign a value without an index, a new xavp is allocated and the old one is pushed up the stack, becoming index [1]. Old index [1] becomes [2] etc. | ||
+ | |||
<code c> | <code c> | ||
- | $xavp(example=>name)="one"; | + | # new item (person => [(lastname = " |
- | #create | + | $xavp(person=>lastname)="Smith"; |
- | $xavp(example=>name)="two"; | + | |
- | #add extra value to "two" | + | # add new item (person => [(lastname = " |
- | $xavp(example[0]=>value)=" | + | $xavp(person=>lastname)="Doe"; |
- | #add value to first variable - "one" | + | |
- | $xavp(example[1]=>value)="Anna"; | + | # add another named value to the last example item |
+ | # | ||
+ | $xavp(person[0]=>firstname)=" | ||
+ | |||
+ | # add another named value to first example item | ||
+ | # | ||
+ | xavp(person[1]=>firstname)="Alice"; | ||
</ | </ | ||
Line 733: | Line 769: | ||
Another example: | Another example: | ||
<code c> | <code c> | ||
- | # Create | + | # create |
$xavp(sf=> | $xavp(sf=> | ||
- | #assign | + | # add named values |
$xavp(sf[0]=> | $xavp(sf[0]=> | ||
$xavp(sf[0]=> | $xavp(sf[0]=> | ||
$xavp(sf[0]=> | $xavp(sf[0]=> | ||
- | #create new xavp, moving previous one to sf[1] | + | # create new (the second) root xavp with a named value of string type, moving previous one to sf[1] |
$xavp(sf=> | $xavp(sf=> | ||
+ | # add named values (child values) | ||
$xavp(sf[0]=> | $xavp(sf[0]=> | ||
$xavp(sf[0]=> | $xavp(sf[0]=> | ||
- | #Create a third xavp | + | # create new (the third) xavp with a named value of string type, moving previous one to sf[1] and the other one to sf[2] |
$xavp(sf=> | $xavp(sf=> | ||
+ | # add named values (child values) | ||
$xavp(sf[0]=> | $xavp(sf[0]=> | ||
$xavp(sf[0]=> | $xavp(sf[0]=> | ||
Line 753: | Line 791: | ||
</ | </ | ||
- | xavps are read and write variables. You can create multilevel xavps, as xavps may contain xavps. | + | xavps are read and write variables. |
===== $hdr(name) - Headers ===== | ===== $hdr(name) - Headers ===== | ||
Line 1356: | Line 1394: | ||
The $http_req(key) write-only variable can be used to set custom parameters before sending a HTTP query. | The $http_req(key) write-only variable can be used to set custom parameters before sending a HTTP query. | ||
- | key can be one of: | + | **key** can be one of: |
* all: if set to $null, resets all the parameters to their default value (the ones defined in modparam) | * all: if set to $null, resets all the parameters to their default value (the ones defined in modparam) | ||
* hdr: sets/ | * hdr: sets/ | ||
Line 1365: | Line 1403: | ||
* tls_client_key: | * tls_client_key: | ||
* tls_ca_path: | * tls_ca_path: | ||
- | * authmethod: Sets the preferred authentication mode for HTTP/HTTPS requests. The value is a bitmap and multiple methods can be used. Note that in this case, the CURL library will make an extra request to discover server-supported authentication methods. You may want to use a specific value. | + | * authmethod: Sets the preferred authentication mode for HTTP/HTTPS requests. The value is a bitmap and multiple methods can be used. Note that in this case, the CURL library will make an extra request to discover server-supported authentication methods. You may want to use a specific value. Valid values are: |
- | + | * 1 - BASIC authentication | |
- | Valid values are: | + | * 2 - HTTP Digest authentication |
- | * 1 - BASIC authentication | + | * 4 - GSS-Negotiate authentication |
- | * 2 - HTTP Digest authentication | + | * 8 - NTLM authentication |
- | * 4 - GSS-Negotiate authentication | + | * 16 - HTTP Digest with IE flavour. |
- | * 8 - NTLM authentication | + | * (Default value is 3 - BASIC and Digest authentication.) |
- | * 16 - HTTP Digest with IE flavour | + | |
- | + | ||
- | Default value is 3 - BASIC and Digest authentication. | + | |
* username: sets the username to use for authenticated requests | * username: sets the username to use for authenticated requests | ||
* password: sets the password to use for authenticated requests | * password: sets the password to use for authenticated requests | ||
Line 2136: | Line 2170: | ||
* version - HEP version | * version - HEP version | ||
- | * src_ip - source IP address | ||
- | * dst_ip - destination IP address | ||
* 0x000 - HEP attribute 0x000 | * 0x000 - HEP attribute 0x000 | ||
* 0x999 - HEP attribute 0x999 | * 0x999 - HEP attribute 0x999 |
cookbooks/5.3.x/pseudovariables.1573826348.txt.gz · Last modified: 2019/11/15 13:59 by giavac