[sr-dev] git:jh/32plus: modules_k/textops: added documentation of in_list() function .

Juha Heinanen jh at tutpro.com
Wed Sep 14 08:48:30 CEST 2011


Module: sip-router
Branch: jh/32plus
Commit: aaf46c6b60b7093e97bc21b8730b35bca851be6a
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=aaf46c6b60b7093e97bc21b8730b35bca851be6a

Author: Juha Heinanen <jh at tutpro.com>
Committer: Juha Heinanen <jh at tutpro.com>
Date:   Wed Sep 14 09:46:35 2011 +0300

modules_k/textops: added documentation of in_list() function.

---

 modules_k/textops/README                |   56 +++++++++++++++++++++---------
 modules_k/textops/doc/textops_admin.xml |   24 +++++++++++++
 2 files changed, 63 insertions(+), 17 deletions(-)

diff --git a/modules_k/textops/README b/modules_k/textops/README
index b0ccfe4..7210ff5 100644
--- a/modules_k/textops/README
+++ b/modules_k/textops/README
@@ -73,9 +73,10 @@ Juha Heinanen
               3.30. has_body(), has_body(mime)
               3.31. is_audio_on_hold()
               3.32. is_privacy(privacy_type)
-              3.33. cmp_str(str1, str2)
-              3.34. cmp_istr(str1, str2)
-              3.35. starts_with(str1, str2)
+              3.33. in_list(subject, list, separator)
+              3.34. cmp_str(str1, str2)
+              3.35. cmp_istr(str1, str2)
+              3.36. starts_with(str1, str2)
 
         4. Known Limitations
 
@@ -119,9 +120,10 @@ Juha Heinanen
    1.30. has_body usage
    1.31. is_audio_on_hold usage
    1.32. is_privacy usage
-   1.33. cmp_str usage
+   1.33. in_list() usage
    1.34. cmp_str usage
-   1.35. starts_with usage
+   1.35. cmp_str usage
+   1.36. starts_with usage
 
 Chapter 1. Admin Guide
 
@@ -170,9 +172,10 @@ Chapter 1. Admin Guide
         3.30. has_body(), has_body(mime)
         3.31. is_audio_on_hold()
         3.32. is_privacy(privacy_type)
-        3.33. cmp_str(str1, str2)
-        3.34. cmp_istr(str1, str2)
-        3.35. starts_with(str1, str2)
+        3.33. in_list(subject, list, separator)
+        3.34. cmp_str(str1, str2)
+        3.35. cmp_istr(str1, str2)
+        3.36. starts_with(str1, str2)
 
    4. Known Limitations
 
@@ -244,9 +247,10 @@ From: medabeda
    3.30. has_body(), has_body(mime)
    3.31. is_audio_on_hold()
    3.32. is_privacy(privacy_type)
-   3.33. cmp_str(str1, str2)
-   3.34. cmp_istr(str1, str2)
-   3.35. starts_with(str1, str2)
+   3.33. in_list(subject, list, separator)
+   3.34. cmp_str(str1, str2)
+   3.35. cmp_istr(str1, str2)
+   3.36. starts_with(str1, str2)
 
 3.1.  search(re)
 
@@ -886,7 +890,25 @@ if(is_privacy("id"))
 }
 ...
 
-3.33.  cmp_str(str1, str2)
+3.33.  in_list(subject, list, separator)
+
+   Function checks if subject string is found in list string where list
+   items are separated by separator string. Subject and list strings may
+   contain pseudo variables. Separator string needs to be one character
+   long. Returns 1 if subject is found and -1 otherwise.
+
+   Function can be used from all kinds of routes.
+
+   Example 1.33. in_list() usage
+...
+$var(subject) = "fi";
+$var(list) = "dk,fi,no,se";
+if (in_list("$var(subject)", "$var(list)", ",") {
+    xlog("L_INFO", "subject is found in list\n");
+}
+...
+
+3.34.  cmp_str(str1, str2)
 
    The function returns true if the two parameters matches as string case
    sensitive comparison.
@@ -894,7 +916,7 @@ if(is_privacy("id"))
    This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
    FAILURE_ROUTE and BRANCH_ROUTE.
 
-   Example 1.33. cmp_str usage
+   Example 1.34. cmp_str usage
 ...
 if(cmp_str("$rU", "kamailio"))
 {
@@ -902,7 +924,7 @@ if(cmp_str("$rU", "kamailio"))
 }
 ...
 
-3.34.  cmp_istr(str1, str2)
+3.35.  cmp_istr(str1, str2)
 
    The function returns true if the two parameters matches as string case
    insensitive comparison.
@@ -910,7 +932,7 @@ if(cmp_str("$rU", "kamailio"))
    This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
    FAILURE_ROUTE and BRANCH_ROUTE.
 
-   Example 1.34. cmp_str usage
+   Example 1.35. cmp_str usage
 ...
 if(cmp_istr("$rU at you", "kamailio at YOU"))
 {
@@ -918,7 +940,7 @@ if(cmp_istr("$rU at you", "kamailio at YOU"))
 }
 ...
 
-3.35.  starts_with(str1, str2)
+3.36.  starts_with(str1, str2)
 
    The function returns true if the first string starts with the second
    string.
@@ -926,7 +948,7 @@ if(cmp_istr("$rU at you", "kamailio at YOU"))
    This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
    FAILURE_ROUTE and BRANCH_ROUTE.
 
-   Example 1.35. starts_with usage
+   Example 1.36. starts_with usage
 ...
 if (starts_with("$rU", "+358"))
 {
diff --git a/modules_k/textops/doc/textops_admin.xml b/modules_k/textops/doc/textops_admin.xml
index 75633a6..fbec64c 100644
--- a/modules_k/textops/doc/textops_admin.xml
+++ b/modules_k/textops/doc/textops_admin.xml
@@ -1247,6 +1247,30 @@ if(is_privacy("id"))
 
 	<section>
 		<title>
+			<function moreinfo="none">in_list(subject, list, separator)</function>
+		</title>
+		<para>
+		Function checks if subject string is found in list string where list items are separated by separator string.  Subject and list strings may contain pseudo variables.  Separator string needs to be one character long.  Returns 1 if subject is found and -1 otherwise.
+    	        </para>
+		<para>
+		Function can be used from all kinds of routes.
+		</para>
+		<example>
+			<title><function>in_list()</function> usage</title>
+			<programlisting format="linespecific">
+...
+$var(subject) = "fi";
+$var(list) = "dk,fi,no,se";
+if (in_list("$var(subject)", "$var(list)", ",") {
+    xlog("L_INFO", "subject is found in list\n");
+}
+...
+			</programlisting>
+		</example>
+	</section>
+
+	<section>
+		<title>
 		<function moreinfo="none">cmp_str(str1, str2)</function>
 		</title>
 		<para>




More information about the sr-dev mailing list