[sr-dev] git:master: dialplan: added sample records to readme

Daniel-Constantin Mierla miconda at gmail.com
Mon Oct 17 18:43:28 CEST 2011


Module: sip-router
Branch: master
Commit: 08390a9a79e111e2d22533476d397dd9a92744ac
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=08390a9a79e111e2d22533476d397dd9a92744ac

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Mon Oct 17 18:42:39 2011 +0200

dialplan: added sample records to readme

- added note about limitation in using pseudo-variables in replacement
  expressions

---

 modules/dialplan/README                 |   32 ++++++++++++++++++++++++
 modules/dialplan/doc/dialplan_admin.xml |   40 +++++++++++++++++++++++++++++-
 2 files changed, 70 insertions(+), 2 deletions(-)

diff --git a/modules/dialplan/README b/modules/dialplan/README
index 3036a3f..95f2950 100644
--- a/modules/dialplan/README
+++ b/modules/dialplan/README
@@ -78,6 +78,7 @@ Juha Heinanen
    1.12. Set fetch_rows parameter
    1.13. dp_translate usage
    1.14. dp_translate usage
+   1.15. Example of rules
 
 Chapter 1. Admin Guide
 
@@ -456,6 +457,37 @@ xlog("translated to var $var(y) \n");
    the complete database documentation on the project webpage,
    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
 
    The module does not provide any API to use in other Kamailio modules.
diff --git a/modules/dialplan/doc/dialplan_admin.xml b/modules/dialplan/doc/dialplan_admin.xml
index 9e9610b..398b934 100644
--- a/modules/dialplan/doc/dialplan_admin.xml
+++ b/modules/dialplan/doc/dialplan_admin.xml
@@ -563,12 +563,48 @@ xlog("translated to var $var(y) \n");
     <section>
 	    <title>Installation</title>
 	    <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.
         You can also find the complete database documentation on the
         project webpage, &kamailiodbdocslink;.
         </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>
 
 </chapter>




More information about the sr-dev mailing list