Module: kamailio
Branch: master
Commit: 2cae9f8a301befb0a00f1831c9d5773924e35c10
URL: https://github.com/kamailio/kamailio/commit/2cae9f8a301befb0a00f1831c9d5773…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-07-25T19:41:05+02:00
dialplan: added documentation for dp_match() and dp_translate()
---
Modified: src/modules/dialplan/doc/dialplan_admin.xml
---
Diff: https://github.com/kamailio/kamailio/commit/2cae9f8a301befb0a00f1831c9d5773…
Patch: https://github.com/kamailio/kamailio/commit/2cae9f8a301befb0a00f1831c9d5773…
---
diff --git a/src/modules/dialplan/doc/dialplan_admin.xml b/src/modules/dialplan/doc/dialplan_admin.xml
index 8153974401..073c2b24ed 100644
--- a/src/modules/dialplan/doc/dialplan_admin.xml
+++ b/src/modules/dialplan/doc/dialplan_admin.xml
@@ -394,6 +394,103 @@ modparam("dialplan", "match_dynamic", 1)
<section>
<title>Functions</title>
+ <section id="dialplan.p.dp_replace">
+ <title>
+ <function moreinfo="none">dp_replace(dpid, inval, outvar)</function>
+ </title>
+ <para>
+ The function translates the input value 'inval' using the rules with dialplan
+ id 'dpid', storing the value in the variable 'outvar'. If the rule that was
+ applied has attributes, they are stored in the variable provided via the
+ module parameter 'attrs_pvar'.
+ </para>
+ <para>
+ The behavior is same as dp_translate("dpid", "inval/outvar"), but the
+ parameters have a more flexible format.
+ </para>
+ <para>Meaning of the parameters is as follows:</para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <emphasis>dpid</emphasis> - the dialplan id to match the rules and apply
+ the transformations. It can be a static string or a config variable
+ holding an integer value.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis>inval</emphasis> - input value. It can be a static or a
+ dynamic string. The dynamic string can contain config variables,
+ combined or not with static strings, that are evaluated at runtime.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis>outvar</emphasis> - output variable name. The value resulted
+ after applying the matching rule is stored in this variable. The name
+ must refer to a writable variable.
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ This function can be used from ANY_ROUTE.
+ </para>
+ <example>
+ <title><function>dp_replace</function> usage</title>
+ <programlisting format="linespecific">
+...
+dp_replace("240", "$rU", "$var(newru)");
+xlog("'$rU' was translated to '$var(newru)'\n");
+dp_replace("240", "+49$rU", "$var(newval)");
+...
+ </programlisting>
+ </example>
+ </section>
+
+ <section id="dialplan.p.dp_match">
+ <title>
+ <function moreinfo="none">dp_match(dpid, inval)</function>
+ </title>
+ <para>
+ The function matches the input value 'inval' using the rules with dialplan
+ id 'dpid'. If the rule that was applied has attributes, they are stored in
+ the variable provided via the module parameter 'attrs_pvar'.
+ </para>
+ <para>
+ The behavior is same as dp_translate("dpid", "inval"), but the
+ parameters have a more flexible format.
+ </para>
+ <para>Meaning of the parameters is as follows:</para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <emphasis>dpid</emphasis> - the dialplan id to match the rules and apply
+ the transformations. It can be a static string or a config variable
+ holding an integer value.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis>inval</emphasis> - input value. It can be a static or a
+ dynamic string. The dynamic string can contain config variables,
+ combined or not with static strings, that are evaluated at runtime.
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ This function can be used from ANY_ROUTE.
+ </para>
+ <example>
+ <title><function>dp_match</function> usage</title>
+ <programlisting format="linespecific">
+...
+dp_match("240", "+49$rU");
+xlog("the attributes associated with '+49$rU' are '$var(attrs)'\n");
+...
+ </programlisting>
+ </example>
+ </section>
+
<section id="dialplan.p.dp_translate">
<title>
<function moreinfo="none">dp_translate(id, [src[/dest]])</function>
Module: kamailio
Branch: master
Commit: 2c105fa6a66e24a6d9e24f96b0f4c04b60ce0da9
URL: https://github.com/kamailio/kamailio/commit/2c105fa6a66e24a6d9e24f96b0f4c04…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-07-25T19:41:05+02:00
dialplan: added dp_match() and dp_replace() functions
- alternatives to dp_translate() with dedicated required parameters
(avoiding second parameter of two variables separated by '/')
- dp_match(dpid, inval)
- dp_replace(dpid, inval, outvar)
- dpid can be interger or variable
- inval can be a static or dynamic (with vars) string
- outvar has to be a writable variable
---
Modified: src/modules/dialplan/dialplan.c
Modified: src/modules/dialplan/dialplan.h
Modified: src/modules/dialplan/dp_repl.c
---
Diff: https://github.com/kamailio/kamailio/commit/2c105fa6a66e24a6d9e24f96b0f4c04…
Patch: https://github.com/kamailio/kamailio/commit/2c105fa6a66e24a6d9e24f96b0f4c04…