Browse Source

kamailio-kemi-framework: added examples for pv functions

Daniel-Constantin Mierla 7 years ago
parent
commit
ffe8d50aa7
1 changed files with 38 additions and 0 deletions
  1. 38 0
      kamailio-kemi-framework/docs/kemimods.md

+ 38 - 0
kamailio-kemi-framework/docs/kemimods.md

@@ -19,30 +19,62 @@ The functions exported by these modules are listed in the next sections.
 
 
 Return the value of pseudo-variable `pvname`. The returned value can be string or integer.
 Return the value of pseudo-variable `pvname`. The returned value can be string or integer.
 
 
+Example:
+
+```
+KSR.dbg("ruri is: " + KSR.pv.get("$ru") + "\n");
+```
+
 ### KSR.pv.seti(...) ###
 ### KSR.pv.seti(...) ###
 
 
 `void KSR.pv.seti("pvname", intval)`
 `void KSR.pv.seti("pvname", intval)`
 
 
 Set the value of pseudo-variable `pvname` to integer value provided by parameter `intval`.
 Set the value of pseudo-variable `pvname` to integer value provided by parameter `intval`.
 
 
+Example:
+
+```
+KSR.pv.seti("$var(x)", 10);
+```
+
 ### KSR.pv.sets(...) ###
 ### KSR.pv.sets(...) ###
 
 
 `void KSR.pv.sets("pvname", "strval")`
 `void KSR.pv.sets("pvname", "strval")`
 
 
 Set the value of pseudo-variable `pvname` to string value provided by parameter `strval`.
 Set the value of pseudo-variable `pvname` to string value provided by parameter `strval`.
 
 
+Example:
+
+```
+KSR.pv.sets("$var(x)", "kamailio");
+```
+
 ### KSR.pv.unset(...) ###
 ### KSR.pv.unset(...) ###
 
 
 `void KSR.pv.unset("pvname")`
 `void KSR.pv.unset("pvname")`
 
 
 Set the value of pseudo-variable `pvname` to `$null`.
 Set the value of pseudo-variable `pvname` to `$null`.
 
 
+Example:
+
+```
+KSR.pv.unset("$avp(x)");
+```
+
 ### KSR.pv.is_null(...) ###
 ### KSR.pv.is_null(...) ###
 
 
 `bool KSR.pv.is_null("pvname")`
 `bool KSR.pv.is_null("pvname")`
 
 
 Return true if pseudo-variable `pvname` is `$null`.
 Return true if pseudo-variable `pvname` is `$null`.
 
 
+Example:
+
+```
+if(KSR.pv.is_null("$avp(x)")) {
+  ...
+}
+```
+
 ### KSR.x.modf(...) ###
 ### KSR.x.modf(...) ###
 
 
 `int KSR.x.modf("fname", params...)`
 `int KSR.x.modf("fname", params...)`
@@ -50,6 +82,12 @@ Return true if pseudo-variable `pvname` is `$null`.
 Execute a function (specified by `fname`) exported by a Kamailio module. Additional parameters must be string and
 Execute a function (specified by `fname`) exported by a Kamailio module. Additional parameters must be string and
 they are passed to the Kamailio module function.
 they are passed to the Kamailio module function.
 
 
+Example:
+
+```
+KSR.x.modf("sl_send_reply", "200", "OK");
+```
+
 ### KSR.x.exit(...) ###
 ### KSR.x.exit(...) ###
 
 
 `void KSR.x.exit()`
 `void KSR.x.exit()`