ソースを参照

dialplan: added sample records to readme

- added note about limitation in using pseudo-variables in replacement
  expressions
Daniel-Constantin Mierla 14 年 前
コミット
08390a9a79
2 ファイル変更70 行追加2 行削除
  1. 32 0
      modules/dialplan/README
  2. 38 2
      modules/dialplan/doc/dialplan_admin.xml

+ 32 - 0
modules/dialplan/README

@@ -78,6 +78,7 @@ Juha Heinanen
    1.12. Set fetch_rows parameter
    1.12. Set fetch_rows parameter
    1.13. dp_translate usage
    1.13. dp_translate usage
    1.14. dp_translate usage
    1.14. dp_translate usage
+   1.15. Example of rules
 
 
 Chapter 1. Admin Guide
 Chapter 1. Admin Guide
 
 
@@ -456,6 +457,37 @@ xlog("translated to var $var(y) \n");
    the complete database documentation on the project webpage,
    the complete database documentation on the project webpage,
    http://www.kamailio.org/docs/db-tables/kamailio-db-devel.html.
    http://www.kamailio.org/docs/db-tables/kamailio-db-devel.html.
 
 
+   Some sample records fromd dialplan table are presented in the next
+   figure.
+
+   Example 1.15. Example of rules
+...
+dpid: 1
+pr: 1
+match_op: 1
+match_exp: ^0([1-9][0-9]+)$
+match_len: 0
+subst_exp: ^0([1-9][0-9]+)$
+repl_exp: 0049\1
+attrs: xyz
+...
+dpid: 1
+pr: 1
+match_op: 1
+match_exp: ^0([1-9][0-9]+)$
+match_len: 0
+subst_exp: ^0(.+)$
+repl_exp: $var(prefix)\1
+attrs: xyz
+...
+
+   Note that you can use config variables in the replacement expression
+   (repl_exp) field. However, not all of config variables are safe to use
+   there - specifically the variables that have in their name other
+   variables (variables with dinamic name). References to sip message,
+   private variables ($var(...)) and AVPs with static name are among those
+   that are safe to use in replacement expressions.
+
 Chapter 2. Developer's Guide
 Chapter 2. Developer's Guide
 
 
    The module does not provide any API to use in other Kamailio modules.
    The module does not provide any API to use in other Kamailio modules.

+ 38 - 2
modules/dialplan/doc/dialplan_admin.xml

@@ -563,12 +563,48 @@ xlog("translated to var $var(y) \n");
     <section>
     <section>
 	    <title>Installation</title>
 	    <title>Installation</title>
 	    <para>
 	    <para>
-        The modules requires one table in &kamailio; database: dialplan. The SQL 
-        syntax to create them can be found in dialplan-create.sql     
+		The modules requires one table in &kamailio; database: dialplan.
+		The SQL syntax to create them can be found in dialplan-create.sql     
         script in the database directories in the kamailio/scripts folder.
         script in the database directories in the kamailio/scripts folder.
         You can also find the complete database documentation on the
         You can also find the complete database documentation on the
         project webpage, &kamailiodbdocslink;.
         project webpage, &kamailiodbdocslink;.
         </para>
         </para>
+		<para>
+		Some sample records fromd dialplan table are presented in the next
+		figure.
+        </para>
+		<example>
+		<title>Example of rules</title>
+		<programlisting format="linespecific">
+...
+dpid: 1
+pr: 1
+match_op: 1
+match_exp: ^0([1-9][0-9]+)$
+match_len: 0
+subst_exp: ^0([1-9][0-9]+)$
+repl_exp: 0049\1
+attrs: xyz
+...
+dpid: 1
+pr: 1
+match_op: 1
+match_exp: ^0([1-9][0-9]+)$
+match_len: 0
+subst_exp: ^0(.+)$
+repl_exp: $var(prefix)\1
+attrs: xyz
+...
+		</programlisting>
+		</example>
+		<para>
+		Note that you can use config variables in the replacement expression
+		(repl_exp) field. However, not all of config variables are safe to use
+		there - specifically the variables that have in their name other
+		variables (variables with dinamic name). References to sip message,
+		private variables ($var(...)) and AVPs with static name are among
+		those that are safe to use in replacement expressions.
+		</para>
     </section>
     </section>
 
 
 </chapter>
 </chapter>