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:25] – [$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 structures | + | **xavp** - eXtended AVPs - are variables |
+ | |||
+ | They work like a stack, similar to AVPs, and are attached to SIP transactions | ||
+ | |||
+ | Each xavp has a string | ||
+ | |||
+ | To assign a single value use: | ||
+ | |||
+ | <code c> | ||
+ | $xavp(root)=" | ||
+ | $xavp(root)=intnumber; | ||
+ | </ | ||
+ | |||
+ | To assign a named value use: | ||
<code c> | <code c> | ||
Line 730: | Line 743: | ||
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]=> | ||
Line 737: | Line 751: | ||
<code c> | <code c> | ||
- | # new item (example | + | # new item (person |
- | $xavp(example=>name)="one"; | + | $xavp(person=>lastname)="Smith"; |
- | # add new item (example | + | |
- | $xavp(example=>name)="two"; | + | # add new item (person |
+ | $xavp(person=>lastname)="Doe"; | ||
# add another named value to the last example item | # add another named value to the last example item | ||
- | $xavp(example[0]=>value)=" | + | # |
+ | $xavp(person[0]=>firstname)=" | ||
# add another named value to first example item | # add another named value to first example item | ||
- | xavp(example[1]=>value)="Anna"; | + | # |
+ | xavp(person[1]=>firstname)="Alice"; | ||
</ | </ | ||
Line 750: | 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 770: | 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.1585855558.txt.gz · Last modified: 2020/04/02 19:25 by miconda