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 [2020/04/02 19:35] – [$xavp(id) - XAVPs] miconda | cookbooks:5.3.x:pseudovariables [2020/04/06 16:09] (current) – typo in xavp example pojogas | ||
---|---|---|---|
Line 722: | Line 722: | ||
===== $xavp(id) - XAVPs ===== | ===== $xavp(id) - XAVPs ===== | ||
- | **xavp** - eXtended AVPs - are variables that can store multiple values, which can also be grouped in a structure-like fashion. Their value can be a string, an integer number or a list of named values. | + | **xavp** - eXtended AVPs - are variables that can store multiple values, which can also be grouped in a structure-like fashion. Their value can be a string, an integer number or a list of named values |
They work like a stack, similar to AVPs, and are attached to SIP transactions and automatically destroyed when the transaction is finished. | They work like a stack, similar to AVPs, and are attached to SIP transactions and automatically destroyed when the transaction is finished. | ||
- | Each xavp has a string name and can contain a string, and integer or a list of named value. The structure name (or root list name) and the value name (or field name) are separated by < | + | Each xavp has a string name and can contain a string, and integer or a list of named values. The structure name (or root list name) and the value name (or field name, or child value name) are separated by < |
To assign a single value use: | To assign a single value use: | ||
Line 751: | Line 751: | ||
<code c> | <code c> | ||
- | # new item (example | + | # new item (person |
- | $xavp(example=>name)="one"; | + | $xavp(person=>lastname)="Smith"; |
- | # add new item (example | + | # add new item (person |
- | $xavp(example=>name)="two"; | + | $xavp(person=>lastname)="Doe"; |
# add another named value to the last example item | # add another named value to the last example item | ||
- | # (example | + | # (person |
- | $xavp(example[0]=>value)=" | + | $xavp(person[0]=>firstname)=" |
# add another named value to first example item | # add another named value to first example item | ||
- | # (example | + | # (person |
- | xavp(example[1]=>value)="Anna"; | + | xavp(person[1]=>firstname)="Alice"; |
</ | </ | ||
Line 769: | 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 789: | 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 ===== |
cookbooks/5.3.x/pseudovariables.1585856115.txt.gz · Last modified: 2020/04/02 19:35 by miconda