|
@@ -1,4 +1,4 @@
|
|
|
-1. Avp Module
|
|
|
+The AVP module
|
|
|
|
|
|
Jiri Kuthan
|
|
|
|
|
@@ -10,43 +10,26 @@ Michal Matyska
|
|
|
iptel
|
|
|
<[email protected]>
|
|
|
|
|
|
- Copyright © 2004, 2005, 2006 FhG FOKUS, iptelorg GmbH
|
|
|
+ Copyright © 2004, 2005, 2006 FhG FOKUS, iptelorg GmbH
|
|
|
__________________________________________________________________
|
|
|
|
|
|
- 1.1. Overview
|
|
|
- 1.2. Functions
|
|
|
-
|
|
|
- 1.2.1. set_iattr(attribute,value)
|
|
|
- 1.2.2. flags2attr("$avp")
|
|
|
- 1.2.3. set_sattr(attribute,value)
|
|
|
- 1.2.4. print_attr($attribute)
|
|
|
- 1.2.5. attr2uri($attribute[,uri-part])
|
|
|
- 1.2.6. attr_exists(attribute)
|
|
|
- 1.2.7. attr_equals(attribute, value)
|
|
|
- 1.2.8. attr_equals_xl(attribute, xl_format)
|
|
|
- 1.2.9. dump_attrs()
|
|
|
- 1.2.10. xlset_attr($attribute, xl_format)
|
|
|
- 1.2.11. xlfix_attr($attribute)
|
|
|
- 1.2.12. insert_attr_hf(name)
|
|
|
- 1.2.13. insert_attr_hf(header_name, $avp_name)
|
|
|
- 1.2.14. append_attr_hf(name)
|
|
|
- 1.2.15. append_attr_hf(header_name, $avp_name)
|
|
|
- 1.2.16. replace_attr_hf(name)
|
|
|
- 1.2.17. replace_attr_hf(header_name, $avp_name)
|
|
|
- 1.2.18. attr_to_reply(name)
|
|
|
- 1.2.19. attr_to_reply(header_name, $avp_name)
|
|
|
- 1.2.20. attr_destination($avp_name)
|
|
|
- 1.2.21. xlset_destination(xl_format)
|
|
|
- 1.2.22. subst_attr($avp_name, subst_re)
|
|
|
- 1.2.23. del_attr($avp_name)
|
|
|
- 1.2.24. hdr_body2attrs(headername, prefix)
|
|
|
- 1.2.25. hdr_body2attrs2(headername, prefix)
|
|
|
-
|
|
|
- 1.3. Parameters
|
|
|
-
|
|
|
- 1.3.1. xlbuf_size (integer)
|
|
|
-
|
|
|
-1.1. Overview
|
|
|
+ List of Examples
|
|
|
+
|
|
|
+ 1. set_iattr usage
|
|
|
+ 2. flags2attr usage
|
|
|
+ 3. set_sattr usage
|
|
|
+ 4. attr_exists usage
|
|
|
+ 5. attr_equals_xl usage
|
|
|
+ 6. insert_attr_hf usage
|
|
|
+ 7. attr_to_reply usage
|
|
|
+ 8. attr_destination usage
|
|
|
+ 9. xlset_destination usage
|
|
|
+ 10. subst_attr usage
|
|
|
+ 11. del_attr usage
|
|
|
+ 12. hdr_body2attrs and hdr_body2attrs2 usage
|
|
|
+ 13. Set xlbuf_size parameter
|
|
|
+
|
|
|
+1. Overview
|
|
|
|
|
|
This module contains several functions that can be used to manipulate
|
|
|
the contents of AVPs (Attribute-Value pairs). The AVPs are variables
|
|
@@ -58,9 +41,9 @@ Michal Matyska
|
|
|
contains more functions. In future SER releases the avp module will be
|
|
|
probably deprecated in favor of avpops module.
|
|
|
|
|
|
-1.2. Functions
|
|
|
+2. Functions
|
|
|
|
|
|
-1.2.1. set_iattr(attribute,value)
|
|
|
+2.1. set_iattr(attribute,value)
|
|
|
|
|
|
Create an AVP of type integer.
|
|
|
|
|
@@ -73,7 +56,7 @@ Michal Matyska
|
|
|
set_iattr("fr_inv_timer", "60")
|
|
|
...
|
|
|
|
|
|
-1.2.2. flags2attr("$avp")
|
|
|
+2.2. flags2attr("$avp")
|
|
|
|
|
|
Store the current state of SER flags into the sepcified avp.
|
|
|
|
|
@@ -82,7 +65,7 @@ set_iattr("fr_inv_timer", "60")
|
|
|
flags2attr("$msg_flags")
|
|
|
...
|
|
|
|
|
|
-1.2.3. set_sattr(attribute,value)
|
|
|
+2.3. set_sattr(attribute,value)
|
|
|
|
|
|
Create an AVP of type string.
|
|
|
|
|
@@ -95,14 +78,14 @@ flags2attr("$msg_flags")
|
|
|
set_sattr("called_number", "1234")
|
|
|
...
|
|
|
|
|
|
-1.2.4. print_attr($attribute)
|
|
|
+2.4. print_attr($attribute)
|
|
|
|
|
|
Print the value of an AVP to syslog.
|
|
|
|
|
|
Meaning of the parameter is as follows:
|
|
|
* attribute - The name of the AVP.
|
|
|
|
|
|
-1.2.5. attr2uri($attribute[,uri-part])
|
|
|
+2.5. attr2uri($attribute[,uri-part])
|
|
|
|
|
|
Rewrite the whole Request-URI of the message being processed with the
|
|
|
value of an AVP, or if an uri-part is specified, rewrite only that
|
|
@@ -120,7 +103,7 @@ set_sattr("called_number", "1234")
|
|
|
respective the end of the username part of the uri. The rest of the
|
|
|
uri-part values names are self-explaining.
|
|
|
|
|
|
-1.2.6. attr_exists(attribute)
|
|
|
+2.6. attr_exists(attribute)
|
|
|
|
|
|
Test for the existence of AVP with given name. The function returns 1
|
|
|
if given AVP exists and -1 if not.
|
|
@@ -137,7 +120,7 @@ if (attr_exists("saved_ruri")) {
|
|
|
};
|
|
|
...
|
|
|
|
|
|
-1.2.7. attr_equals(attribute, value)
|
|
|
+2.7. attr_equals(attribute, value)
|
|
|
|
|
|
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.
|
|
@@ -148,7 +131,7 @@ if (attr_exists("saved_ruri")) {
|
|
|
* attribute - The name of the AVP.
|
|
|
* value - The AVP value to look for.
|
|
|
|
|
|
-1.2.8. attr_equals_xl(attribute, xl_format)
|
|
|
+2.8. attr_equals_xl(attribute, xl_format)
|
|
|
|
|
|
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.
|
|
@@ -160,8 +143,8 @@ if (attr_exists("saved_ruri")) {
|
|
|
* xl_format - The xprint formatting string, result of which is looked
|
|
|
for in AVP.
|
|
|
|
|
|
- Note: You must ensure, that the xprint module is loaded to be able to use
|
|
|
- this function.
|
|
|
+ Note: You must ensure, that the xprint module is loaded to be able to
|
|
|
+ use this function.
|
|
|
|
|
|
Example 5. attr_equals_xl usage
|
|
|
...
|
|
@@ -172,33 +155,33 @@ if (attr_equals_xl("my_avp", "%ct")) {
|
|
|
}
|
|
|
...
|
|
|
|
|
|
-1.2.9. dump_attrs()
|
|
|
+2.9. dump_attrs()
|
|
|
|
|
|
Dumps all AVPs in user lists to the debug output (with level INFO).
|
|
|
|
|
|
The function does not require any parameters.
|
|
|
|
|
|
-1.2.10. xlset_attr($attribute, xl_format)
|
|
|
+2.10. xlset_attr($attribute, xl_format)
|
|
|
|
|
|
Creates new AVP identified by attribute and assigns the result string
|
|
|
of xprint formatting rules as its value.
|
|
|
|
|
|
Meaning of the parameter is as follows:
|
|
|
* $attribute - The name of the AVP.
|
|
|
- * xl_format - String used for xprint formatting. For detailed info see
|
|
|
- documentation of xprint module.
|
|
|
+ * xl_format - String used for xprint formatting. For detailed info
|
|
|
+ see documentation of xprint module.
|
|
|
|
|
|
- Note: You must ensure, that the xprint module is loaded to be able to use
|
|
|
- this function.
|
|
|
+ Note: You must ensure, that the xprint module is loaded to be able to
|
|
|
+ use this function.
|
|
|
|
|
|
-1.2.11. xlfix_attr($attribute)
|
|
|
+2.11. xlfix_attr($attribute)
|
|
|
|
|
|
Fixes an xl formatted attribute value to pure string.
|
|
|
|
|
|
Meaning of the parameter is as follows:
|
|
|
* $attribute - The name of the AVP.
|
|
|
|
|
|
-1.2.12. insert_attr_hf(name)
|
|
|
+2.12. insert_attr_hf(name)
|
|
|
|
|
|
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
|
|
@@ -213,7 +196,7 @@ if (attr_equals_xl("my_avp", "%ct")) {
|
|
|
forwarded request as well as name of AVP which's value is put as
|
|
|
the header field value.
|
|
|
|
|
|
-1.2.13. insert_attr_hf(header_name, $avp_name)
|
|
|
+2.13. insert_attr_hf(header_name, $avp_name)
|
|
|
|
|
|
Inserts new header into the request, which is beeing forwarded.
|
|
|
|
|
@@ -232,7 +215,7 @@ set_sattr("my_route","<sip:user@host:port;lr>");
|
|
|
insert_attr_hf("Route", "$my_route");
|
|
|
...
|
|
|
|
|
|
-1.2.14. append_attr_hf(name)
|
|
|
+2.14. append_attr_hf(name)
|
|
|
|
|
|
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
|
|
@@ -247,7 +230,7 @@ insert_attr_hf("Route", "$my_route");
|
|
|
forwarded request as well as name of AVP which's value is put as
|
|
|
the header field value.
|
|
|
|
|
|
-1.2.15. append_attr_hf(header_name, $avp_name)
|
|
|
+2.15. append_attr_hf(header_name, $avp_name)
|
|
|
|
|
|
Appends new header into the request, which is beeing forwarded.
|
|
|
|
|
@@ -260,7 +243,7 @@ insert_attr_hf("Route", "$my_route");
|
|
|
* $avp_name - The name of AVP which's value is put as the header
|
|
|
field value.
|
|
|
|
|
|
-1.2.16. replace_attr_hf(name)
|
|
|
+2.16. replace_attr_hf(name)
|
|
|
|
|
|
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
|
|
@@ -275,7 +258,7 @@ insert_attr_hf("Route", "$my_route");
|
|
|
request as well as name of AVP which's value is put as the header
|
|
|
field value.
|
|
|
|
|
|
-1.2.17. replace_attr_hf(header_name, $avp_name)
|
|
|
+2.17. replace_attr_hf(header_name, $avp_name)
|
|
|
|
|
|
Replaces header in the request, which is beeing forwarded.
|
|
|
|
|
@@ -288,7 +271,7 @@ insert_attr_hf("Route", "$my_route");
|
|
|
* $avp_name - The name of AVP which's value is put as the header
|
|
|
field value.
|
|
|
|
|
|
-1.2.18. attr_to_reply(name)
|
|
|
+2.18. attr_to_reply(name)
|
|
|
|
|
|
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
|
|
@@ -303,7 +286,7 @@ insert_attr_hf("Route", "$my_route");
|
|
|
* name - The name of the header field which is appended into reply as
|
|
|
well as name of AVP which's value is put as the header field value.
|
|
|
|
|
|
-1.2.19. attr_to_reply(header_name, $avp_name)
|
|
|
+2.19. attr_to_reply(header_name, $avp_name)
|
|
|
|
|
|
Appends new header into the reply at the request time processing.
|
|
|
|
|
@@ -319,7 +302,7 @@ xlset_attr("$my_route","<sip:%Hf:5080;lr>";
|
|
|
attr_to_reply("P-Hint-Route", "my_route");
|
|
|
...
|
|
|
|
|
|
-1.2.20. attr_destination($avp_name)
|
|
|
+2.20. attr_destination($avp_name)
|
|
|
|
|
|
Sets the destination of the forwarded request to the value of AVP,
|
|
|
which must be either a SIP URI or a string in nameaddr format (e.g.
|
|
@@ -337,7 +320,7 @@ attr_destination("$my_route");
|
|
|
t_relay();
|
|
|
...
|
|
|
|
|
|
-1.2.21. xlset_destination(xl_format)
|
|
|
+2.21. xlset_destination(xl_format)
|
|
|
|
|
|
Sets the destination of the forwarded request to the value of result of
|
|
|
xprint formatted string. Either SIP URI or nameaddr format is allowed.
|
|
@@ -346,8 +329,8 @@ t_relay();
|
|
|
* xl_format - xprint module formatting string, the result is used for
|
|
|
request forwarding.
|
|
|
|
|
|
- Note: You must ensure, that the xprint module is loaded to be able to use
|
|
|
- this function.
|
|
|
+ Note: You must ensure, that the xprint module is loaded to be able to
|
|
|
+ use this function.
|
|
|
|
|
|
Example 9. xlset_destination usage
|
|
|
...
|
|
@@ -355,7 +338,7 @@ xlset_destination("%<next_host>:%<next_port>");
|
|
|
t_relay();
|
|
|
...
|
|
|
|
|
|
-1.2.22. subst_attr($avp_name, subst_re)
|
|
|
+2.22. subst_attr($avp_name, subst_re)
|
|
|
|
|
|
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
|
|
@@ -371,7 +354,7 @@ t_relay();
|
|
|
subst_attr("$uri","/tel:[0-9]*/sip:\[email protected];user=phone/");
|
|
|
...
|
|
|
|
|
|
-1.2.23. del_attr($avp_name)
|
|
|
+2.23. del_attr($avp_name)
|
|
|
|
|
|
The AVP identified by $avp_name name is deleted.
|
|
|
|
|
@@ -391,7 +374,7 @@ failure_route[1] {
|
|
|
}
|
|
|
...
|
|
|
|
|
|
-1.2.24. hdr_body2attrs(headername, prefix)
|
|
|
+2.24. hdr_body2attrs(headername, prefix)
|
|
|
|
|
|
Function parses a header body content scans for fld1=val1,fld2=val2,...
|
|
|
and creates bunch of avps prefixfld1:= val1, prefixfld2:= val2, .... If
|
|
@@ -407,7 +390,7 @@ failure_route[1] {
|
|
|
* prefix - The prefix, which is added before the name parsed from the
|
|
|
header body.
|
|
|
|
|
|
-1.2.25. hdr_body2attrs2(headername, prefix)
|
|
|
+2.25. hdr_body2attrs2(headername, prefix)
|
|
|
|
|
|
Function parses a header body content scans for
|
|
|
fld1=val1,val2;fld2=val3,... and creates bunch of avps prefixfld1#1:=
|
|
@@ -440,9 +423,9 @@ if (method=="BYE") {
|
|
|
# AVP QoS_xx now contain the values from appropriate header
|
|
|
# e.g. QoS_JI is jitter
|
|
|
|
|
|
-1.3. Parameters
|
|
|
+3. Parameters
|
|
|
|
|
|
-1.3.1. xlbuf_size (integer)
|
|
|
+3.1. xlbuf_size (integer)
|
|
|
|
|
|
Defines size of internal buffer for all xprint formatting calls. If you
|
|
|
don't use xprint formatting calls, you can set it to 0 to preserve some
|