avpStandard-dep This module contains several functions that can be used to manipulate the contents of AVPs (Attribute-Value pairs). The AVPs are variables attached to the SIP message being processed. Each variable has its name and value. AVPs can be used to store arbitrary data or as a means of inter-module comminication. Jiri Kuthan Copyright © 2004, 2005, 2006 FhG FOKUS, iptelorg GmbH
This module contains several functions that can be used to manipulate the contents of AVPs (Attribute-Value pairs). The AVPs are variables attached to the SIP message being processed. Each variable has its name and value. AVPs can be used to store arbitrary data or as a means of inter-module comminication. You may also want to check the avpops module which is more flexible and contains more functions. In future SERi releases the avp module will be probably deprecated in favor of avpops module. Create an AVP of type integer. Meaning of the parameter is as follows:
Store the current state of SER flags into AVP called "flags". Create an AVP of type string. Meaning of the parameter is as follows:
Store the Request-URIii of the message being processed in an AVP. The new value of the Request-URI will be used if it has been already rewritten by some other function or module. Meaning of the parameter is as follows:
Print the value of an AVP to syslog. Meaning of the parameter is as follows:
Rewrite the Request-URI of the message being processed with the value of an AVP. Meaning of the parameter is as follows:
Test for the existence of AVP with given name. The function returns 1 if given AVP exists and -1 if not. Meaning of the parameter is as follows:
Test whether an AVP with given name and value exists. The function returns 1 if the AVP with given name and value exists and -1 if not. The value of the AVP is compared string-wise. The comparison is case sensitive. Meaning of the parameter is as follows:
Test whether an AVP with given name and value exists. The function returns 1 if the AVP with given name and value exists and -1 if not. The value of the AVP is compared string-wise to the result of xlog formatting call. The comparison is case sensitive. Meaning of the parameter is as follows:
Note: You must ensure, that the xlog module is loaded to be able to use this function. Test whether an AVP with given name exists. The function returns 1 if the AVP with given name exists and -1 if not. Meaning of the parameter is as follows:
Dumps all AVPs in user lists to the debug output (with level INFO). The function does not require any parameters. Creates new AVP identified by attribute and assigns the result string of xlog formatting rules as its value. Meaning of the parameter is as follows:
Note: You must ensure, that the xlog module is loaded to be able to use this function. Inserts new header into the request, which is beeing forwarded. The AVP name is the name of the header field. If you need to insert header with name which differs from the AVP name use insert_avp_hf(header_name, avp_name) instead. Inserting means putting the header to the beginning of the request, before any others. Meaning of the parameter is as follows:
Inserts new header into the request, which is beeing forwarded. Inserting means putting the header to the beginning of the request, before any others. Meaning of the parameter is as follows:
Appends new header into the request, which is beeing forwarded. The AVP name is the name of the header field. If you need to append header with name which differs from the AVP name use append_avp_hf(header_name, avp_name) instead. Appending means putting the header to the end of the request, after any others. Meaning of the parameter is as follows:
Appends new header into the request, which is beeing forwarded. Appending means putting the header to the end of the request, after any others. Meaning of the parameter is as follows:
Replaces header in the request, which is beeing forwarded. The AVP name is the same as the name of the header field. If you need to replace header with name which differs from the AVP name use replace_avp_hf(header_name, avp_name) instead. Replacing means removing all the headers with specified name and appending new one at the end, with the value from AVP. Meaning of the parameter is as follows:
Replaces header in the request, which is beeing forwarded. Replacing means removing all the headers with specified name and appending new one at the end, with the value from AVP. Meaning of the parameter is as follows:
Appends new header into the reply at the request time processing. The AVP name is the name of the header field. If you need to append header with name which differs from the AVP name use avp_to_reply(header_name, avp_name) instead. If you need to append headers during reply processing you can use insert_avp_hf and append_avp_hf. This function stores data and waits for the reply being created. Meaning of the parameter is as follows:
Appends new header into the reply at the request time processing. Meaning of the parameter is as follows:
Sets the destination of the forwarded request to the value of AVP, which must be a SIP URI or nameaddr format. Meaning of the parameter is as follows:
Sets the destination of the forwarded request to the value of result of xlog formatted string. Either SIP URI or nameaddr format is allowed. Meaning of the parameter is as follows:
Note: You must ensure, that the xlog module is loaded to be able to use this function. The value of the AVP identified by avp_name name is matched and substitued according to the subst_re sed like expression. Result of the substitution is then stored in the original AVP. Meaning of the parameter is as follows:
The AVP identified by avp_name name is deleted. Meaning of the parameter is as follows:
Example 12. avp_subst usage ...
failure_route[1] {
if (status=~4[0-9][0-9]) {
if (is_sattr_set("backup_gw") {
append_branchi;
avp_destination("backup_gw");
avp_delete("backup_gw");
t_relay();
}
}
...
Function parses a header body content scans for fld1=val1,fld2=val2,... and creates bunch of avps prefixfld1:= val1, prefixfld2:= val2, .... If possible stores values as integers. Meaning of the parameter is as follows:
Function parses a header body content scans for fld1=val1,val2;fld2=val3,... and creates bunch of avps prefixfld1#1:= val1, prefixfld1#2:= val2, prefixfld2:=val3 .... If possible stores values as integers. Meaning of the parameter is as follows:
Example 13. hdr_body2attrs and hdr_body2attrs2 usage if (method=="BYE") {
# QoS reporting
if (search("^User-Agent: AVM FRITZ!Box Fon*")) {
hdr_body2attrs2("X-RTPi-Stat/i", "QoS_");
xlog("L_INFO", "QoS: %Ts, %fu, %tu, %ci, %{User-Agent}, %{X-RTP-Stat}\n");
} else if (search("^User-Agent: Sipura/*")) {
hdr_body2attrs("P-RTP-Stat/i", "QoS_");
xlog("L_INFO", "QoS: %Ts, %fu, %tu, %ci, %{User-Agent}, %{P-RTP-Stat}\n");
}
}
# AVP QoS_xx now contain the values from appropriate header
# e.g. QoS_JI is jitter
Defines size of internal buffer for all xlog formatting calls. If you don't use xlog formatting calls, you can set it to 0 to preserve some memory, if you get errors while formatting due to buffer size, you can enlarge it. Default value is 256. |
Navigation |
||||