瀏覽代碼

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

Juha Heinanen 14 年之前
父節點
當前提交
aaf46c6b60
共有 2 個文件被更改,包括 63 次插入17 次删除
  1. 39 17
      modules_k/textops/README
  2. 24 0
      modules_k/textops/doc/textops_admin.xml

+ 39 - 17
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@you", "kamailio@YOU"))
 {
@@ -918,7 +940,7 @@ if(cmp_istr("$rU@you", "kamailio@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@you", "kamailio@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"))
 {

+ 24 - 0
modules_k/textops/doc/textops_admin.xml

@@ -1245,6 +1245,30 @@ if(is_privacy("id"))
 		</example>
 	</section>
 
+	<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>