Skip to content

Commit

Permalink
dialplan: added documentation for dp_match() and dp_translate()
Browse files Browse the repository at this point in the history
  • Loading branch information
miconda committed Jul 25, 2017
1 parent 2c105fa commit 2cae9f8
Showing 1 changed file with 97 additions and 0 deletions.
97 changes: 97 additions & 0 deletions src/modules/dialplan/doc/dialplan_admin.xml
Expand Up @@ -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>
Expand Down

0 comments on commit 2cae9f8

Please sign in to comment.