From 06f684eb3c099e0a7e47c1fbb86335a43d409b57 Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Mon, 31 Aug 2015 11:19:12 +0200 Subject: [PATCH] pv: refresh README --- modules/pv/README | 58 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 43 insertions(+), 15 deletions(-) diff --git a/modules/pv/README b/modules/pv/README index ae8506335d5..89774e14a96 100644 --- a/modules/pv/README +++ b/modules/pv/README @@ -11,11 +11,11 @@ Daniel-Constantin Mierla - Copyright © 2008-2011 Daniel-Constantin Mierla (asipto.com) + Copyright (c) 2008-2011 Daniel-Constantin Mierla (asipto.com) - Copyright © 2011 Juha Heinanen + Copyright (c) 2011 Juha Heinanen - Copyright © 2013 Olle E. Johansson, Edvina AB + Copyright (c) 2013 Olle E. Johansson, Edvina AB __________________________________________________________________ Table of Contents @@ -46,6 +46,7 @@ Daniel-Constantin Mierla 4.8. sbranch_append() 4.9. sbranch_reset() 4.10. pv_xavp_print() + 4.11. pv_var_to_xavp(varname, xname) 5. MI Commands @@ -72,8 +73,9 @@ Daniel-Constantin Mierla 1.11. sbranch_append() usage 1.12. sbranch_append() usage 1.13. pv_xavp_print() usage - 1.14. shv_set usage - 1.15. shv_get usage + 1.14. pv_var_to_xavp() usage + 1.15. shv_set usage + 1.16. shv_get usage Chapter 1. Admin Guide @@ -103,6 +105,7 @@ Chapter 1. Admin Guide 4.8. sbranch_append() 4.9. sbranch_reset() 4.10. pv_xavp_print() + 4.11. pv_var_to_xavp(varname, xname) 5. MI Commands @@ -207,6 +210,7 @@ modparam("pv","avp_aliases","email=s:email_addr;tmp=i:100") 4.8. sbranch_append() 4.9. sbranch_reset() 4.10. pv_xavp_print() + 4.11. pv_var_to_xavp(varname, xname) 4.1. pv_isset(pvar) @@ -239,7 +243,7 @@ if(pv_isset("$avp(s:x)")) pv_unset("$avp(s:x)"); ... -4.3. is_int(pvar) +4.3. is_int(pvar) Function checks if pvar argument contains integer value and returns 1 if it does and -1 otherwise. @@ -253,7 +257,7 @@ if (is_int("$var(foo)")) { } ... -4.4. typeof(pvar, vtype) +4.4. typeof(pvar, vtype) Returns true if the type of pseudo-variable matches the second parameter. The second parameter can be: 'int' - type is integer; 'str' @@ -268,7 +272,7 @@ if (typeof("$var(foo)", "str")) { } ... -4.5. not_empty(pvar) +4.5. not_empty(pvar) Returns true if the pseudo-variables has the type string and is not empty value. @@ -282,7 +286,7 @@ if (not_empty("$var(foo)")) { } ... -4.6. xavp_params_explode(sparams, xname) +4.6. xavp_params_explode(sparams, xname) Convert a parameters string in xavp atributes. @@ -303,7 +307,7 @@ xavp_params_explode("a=b;c=d;e=d", "x"); # $xavp(x=>e) = "f"; ... -4.7. sbranch_set_ruri() +4.7. sbranch_set_ruri() Use the attributes from static branch ($sbranch(key) variable) to set request URI and the other fields of the branch associated with request @@ -324,7 +328,7 @@ $sbranch(send_socket) = "udp:127.0.0.1:5060"; sbranch_set_ruri(); ... -4.8. sbranch_append() +4.8. sbranch_append() Use the attributes from static branch ($sbranch(key) variable) to append a new branch to destination set. It is an alternative to @@ -345,7 +349,7 @@ $sbranch(send_socket) = "udp:127.0.0.1:5060"; sbranch_append(); ... -4.9. sbranch_reset() +4.9. sbranch_reset() Reset the content of static branch ($sbranch(key) variable. @@ -356,7 +360,7 @@ sbranch_append(); sbranch_reset(); ... -4.10. pv_xavp_print() +4.10. pv_xavp_print() Print all XAVPs to the syslog using INFO log level. @@ -367,6 +371,30 @@ sbranch_reset(); pv_xavp_print(); ... +4.11. pv_var_to_xavp(varname, xname) + + Copy script variables values to a xavp. + + First parameter can be '*' in order to copy all script variables. + Second parameter is the name of the destination xavp. If xavp already + exists it will be reset first. + + Function can be used from ANY_ROUTE. + + Example 1.14. pv_var_to_xavp() usage +... +$var("temp") = 3; +$var("foo") = "foo indeed"; +pv_var_to_xavp("temp", "ok"); +... +$xavp("ok[0]=>temp") now is 3 +... +pv_var_to_xavp("*", "ok"); +... +$xavp("ok[0]=>temp") now is 3 +$xavp("ok[0]=>foo") now is "foo indeed" +... + 5. MI Commands 5.1. shv_set @@ -390,7 +418,7 @@ pv_xavp_print(); _value_ _empty_line_ - Example 1.14. shv_set usage + Example 1.15. shv_set usage ... $ kamctl fifo shv_set debug int 0 ... @@ -408,7 +436,7 @@ $ kamctl fifo shv_set debug int 0 _name_ _empty_line_ - Example 1.15. shv_get usage + Example 1.16. shv_get usage ... $ kamctl fifo shv_get debug $ kamctl fifo shv_get