Copyright © 2004, 2005 voice-system.ro
avp_url
(string)avp_table
(string)avp_aliases
(string)use_domain
(integer)uuid_column
(string)username_column
(string)domain_column
(string)attribute_column
(string)value_column
(string)type_column
(string)db_scheme
(string)avp_db_load(source,name)
avp_db_store(source,name)
avp_db_delete(source,name)
avp_write(value,name)
avp_delete(name)
avp_pushto(destination,name)
avp_check(name,op_value)
avp_copy(old_name,new_name)
avp_printf(dest, format)
avp_subst(avps, subst)
avp_op(name,op_value)
is_avp_set(name)
avp_print()
avp_url
parameteravp_table
parameteravp_aliases
parameteruse_domain
parameteruuid_column
parameterusername_column
parameterdomain_column
parameterattribute_column
parametervalue_column
parametertype_column
parameterdb_scheme
parameteravp_db_load
usageavp_db_store
usageavp_db_delete
usageavp_write
usageavp_delete
usageavp_pushto
usageavp_check
usageavp_copy
usageavp_printf
usageavp_subst
usageavp_op
usageis_avp_set
usageavp_print
usageAVPops (AVP-operations) modules implements a set of script functions which allow access and manipulation of user AVPs (preferences). AVPs are a powerful tool for implementing services/preferences per user/domain. Now they are usable directly from configuration script. Functions for interfacing DB resources (loading/storing/removing), functions for swapping information between AVPs and SIP messages, function for testing/checking the value of an AVP.
An up-to-date tutorial providing more information (detailed explanations and commented examples) can be found on Voice Sistem documentation web page at http://voice-system.ro/docs/avpops .
The following modules must be loaded before this module:
Optionally a database module
The following libraries or applications must be installed before running OpenSER with this module loaded:
None
avp_url
(string)DB URL for database connection.
This parameter is optional, it's default value being NULL.
avp_table
(string)DB table to be used.
This parameter is optional, it's default value being NULL.
avp_aliases
(string)Contains a multiple definition of aliases for AVP names.
This parameter is optional.
use_domain
(integer)If the domain part of the an URI should be used for identifying an AVP in DB operations.
Default value is 0 (no).
uuid_column
(string)Name of column containing the uuid (unique user id).
Default value is "uuid".
username_column
(string)Name of column containing the username.
Default value is "username".
attribute_column
(string)Name of column containing the attribute name (AVP name).
Default value is "attribute".
db_scheme
(string)Definition of a DB schemeto be used for non-standard access to Database information.
Default value is "NULL".
avp_db_load(source,name)
Loads from DB into memory the AVPs corresponding to the given source.
Meaning of the parameters is as follows:
source - what info is used for identifying the AVPs. Parameter syntax:
source = (sip_uri|avp_alias|str_value) ['/'('username'|'domain'|'uri'|'uuid')])
sip_uri = '$from' | '$to' | '$ruri'
name - which AVPs will be loaded from DB into memory. Parameter syntax is:
name = avp_spec['/'(table_name|'$'db_scheme)]
avp_spec = ''|'s:'|'i:'|avp_name|avp_alias
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE.
avp_db_store(source,name)
Stores to DB the AVPs corresponding to the given source.
The meaning and usage of the parameters are identical as for avp_db_load(source,name) function. Please refer to its description.
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE.
avp_db_delete(source,name)
Deletes from DB the AVPs corresponding to the given source.
The meaning and usage of the parameters are identical as for avp_db_load(source,name) function. Please refer to its description.
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE.
avp_write(value,name)
The function writes some value (given) or some information from the SIP message into a new AVP.
Meaning of the parameters is as follows:
value - the value to be written into the AVP. Parameter syntax:
value = (variable) | (fix_value)
variable = '$src_ip' | '$dst_ip' | '$hdr(name)' | '$duri' | (sip_uri)['/'('username'|'domain')])
sip_uri = '$from' | '$to' | '$ruri'
fix_value = 'i:'integer | 's:'string | string
Integer values can be given in hexadecimal using notation 'i:0xhex_number' (e.g.,: 'i:0xabcd');
name - the name of the new written AVP. Parameter syntax is:
name = avp_name | avp_alias
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE.
avp_delete(name)
Deletes from memory the AVPs with name or, if empty, all AVPs.
Meaning of the parameters is as follows:
name - which AVPs will be deleted from memory. Parameter syntax is:
name = (''|'s:'|'i:'|avp_name|avp_alias)['/'flag]
flag = 'g'|'G'
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE.
avp_pushto(destination,name)
Pushes the value of AVP(s) into the SIP message.
Meaning of the parameters is as follows:
destination - as what will be the AVP value pushed into SIP message. Parameter syntax:
destination = ruri_dst | hdr_dst | '$duri'
ruri_dst = '$ruri'['/'('username'|'domain')]
hdr_dst = '$hdr_name'['/'('request'|'reply')]
name - which AVP(s) should be pushed into the SIP message. Parameter syntax is:
name = ( avp_name | avp_alias )['/'flags]
flags = 'g'
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE.
avp_check(name,op_value)
Checks the value of the AVP(s) against an operator and value.
Meaning of the parameters is as follows:
name - which AVP(s) should be checked. Parameter syntax is:
name = ( avp_name | avp_alias )
op_value - define the operator, the value and flags for checking. Parameter syntax is:
op_value = operator '/' value ['/'flags]
operator = 'eq' | 'ne' | 'lt' | 'le' | 'gt' | 'ge' | 're' | 'fm' | 'and' | 'or' | 'xor'
value = variable | fix_value
variable = '$from'|'$ruri'|'$from'|'$src_ip'|'$dst_ip'|avp_alias
fix_value = 'i:'integer | 's:'string | string
flags = 'g' | 'G' | 'i' | 'I'
Integer values can be given in hexadecimal using notation: 'i:0xhex_number' (e.g.,: 'i:0xabcd');
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE.
avp_copy(old_name,new_name)
Copy / move an avp under a new name.
Meaning of the parameters is as follows:
name1 - which AVP(s) should be copied/moved. Parameter syntax is:
name = ( avp_name | avp_alias )
name2 - the new name of the copied/moved AVP(s). Parameter syntax is:
name = ( avp_name | avp_alias ) ['/'flags]
flags = 'g' | 'G' | 'd' | 'D' | 'n' | 'N' | 's' | 'S'
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE.
avp_printf(dest, format)
Prints the formatted string 'format' in the AVP 'dest'. The 'format' parameter can include any pseudo-variable defined in OpenSER. The list with all pseudo-variables in OpenSER can be found at: http://openser.org/docs/pseudo-variables.html.
Meaning of the parameters is as follows:
dest - in which AVP should be stored the result. Parameter syntax is:
name = ( avp_name | avp_alias )
format - the formatted string to be printed in 'dest' AVP.
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE.
avp_subst(avps, subst)
Perl/sed-like subst applied to AVPs having string value.
Meaning of the parameters is as follows:
avps - source AVP, destination AVP and flags. Parameter syntax is:
avps = src_avp [ '/' dst_avp [ '/' flags ] ]
src_avp = ( avp_name | avp_alias )
dst_avp = ( avp_name | avp_alias ) - if dst_avp is missing then the value of src_avp will be replaced
flags = ( d | D | g | G ) -- (d, D - delete source avp; g, G - apply to all avps matching src_avp name)
subst - perl/sed-like reqular expression. Parameter syntax is:
subst = "/regexp/replacement/flags"
regexp - regular expression
replacement - replacement string, can include pseudo-variables and \1, ..., \9 for matching tokens, \0 for whole matching text
flags = 'g' | 'G' | 'i' | 'i' (g, G - replace all matching tokens; i, I - match ignore case)
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE.
Example 1-21. avp_subst
usage
... # if avp i:678 has a string value in e-mail format, replace the # domain part with the value of domain part from R-URI avp_subst("i:678", "/(.*)@(.*)/\1@$rd/"); # if any avp i:678 has a string value in e-mail format, replace the # domain part with the value of domain part from R-URI # and place the result in avp i:679 avp_subst("i:678/i:679/g", "/(.*)@(.*)/\1@$rd/"); ...
IMPORTANT NOTE: if the replacement string includes src_avp or dst_avp you will get something that you may not expect. In case you have many src_avp and you make the substitution to be applied to all of them, after the first src_avp is processed, it will be added in avp list and next processing will use it.
avp_op(name,op_value)
Different integer operations with avps.
Meaning of the parameters is as follows:
name - 'source_avp/destination_avp' - which AVP(s) should be processed and where to store the result. If 'destination_avp' is missing, same name as 'source_avp' is used to store the result.
Parameter syntax is:
name = ( source_avp[/destination_avp] )
source_avp = ( avp_name | avp_alias )
destination_avp = ( avp_name | avp_alias )
op_value - define the operation, the value and flags. Parameter syntax is:
op_value = operator '/' value ['/'flags]
operator = 'add' | 'sub' | 'mul' | 'div' | 'mod' | 'and' | 'or' | 'xor' | 'not'
value = variable | fix_value
variable = avp_alias
fix_value = 'i:'integer
flags = 'g' | 'G' | 'd' | 'D'
Integer values can be given in hexadecimal using notation 'i:0xhex_number' (e.g.,: 'i:0xabcd');
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE.
is_avp_set(name)
Check if any AVP with name is set.
Meaning of the parameters is as follows:
name - name of AVP to look for. Parameter syntax is:
name = ('s:'|'i:'|avp_name|avp_alias [ '/' flags ])
flags = ('s'|'n') - s = value string; n = value number (int)
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE.
avp_print()
Prints the list with all the AVPs from memory. This is only a helper/debug function.
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE.
An up-to-date tutorial providing more information (detailed explanations and commneted examples) can be found on Voice Sistem documentation web page at http://voice-system.ro/docs/avpops .
Sent an email to <team@openser.org>
or,
if you want to keep the mail private, send it to
<ramona@voice-system.ro>
.
Remember: first at all, check if your question was already answered on one of OpenSER mailing lists:
User Mailing List - http://openser.org/cgi-bin/mailman/listinfo/users
Developer Mailing List - http://openser.org/cgi-bin/mailman/listinfo/devel
Accumulate as much as possible information (OpenSER version,
openser -V output, your OS (uname -a), OpenSER logs, network dumps,
core dump files, configuration file)
and send a mail to <team@openser.org>
.