[Users] avpops updates

Daniel-Constantin Mierla daniel at voice-system.ro
Fri Feb 10 20:44:07 CET 2006


Hello,

the avpops module was refurbished to benefit better of pseudo-variables. 
In addition, the avp and hdr pseudo-variables can have dynamic names. 
Here are some details:

- all parameters being avp names in avpops functions MUST be specified 
in the same format as pseudo-variables:
     - $avp(i:23) - refers to the avp having the integer id 23
    - $avp(s:test) - refers to the avp having the name 'test'
    - $avp($aliasid) - refers to the avp defined by avp alias 'aliasid'
    - example: avp_write("i:10", "$avp(i:30)") - write integer value 10 
into the avp having the id 30

- avps and hdrs pseudo-variables can have dynamic names:
    -$avp($pvar) refers to the avp having the name the value of $pvar
    -$hdr($pvar) refers to the hdr having the name the value of $pvar
    - please note that the pseudo-variables specifiers have priority 
over avp aliases (if you define an avp alias $ru, $avp(ru) will refer to 
the avp having the name the value of R-URI)

- in all parameters of avpops module can be used pseudo-variables where 
are expected values
    - avp_check("$fd", "eq/$td") returns true if the domain of From uri 
is the same with domain part of To uri
    - avp_write("$tU", "$avp($fU)") - writes the username in To header 
in the avp having the name the username from From header

- avp_pushto() - cannot add anymore headers - same functionality is 
provided by the textops module via append_hf() and append_to_reply() 
functions
- the format of the first parameter of avp_pushto() follows the 
pseudo-variables names as well.
    - avp_pushto("$ru[/username|domain]", "...") to rewrite parts of R-URI
   - avp_pushto("$du", "...") to rewrite dst_uri

- for developers, internal structure int_str has changed from (int, 
str*) to (int,str) to avoid extra reference

- the documentation will be updated soon (module readme and avpops tutorial)

Still to come:
- support for global avps: avps shared between all processes during the 
openser lifetime
- support for script avps: avps specific per process with life time only 
during the script execution (temporary avps, which do not need to last 
too much, using private memory)
- support for local avps: avps specific per process kept during openser 
lifetime (avps which need to be kept for each process, without 
synchronized access, using private memory)
- avp_db_query() - ability to send a raw query (simple, joins, unions 
...) to database and load the result in avps (e.g., avp_db_query("select 
first_name, last_name from subscriber where username='$tU' and 
domain='$td'", "$avp(first_name);$avp(last_name)"))

Testing and feedback are more than welcome.

Cheers,
Daniel







More information about the Users mailing list