aboutsummaryrefslogtreecommitdiffstats
path: root/funcs
diff options
context:
space:
mode:
Diffstat (limited to 'funcs')
-rw-r--r--funcs/func_base64.c35
-rw-r--r--funcs/func_blacklist.c17
-rw-r--r--funcs/func_callerid.c89
-rw-r--r--funcs/func_cdr.c163
-rw-r--r--funcs/func_channel.c243
-rw-r--r--funcs/func_config.c22
-rw-r--r--funcs/func_cut.c57
-rw-r--r--funcs/func_db.c69
-rw-r--r--funcs/func_devstate.c79
-rw-r--r--funcs/func_dialgroup.c52
-rw-r--r--funcs/func_dialplan.c20
-rw-r--r--funcs/func_enum.c137
-rw-r--r--funcs/func_env.c79
-rw-r--r--funcs/func_extstate.c34
-rw-r--r--funcs/func_global.c66
-rw-r--r--funcs/func_groupcount.c78
-rw-r--r--funcs/func_iconv.c35
-rw-r--r--funcs/func_lock.c67
-rw-r--r--funcs/func_logic.c92
-rw-r--r--funcs/func_math.c40
-rw-r--r--funcs/func_md5.c16
-rw-r--r--funcs/func_module.c23
-rw-r--r--funcs/func_odbc.c124
-rw-r--r--funcs/func_rand.c25
-rw-r--r--funcs/func_realtime.c88
-rw-r--r--funcs/func_sha1.c25
-rw-r--r--funcs/func_shell.c32
-rw-r--r--funcs/func_speex.c73
-rw-r--r--funcs/func_strings.c332
-rw-r--r--funcs/func_timeout.c59
-rw-r--r--funcs/func_uri.c33
-rw-r--r--funcs/func_version.c56
-rw-r--r--funcs/func_vmcount.c29
-rw-r--r--funcs/func_volume.c27
34 files changed, 1751 insertions, 665 deletions
diff --git a/funcs/func_base64.c b/funcs/func_base64.c
index 0849e9539..28805b943 100644
--- a/funcs/func_base64.c
+++ b/funcs/func_base64.c
@@ -30,6 +30,35 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/pbx.h" /* function register/unregister */
#include "asterisk/utils.h"
+/*** DOCUMENTATION
+ <function name="BASE64_ENCODE" language="en_US">
+ <synopsis>
+ Encode a string in base64.
+ </synopsis>
+ <syntax>
+ <parameter name="string" required="true">
+ <para>Input string</para>
+ </parameter>
+ </syntax>
+ <description>
+ <para>Returns the base64 string.</para>
+ </description>
+ </function>
+ <function name="BASE64_DECODE" language="en_US">
+ <synopsis>
+ Decode a base64 string.
+ </synopsis>
+ <syntax>
+ <parameter name="string" required="true">
+ <para>Input string.</para>
+ </parameter>
+ </syntax>
+ <description>
+ <para>Returns the plain text string.</para>
+ </description>
+ </function>
+ ***/
+
static int base64_encode(struct ast_channel *chan, const char *cmd, char *data,
char *buf, size_t len)
{
@@ -58,17 +87,11 @@ static int base64_decode(struct ast_channel *chan, const char *cmd, char *data,
static struct ast_custom_function base64_encode_function = {
.name = "BASE64_ENCODE",
- .synopsis = "Encode a string in base64",
- .desc = "Returns the base64 string\n",
- .syntax = "BASE64_ENCODE(<string>)",
.read = base64_encode,
};
static struct ast_custom_function base64_decode_function = {
.name = "BASE64_DECODE",
- .synopsis = "Decode a base64 string",
- .desc = "Returns the plain text string\n",
- .syntax = "BASE64_DECODE(<base64_string>)",
.read = base64_decode,
};
diff --git a/funcs/func_blacklist.c b/funcs/func_blacklist.c
index 2a2fa78c7..c353b20fd 100644
--- a/funcs/func_blacklist.c
+++ b/funcs/func_blacklist.c
@@ -35,6 +35,20 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/channel.h"
#include "asterisk/astdb.h"
+/*** DOCUMENTATION
+ <function name="BLACKLIST" language="en_US">
+ <synopsis>
+ Check if the callerid is on the blacklist.
+ </synopsis>
+ <syntax />
+ <description>
+ <para>Uses astdb to check if the Caller*ID is in family <literal>blacklist</literal>.
+ Returns <literal>1</literal> or <literal>0</literal>.</para>
+ </description>
+ </function>
+
+***/
+
static int blacklist_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
{
char blacklist[1];
@@ -55,9 +69,6 @@ static int blacklist_read(struct ast_channel *chan, const char *cmd, char *data,
static struct ast_custom_function blacklist_function = {
.name = "BLACKLIST",
- .synopsis = "Check if the callerid is on the blacklist",
- .desc = "Uses astdb to check if the Caller*ID is in family 'blacklist'. Returns 1 or 0.\n",
- .syntax = "BLACKLIST()",
.read = blacklist_read,
};
diff --git a/funcs/func_callerid.c b/funcs/func_callerid.c
index c56089ca2..7f066cdaa 100644
--- a/funcs/func_callerid.c
+++ b/funcs/func_callerid.c
@@ -32,6 +32,74 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/app.h"
#include "asterisk/callerid.h"
+/*** DOCUMENTATION
+ <function name="CALLERID" language="en_US">
+ <synopsis>
+ Gets or sets Caller*ID data on the channel.
+ </synopsis>
+ <syntax>
+ <parameter name="datatype" required="true">
+ <para>The allowable datatypes are:</para>
+ <enumlist>
+ <enum name="all" />
+ <enum name="num" />
+ <enum name="ANI" />
+ <enum name="DNID" />
+ <enum name="RDNIS" />
+ <enum name="pres" />
+ <enum name="ton" />
+ </enumlist>
+ </parameter>
+ <parameter name="CID">
+ <para>Optional Caller*ID</para>
+ </parameter>
+ </syntax>
+ <description>
+ <para>Gets or sets Caller*ID data on the channel. Uses channel callerid by default or optional
+ callerid, if specified.</para>
+ </description>
+ </function>
+ <function name="CALLERPRES" language="en_US">
+ <synopsis>
+ Gets or sets Caller*ID presentation on the channel.
+ </synopsis>
+ <syntax />
+ <description>
+ <para>Gets or sets Caller*ID presentation on the channel. The following values
+ are valid:</para>
+ <enumlist>
+ <enum name="allowed_not_screened">
+ <para>Presentation Allowed, Not Screened.</para>
+ </enum>
+ <enum name="allowed_passed_screen">
+ <para>Presentation Allowed, Passed Screen.</para>
+ </enum>
+ <enum name="allowed_failed_screen">
+ <para>Presentation Allowed, Failed Screen.</para>
+ </enum>
+ <enum name="allowed">
+ <para>Presentation Allowed, Network Number.</para>
+ </enum>
+ <enum name="prohib_not_screened">
+ <para>Presentation Prohibited, Not Screened.</para>
+ </enum>
+ <enum name="prohib_passed_screen">
+ <para>Presentation Prohibited, Passed Screen.</para>
+ </enum>
+ <enum name="prohib_failed_screen">
+ <para>Presentation Prohibited, Failed Screen.</para>
+ </enum>
+ <enum name="prohib">
+ <para>Presentation Prohibited, Network Number.</para>
+ </enum>
+ <enum name="unavailable">
+ <para>Number Unavailable.</para>
+ </enum>
+ </enumlist>
+ </description>
+ </function>
+ ***/
+
static int callerpres_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
{
ast_copy_string(buf, ast_named_caller_presentation(chan->cid.cid_pres), len);
@@ -184,33 +252,12 @@ static int callerid_write(struct ast_channel *chan, const char *cmd, char *data,
static struct ast_custom_function callerid_function = {
.name = "CALLERID",
- .synopsis = "Gets or sets Caller*ID data on the channel.",
- .syntax = "CALLERID(datatype[,<optional-CID>])",
- .desc =
- "Gets or sets Caller*ID data on the channel. The allowable datatypes\n"
- "are \"all\", \"name\", \"num\", \"ANI\", \"DNID\", \"RDNIS\", \"pres\",\n"
- "and \"ton\".\n"
- "Uses channel callerid by default or optional callerid, if specified.\n",
.read = callerid_read,
.write = callerid_write,
};
static struct ast_custom_function callerpres_function = {
.name = "CALLERPRES",
- .synopsis = "Gets or sets Caller*ID presentation on the channel.",
- .syntax = "CALLERPRES()",
- .desc =
-"Gets or sets Caller*ID presentation on the channel. The following values\n"
-"are valid:\n"
-" allowed_not_screened : Presentation Allowed, Not Screened\n"
-" allowed_passed_screen : Presentation Allowed, Passed Screen\n"
-" allowed_failed_screen : Presentation Allowed, Failed Screen\n"
-" allowed : Presentation Allowed, Network Number\n"
-" prohib_not_screened : Presentation Prohibited, Not Screened\n"
-" prohib_passed_screen : Presentation Prohibited, Passed Screen\n"
-" prohib_failed_screen : Presentation Prohibited, Failed Screen\n"
-" prohib : Presentation Prohibited, Network Number\n"
-" unavailable : Number Unavailable\n",
.read = callerpres_read,
.write = callerpres_write,
};
diff --git a/funcs/func_cdr.c b/funcs/func_cdr.c
index 9b73d03f1..6c80e4f93 100644
--- a/funcs/func_cdr.c
+++ b/funcs/func_cdr.c
@@ -36,6 +36,133 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/app.h"
#include "asterisk/cdr.h"
+/*** DOCUMENTATION
+ <function name="CDR" language="en_US">
+ <synopsis>
+ Gets or sets a CDR variable.
+ </synopsis>
+ <syntax>
+ <parameter name="name" required="true">
+ <para>CDR field name:</para>
+ <enumlist>
+ <enum name="clid">
+ <para>Caller ID.</para>
+ </enum>
+ <enum name="lastdata">
+ <para>Last application arguments.</para>
+ </enum>
+ <enum name="disposition">
+ <para>ANSWERED, NO ANSWER, BUSY.</para>
+ </enum>
+ <enum name="src">
+ <para>Source.</para>
+ </enum>
+ <enum name="start">
+ <para>Time the call started.</para>
+ </enum>
+ <enum name="amaflags">
+ <para>DOCUMENTATION, BILL, IGNORE, etc.</para>
+ </enum>
+ <enum name="dst">
+ <para>Destination.</para>
+ </enum>
+ <enum name="answer">
+ <para>Time the call was answered.</para>
+ </enum>
+ <enum name="accountcode">
+ <para>The channel's account code.</para>
+ </enum>
+ <enum name="dcontext">
+ <para>Destination context.</para>
+ </enum>
+ <enum name="end">
+ <para>Time the call ended.</para>
+ </enum>
+ <enum name="uniqueid">
+ <para>The channel's unique id.</para>
+ </enum>
+ <enum name="dstchannel">
+ <para>Destination channel.</para>
+ </enum>
+ <enum name="duration">
+ <para>Duration of the call.</para>
+ </enum>
+ <enum name="userfield">
+ <para>The channel's user specified field.</para>
+ </enum>
+ <enum name="lastapp">
+ <para>Last application.</para>
+ </enum>
+ <enum name="billsec">
+ <para>Duration of the call once it was answered.</para>
+ </enum>
+ <enum name="channel">
+ <para>Channel name.</para>
+ </enum>
+ </enumlist>
+ </parameter>
+ <parameter name="options" required="false">
+ <optionlist>
+ <option name="l">
+ <para>Uses the most recent CDR on a channel with multiple records</para>
+ </option>
+ <option name="r">
+ <para>Searches the entire stack of CDRs on the channel.</para>
+ </option>
+ <option name="s">
+ <para>Skips any CDR's that are marked 'LOCKED' due to forkCDR() calls.
+ (on setting/writing CDR vars only)</para>
+ </option>
+ <option name="u">
+ <para>Retrieves the raw, unprocessed value.</para>
+ <para>For example, 'start', 'answer', and 'end' will be retrieved as epoch
+ values, when the <literal>u</literal> option is passed, but formatted as YYYY-MM-DD HH:MM:SS
+ otherwise. Similarly, disposition and amaflags will return their raw
+ integral values.</para>
+ </option>
+ </optionlist>
+ </parameter>
+ </syntax>
+ <description>
+ <para>All of the CDR field names are read-only, except for <literal>accountcode</literal>,
+ <literal>userfield</literal>, and <literal>amaflags</literal>. You may, however, supply
+ a name not on the above list, and create your own variable, whose value can be changed
+ with this function, and this variable will be stored on the cdr.</para>
+ <note><para>For setting CDR values, the <literal>l</literal> flag does not apply to
+ setting the <literal>accountcode</literal>, <literal>userfield</literal>, or
+ <literal>amaflags</literal>.</para></note>
+ <para>Raw values for <literal>disposition</literal>:</para>
+ <enumlist>
+ <enum name="1">
+ <para>NO ANSWER</para>
+ </enum>
+ <enum name="2">
+ <para>BUSY</para>
+ </enum>
+ <enum name="3">
+ <para>FAILED</para>
+ </enum>
+ <enum name="4">
+ <para>ANSWERED</para>
+ </enum>
+ </enumlist>
+ <para>Raw values for <literal>amaflags</literal>:</para>
+ <enumlist>
+ <enum name="1">
+ <para>OMIT</para>
+ </enum>
+ <enum name="2">
+ <para>BILLING</para>
+ </enum>
+ <enum name="3">
+ <para>DOCUMENTATION</para>
+ </enum>
+ </enumlist>
+ <para>Example: exten => 1,1,Set(CDR(userfield)=test)</para>
+ </description>
+ </function>
+ ***/
+
enum {
OPT_RECURSIVE = (1 << 0),
OPT_UNPARSED = (1 << 1),
@@ -128,44 +255,8 @@ static int cdr_write(struct ast_channel *chan, const char *cmd, char *parse,
static struct ast_custom_function cdr_function = {
.name = "CDR",
- .synopsis = "Gets or sets a CDR variable",
- .syntax = "CDR(<name>[,options])",
.read = cdr_read,
.write = cdr_write,
- .desc =
-"Options:\n"
-" 'l' uses the most recent CDR on a channel with multiple records\n"
-" 'r' searches the entire stack of CDRs on the channel\n"
-" 's' skips any CDR's that are marked 'LOCKED' due to forkCDR() calls.\n"
-" (on setting/writing CDR vars only)\n"
-" 'u' retrieves the raw, unprocessed value\n"
-" For example, 'start', 'answer', and 'end' will be retrieved as epoch\n"
-" values, when the 'u' option is passed, but formatted as YYYY-MM-DD HH:MM:SS\n"
-" otherwise. Similarly, disposition and amaflags will return their raw\n"
-" integral values.\n"
-" Here is a list of all the available cdr field names:\n"
-" clid lastdata disposition\n"
-" src start amaflags\n"
-" dst answer accountcode\n"
-" dcontext end uniqueid\n"
-" dstchannel duration userfield\n"
-" lastapp billsec channel\n"
-" All of the above variables are read-only, except for accountcode,\n"
-" userfield, and amaflags. You may, however, supply\n"
-" a name not on the above list, and create your own\n"
-" variable, whose value can be changed with this function,\n"
-" and this variable will be stored on the cdr.\n"
-" For setting CDR values, the 'l' flag does not apply to\n"
-" setting the accountcode, userfield, or amaflags.\n"
-" raw values for disposition:\n"
-" 1 = NO ANSWER\n"
-" 2 = BUSY\n"
-" 3 = FAILED\n"
-" 4 = ANSWERED\n"
-" raw values for amaflags:\n"
-" 1 = OMIT\n"
-" 2 = BILLING\n"
-" 3 = DOCUMENTATION\n",
};
static int unload_module(void)
diff --git a/funcs/func_channel.c b/funcs/func_channel.c
index c13c668a3..4393c2e33 100644
--- a/funcs/func_channel.c
+++ b/funcs/func_channel.c
@@ -38,6 +38,168 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/indications.h"
#include "asterisk/stringfields.h"
+/*** DOCUMENTATION
+ <function name="CHANNELS" language="en_US">
+ <synopsis>
+ Gets the list of channels, optionally filtering by a regular expression.
+ </synopsis>
+ <syntax>
+ <parameter name="regular_expression" />
+ </syntax>
+ <description>
+ <para>Gets the list of channels, optionally filtering by a <replaceable>regular_expression</replaceable>. If
+ no argument is provided, all known channels are returned. The
+ <replaceable>regular_expression</replaceable> must correspond to
+ the POSIX.2 specification, as shown in <emphasis>regex(7)</emphasis>. The list returned
+ will be space-delimited.</para>
+ </description>
+ </function>
+ <function name="CHANNEL" language="en_US">
+ <synopsis>
+ Gets/sets various pieces of information about the channel.
+ </synopsis>
+ <syntax>
+ <parameter name="item" required="true">
+ <para>Standard items (provided by all channel technologies) are:</para>
+ <enumlist>
+ <enum name="audioreadformat">
+ <para>R/O format currently being read.</para>
+ </enum>
+ <enum name="audionativeformat">
+ <para>R/O format used natively for audio.</para>
+ </enum>
+ <enum name="audiowriteformat">
+ <para>R/O format currently being written.</para>
+ </enum>
+ <enum name="callgroup">
+ <para>R/W call groups for call pickup.</para>
+ </enum>
+ <enum name="channeltype">
+ <para>R/O technology used for channel.</para>
+ </enum>
+ <enum name="language">
+ <para>R/W language for sounds played.</para>
+ </enum>
+ <enum name="musicclass">
+ <para>R/W class (from musiconhold.conf) for hold music.</para>
+ </enum>
+ <enum name="parkinglot">
+ <para>R/W parkinglot for parking.</para>
+ </enum>
+ <enum name="rxgain">
+ <para>R/W set rxgain level on channel drivers that support it.</para>
+ </enum>
+ <enum name="state">
+ <para>R/O state for channel</para>
+ </enum>
+ <enum name="tonezone">
+ <para>R/W zone for indications played</para>
+ </enum>
+ <enum name="txgain">
+ <para>R/W set txgain level on channel drivers that support it.</para>
+ </enum>
+ <enum name="videonativeformat">
+ <para>R/O format used natively for video</para>
+ </enum>
+ <enum name="trace">
+ <para>R/W whether or not context tracing is enabled, only available
+ <emphasis>if CHANNEL_TRACE is defined</emphasis>.</para>
+ </enum>
+ </enumlist>
+ <para><emphasis>chan_sip</emphasis> provides the following additional options:</para>
+ <enumlist>
+ <enum name="peerip">
+ <para>R/O Get the IP address of the peer.</para>
+ </enum>
+ <enum name="recvip">
+ <para>R/O Get the source IP address of the peer.</para>
+ </enum>
+ <enum name="from">
+ <para>R/O Get the URI from the From: header.</para>
+ </enum>
+ <enum name="uri">
+ <para>R/O Get the URI from the Contact: header.</para>
+ </enum>
+ <enum name="useragent">
+ <para>R/O Get the useragent.</para>
+ </enum>
+ <enum name="peername">
+ <para>R/O Get the name of the peer.</para>
+ </enum>
+ <enum name="t38passthrough">
+ <para>R/O <literal>1</literal> if T38 is offered or enabled in this channel,
+ otherwise <literal>0</literal></para>
+ </enum>
+ <enum name="rtpqos">
+ <para>R/O Get QOS information about the RTP stream</para>
+ <para> This option takes two additional arguments:</para>
+ <para> Argument 1:</para>
+ <para> <literal>audio</literal> Get data about the audio stream</para>
+ <para> <literal>video</literal> Get data about the video stream</para>
+ <para> <literal>text</literal> Get data about the text stream</para>
+ <para> Argument 2:</para>
+ <para> <literal>local_ssrc</literal> Local SSRC (stream ID)</para>
+ <para> <literal>local_lostpackets</literal> Local lost packets</para>
+ <para> <literal>local_jitter</literal> Local calculated jitter</para>
+ <para> <literal>local_maxjitter</literal> Local calculated jitter (maximum)</para>
+ <para> <literal>local_minjitter</literal> Local calculated jitter (minimum)</para>
+ <para> <literal>local_normdevjitter</literal>Local calculated jitter (normal deviation)</para>
+ <para> <literal>local_stdevjitter</literal> Local calculated jitter (standard deviation)</para>
+ <para> <literal>local_count</literal> Number of received packets</para>
+ <para> <literal>remote_ssrc</literal> Remote SSRC (stream ID)</para>
+ <para> <literal>remote_lostpackets</literal>Remote lost packets</para>
+ <para> <literal>remote_jitter</literal> Remote reported jitter</para>
+ <para> <literal>remote_maxjitter</literal> Remote calculated jitter (maximum)</para>
+ <para> <literal>remote_minjitter</literal> Remote calculated jitter (minimum)</para>
+ <para> <literal>remote_normdevjitter</literal>Remote calculated jitter (normal deviation)</para>
+ <para> <literal>remote_stdevjitter</literal>Remote calculated jitter (standard deviation)</para>
+ <para> <literal>remote_count</literal> Number of transmitted packets</para>
+ <para> <literal>remote_ssrc</literal> Remote SSRC (stream ID)</para>
+ <para> <literal>remote_lostpackets</literal>Remote lost packets</para>
+ <para> <literal>remote_jitter</literal> Remote reported jitter</para>
+ <para> <literal>remote_maxjitter</literal> Remote calculated jitter (maximum)</para>
+ <para> <literal>remote_minjitter</literal> Remote calculated jitter (minimum)</para>
+ <para> <literal>remote_normdevjitter</literal>Remote calculated jitter (normal deviation)</para>
+ <para> <literal>remote_stdevjitter</literal>Remote calculated jitter (standard deviation)</para>
+ <para> <literal>remote_count</literal> Number of transmitted packets</para>
+ <para> <literal>rtt</literal> Round trip time</para>
+ <para> <literal>maxrtt</literal> Round trip time (maximum)</para>
+ <para> <literal>minrtt</literal> Round trip time (minimum)</para>
+ <para> <literal>normdevrtt</literal> Round trip time (normal deviation)</para>
+ <para> <literal>stdevrtt</literal> Round trip time (standard deviation)</para>
+ <para> <literal>all</literal> All statistics (in a form suited to logging,
+ but not for parsing)</para>
+ </enum>
+ <enum name="rtpdest">
+ <para>R/O Get remote RTP destination information.</para>
+ <para> This option takes one additional argument:</para>
+ <para> Argument 1:</para>
+ <para> <literal>audio</literal> Get audio destination</para>
+ <para> <literal>video</literal> Get video destination</para>
+ </enum>
+ </enumlist>
+ <para><emphasis>chan_iax2</emphasis> provides the following additional options:</para>
+ <enumlist>
+ <enum name="osptoken">
+ <para>R/W Get or set the OSP token information for a call.</para>
+ </enum>
+ <enum name="peerip">
+ <para>R/O Get the peer's ip address.</para>
+ </enum>
+ <enum name="peername">
+ <para>R/O Get the peer's username.</para>
+ </enum>
+ </enumlist>
+ </parameter>
+ </syntax>
+ <description>
+ <para>Gets/sets various pieces of information about the channel, additional <replaceable>item</replaceable> may
+ be available from the channel driver; see its documentation for details. Any <replaceable>item</replaceable>
+ requested that is not available on the current channel will return an empty string.</para>
+ </description>
+ </function>
+ ***/
+
#define locked_copy_string(chan, dest, source, len) \
do { \
ast_channel_lock(chan); \
@@ -168,80 +330,6 @@ static int func_channel_write(struct ast_channel *chan, const char *function,
static struct ast_custom_function channel_function = {
.name = "CHANNEL",
- .synopsis = "Gets/sets various pieces of information about the channel.",
- .syntax = "CHANNEL(item)",
- .desc = "Gets/set various pieces of information about the channel.\n"
- "Standard items (provided by all channel technologies) are:\n"
- "R/O audioreadformat format currently being read\n"
- "R/O audionativeformat format used natively for audio\n"
- "R/O audiowriteformat format currently being written\n"
- "R/W callgroup call groups for call pickup\n"
- "R/O channeltype technology used for channel\n"
- "R/W language language for sounds played\n"
- "R/W musicclass class (from musiconhold.conf) for hold music\n"
- "R/W parkinglot parkinglot for parking\n"
- "R/W rxgain set rxgain level on channel drivers that support it\n"
- "R/O state state for channel\n"
- "R/W tonezone zone for indications played\n"
- "R/W txgain set txgain level on channel drivers that support it\n"
- "R/O videonativeformat format used natively for video\n"
-#ifdef CHANNEL_TRACE
- "R/W trace whether or not context tracing is enabled\n"
-#endif
- "\n"
- "chan_sip provides the following additional options:\n"
- "R/O peerip Get the IP address of the peer\n"
- "R/O recvip Get the source IP address of the peer\n"
- "R/O from Get the URI from the From: header\n"
- "R/O uri Get the URI from the Contact: header\n"
- "R/O useragent Get the useragent\n"
- "R/O peername Get the name of the peer\n"
- "R/O t38passthrough 1 if T38 is offered or enabled in this channel, otherwise 0\n"
- "R/O rtpqos Get QOS information about the RTP stream\n"
- " This option takes two additional arguments:\n"
- " Argument 1:\n"
- " audio Get data about the audio stream\n"
- " video Get data about the video stream\n"
- " text Get data about the text stream\n"
- " Argument 2:\n"
- " local_ssrc Local SSRC (stream ID)\n"
- " local_lostpackets Local lost packets\n"
- " local_jitter Local calculated jitter\n"
- " local_maxjitter Local calculated jitter (maximum)\n"
- " local_minjitter Local calculated jitter (minimum)\n"
- " local_normdevjitter Local calculated jitter (normal deviation)\n"
- " local_stdevjitter Local calculated jitter (standard deviation)\n"
- " local_count Number of received packets\n"
- " remote_ssrc Remote SSRC (stream ID)\n"
- " remote_lostpackets Remote lost packets\n"
- " remote_jitter Remote reported jitter\n"
- " remote_maxjitter Remote calculated jitter (maximum)\n"
- " remote_minjitter Remote calculated jitter (minimum)\n"
- " remote_normdevjitter Remote calculated jitter (normal deviation)\n"
- " remote_stdevjitter Remote calculated jitter (standard deviation)\n"
- " remote_count Number of transmitted packets\n"
- " rtt Round trip time\n"
- " maxrtt Round trip time (maximum)\n"
- " minrtt Round trip time (minimum)\n"
- " normdevrtt Round trip time (normal deviation)\n"
- " stdevrtt Round trip time (standard deviation)\n"
- " all All statistics (in a form suited to logging, but not for parsing)\n"
- "R/O rtpdest Get remote RTP destination information\n"
- " This option takes one additional argument:\n"
- " Argument 1:\n"
- " audio Get audio destination\n"
- " video Get video destination\n"
- "\n"
- "chan_iax2 provides the following additional options:\n"
- "R/W osptoken Get or set the OSP token information for a call\n"
- "R/O peerip Get the peer's ip address\n"
- "R/O peername Get the peer's username\n"
- "\n"
- "Additional items may be available from the channel driver providing\n"
- "the channel; see its documentation for details.\n"
- "\n"
- "Any item requested that is not available on the current channel will\n"
- "return an empty string.\n",
.read = func_channel_read,
.write = func_channel_write,
};
@@ -288,13 +376,6 @@ static int func_channels_read(struct ast_channel *chan, const char *function, ch
static struct ast_custom_function channels_function = {
.name = "CHANNELS",
- .synopsis = "Gets the list of channels, optionally filtering by a regular expression.",
- .syntax = "CHANNEL([regular expression])",
- .desc =
-"Gets the list of channels, optionally filtering by a regular expression. If\n"
-"no argument is provided, all known channels are returned. The regular\n"
-"expression must correspond to the POSIX.2 specification, as shown in\n"
-"regex(7). The list returned will be space-delimited.\n",
.read = func_channels_read,
};
diff --git a/funcs/func_config.c b/funcs/func_config.c
index 5669f3655..21d291c2e 100644
--- a/funcs/func_config.c
+++ b/funcs/func_config.c
@@ -36,6 +36,23 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/pbx.h"
#include "asterisk/app.h"
+/*** DOCUMENTATION
+ <function name="AST_CONFIG" language="en_US">
+ <synopsis>
+ Retrieve a variable from a configuration file.
+ </synopsis>
+ <syntax>
+ <parameter name="config_file" required="true" />
+ <parameter name="category" required="true" />
+ <parameter name="variable_name" required="true" />
+ </syntax>
+ <description>
+ <para>This function reads a variable from an Asterisk configuration file.</para>
+ </description>
+ </function>
+
+***/
+
struct config_item {
AST_RWLIST_ENTRY(config_item) entry;
struct ast_config *cfg;
@@ -160,11 +177,6 @@ static int config_function_read(struct ast_channel *chan, const char *cmd, char
static struct ast_custom_function config_function = {
.name = "AST_CONFIG",
- .syntax = "AST_CONFIG(config_file,category,variable_name)",
- .synopsis = "Retrieve a variable from a configuration file",
- .desc =
- " This function reads a variable from an Asterisk configuration file.\n"
- "",
.read = config_function_read,
};
diff --git a/funcs/func_cut.c b/funcs/func_cut.c
index 96779b661..dda907ca2 100644
--- a/funcs/func_cut.c
+++ b/funcs/func_cut.c
@@ -34,6 +34,49 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/module.h"
#include "asterisk/app.h"
+/*** DOCUMENTATION
+ <function name="SORT" language="en_US">
+ <synopsis>
+ Sorts a list of key/vals into a list of keys, based upon the vals.
+ </synopsis>
+ <syntax>
+ <parameter name="keyval" required="true" argsep=":">
+ <argument name="key1" required="true" />
+ <argument name="val1" required="true" />
+ </parameter>
+ <parameter name="keyvaln" multiple="true" argsep=":">
+ <argument name="key2" required="true" />
+ <argument name="val2" required="true" />
+ </parameter>
+ </syntax>
+ <description>
+ <para>Takes a comma-separated list of keys and values, each separated by a colon, and returns a
+ comma-separated list of the keys, sorted by their values. Values will be evaluated as
+ floating-point numbers.</para>
+ </description>
+ </function>
+ <function name="CUT" language="en_US">
+ <synopsis>
+ Slices and dices strings, based upon a named delimiter.
+ </synopsis>
+ <syntax>
+ <parameter name="varname" required="true">
+ <para>Variable you want cut</para>
+ </parameter>
+ <parameter name="char-delim" required="true">
+ <para>Delimiter, defaults to <literal>-</literal></para>
+ </parameter>
+ <parameter name="range-spec" required="true">
+ <para>Number of the field you want (1-based offset), may also be specified as a range (with <literal>-</literal>)
+ or group of ranges and fields (with <literal>&amp;</literal>)</para>
+ </parameter>
+ </syntax>
+ <description>
+ <para>Cut out information from a string (<replaceable>varname</replaceable>), based upon a named delimiter.</para>
+ </description>
+ </function>
+ ***/
+
/* Maximum length of any variable */
#define MAXRESULT 1024
@@ -255,25 +298,11 @@ static int acf_cut_exec(struct ast_channel *chan, const char *cmd, char *data, c
struct ast_custom_function acf_sort = {
.name = "SORT",
- .synopsis = "Sorts a list of key/vals into a list of keys, based upon the vals",
- .syntax = "SORT(key1:val1[...][,keyN:valN])",
- .desc =
-"Takes a comma-separated list of keys and values, each separated by a colon, and returns a\n"
-"comma-separated list of the keys, sorted by their values. Values will be evaluated as\n"
-"floating-point numbers.\n",
.read = acf_sort_exec,
};
struct ast_custom_function acf_cut = {
.name = "CUT",
- .synopsis = "Slices and dices strings, based upon a named delimiter.",
- .syntax = "CUT(<varname>,<char-delim>,<range-spec>)",
- .desc =
-" varname - variable you want cut\n"
-" char-delim - defaults to '-'\n"
-" range-spec - number of the field you want (1-based offset)\n"
-" may also be specified as a range (with -)\n"
-" or group of ranges and fields (with &)\n",
.read = acf_cut_exec,
};
diff --git a/funcs/func_db.c b/funcs/func_db.c
index 374d4b859..9c8e0bdf9 100644
--- a/funcs/func_db.c
+++ b/funcs/func_db.c
@@ -40,6 +40,54 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/app.h"
#include "asterisk/astdb.h"
+/*** DOCUMENTATION
+ <function name="DB" language="en_US">
+ <synopsis>
+ Read from or write to the Asterisk database.
+ </synopsis>
+ <syntax argsep="/">
+ <parameter name="family" required="true" />
+ <parameter name="key" required="true" />
+ </syntax>
+ <description>
+ <para>This function will read from or write a value to the Asterisk database. On a
+ read, this function returns the corresponding value from the database, or blank
+ if it does not exist. Reading a database value will also set the variable
+ DB_RESULT. If you wish to find out if an entry exists, use the DB_EXISTS
+ function.</para>
+ </description>
+ </function>
+ <function name="DB_EXISTS" language="en_US">
+ <synopsis>
+ Check to see if a key exists in the Asterisk database.
+ </synopsis>
+ <syntax argsep="/">
+ <parameter name="family" required="true" />
+ <parameter name="key" required="true" />
+ </syntax>
+ <description>
+ <para>This function will check to see if a key exists in the Asterisk
+ database. If it exists, the function will return <literal>1</literal>. If not,
+ it will return <literal>0</literal>. Checking for existence of a database key will
+ also set the variable DB_RESULT to the key's value if it exists.</para>
+ </description>
+ </function>
+ <function name="DB_DELETE" language="en_US">
+ <synopsis>
+ Return a value from the database and delete it.
+ </synopsis>
+ <syntax argsep="/">
+ <parameter name="family" required="true" />
+ <parameter name="key" required="true" />
+ </syntax>
+ <description>
+ <para>This function will retrieve a value from the Asterisk database
+ and then remove that key from the database. <variable>DB_RESULT</variable>
+ will be set to the key's value if it exists.</para>
+ </description>
+ </function>
+ ***/
+
static int function_db_read(struct ast_channel *chan, const char *cmd,
char *parse, char *buf, size_t len)
{
@@ -100,14 +148,6 @@ static int function_db_write(struct ast_channel *chan, const char *cmd, char *pa
static struct ast_custom_function db_function = {
.name = "DB",
- .synopsis = "Read from or write to the Asterisk database",
- .syntax = "DB(<family>/<key>)",
- .desc =
-"This function will read from or write a value to the Asterisk database. On a\n"
-"read, this function returns the corresponding value from the database, or blank\n"
-"if it does not exist. Reading a database value will also set the variable\n"
-"DB_RESULT. If you wish to find out if an entry exists, use the DB_EXISTS\n"
-"function.\n",
.read = function_db_read,
.write = function_db_write,
};
@@ -146,13 +186,6 @@ static int function_db_exists(struct ast_channel *chan, const char *cmd,
static struct ast_custom_function db_exists_function = {
.name = "DB_EXISTS",
- .synopsis = "Check to see if a key exists in the Asterisk database",
- .syntax = "DB_EXISTS(<family>/<key>)",
- .desc =
- "This function will check to see if a key exists in the Asterisk\n"
- "database. If it exists, the function will return \"1\". If not,\n"
- "it will return \"0\". Checking for existence of a database key will\n"
- "also set the variable DB_RESULT to the key's value if it exists.\n",
.read = function_db_exists,
};
@@ -194,12 +227,6 @@ static int function_db_delete(struct ast_channel *chan, const char *cmd,
static struct ast_custom_function db_delete_function = {
.name = "DB_DELETE",
- .synopsis = "Return a value from the database and delete it",
- .syntax = "DB_DELETE(<family>/<key>)",
- .desc =
- "This function will retrieve a value from the Asterisk database\n"
- " and then remove that key from the database. DB_RESULT\n"
- "will be set to the key's value if it exists.\n",
.read = function_db_delete,
};
diff --git a/funcs/func_devstate.c b/funcs/func_devstate.c
index 1cedb3e53..f164cb7c1 100644
--- a/funcs/func_devstate.c
+++ b/funcs/func_devstate.c
@@ -44,6 +44,57 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/astdb.h"
#include "asterisk/app.h"
+/*** DOCUMENTATION
+ <function name="DEVICE_STATE" language="en_US">
+ <synopsis>
+ Get or Set a device state.
+ </synopsis>
+ <syntax>
+ <parameter name="device" required="true" />
+ </syntax>
+ <description>
+ <para>The DEVICE_STATE function can be used to retrieve the device state from any
+ device state provider. For example:</para>
+ <para>NoOp(SIP/mypeer has state ${DEVICE_STATE(SIP/mypeer)})</para>
+ <para>NoOp(Conference number 1234 has state ${DEVICE_STATE(MeetMe:1234)})</para>
+ <para>The DEVICE_STATE function can also be used to set custom device state from
+ the dialplan. The <literal>Custom:</literal> prefix must be used. For example:</para>
+ <para>Set(DEVICE_STATE(Custom:lamp1)=BUSY)</para>
+ <para>Set(DEVICE_STATE(Custom:lamp2)=NOT_INUSE)</para>
+ <para>You can subscribe to the status of a custom device state using a hint in
+ the dialplan:</para>
+ <para>exten => 1234,hint,Custom:lamp1</para>
+ <para>The possible values for both uses of this function are:</para>
+ <para>UNKNOWN | NOT_INUSE | INUSE | BUSY | INVALID | UNAVAILABLE | RINGING |
+ RINGINUSE | ONHOLD</para>
+ </description>
+ </function>
+ <function name="HINT" language="en_US">
+ <synopsis>
+ Get the devices set for a dialplan hint.
+ </synopsis>
+ <syntax>
+ <parameter name="extension" required="true" argsep="@">
+ <argument name="extension" required="true" />
+ <argument name="context" />
+ </parameter>
+ <parameter name="options">
+ <optionlist>
+ <option name="n">
+ <para>Retrieve name on the hint instead of list of devices.</para>
+ </option>
+ </optionlist>
+ </parameter>
+ </syntax>
+ <description>
+ <para>The HINT function can be used to retrieve the list of devices that are
+ mapped to a dialplan hint. For example:</para>
+ <para>NoOp(Hint for Extension 1234 is ${HINT(1234)})</para>
+ </description>
+ </function>
+ ***/
+
+
static const char astdb_family[] = "CustomDevstate";
static int devstate_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
@@ -296,40 +347,12 @@ static struct ast_cli_entry cli_funcdevstate[] = {
static struct ast_custom_function devstate_function = {
.name = "DEVICE_STATE",
- .synopsis = "Get or Set a device state",
- .syntax = "DEVICE_STATE(device)",
- .desc =
- " The DEVICE_STATE function can be used to retrieve the device state from any\n"
- "device state provider. For example:\n"
- " NoOp(SIP/mypeer has state ${DEVICE_STATE(SIP/mypeer)})\n"
- " NoOp(Conference number 1234 has state ${DEVICE_STATE(MeetMe:1234)})\n"
- "\n"
- " The DEVICE_STATE function can also be used to set custom device state from\n"
- "the dialplan. The \"Custom:\" prefix must be used. For example:\n"
- " Set(DEVICE_STATE(Custom:lamp1)=BUSY)\n"
- " Set(DEVICE_STATE(Custom:lamp2)=NOT_INUSE)\n"
- "You can subscribe to the status of a custom device state using a hint in\n"
- "the dialplan:\n"
- " exten => 1234,hint,Custom:lamp1\n"
- "\n"
- " The possible values for both uses of this function are:\n"
- "UNKNOWN | NOT_INUSE | INUSE | BUSY | INVALID | UNAVAILABLE | RINGING\n"
- "RINGINUSE | ONHOLD\n",
.read = devstate_read,
.write = devstate_write,
};
static struct ast_custom_function hint_function = {
.name = "HINT",
- .synopsis = "Get the devices set for a dialplan hint",
- .syntax = "HINT(extension[@context][|options])",
- .desc =
- " The HINT function can be used to retrieve the list of devices that are\n"
- "mapped to a dialplan hint. For example:\n"
- " NoOp(Hint for Extension 1234 is ${HINT(1234)})\n"
- "Options:\n"
- " 'n' - Retrieve name on the hint instead of list of devices\n"
- "",
.read = hint_read,
};
diff --git a/funcs/func_dialgroup.c b/funcs/func_dialgroup.c
index c3674beb9..4e4f63389 100644
--- a/funcs/func_dialgroup.c
+++ b/funcs/func_dialgroup.c
@@ -39,6 +39,40 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/astobj2.h"
#include "asterisk/astdb.h"
+/*** DOCUMENTATION
+ <function name="DIALGROUP" language="en_US">
+ <synopsis>
+ Manages a group of users for dialing.
+ </synopsis>
+ <syntax>
+ <parameter name="group" required="true" />
+ <parameter name="op">
+ <para>The operation name, possible values are:</para>
+ <para><literal>add</literal> - add a channel name or interface (write-only)</para>
+ <para><literal>del</literal> - remove a channel name or interface (write-only)</para>
+ </parameter>
+ </syntax>
+ <description>
+ <para>Presents an interface meant to be used in concert with the Dial
+ application, by presenting a list of channels which should be dialled when
+ referenced.</para>
+ <para>When DIALGROUP is read from, the argument is interpreted as the particular
+ <replaceable>group</replaceable> for which a dial should be attempted. When DIALGROUP is written to
+ with no arguments, the entire list is replaced with the argument specified.</para>
+ <para>Functionality is similar to a queue, except that when no interfaces are
+ available, execution may continue in the dialplan. This is useful when
+ you want certain people to be the first to answer any calls, with immediate
+ fallback to a queue when the front line people are busy or unavailable, but
+ you still want front line people to log in and out of that group, just like
+ a queue.</para>
+ <para>Example:</para>
+ <para>exten => 1,1,Set(DIALGROUP(mygroup,add)=SIP/10)</para>
+ <para>exten => 1,n,Set(DIALGROUP(mygroup,add)=SIP/20)</para>
+ <para>exten => 1,n,Dial(${DIALGROUP(mygroup)})</para>
+ </description>
+ </function>
+ ***/
+
static struct ao2_container *group_container = NULL;
struct group_entry {
@@ -232,24 +266,6 @@ static int dialgroup_write(struct ast_channel *chan, const char *cmd, char *data
static struct ast_custom_function dialgroup_function = {
.name = "DIALGROUP",
- .synopsis = "Manages a group of users for dialing",
- .syntax = "DIALGROUP(<group>[,op])",
- .desc =
-" DIALGROUP presents an interface meant to be used in concert with the Dial\n"
-"application, by presenting a list of channels which should be dialled when\n"
-"referenced.\n"
-" When DIALGROUP is read from, the argument is interpreted as the particular\n"
-"group for which a dial should be attempted. When DIALGROUP is written to\n"
-"with no arguments, the entire list is replaced with the argument specified.\n"
-"Other operations are as follows:\n"
-" add - add a channel name or interface (write-only)\n"
-" del - remove a channel name or interface (write-only)\n\n"
-"Functionality is similar to a queue, except that when no interfaces are\n"
-"available, execution may continue in the dialplan. This is useful when\n"
-"you want certain people to be the first to answer any calls, with immediate\n"
-"fallback to a queue when the front line people are busy or unavailable, but\n"
-"you still want front line people to log in and out of that group, just like\n"
-"a queue.\n",
.read = dialgroup_read,
.write = dialgroup_write,
};
diff --git a/funcs/func_dialplan.c b/funcs/func_dialplan.c
index 6d4c488f6..0e371d2c8 100644
--- a/funcs/func_dialplan.c
+++ b/funcs/func_dialplan.c
@@ -33,6 +33,23 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/pbx.h"
#include "asterisk/app.h"
+/*** DOCUMENTATION
+ <function name="DIALPLAN_EXISTS" language="en_US">
+ <synopsis>
+ Checks the existence of a dialplan target.
+ </synopsis>
+ <syntax>
+ <parameter name="context" required="true" />
+ <parameter name="extension" />
+ <parameter name="priority" />
+ </syntax>
+ <description>
+ <para>This function returns <literal>1</literal> if the target exits. Otherwise, it returns <literal>0</literal>.</para>
+ </description>
+ </function>
+
+ ***/
+
static int isexten_function_read(struct ast_channel *chan, const char *cmd, char *data,
char *buf, size_t len)
{
@@ -87,9 +104,6 @@ static int isexten_function_read(struct ast_channel *chan, const char *cmd, char
static struct ast_custom_function isexten_function = {
.name = "DIALPLAN_EXISTS",
- .syntax = "DIALPLAN_EXISTS(context[,extension[,priority]])",
- .synopsis = "Checks the existence of a dialplan target.",
- .desc = "This function returns 1 if the target exits. Otherwise, it returns 0.\n",
.read = isexten_function_read,
};
diff --git a/funcs/func_enum.c b/funcs/func_enum.c
index 54893a9bf..525c935f6 100644
--- a/funcs/func_enum.c
+++ b/funcs/func_enum.c
@@ -46,6 +46,109 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/enum.h"
#include "asterisk/app.h"
+/*** DOCUMENTATION
+ <function name="ENUMQUERY" language="en_US">
+ <synopsis>
+ Initiate an ENUM query.
+ </synopsis>
+ <syntax>
+ <parameter name="number" required="true" />
+ <parameter name="method-type">
+ <para>If no <replaceable>method-type</replaceable> is given, the default will be
+ <literal>sip</literal>.</para>
+ </parameter>
+ <parameter name="zone-suffix">
+ <para>If no <replaceable>zone-suffix</replaceable> is given, the default will be
+ <literal>e164.arpa</literal></para>
+ </parameter>
+ </syntax>
+ <description>
+ <para>This will do a ENUM lookup of the given phone number.</para>
+ </description>
+ </function>
+ <function name="ENUMRESULT" language="en_US">
+ <synopsis>
+ Retrieve results from a ENUMQUERY.
+ </synopsis>
+ <syntax>
+ <parameter name="id" required="true">
+ <para>The identifier returned by the ENUMQUERY function.</para>
+ </parameter>
+ <parameter name="resultnum" required="true">
+ <para>The number of the result that you want to retrieve.</para>
+ <para>Results start at <literal>1</literal>. If this argument is specified
+ as <literal>getnum</literal>, then it will return the total number of results
+ that are available.</para>
+ </parameter>
+ </syntax>
+ <description>
+ <para>This function will retrieve results from a previous use
+ of the ENUMQUERY function.</para>
+ </description>
+ </function>
+ <function name="ENUMLOOKUP" language="en_US">
+ <synopsis>
+ General or specific querying of NAPTR records for ENUM or ENUM-like DNS pointers.
+ </synopsis>
+ <syntax>
+ <parameter name="number" required="true" />
+ <parameter name="method-type">
+ <para>If no <replaceable>method-type</replaceable> is given, the default will be
+ <literal>sip</literal>.</para>
+ </parameter>
+ <parameter name="options">
+ <optionlist>
+ <option name="c">
+ <para>Returns an integer count of the number of NAPTRs of a certain RR type.</para>
+ <para>Combination of <literal>c</literal> and Method-type of <literal>ALL</literal> will
+ return a count of all NAPTRs for the record.</para>
+ </option>
+ <option name="u">
+ <para>Returns the full URI and does not strip off the URI-scheme.</para>
+ </option>
+ <option name="s">
+ <para>Triggers ISN specific rewriting.</para>
+ </option>
+ <option name="i">
+ <para>Looks for branches into an Infrastructure ENUM tree.</para>
+ </option>
+ <option name="d">
+ <para>for a direct DNS lookup without any flipping of digits.</para>
+ </option>
+ </optionlist>
+ </parameter>
+ <parameter name="record#">
+ <para>If no <replaceable>record#</replaceable> is given,
+ defaults to <literal>1</literal>.</para>
+ </parameter>
+ <parameter name="zone-suffix">
+ <para>If no <replaceable>zone-suffix</replaceable> is given, the default will be
+ <literal>e164.arpa</literal></para>
+ </parameter>
+ </syntax>
+ <description>
+ <para>For more information see <filename>doc/asterisk.pdf</filename>.</para>
+ </description>
+ </function>
+ <function name="TXTCIDNAME" language="en_US">
+ <synopsis>
+ TXTCIDNAME looks up a caller name via DNS.
+ </synopsis>
+ <syntax>
+ <parameter name="number" required="true" />
+ <parameter name="zone-suffix">
+ <para>If no <replaceable>zone-suffix</replaceable> is given, the default will be
+ <literal>e164.arpa</literal></para>
+ </parameter>
+ </syntax>
+ <description>
+ <para>This function looks up the given phone number in DNS to retrieve
+ the caller id name. The result will either be blank or be the value
+ found in the TXT record in DNS.</para>
+ </description>
+ </function>
+ ***/
+
static char *synopsis = "Syntax: ENUMLOOKUP(number[,Method-type[,options[,record#[,zone-suffix]]]])\n";
static int function_enum(struct ast_channel *chan, const char *cmd, char *data,
@@ -295,44 +398,16 @@ finish:
static struct ast_custom_function enum_query_function = {
.name = "ENUMQUERY",
- .synopsis = "Initiate an ENUM query",
- .syntax = "ENUMQUERY(number[,Method-type[,zone-suffix]])",
- .desc = "This will do a ENUM lookup of the given phone number.\n"
- "If no method-tpye is given, the default will be sip. If no\n"
- "zone-suffix is given, the default will be \"e164.arpa\".\n"
- "The result of this function will be a numeric ID that can\n"
- "be used to retrieve the results using the ENUMRESULT function.\n",
.read = enum_query_read,
};
static struct ast_custom_function enum_result_function = {
.name = "ENUMRESULT",
- .synopsis = "Retrieve results from a ENUMQUERY",
- .syntax = "ENUMRESULT(id,resultnum)",
- .desc = "This function will retrieve results from a previous use\n"
- "of the ENUMQUERY function.\n"
- " id - This argument is the identifier returned by the ENUMQUERY function.\n"
- " resultnum - This is the number of the result that you want to retrieve.\n"
- " Results start at 1. If this argument is specified as \"getnum\",\n"
- " then it will return the total number of results that are available.\n",
.read = enum_result_read,
};
static struct ast_custom_function enum_function = {
.name = "ENUMLOOKUP",
- .synopsis =
- "General or specific querying of NAPTR records for ENUM or ENUM-like DNS pointers",
- .syntax =
- "ENUMLOOKUP(number[,Method-type[,options[,record#[,zone-suffix]]]])",
- .desc =
- "Option 'c' returns an integer count of the number of NAPTRs of a certain RR type.\n"
- "Combination of 'c' and Method-type of 'ALL' will return a count of all NAPTRs for the record.\n"
- "Option 'u' returns the full URI and does not strip off the URI-scheme.\n"
- "Option 's' triggers ISN specific rewriting\n"
- "Option 'i' looks for branches into an Infrastructure ENUM tree\n"
- "Option 'd' for a direct DNS lookup without any flipping of digits\n"
- "Defaults are: Method-type=sip, no options, record=1, zone-suffix=e164.arpa\n\n"
- "For more information, see doc/asterisk.pdf",
.read = function_enum,
};
@@ -370,12 +445,6 @@ static int function_txtcidname(struct ast_channel *chan, const char *cmd,
static struct ast_custom_function txtcidname_function = {
.name = "TXTCIDNAME",
- .synopsis = "TXTCIDNAME looks up a caller name via DNS",
- .syntax = "TXTCIDNAME(<number>[,zone-suffix])",
- .desc =
- "This function looks up the given phone number in DNS to retrieve\n"
- "the caller id name. The result will either be blank or be the value\n"
- "found in the TXT record in DNS. The default zone-suffix is e164.arpa.\n",
.read = function_txtcidname,
};
diff --git a/funcs/func_env.c b/funcs/func_env.c
index 4eba211bb..401dc28e3 100644
--- a/funcs/func_env.c
+++ b/funcs/func_env.c
@@ -33,6 +33,59 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/utils.h"
#include "asterisk/app.h"
+/*** DOCUMENTATION
+ <function name="ENV" language="en_US">
+ <synopsis>
+ Gets or sets the environment variable specified.
+ </synopsis>
+ <syntax>
+ <parameter name="varname" required="true">
+ <para>Enviroment variable name</para>
+ </parameter>
+ </syntax>
+ <description>
+ </description>
+ </function>
+ <function name="STAT" language="en_US">
+ <synopsis>
+ Does a check on the specified file.
+ </synopsis>
+ <syntax>
+ <parameter name="flag" required="true">
+ <para>Flag may be one of the following:</para>
+ <para>d - Checks if the file is a directory.</para>
+ <para>e - Checks if the file exists.</para>
+ <para>f - Checks if the file is a regular file.</para>
+ <para>m - Returns the file mode (in octal)</para>
+ <para>s - Returns the size (in bytes) of the file</para>
+ <para>A - Returns the epoch at which the file was last accessed.</para>
+ <para>C - Returns the epoch at which the inode was last changed.</para>
+ <para>M - Returns the epoch at which the file was last modified.</para>
+ </parameter>
+ <parameter name="filename" required="true" />
+ </syntax>
+ <description>
+ </description>
+ </function>
+ <function name="FILE" language="en_US">
+ <synopsis>
+ Obtains the contents of a file.
+ </synopsis>
+ <syntax>
+ <parameter name="filename" required="true" />
+ <parameter name="offset" required="true">
+ <para>Maybe specified as any number. if negative <replaceable>offset</replaceable> specifies the number
+ of bytes back from the end of the file.</para>
+ </parameter>
+ <parameter name="length" required="true">
+ <para>If specified, will limit the length of the data read to that size.</para>
+ </parameter>
+ </syntax>
+ <description>
+ </description>
+ </function>
+ ***/
+
static int env_read(struct ast_channel *chan, const char *cmd, char *data,
char *buf, size_t len)
{
@@ -151,43 +204,23 @@ static int file_read(struct ast_channel *chan, const char *cmd, char *data, char
static struct ast_custom_function env_function = {
.name = "ENV",
- .synopsis = "Gets or sets the environment variable specified",
- .syntax = "ENV(<envname>)",
.read = env_read,
- .write = env_write,
+ .write = env_write
};
static struct ast_custom_function stat_function = {
.name = "STAT",
- .synopsis = "Does a check on the specified file",
- .syntax = "STAT(<flag>,<filename>)",
- .read = stat_read,
- .desc =
- "flag may be one of the following:\n"
- " d - Checks if the file is a directory\n"
- " e - Checks if the file exists\n"
- " f - Checks if the file is a regular file\n"
- " m - Returns the file mode (in octal)\n"
- " s - Returns the size (in bytes) of the file\n"
- " A - Returns the epoch at which the file was last accessed\n"
- " C - Returns the epoch at which the inode was last changed\n"
- " M - Returns the epoch at which the file was last modified\n",
+ .read = stat_read
};
static struct ast_custom_function file_function = {
.name = "FILE",
- .synopsis = "Obtains the contents of a file",
- .syntax = "FILE(<filename>,<offset>,<length>)",
- .read = file_read,
+ .read = file_read
/*
* Some enterprising programmer could probably add write functionality
* to FILE(), although I'm not sure how useful it would be. Hence why
* it's called FILE and not READFILE (like the app was).
*/
- .desc =
-"<offset> may be specified as any number. If negative, <offset> specifies\n"
-" the number of bytes back from the end of the file.\n"
-"<length>, if specified, will limit the length of the data read to that size.\n",
};
static int unload_module(void)
diff --git a/funcs/func_extstate.c b/funcs/func_extstate.c
index 8866d89b9..7f2288560 100644
--- a/funcs/func_extstate.c
+++ b/funcs/func_extstate.c
@@ -36,6 +36,29 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/utils.h"
#include "asterisk/devicestate.h"
+/*** DOCUMENTATION
+ <function name="EXTENSION_STATE" language="en_US">
+ <synopsis>
+ Get an extension's state.
+ </synopsis>
+ <syntax argsep="@">
+ <parameter name="extension" required="true" />
+ <parameter name="context">
+ <para>If it is not specified defaults to <literal>default</literal>.</para>
+ </parameter>
+ </syntax>
+ <description>
+ <para>The EXTENSION_STATE function can be used to retrieve the state from any
+ hinted extension. For example:</para>
+ <para>NoOp(1234@default has state ${EXTENSION_STATE(1234)})</para>
+ <para>NoOp(4567@home has state ${EXTENSION_STATE(4567@home)})</para>
+ <para>The possible values returned by this function are:</para>
+ <para>UNKNOWN | NOT_INUSE | INUSE | BUSY | INVALID | UNAVAILABLE | RINGING |
+ RINGINUSE | HOLDINUSE | ONHOLD</para>
+ </description>
+ </function>
+ ***/
+
static const char *ast_extstate_str(int state)
{
const char *res = "UNKNOWN";
@@ -98,17 +121,6 @@ static int extstate_read(struct ast_channel *chan, const char *cmd, char *data,
static struct ast_custom_function extstate_function = {
.name = "EXTENSION_STATE",
- .synopsis = "Get an extension's state",
- .syntax = "EXTENSION_STATE(extension[@context])",
- .desc =
- " The EXTENSION_STATE function can be used to retrieve the state from any\n"
- "hinted extension. For example:\n"
- " NoOp(1234@default has state ${EXTENSION_STATE(1234)})\n"
- " NoOp(4567@home has state ${EXTENSION_STATE(4567@home)})\n"
- "\n"
- " The possible values returned by this function are:\n"
- "UNKNOWN | NOT_INUSE | INUSE | BUSY | INVALID | UNAVAILABLE | RINGING\n"
- "RINGINUSE | HOLDINUSE | ONHOLD\n",
.read = extstate_read,
};
diff --git a/funcs/func_global.c b/funcs/func_global.c
index 3380cef12..74df1757c 100644
--- a/funcs/func_global.c
+++ b/funcs/func_global.c
@@ -37,6 +37,51 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/app.h"
#include "asterisk/manager.h"
+/*** DOCUMENTATION
+ <function name="GLOBAL" language="en_US">
+ <synopsis>
+ Gets or sets the global variable specified.
+ </synopsis>
+ <syntax>
+ <parameter name="varname" required="true">
+ <para>Global variable name</para>
+ </parameter>
+ </syntax>
+ <description>
+ <para>Set or get the value of a global variable specified in <replaceable>varname</replaceable></para>
+ </description>
+ </function>
+ <function name="SHARED" language="en_US">
+ <synopsis>
+ Gets or sets the shared variable specified.
+ </synopsis>
+ <syntax>
+ <parameter name="varname" required="true">
+ <para>Variable name</para>
+ </parameter>
+ <parameter name="channel">
+ <para>If not specified will default to current channel. It is the complete
+ channel name: <literal>SIP/12-abcd1234</literal> or the prefix only <literal>SIP/12</literal>.</para>
+ </parameter>
+ </syntax>
+ <description>
+ <para>Implements a shared variable area, in which you may share variables between
+ channels.</para>
+ <para>The variables used in this space are separate from the general namespace of
+ the channel and thus <variable>SHARED(foo)</variable> and <variable>foo</variable>
+ represent two completely different variables, despite sharing the same name.</para>
+ <para>Finally, realize that there is an inherent race between channels operating
+ at the same time, fiddling with each others' internal variables, which is why
+ this special variable namespace exists; it is to remind you that variables in
+ the SHARED namespace may change at any time, without warning. You should
+ therefore take special care to ensure that when using the SHARED namespace,
+ you retrieve the variable and store it in a regular channel variable before
+ using it in a set of calculations (or you might be surprised by the result).</para>
+ </description>
+ </function>
+
+ ***/
+
static void shared_variable_free(void *data);
static struct ast_datastore_info shared_variable_info = {
@@ -76,8 +121,6 @@ static int global_write(struct ast_channel *chan, const char *cmd, char *data, c
static struct ast_custom_function global_function = {
.name = "GLOBAL",
- .synopsis = "Gets or sets the global variable specified",
- .syntax = "GLOBAL(<varname>)",
.read = global_read,
.write = global_write,
};
@@ -203,25 +246,6 @@ static int shared_write(struct ast_channel *chan, const char *cmd, char *data, c
static struct ast_custom_function shared_function = {
.name = "SHARED",
- .synopsis = "Gets or sets the shared variable specified",
- .syntax = "SHARED(<varname>[,<channel>])",
- .desc =
-"Implements a shared variable area, in which you may share variables between\n"
-"channels. If channel is unspecified, defaults to the current channel. Note\n"
-"that the channel name may be the complete name (i.e. SIP/12-abcd1234) or the\n"
-"prefix only (i.e. SIP/12).\n"
-"\n"
-"The variables used in this space are separate from the general namespace of\n"
-"the channel and thus ${SHARED(foo)} and ${foo} represent two completely\n"
-"different variables, despite sharing the same name.\n"
-"\n"
-"Finally, realize that there is an inherent race between channels operating\n"
-"at the same time, fiddling with each others' internal variables, which is why\n"
-"this special variable namespace exists; it is to remind you that variables in\n"
-"the SHARED namespace may change at any time, without warning. You should\n"
-"therefore take special care to ensure that when using the SHARED namespace,\n"
-"you retrieve the variable and store it in a regular channel variable before\n"
-"using it in a set of calculations (or you might be surprised by the result).\n",
.read = shared_read,
.write = shared_write,
};
diff --git a/funcs/func_groupcount.c b/funcs/func_groupcount.c
index b70a42e94..181855015 100644
--- a/funcs/func_groupcount.c
+++ b/funcs/func_groupcount.c
@@ -31,6 +31,67 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/utils.h"
#include "asterisk/app.h"
+/*** DOCUMENTATION
+ <function name="GROUP_COUNT" language="en_US">
+ <synopsis>
+ Counts the number of channels in the specified group.
+ </synopsis>
+ <syntax argsep="@">
+ <parameter name="groupname">
+ <para>Group name.</para>
+ </parameter>
+ <parameter name="category">
+ <para>Category name</para>
+ </parameter>
+ </syntax>
+ <description>
+ <para>Calculates the group count for the specified group, or uses the
+ channel's current group if not specifed (and non-empty).</para>
+ </description>
+ </function>
+ <function name="GROUP_MATCH_COUNT" language="en_US">
+ <synopsis>
+ Counts the number of channels in the groups matching the specified pattern.
+ </synopsis>
+ <syntax argsep="@">
+ <parameter name="groupmatch" required="true">
+ <para>A standard regular expression used to match a group name.</para>
+ </parameter>
+ <parameter name="category">
+ <para>Category name.</para>
+ </parameter>
+ </syntax>
+ <description>
+ <para>Calculates the group count for all groups that match the specified pattern.
+ Uses standard regular expression matching (see regex(7)).</para>
+ </description>
+ </function>
+ <function name="GROUP" language="en_US">
+ <synopsis>
+ Gets or sets the channel group.
+ </synopsis>
+ <syntax>
+ <parameter name="category">
+ <para>Category name.</para>
+ </parameter>
+ </syntax>
+ <description>
+ <para><replaceable>category</replaceable> can be employed for more fine grained group management. Each channel
+ can only be member of exactly one group per <replaceable>category</replaceable>.</para>
+ </description>
+ </function>
+ <function name="GROUP_LIST" language="en_US">
+ <synopsis>
+ Gets a list of the groups set on a channel.
+ </synopsis>
+ <syntax />
+ <description>
+ <para>Gets a list of the groups set on a channel.</para>
+ </description>
+ </function>
+
+ ***/
+
static int group_count_function_read(struct ast_channel *chan, const char *cmd,
char *data, char *buf, size_t len)
{
@@ -72,11 +133,6 @@ static int group_count_function_read(struct ast_channel *chan, const char *cmd,
static struct ast_custom_function group_count_function = {
.name = "GROUP_COUNT",
- .syntax = "GROUP_COUNT([groupname][@category])",
- .synopsis = "Counts the number of channels in the specified group",
- .desc =
- "Calculates the group count for the specified group, or uses the\n"
- "channel's current group if not specifed (and non-empty).\n",
.read = group_count_function_read,
};
@@ -102,12 +158,6 @@ static int group_match_count_function_read(struct ast_channel *chan,
static struct ast_custom_function group_match_count_function = {
.name = "GROUP_MATCH_COUNT",
- .syntax = "GROUP_MATCH_COUNT(groupmatch[@category])",
- .synopsis =
- "Counts the number of channels in the groups matching the specified pattern",
- .desc =
- "Calculates the group count for all groups that match the specified pattern.\n"
- "Uses standard regular expression matching (see regex(7)).\n",
.read = group_match_count_function_read,
.write = NULL,
};
@@ -159,9 +209,6 @@ static int group_function_write(struct ast_channel *chan, const char *cmd,
static struct ast_custom_function group_function = {
.name = "GROUP",
- .syntax = "GROUP([category])",
- .synopsis = "Gets or sets the channel group.",
- .desc = "Gets or sets the channel group.\n",
.read = group_function_read,
.write = group_function_write,
};
@@ -204,9 +251,6 @@ static int group_list_function_read(struct ast_channel *chan, const char *cmd,
static struct ast_custom_function group_list_function = {
.name = "GROUP_LIST",
- .syntax = "GROUP_LIST()",
- .synopsis = "Gets a list of the groups set on a channel.",
- .desc = "Gets a list of the groups set on a channel.\n",
.read = group_list_function_read,
.write = NULL,
};
diff --git a/funcs/func_iconv.c b/funcs/func_iconv.c
index 74f32412b..231b4880f 100644
--- a/funcs/func_iconv.c
+++ b/funcs/func_iconv.c
@@ -41,6 +41,32 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/utils.h"
#include "asterisk/app.h"
+/*** DOCUMENTATION
+ <function name="ICONV" language="en_US">
+ <synopsis>
+ Converts charsets of strings.
+ </synopsis>
+ <syntax>
+ <parameter name="in-charset" required="true">
+ <para>Input charset</para>
+ </parameter>
+ <parameter name="out-charset" required="true">
+ <para>Output charset</para>
+ </parameter>
+ <parameter name="string" required="true">
+ <para>String to convert, from <replaceable>in-charset</replaceable> to <replaceable>out-charset</replaceable></para>
+ </parameter>
+ </syntax>
+ <description>
+ <para>Converts string from <replaceable>in-charset</replaceable> into <replaceable>out-charset</replaceable>.
+ For available charsets, use <literal>iconv -l</literal> on your shell command line.</para>
+ <note><para>Due to limitations within the API, ICONV will not currently work with
+ charsets with embedded NULLs. If found, the string will terminate.</para></note>
+ </description>
+ </function>
+ ***/
+
+
/*!
* Some systems define the second arg to iconv() as (const char *),
* while others define it as (char *). Cast it to a (void *) to
@@ -101,14 +127,7 @@ static int iconv_read(struct ast_channel *chan, const char *cmd, char *arguments
static struct ast_custom_function iconv_function = {
.name = "ICONV",
- .synopsis = "Converts charsets of strings.",
- .desc =
-"Converts string from in-charset into out-charset. For available charsets,\n"
-"use 'iconv -l' on your shell command line.\n"
-"Note: due to limitations within the API, ICONV will not currently work with\n"
-"charsets with embedded NULLs. If found, the string will terminate.\n",
- .syntax = "ICONV(in-charset,out-charset,string)",
- .read = iconv_read,
+ .read = iconv_read
};
static int unload_module(void)
diff --git a/funcs/func_lock.c b/funcs/func_lock.c
index 133ea3e22..d6df6d0ef 100644
--- a/funcs/func_lock.c
+++ b/funcs/func_lock.c
@@ -37,6 +37,53 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/module.h"
#include "asterisk/linkedlists.h"
+/*** DOCUMENTATION
+ <function name="LOCK" language="en_US">
+ <synopsis>
+ Attempt to obtain a named mutex.
+ </synopsis>
+ <syntax>
+ <parameter name="lockname" required="true" />
+ </syntax>
+ <description>
+ <para>Attempts to grab a named lock exclusively, and prevents other channels from
+ obtaining the same lock. LOCK will wait for the lock to become available.
+ Returns <literal>1</literal> if the lock was obtained or <literal>0</literal> on error.</para>
+ <note><para>To avoid the possibility of a deadlock, LOCK will only attempt to
+ obtain the lock for 3 seconds if the channel already has another lock.</para></note>
+ </description>
+ </function>
+ <function name="TRYLOCK" language="en_US">
+ <synopsis>
+ Attempt to obtain a named mutex.
+ </synopsis>
+ <syntax>
+ <parameter name="lockname" required="true" />
+ </syntax>
+ <description>
+ <para>Attempts to grab a named lock exclusively, and prevents other channels
+ from obtaining the same lock. Returns <literal>1</literal> if the lock was
+ available or <literal>0</literal> otherwise.</para>
+ </description>
+ </function>
+ <function name="UNLOCK" language="en_US">
+ <synopsis>
+ Unlocks a named mutex.
+ </synopsis>
+ <syntax>
+ <parameter name="lockname" required="true" />
+ </syntax>
+ <description>
+ <para>Unlocks a previously locked mutex. Returns <literal>1</literal> if the channel
+ had a lock or <literal>0</literal> otherwise.</para>
+ <note><para>It is generally unnecessary to unlock in a hangup routine, as any locks
+ held are automatically freed when the channel is destroyed.</para></note>
+ </description>
+ </function>
+ ***/
+
+
+
AST_LIST_HEAD_STATIC(locklist, lock_frame);
static void lock_free(void *data);
@@ -276,36 +323,16 @@ static int trylock_read(struct ast_channel *chan, const char *cmd, char *data, c
static struct ast_custom_function lock_function = {
.name = "LOCK",
- .synopsis = "Attempt to obtain a named mutex",
- .desc =
-"Attempts to grab a named lock exclusively, and prevents other channels from\n"
-"obtaining the same lock. LOCK will wait for the lock to become available.\n"
-"Returns 1 if the lock was obtained or 0 on error.\n\n"
-"Note: to avoid the possibility of a deadlock, LOCK will only attempt to\n"
-"obtain the lock for 3 seconds if the channel already has another lock.\n",
- .syntax = "LOCK(<lockname>)",
.read = lock_read,
};
static struct ast_custom_function trylock_function = {
.name = "TRYLOCK",
- .synopsis = "Attempt to obtain a named mutex",
- .desc =
-"Attempts to grab a named lock exclusively, and prevents other channels\n"
-"from obtaining the same lock. Returns 1 if the lock was available or 0\n"
-"otherwise.\n",
- .syntax = "TRYLOCK(<lockname>)",
.read = trylock_read,
};
static struct ast_custom_function unlock_function = {
.name = "UNLOCK",
- .synopsis = "Unlocks a named mutex",
- .desc =
-"Unlocks a previously locked mutex. Note that it is generally unnecessary to\n"
-"unlock in a hangup routine, as any locks held are automatically freed when the\n"
-"channel is destroyed. Returns 1 if the channel had a lock or 0 otherwise.\n",
- .syntax = "UNLOCK(<lockname>)",
.read = unlock_read,
};
diff --git a/funcs/func_logic.c b/funcs/func_logic.c
index 7fca070aa..ef644f43f 100644
--- a/funcs/func_logic.c
+++ b/funcs/func_logic.c
@@ -34,6 +34,83 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/utils.h"
#include "asterisk/app.h"
+/*** DOCUMENTATION
+ <function name="ISNULL" language="en_US">
+ <synopsis>
+ Check if a value is NULL.
+ </synopsis>
+ <syntax>
+ <parameter name="data" required="true" />
+ </syntax>
+ <description>
+ <para>Returns <literal>1</literal> if NULL or <literal>0</literal> otherwise.</para>
+ </description>
+ </function>
+ <function name="SET" language="en_US">
+ <synopsis>
+ SET assigns a value to a channel variable.
+ </synopsis>
+ <syntax argsep="=">
+ <parameter name="varname" required="true" />
+ <parameter name="value" />
+ </syntax>
+ <description>
+ </description>
+ </function>
+ <function name="EXISTS" language="en_US">
+ <synopsis>
+ Test the existence of a value.
+ </synopsis>
+ <syntax>
+ <parameter name="data" required="true" />
+ </syntax>
+ <description>
+ <para>Returns <literal>1</literal> if exists, <literal>0</literal> otherwise.</para>
+ </description>
+ </function>
+ <function name="IF" language="en_US">
+ <synopsis>
+ Check for an expresion.
+ </synopsis>
+ <syntax argsep="?">
+ <parameter name="expresion" required="true" />
+ <parameter name="retvalue" argsep=":" required="true">
+ <argument name="true" />
+ <argument name="false" />
+ </parameter>
+ </syntax>
+ <description>
+ <para>Returns the data following <literal>?</literal> if true, else the data following <literal>:</literal></para>
+ </description>
+ </function>
+ <function name="IFTIME" language="en_US">
+ <synopsis>
+ Temporal Conditional.
+ </synopsis>
+ <syntax argsep="?">
+ <parameter name="timespec" required="true" />
+ <parameter name="retvalue" required="true" argsep=":">
+ <argument name="true" />
+ <argument name="false" />
+ </parameter>
+ </syntax>
+ <description>
+ <para>Returns the data following <literal>?</literal> if true, else the data following <literal>:</literal></para>
+ </description>
+ </function>
+ <function name="IMPORT" language="en_US">
+ <synopsis>
+ Retrieve the value of a variable from another channel.
+ </synopsis>
+ <syntax>
+ <parameter name="channel" required="true" />
+ <parameter name="variable" required="true" />
+ </syntax>
+ <description>
+ </description>
+ </function>
+ ***/
+
static int isnull(struct ast_channel *chan, const char *cmd, char *data,
char *buf, size_t len)
{
@@ -168,46 +245,31 @@ static int acf_import(struct ast_channel *chan, const char *cmd, char *data, cha
static struct ast_custom_function isnull_function = {
.name = "ISNULL",
- .synopsis = "NULL Test: Returns 1 if NULL or 0 otherwise",
- .syntax = "ISNULL(<data>)",
.read = isnull,
};
static struct ast_custom_function set_function = {
.name = "SET",
- .synopsis = "SET assigns a value to a channel variable",
- .syntax = "SET(<varname>=[<value>])",
.read = set,
};
static struct ast_custom_function exists_function = {
.name = "EXISTS",
- .synopsis = "Existence Test: Returns 1 if exists, 0 otherwise",
- .syntax = "EXISTS(<data>)",
.read = exists,
};
static struct ast_custom_function if_function = {
.name = "IF",
- .synopsis =
- "Conditional: Returns the data following '?' if true, else the data following ':'",
- .syntax = "IF(<expr>?[<true>][:<false>])",
.read = acf_if,
};
static struct ast_custom_function if_time_function = {
.name = "IFTIME",
- .synopsis =
- "Temporal Conditional: Returns the data following '?' if true, else the data following ':'",
- .syntax = "IFTIME(<timespec>?[<true>][:<false>])",
.read = iftime,
};
static struct ast_custom_function import_function = {
.name = "IMPORT",
- .synopsis =
- "Retrieve the value of a variable from another channel\n",
- .syntax = "IMPORT(channel,variable)",
.read = acf_import,
};
diff --git a/funcs/func_math.c b/funcs/func_math.c
index 3517b16ed..627cf860a 100644
--- a/funcs/func_math.c
+++ b/funcs/func_math.c
@@ -39,6 +39,35 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/app.h"
#include "asterisk/config.h"
+/*** DOCUMENTATION
+ <function name="MATH" language="en_US">
+ <synopsis>
+ Performs Mathematical Functions.
+ </synopsis>
+ <syntax>
+ <parameter name="expression" required="true">
+ <para>Is of the form:
+ <replaceable>number1</replaceable><replaceable>op</replaceable><replaceable>number2</replaceable>
+ where the possible values for <replaceable>op</replaceable>
+ are:</para>
+ <para>+,-,/,*,%,&lt;&lt;,&gt;&gt;,^,AND,OR,XOR,&lt;,%gt;,&gt;=,&lt;=,== (and behave as their C equivalents)</para>
+ </parameter>
+ <parameter name="type">
+ <para>Wanted type of result:</para>
+ <para>f, float - float(default)</para>
+ <para>i, int - integer</para>
+ <para>h, hex - hex</para>
+ <para>c, char - char</para>
+ </parameter>
+ </syntax>
+ <description>
+ <para>Performs mathematicas functions based on two parameters and a operator, the returned
+ value type is <replaceable>type</replaceable></para>
+ <para>Example: Set(i=${MATH(123%16,int)}) - sets var i=11</para>
+ </description>
+ </function>
+ ***/
+
enum TypeOfFunctions {
ADDFUNCTION,
DIVIDEFUNCTION,
@@ -306,17 +335,6 @@ static int math(struct ast_channel *chan, const char *cmd, char *parse,
static struct ast_custom_function math_function = {
.name = "MATH",
- .synopsis = "Performs Mathematical Functions",
- .syntax = "MATH(<number1><op><number2>[,<type_of_result>])",
- .desc = "Perform calculation on number1 to number2. Valid ops are: \n"
- " +,-,/,*,%,<<,>>,^,AND,OR,XOR,<,>,>=,<=,==\n"
- "and behave as their C equivalents.\n"
- "<type_of_result> - wanted type of result:\n"
- " f, float - float(default)\n"
- " i, int - integer,\n"
- " h, hex - hex,\n"
- " c, char - char\n"
- "Example: Set(i=${MATH(123%16,int)}) - sets var i=11",
.read = math
};
diff --git a/funcs/func_md5.c b/funcs/func_md5.c
index b376e8ae3..23b35489a 100644
--- a/funcs/func_md5.c
+++ b/funcs/func_md5.c
@@ -33,6 +33,20 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/module.h"
#include "asterisk/pbx.h"
+/*** DOCUMENTATION
+ <function name="MD5" language="en_US">
+ <synopsis>
+ Computes an MD5 digest.
+ </synopsis>
+ <syntax>
+ <parameter name="data" required="true" />
+ </syntax>
+ <description>
+ <para>Computes an MD5 digest.</para>
+ </description>
+ </function>
+ ***/
+
static int md5(struct ast_channel *chan, const char *cmd, char *data,
char *buf, size_t len)
{
@@ -49,8 +63,6 @@ static int md5(struct ast_channel *chan, const char *cmd, char *data,
static struct ast_custom_function md5_function = {
.name = "MD5",
- .synopsis = "Computes an MD5 digest",
- .syntax = "MD5(<data>)",
.read = md5,
};
diff --git a/funcs/func_module.c b/funcs/func_module.c
index 8b2326386..a7cf73164 100644
--- a/funcs/func_module.c
+++ b/funcs/func_module.c
@@ -28,6 +28,24 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/module.h"
#include "asterisk/pbx.h"
+/*** DOCUMENTATION
+ <function name="IFMODULE" language="en_US">
+ <synopsis>
+ Checks if an Asterisk module is loaded in memory.
+ </synopsis>
+ <syntax>
+ <parameter name="modulename.so" required="true">
+ <para>Module name complete with <literal>.so</literal></para>
+ </parameter>
+ </syntax>
+ <description>
+ <para>Checks if a module is loaded. Use the full module name
+ as shown by the list in <literal>module list</literal>.
+ Returns <literal>1</literal> if module exists in memory, otherwise <literal>0</literal></para>
+ </description>
+ </function>
+ ***/
+
static int ifmodule_read(struct ast_channel *chan, const char *cmd, char *data,
char *buf, size_t len)
{
@@ -46,12 +64,7 @@ static int ifmodule_read(struct ast_channel *chan, const char *cmd, char *data,
static struct ast_custom_function ifmodule_function = {
.name = "IFMODULE",
- .synopsis = "Checks if an Asterisk module is loaded in memory",
- .syntax = "IFMODULE(<modulename.so>)",
.read = ifmodule_read,
- .desc = "Checks if a module is loaded. Use the full module name\n"
- "as shown by the list in \"module list\". \n"
- "Returns \"1\" if module exists in memory, otherwise \"0\".\n",
};
diff --git a/funcs/func_odbc.c b/funcs/func_odbc.c
index 85f7e2395..135dd9819 100644
--- a/funcs/func_odbc.c
+++ b/funcs/func_odbc.c
@@ -47,6 +47,58 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/app.h"
#include "asterisk/cli.h"
+/*** DOCUMENTATION
+ <function name="ODBC_FETCH" language="en_US">
+ <synopsis>
+ Fetch a row from a multirow query.
+ </synopsis>
+ <syntax>
+ <parameter name="result-id" required="true" />
+ </syntax>
+ <description>
+ <para>For queries which are marked as mode=multirow, the original
+ query returns a <replaceable>result-id</replaceable> from which results
+ may be fetched. This function implements the actual fetch of the results.</para>
+ <para>This also sets <variable>ODBC_FETCH_STATUS</variable>.</para>
+ <variablelist>
+ <variable name="ODBC_FETCH_STATUS">
+ <value name="SUCESS">
+ If rows are available.
+ </value>
+ <value name="FAILURE">
+ If no rows are available.
+ </value>
+ </variable>
+ </variablelist>
+ </description>
+ </function>
+ <application name="ODBCFinish" language="en_US">
+ <synopsis>
+ Clear the resultset of a sucessful multirow query.
+ </synopsis>
+ <syntax>
+ <parameter name="result-id" required="true" />
+ </syntax>
+ <description>
+ <para>For queries which are marked as mode=multirow, this will clear
+ any remaining rows of the specified resultset.</para>
+ </description>
+ </application>
+ <function name="SQL_ESC" language="en_US">
+ <synopsis>
+ Escapes single ticks for use in SQL statements.
+ </synopsis>
+ <syntax>
+ <parameter name="string" required="true" />
+ </syntax>
+ <description>
+ <para>Used in SQL templates to escape data which may contain single ticks
+ <literal>'</literal> which are otherwise used to delimit data.</para>
+ <para>Example: SELECT foo FROM bar WHERE baz='${SQL_ESC(${ARG1})}'</para>
+ </description>
+ </function>
+ ***/
+
static char *config = "func_odbc.conf";
enum {
@@ -620,12 +672,6 @@ static int acf_escape(struct ast_channel *chan, const char *cmd, char *data, cha
static struct ast_custom_function escape_function = {
.name = "SQL_ESC",
- .synopsis = "Escapes single ticks for use in SQL statements",
- .syntax = "SQL_ESC(<string>)",
- .desc =
-"Used in SQL templates to escape data which may contain single ticks (') which\n"
-"are otherwise used to delimit data. For example:\n"
-"SELECT foo FROM bar WHERE baz='${SQL_ESC(${ARG1})}'\n",
.read = acf_escape,
.write = NULL,
};
@@ -660,24 +706,11 @@ static int acf_fetch(struct ast_channel *chan, const char *cmd, char *data, char
static struct ast_custom_function fetch_function = {
.name = "ODBC_FETCH",
- .synopsis = "Fetch a row from a multirow query",
- .syntax = "ODBC_FETCH(<result-id>)",
- .desc =
-"For queries which are marked as mode=multirow, the original query returns a\n"
-"result-id from which results may be fetched. This function implements the\n"
-"actual fetch of the results.\n"
-"This function also sets ODBC_FETCH_STATUS to one of \"SUCCESS\" or \"FAILURE\",\n"
-"depending upon whether there were rows available or not.\n",
.read = acf_fetch,
.write = NULL,
};
static char *app_odbcfinish = "ODBCFinish";
-static char *syn_odbcfinish = "Clear the resultset of a successful multirow query";
-static char *desc_odbcfinish =
-"ODBCFinish(<result-id>)\n"
-" Clears any remaining rows of the specified resultset\n";
-
static int exec_odbcfinish(struct ast_channel *chan, void *data)
{
@@ -784,6 +817,12 @@ static int init_acf_query(struct ast_config *cfg, char *catg, struct acf_odbc_qu
*query = NULL;
return ENOMEM;
}
+ if (ast_string_field_init((*query)->acf, 128)) {
+ ast_free((*query)->acf);
+ ast_free(*query);
+ *query = NULL;
+ return ENOMEM;
+ }
if ((tmp = ast_variable_retrieve(cfg, catg, "prefix")) && !ast_strlen_zero(tmp)) {
asprintf((char **)&((*query)->acf->name), "%s_%s", tmp, catg);
@@ -792,6 +831,7 @@ static int init_acf_query(struct ast_config *cfg, char *catg, struct acf_odbc_qu
}
if (!((*query)->acf->name)) {
+ ast_string_field_free_memory((*query)->acf);
ast_free((*query)->acf);
ast_free(*query);
*query = NULL;
@@ -799,13 +839,14 @@ static int init_acf_query(struct ast_config *cfg, char *catg, struct acf_odbc_qu
}
if ((tmp = ast_variable_retrieve(cfg, catg, "syntax")) && !ast_strlen_zero(tmp)) {
- asprintf((char **)&((*query)->acf->syntax), "%s(%s)", (*query)->acf->name, tmp);
+ ast_string_field_build((*query)->acf, syntax, "%s(%s)", (*query)->acf->name, tmp);
} else {
- asprintf((char **)&((*query)->acf->syntax), "%s(<arg1>[...[,<argN>]])", (*query)->acf->name);
+ ast_string_field_build((*query)->acf, syntax, "%s(<arg1>[...[,<argN>]])", (*query)->acf->name);
}
- if (!((*query)->acf->syntax)) {
+ if (ast_strlen_zero((*query)->acf->syntax)) {
ast_free((char *)(*query)->acf->name);
+ ast_string_field_free_memory((*query)->acf);
ast_free((*query)->acf);
ast_free(*query);
*query = NULL;
@@ -813,14 +854,14 @@ static int init_acf_query(struct ast_config *cfg, char *catg, struct acf_odbc_qu
}
if ((tmp = ast_variable_retrieve(cfg, catg, "synopsis")) && !ast_strlen_zero(tmp)) {
- (*query)->acf->synopsis = ast_strdup(tmp);
+ ast_string_field_set((*query)->acf, synopsis, tmp);
} else {
- (*query)->acf->synopsis = ast_strdup("Runs the referenced query with the specified arguments");
+ ast_string_field_set((*query)->acf, synopsis, "Runs the referenced query with the specified arguments");
}
- if (!((*query)->acf->synopsis)) {
+ if (ast_strlen_zero((*query)->acf->synopsis)) {
ast_free((char *)(*query)->acf->name);
- ast_free((char *)(*query)->acf->syntax);
+ ast_string_field_free_memory((*query)->acf);
ast_free((*query)->acf);
ast_free(*query);
*query = NULL;
@@ -828,7 +869,7 @@ static int init_acf_query(struct ast_config *cfg, char *catg, struct acf_odbc_qu
}
if (!ast_strlen_zero((*query)->sql_read) && !ast_strlen_zero((*query)->sql_write)) {
- asprintf((char **)&((*query)->acf->desc),
+ ast_string_field_build((*query)->acf, desc,
"Runs the following query, as defined in func_odbc.conf, performing\n"
"substitution of the arguments into the query as specified by ${ARG1},\n"
"${ARG2}, ... ${ARGn}. When setting the function, the values are provided\n"
@@ -844,13 +885,13 @@ static int init_acf_query(struct ast_config *cfg, char *catg, struct acf_odbc_qu
ast_strlen_zero((*query)->sql_insert) ? "" : (*query)->sql_insert,
ast_strlen_zero((*query)->sql_insert) ? "" : "\n");
} else if (!ast_strlen_zero((*query)->sql_read)) {
- asprintf((char **)&((*query)->acf->desc),
- "Runs the following query, as defined in func_odbc.conf, performing\n"
- "substitution of the arguments into the query as specified by ${ARG1},\n"
- "${ARG2}, ... ${ARGn}. This function may only be read, not set.\n\nSQL:\n%s\n",
- (*query)->sql_read);
+ ast_string_field_build((*query)->acf, desc,
+ "Runs the following query, as defined in func_odbc.conf, performing\n"
+ "substitution of the arguments into the query as specified by ${ARG1},\n"
+ "${ARG2}, ... ${ARGn}. This function may only be read, not set.\n\nSQL:\n%s\n",
+ (*query)->sql_read);
} else if (!ast_strlen_zero((*query)->sql_write)) {
- asprintf((char **)&((*query)->acf->desc),
+ ast_string_field_build((*query)->acf, desc,
"Runs the following query, as defined in func_odbc.conf, performing\n"
"substitution of the arguments into the query as specified by ${ARG1},\n"
"${ARG2}, ... ${ARGn}. The values are provided either in whole as\n"
@@ -864,8 +905,7 @@ static int init_acf_query(struct ast_config *cfg, char *catg, struct acf_odbc_qu
ast_strlen_zero((*query)->sql_insert) ? "" : (*query)->sql_insert,
ast_strlen_zero((*query)->sql_insert) ? "" : "\n");
} else {
- ast_free((char *)(*query)->acf->synopsis);
- ast_free((char *)(*query)->acf->syntax);
+ ast_string_field_free_memory((*query)->acf);
ast_free((char *)(*query)->acf->name);
ast_free((*query)->acf);
ast_free(*query);
@@ -873,9 +913,8 @@ static int init_acf_query(struct ast_config *cfg, char *catg, struct acf_odbc_qu
return EINVAL;
}
- if (! ((*query)->acf->desc)) {
- ast_free((char *)(*query)->acf->synopsis);
- ast_free((char *)(*query)->acf->syntax);
+ if (ast_strlen_zero((*query)->acf->desc)) {
+ ast_string_field_free_memory((*query)->acf);
ast_free((char *)(*query)->acf->name);
ast_free((*query)->acf);
ast_free(*query);
@@ -904,12 +943,7 @@ static int free_acf_query(struct acf_odbc_query *query)
if (query->acf) {
if (query->acf->name)
ast_free((char *)query->acf->name);
- if (query->acf->syntax)
- ast_free((char *)query->acf->syntax);
- if (query->acf->synopsis)
- ast_free((char *)query->acf->synopsis);
- if (query->acf->desc)
- ast_free((char *)query->acf->desc);
+ ast_string_field_free_memory(query->acf);
ast_free(query->acf);
}
ast_free(query);
@@ -1254,7 +1288,7 @@ static int load_module(void)
struct ast_flags config_flags = { 0 };
res |= ast_custom_function_register(&fetch_function);
- res |= ast_register_application(app_odbcfinish, exec_odbcfinish, syn_odbcfinish, desc_odbcfinish);
+ res |= ast_register_application_xml(app_odbcfinish, exec_odbcfinish);
AST_RWLIST_WRLOCK(&queries);
cfg = ast_config_load(config, config_flags);
diff --git a/funcs/func_rand.c b/funcs/func_rand.c
index a3db21d26..079723686 100644
--- a/funcs/func_rand.c
+++ b/funcs/func_rand.c
@@ -34,6 +34,24 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/utils.h"
#include "asterisk/app.h"
+/*** DOCUMENTATION
+ <function name="RAND" language="en_US">
+ <synopsis>
+ Choose a random number in a range.
+ </synopsis>
+ <syntax>
+ <parameter name="min" />
+ <parameter name="max" />
+ </syntax>
+ <description>
+ <para>Choose a random number between <replaceable>min</replaceable> and <replaceable>max</replaceable>.
+ <replaceable>min</replaceable> defaults to <literal>0</literal>, if not specified, while <replaceable>max</replaceable> defaults
+ to <literal>RAND_MAX</literal> (2147483647 on many systems).</para>
+ <para>Example: Set(junky=${RAND(1,8)});
+ Sets junky to a random number between 1 and 8, inclusive.</para>
+ </description>
+ </function>
+ ***/
static int acf_rand_exec(struct ast_channel *chan, const char *cmd,
char *parse, char *buffer, size_t buflen)
{
@@ -68,13 +86,6 @@ static int acf_rand_exec(struct ast_channel *chan, const char *cmd,
static struct ast_custom_function acf_rand = {
.name = "RAND",
- .synopsis = "Choose a random number in a range",
- .syntax = "RAND([min][,max])",
- .desc =
- "Choose a random number between min and max. Min defaults to 0, if not\n"
- "specified, while max defaults to RAND_MAX (2147483647 on many systems).\n"
- " Example: Set(junky=${RAND(1,8)}); \n"
- " Sets junky to a random number between 1 and 8, inclusive.\n",
.read = acf_rand_exec,
};
diff --git a/funcs/func_realtime.c b/funcs/func_realtime.c
index f3dd14be6..31989c425 100644
--- a/funcs/func_realtime.c
+++ b/funcs/func_realtime.c
@@ -37,6 +37,72 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/utils.h"
#include "asterisk/app.h"
+/*** DOCUMENTATION
+ <function name="REALTIME" language="en_US">
+ <synopsis>
+ RealTime Read/Write Functions.
+ </synopsis>
+ <syntax>
+ <parameter name="family" required="true" />
+ <parameter name="fieldmatch" required="true" />
+ <parameter name="value" />
+ <parameter name="delim1|field">
+ <para>Use <replaceable>delim1</replaceable> with <replaceable>delim2</replaceable> on
+ read and <replaceable>field</replaceable> without <replaceable>delim2</replaceable> on
+ write</para>
+ <para>If we are reading and <replaceable>delim1</replaceable> is not specified, defaults
+ to <literal>,</literal></para>
+ </parameter>
+ <parameter name="delim2">
+ <para>Parameter only used when reading, if not specified defaults to <literal>=</literal></para>
+ </parameter>
+ </syntax>
+ <description>
+ <para>This function will read or write values from/to a RealTime repository.
+ REALTIME(....) will read names/values from the repository, and
+ REALTIME(....)= will write a new value/field to the repository. On a
+ read, this function returns a delimited text string. The name/value
+ pairs are delimited by <replaceable>delim1</replaceable>, and the name and value are delimited
+ between each other with delim2.
+ If there is no match, NULL will be returned by the function.
+ On a write, this function will always return NULL.</para>
+ </description>
+ </function>
+ <function name="REALTIME_STORE" language="en_US">
+ <synopsis>
+ RealTime Store Function.
+ </synopsis>
+ <syntax>
+ <parameter name="family" required="true" />
+ <parameter name="field1" required="true" />
+ <parameter name="fieldN" required="true" multiple="true" />
+ <parameter name="field30" required="true" />
+ </syntax>
+ <description>
+ <para>This function will insert a new set of values into the RealTime repository.
+ If RT engine provides an unique ID of the stored record, REALTIME_STORE(...)=..
+ creates channel variable named RTSTOREID, which contains value of unique ID.
+ Currently, a maximum of 30 field/value pairs is supported.</para>
+ </description>
+ </function>
+ <function name="REALTIME_DESTROY" language="en_US">
+ <synopsis>
+ RealTime Destroy Function.
+ </synopsis>
+ <syntax>
+ <parameter name="family" required="true" />
+ <parameter name="fieldmatch" required="true" />
+ <parameter name="value" />
+ <parameter name="delim1" />
+ <parameter name="delim2" />
+ </syntax>
+ <description>
+ <para>This function acts in the same way as REALTIME(....) does, except that
+ it destroys matched record in RT engine.</para>
+ </description>
+ </function>
+ ***/
+
static int function_realtime_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
{
struct ast_variable *var, *head;
@@ -232,39 +298,17 @@ static int function_realtime_readdestroy(struct ast_channel *chan, const char *c
struct ast_custom_function realtime_function = {
.name = "REALTIME",
- .synopsis = "RealTime Read/Write Functions",
- .syntax = "REALTIME(family,fieldmatch[,value[,delim1[,delim2]]]) on read\n"
- "REALTIME(family,fieldmatch,value,field) on write",
- .desc = "This function will read or write values from/to a RealTime repository.\n"
- "REALTIME(....) will read names/values from the repository, and \n"
- "REALTIME(....)= will write a new value/field to the repository. On a\n"
- "read, this function returns a delimited text string. The name/value \n"
- "pairs are delimited by delim1, and the name and value are delimited \n"
- "between each other with delim2. The default for delim1 is ',' and \n"
- "the default for delim2 is '='. If there is no match, NULL will be \n"
- "returned by the function. On a write, this function will always \n"
- "return NULL. \n",
.read = function_realtime_read,
.write = function_realtime_write,
};
struct ast_custom_function realtime_store_function = {
.name = "REALTIME_STORE",
- .synopsis = "RealTime Store Function",
- .syntax = "REALTIME_STORE(family,field1,field2,...,field30) = value1,value2,...,value30",
- .desc = "This function will insert a new set of values into the RealTime repository.\n"
- "If RT engine provides an unique ID of the stored record, REALTIME_STORE(...)=..\n"
- "creates channel variable named RTSTOREID, which contains value of unique ID.\n"
- "Currently, a maximum of 30 field/value pairs is supported.\n",
.write = function_realtime_store,
};
struct ast_custom_function realtime_destroy_function = {
.name = "REALTIME_DESTROY",
- .synopsis = "RealTime Destroy Function",
- .syntax = "REALTIME_DESTROY(family,fieldmatch[,value[,delim1[,delim2]]])\n",
- .desc = "This function acts in the same way as REALTIME(....) does, except that\n"
- "it destroys matched record in RT engine.\n",
.read = function_realtime_readdestroy,
};
diff --git a/funcs/func_sha1.c b/funcs/func_sha1.c
index 6474140dd..973bc5c07 100644
--- a/funcs/func_sha1.c
+++ b/funcs/func_sha1.c
@@ -31,6 +31,25 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/module.h"
#include "asterisk/pbx.h"
+/*** DOCUMENTATION
+ <function name="SHA1" language="en_US">
+ <synopsis>
+ Computes a SHA1 digest.
+ </synopsis>
+ <syntax>
+ <parameter name="data" required="true">
+ <para>Input string</para>
+ </parameter>
+ </syntax>
+ <description>
+ <para>Generate a SHA1 digest via the SHA1 algorythm.</para>
+ <para>Example: Set(sha1hash=${SHA1(junky)})</para>
+ <para>Sets the asterisk variable sha1hash to the string <literal>60fa5675b9303eb62f99a9cd47f9f5837d18f9a0</literal>
+ which is known as his hash</para>
+ </description>
+ </function>
+ ***/
+
static int sha1(struct ast_channel *chan, const char *cmd, char *data,
char *buf, size_t len)
{
@@ -54,13 +73,7 @@ static int sha1(struct ast_channel *chan, const char *cmd, char *data,
static struct ast_custom_function sha1_function = {
.name = "SHA1",
- .synopsis = "Computes a SHA1 digest",
- .syntax = "SHA1(<data>)",
.read = sha1,
- .desc = "Generate a SHA1 digest via the SHA1 algorythm.\n"
- " Example: Set(sha1hash=${SHA1(junky)})\n"
- " Sets the asterisk variable sha1hash to the string '60fa5675b9303eb62f99a9cd47f9f5837d18f9a0'\n"
- " which is known as his hash\n",
};
static int unload_module(void)
diff --git a/funcs/func_shell.c b/funcs/func_shell.c
index 57a9819cd..df7164d5f 100644
--- a/funcs/func_shell.c
+++ b/funcs/func_shell.c
@@ -63,19 +63,31 @@ static int shell_helper(struct ast_channel *chan, const char *cmd, char *data,
return 0;
}
+/*** DOCUMENTATION
+ <function name="SHELL" language="en_US">
+ <synopsis>
+ Executes a command as if you were at a shell.
+ </synopsis>
+ <syntax>
+ <parameter name="command" required="true">
+ <para>This is the argument to the function, the command you want to pass to the shell.</para>
+ </parameter>
+ </syntax>
+ <description>
+ <para>Returns the value from a system command</para>
+ <para>Example: <literal>Set(foo=${SHELL(echo \bar\)})</literal></para>
+ <note><para>When using the SHELL() dialplan function, your \SHELL\ is /bin/sh,
+ which may differ as to the underlying shell, depending upon your production
+ platform. Also keep in mind that if you are using a common path, you should
+ be mindful of race conditions that could result from two calls running
+ SHELL() simultaneously.</para></note>
+ </description>
+
+ </function>
+ ***/
static struct ast_custom_function shell_function = {
.name = "SHELL",
- .synopsis = "Executes a command as if you were at a shell.",
- .syntax = "SHELL(<command>)",
.read = shell_helper,
- .desc =
-"Returns the value from a system command\n"
-" Example: Set(foo=${SHELL(echo \"bar\")})\n"
-" Note: When using the SHELL() dialplan function, your \"SHELL\" is /bin/sh,\n"
-" which may differ as to the underlying shell, depending upon your production\n"
-" platform. Also keep in mind that if you are using a common path, you should\n"
-" be mindful of race conditions that could result from two calls running\n"
-" SHELL() simultaneously.\n",
};
static int unload_module(void)
diff --git a/funcs/func_speex.c b/funcs/func_speex.c
index 4ddfab80b..6858cf7a3 100644
--- a/funcs/func_speex.c
+++ b/funcs/func_speex.c
@@ -48,6 +48,52 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#define DEFAULT_AGC_LEVEL 8000.0
+/*** DOCUMENTATION
+ <function name="AGC" language="en_US">
+ <synopsis>
+ Apply automatic gain control to audio on a channel.
+ </synopsis>
+ <syntax>
+ <parameter name="channeldirection" required="true">
+ <para>This can be either <literal>rx</literal> or <literal>tx</literal></para>
+ </parameter>
+ </syntax>
+ <description>
+ <para>The AGC function will apply automatic gain control to the audio on the
+ channel that it is executed on. Using <literal>rx</literal> for audio recieved
+ and <literal>tx</literal> for audio transmitted to the channel. When using this
+ function you set a target audio level. It is primarly intended for use with
+ analog lines, but could be useful for other channels as well. The target volume
+ is set with a number between <literal>1-32768</literal>. The larger the number
+ the louder (more gain) the channel will recieve.</para>
+ <para>Examples:</para>
+ <para>exten => 1,1,Set(AGC(rx)=8000)</para>
+ <para>exten => 1,2,Set(AGC(tx)=off)</para>
+ </description>
+ </function>
+ <function name="DENOISE" language="en_US">
+ <synopsis>
+ Apply noise reduction to audio on a channel.
+ </synopsis>
+ <syntax>
+ <parameter name="channeldirection" required="true">
+ <para>This can be either <literal>rx</literal> or <literal>tx</literal>
+ the values that can be set to this are either <literal>on</literal> and
+ <literal>off</literal></para>
+ </parameter>
+ </syntax>
+ <description>
+ <para>The DENOISE function will apply noise reduction to audio on the channel
+ that it is executed on. It is very useful for noisy analog lines, especially
+ when adjusting gains or using AGC. Use <literal>rx</literal> for audio received from the channel
+ and <literal>tx</literal> to apply the filter to the audio being sent to the channel.</para>
+ <para>Examples:</para>
+ <para>exten => 1,1,Set(DENOISE(rx)=on)</para>
+ <para>exten => 1,2,Set(DENOISE(tx)=off)</para>
+ </description>
+ </function>
+ ***/
+
struct speex_direction_info {
SpeexPreprocessState *state; /*!< speex preprocess state object */
int agc; /*!< audio gain control is enabled or not */
@@ -290,39 +336,12 @@ static int speex_read(struct ast_channel *chan, const char *cmd, char *data, cha
static struct ast_custom_function agc_function = {
.name = "AGC",
- .synopsis = "Apply automatic gain control to audio on a channel",
- .desc =
- " The AGC function will apply automatic gain control to audio on the channel\n"
- "that this function is executed on. Use rx for audio received from the channel\n"
- "and tx to apply AGC to the audio being sent to the channel. When using this\n"
- "function, you set a target audio level. It is primarily intended for use with\n"
- "analog lines, but could be useful for other channels, as well. The target volume\n"
- "is set with a number between 1 and 32768. Larger numbers are louder.\n"
- " Example Usage:\n"
- " Set(AGC(rx)=8000)\n"
- " Set(AGC(tx)=8000)\n"
- " Set(AGC(rx)=off)\n"
- " Set(AGC(tx)=off)\n"
- "",
.write = speex_write,
.read = speex_read
};
static struct ast_custom_function denoise_function = {
.name = "DENOISE",
- .synopsis = "Apply noise reduction to audio on a channel",
- .desc =
- " The DENOISE function will apply noise reduction to audio on the channel\n"
- "that this function is executed on. It is especially useful for noisy analog\n"
- "lines, especially when adjusting gains or using AGC. Use rx for audio\n"
- "received from the channel and tx to apply the filter to the audio being sent\n"
- "to the channel.\n"
- " Example Usage:\n"
- " Set(DENOISE(rx)=on)\n"
- " Set(DENOISE(tx)=on)\n"
- " Set(DENOISE(rx)=off)\n"
- " Set(DENOISE(tx)=off)\n"
- "",
.write = speex_write,
.read = speex_read
};
diff --git a/funcs/func_strings.c b/funcs/func_strings.c
index 2494518e3..c45638564 100644
--- a/funcs/func_strings.c
+++ b/funcs/func_strings.c
@@ -39,6 +39,244 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/app.h"
#include "asterisk/localtime.h"
+/*** DOCUMENTATION
+ <function name="FIELDQTY" language="en_US">
+ <synopsis>
+ Count the fields with an arbitrary delimiter
+ </synopsis>
+ <syntax>
+ <parameter name="varname" required="true" />
+ <parameter name="delim" required="true" />
+ </syntax>
+ <description>
+ <para>Example: ${FIELDQTY(ex-amp-le,-)} returns 3</para>
+ </description>
+ </function>
+ <function name="FILTER" language="en_US">
+ <synopsis>
+ Filter the string to include only the allowed characters
+ </synopsis>
+ <syntax>
+ <parameter name="allowed-chars" required="true" />
+ <parameter name="string" required="true" />
+ </syntax>
+ <description>
+ <para>Permits all characters listed in <replaceable>allowed-chars</replaceable>,
+ filtering all others outs. In addition to literally listing the characters,
+ you may also use ranges of characters (delimited by a <literal>-</literal></para>
+ <para>Hexadecimal characters started with a <literal>\x</literal>(i.e. \x20)</para>
+ <para>Octal characters started with a <literal>\0</literal> (i.e. \040)</para>
+ <para>Also <literal>\t</literal>,<literal>\n</literal> and <literal>\r</literal> are recognized.</para>
+ <note><para>If you want the <literal>-</literal> character it needs to be prefixed with a
+ <literal>\</literal></para></note>
+ </description>
+ </function>
+ <function name="REGEX" language="en_US">
+ <synopsis>
+ Check string against a regular expression.
+ </synopsis>
+ <syntax argsep=" ">
+ <parameter name="&quot;regular expression&quot;" required="true" />
+ <parameter name="string" required="true" />
+ </syntax>
+ <description>
+ <para>Return <literal>1</literal> on regular expression match or <literal>0</literal> otherwise</para>
+ <para>Please note that the space following the double quotes separating the
+ regex from the data is optional and if present, is skipped. If a space is
+ desired at the beginning of the data, then put two spaces there; the second
+ will not be skipped.</para>
+ </description>
+ </function>
+ <application name="ClearHash" language="en_US">
+ <synopsis>
+ Clear the keys from a specified hashname.
+ </synopsis>
+ <syntax>
+ <parameter name="hashname" required="true" />
+ </syntax>
+ <description>
+ <para>Clears all keys out of the specified <replaceable>hashname</replaceable>.</para>
+ </description>
+ </application>
+ <function name="HASH" language="en_US">
+ <synopsis>
+ Implementation of a dialplan associative array
+ </synopsis>
+ <syntax>
+ <parameter name="hashname" required="true" />
+ <parameter name="hashkey" />
+ </syntax>
+ <description>
+ <para>In two arguments mode, gets and sets values to corresponding keys within
+ a named associative array. The single-argument mode will only work when assigned
+ to from a function defined by func_odbc</para>
+ </description>
+ </function>
+ <function name="HASHKEYS" language="en_US">
+ <synopsis>
+ Retrieve the keys of the HASH() function.
+ </synopsis>
+ <syntax>
+ <parameter name="hashname" required="true" />
+ </syntax>
+ <description>
+ <para>Returns a comma-delimited list of the current keys of the associative array
+ defined by the HASH() function. Note that if you iterate over the keys of
+ the result, adding keys during iteration will cause the result of the HASHKEYS()
+ function to change.</para>
+ </description>
+ </function>
+ <function name="KEYPADHASH" language="en_US">
+ <synopsis>
+ Hash the letters in string into equivalent keypad numbers.
+ </synopsis>
+ <syntax>
+ <parameter name="string" required="true" />
+ </syntax>
+ <description>
+ <para>Example: ${KEYPADHASH(Les)} returns "537"</para>
+ </description>
+ </function>
+ <function name="ARRAY" language="en_US">
+ <synopsis>
+ Allows setting multiple variables at once.
+ </synopsis>
+ <syntax>
+ <parameter name="var1" required="true" />
+ <parameter name="var2" required="false" multiple="true" />
+ <parameter name="varN" required="false" />
+ </syntax>
+ <description>
+ <para>The comma-delimited list passed as a value to which the function is set will
+ be interpreted as a set of values to which the comma-delimited list of
+ variable names in the arguement should be set.</para>
+ <para>Example: Set(ARRAY(var1,var2)=1,2) will set var1 to 1 and var2 to 2</para>
+ </description>
+ </function>
+ <function name="STRPTIME" language="en_US">
+ <synopsis>
+ Returns the epoch of the arbitrary date/time string structured as described by the format.
+ </synopsis>
+ <syntax>
+ <parameter name="datetime" required="true" />
+ <parameter name="timezone" required="true" />
+ <parameter name="format" required="true" />
+ </syntax>
+ <description>
+ <para>This is useful for converting a date into <literal>EPOCH</literal> time,
+ possibly to pass to an application like SayUnixTime or to calculate the difference
+ between the two date strings</para>
+ <para>Example: ${STRPTIME(2006-03-01 07:30:35,America/Chicago,%Y-%m-%d %H:%M:%S)} returns 1141219835</para>
+ </description>
+ </function>
+ <function name="STRFTIME" language="en_US">
+ <synopsis>
+ Returns the current date/time in the specified format.
+ </synopsis>
+ <syntax>
+ <parameter name="epoch" />
+ <parameter name="timezone" />
+ <parameter name="format" />
+ </syntax>
+ <description>
+ <para>STRFTIME supports all of the same formats as the underlying C function
+ <emphasis>strftime(3)</emphasis>.
+ It also supports the following format: <literal>%[n]q</literal> - fractions of a second,
+ with leading zeros.</para>
+ <para>Example: <literal>%3q</literal> will give milliseconds and <literal>%1q</literal>
+ will give tenths of a second. The default is set at milliseconds (n=3).
+ The common case is to use it in combination with %S, as in <literal>%S.%3q</literal>.</para>
+ </description>
+ <see-also>
+ <ref type="manpage">strftime(3)</ref>
+ </see-also>
+ </function>
+ <function name="EVAL" language="en_US">
+ <synopsis>
+ Evaluate stored variables
+ </synopsis>
+ <syntax>
+ <parameter name="variable" required="true" />
+ </syntax>
+ <description>
+ <para>Using EVAL basically causes a string to be evaluated twice.
+ When a variable or expression is in the dialplan, it will be
+ evaluated at runtime. However, if the results of the evaluation
+ is in fact another variable or expression, using EVAL will have it
+ evaluated a second time.</para>
+ <para>Example: If the <variable>MYVAR</variable> contains
+ <variable>OTHERVAR</variable>, then the result of ${EVAL(
+ <variable>MYVAR</variable>)} in the dialplan will be the
+ contents of <variable>OTHERVAR</variable>. Normally just
+ putting <variable>MYVAR</variable> in the dialplan the result
+ would be <variable>OTHERVAR</variable>.</para>
+ </description>
+ </function>
+ <function name="TOUPPER" language="en_US">
+ <synopsis>
+ Convert string to all uppercase letters.
+ </synopsis>
+ <syntax>
+ <parameter name="string" required="true" />
+ </syntax>
+ <description>
+ <para>Example: ${TOUPPER(Example)} returns "EXAMPLE"</para>
+ </description>
+ </function>
+ <function name="TOLOWER" language="en_US">
+ <synopsis>
+ Convert string to all lowercase letters.
+ </synopsis>
+ <syntax>
+ <parameter name="string" required="true" />
+ </syntax>
+ <description>
+ <para>Example: ${TOLOWER(Example)} returns "example"</para>
+ </description>
+ </function>
+ <function name="LEN" language="en_US">
+ <synopsis>
+ Return the length of the string given.
+ </synopsis>
+ <syntax>
+ <parameter name="string" required="true" />
+ </syntax>
+ <description>
+ <para>Example: ${LEN(example)} returns 7</para>
+ </description>
+ </function>
+ <function name="SPRINTF" language="en_US">
+ <synopsis>
+ Format a variable according to a format string.
+ </synopsis>
+ <syntax>
+ <parameter name="format" required="true" />
+ <parameter name="arg1" required="true" />
+ <parameter name="arg2" multiple="true" />
+ <parameter name="argN" />
+ </syntax>
+ <description>
+ <para>Parses the format string specified and returns a string matching
+ that format. Supports most options found in <emphasis>sprintf(3)</emphasis>.
+ Returns a shortened string if a format specifier is not recognized.</para>
+ </description>
+ <see-also>
+ <ref type="manpage">sprintf(3)</ref>
+ </see-also>
+ </function>
+ <function name="QUOTE" language="en_US">
+ <synopsis>
+ Quotes a given string, escaping embedded quotes as necessary
+ </synopsis>
+ <syntax>
+ <parameter name="string" required="true" />
+ </syntax>
+ <description>
+ <para>Example: ${QUOTE(ab"c"de)} will return "abcde"</para>
+ </description>
+ </function>
+ ***/
+
static int function_fieldqty(struct ast_channel *chan, const char *cmd,
char *parse, char *buf, size_t len)
{
@@ -81,8 +319,6 @@ static int function_fieldqty(struct ast_channel *chan, const char *cmd,
static struct ast_custom_function fieldqty_function = {
.name = "FIELDQTY",
- .synopsis = "Count the fields, with an arbitrary delimiter",
- .syntax = "FIELDQTY(<varname>,<delim>)",
.read = function_fieldqty,
};
@@ -147,16 +383,7 @@ static int filter(struct ast_channel *chan, const char *cmd, char *parse, char *
static struct ast_custom_function filter_function = {
.name = "FILTER",
- .synopsis = "Filter the string to include only the allowed characters",
- .syntax = "FILTER(<allowed-chars>,<string>)",
.read = filter,
- .desc =
-"Permits all characters listed in <allowed-chars>, filtering all others out.\n"
-"In addition to literally listing the characters, you may also use ranges of\n"
-"characters (delimited by a '-'), as well as hexadecimal characters started\n"
-"with a \\x (i.e. \\x20) and octal characters started with \\0 (i.e. \\040).\n"
-"Also, \\t, \\n, and \\r are recognized. If you want a literal '-' character,\n"
-"simply prefix it with a '\\'\n",
};
static int regex(struct ast_channel *chan, const char *cmd, char *parse, char *buf,
@@ -198,13 +425,6 @@ static int regex(struct ast_channel *chan, const char *cmd, char *parse, char *b
static struct ast_custom_function regex_function = {
.name = "REGEX",
- .synopsis = "Regular Expression",
- .desc =
- "Returns 1 if data matches regular expression, or 0 otherwise.\n"
- "Please note that the space following the double quotes separating the regex from the data\n"
- "is optional and if present, is skipped. If a space is desired at the beginning of the data,\n"
- "then put two spaces there; the second will not be skipped.\n",
- .syntax = "REGEX(\"<regular expression>\" <data>)",
.read = regex,
};
@@ -212,10 +432,6 @@ static struct ast_custom_function regex_function = {
#define HASH_FORMAT HASH_PREFIX "%s~"
static char *app_clearhash = "ClearHash";
-static char *syn_clearhash = "Clear the keys from a specified hashname";
-static char *desc_clearhash =
-"ClearHash(<hashname>)\n"
-" Clears all keys out of the specified hashname\n";
/* This function probably should migrate to main/pbx.c, as pbx_builtin_clearvar_prefix() */
static void clearvar_prefix(struct ast_channel *chan, const char *prefix)
@@ -400,38 +616,18 @@ static int hash_read(struct ast_channel *chan, const char *cmd, char *data, char
static struct ast_custom_function hash_function = {
.name = "HASH",
- .synopsis = "Implementation of a dialplan associative array",
- .syntax = "HASH(hashname[,hashkey])",
.write = hash_write,
.read = hash_read,
- .desc =
- "In two argument mode, gets and sets values to corresponding keys within a named\n"
- "associative array. The single-argument mode will only work when assigned to from\n"
- "a function defined by func_odbc.so.\n",
};
static struct ast_custom_function hashkeys_function = {
.name = "HASHKEYS",
- .synopsis = "Retrieve the keys of a HASH()",
- .syntax = "HASHKEYS(<hashname>)",
.read = hashkeys_read,
- .desc =
- "Returns a comma-delimited list of the current keys of an associative array\n"
- "defined by the HASH() function. Note that if you iterate over the keys of\n"
- "the result, adding keys during iteration will cause the result of the HASHKEYS\n"
- "function to change.\n",
};
static struct ast_custom_function array_function = {
.name = "ARRAY",
- .synopsis = "Allows setting multiple variables at once",
- .syntax = "ARRAY(var1[,var2[...][,varN]])",
.write = array,
- .desc =
- "The comma-separated list passed as a value to which the function is set will\n"
- "be interpreted as a set of values to which the comma-separated list of\n"
- "variable names in the argument should be set.\n"
- "Hence, Set(ARRAY(var1,var2)=1,2) will set var1 to 1 and var2 to 2.\n",
};
static int acf_sprintf(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
@@ -580,13 +776,7 @@ sprintf_fail:
static struct ast_custom_function sprintf_function = {
.name = "SPRINTF",
- .synopsis = "Format a variable according to a format string",
- .syntax = "SPRINTF(<format>,<arg1>[,...<argN>])",
.read = acf_sprintf,
- .desc =
-"Parses the format string specified and returns a string matching that format.\n"
-"Supports most options supported by sprintf(3). Returns a shortened string if\n"
-"a format specifier is not recognized.\n",
};
static int quote(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
@@ -613,8 +803,6 @@ static int quote(struct ast_channel *chan, const char *cmd, char *data, char *bu
static struct ast_custom_function quote_function = {
.name = "QUOTE",
- .synopsis = "Quotes a given string, escaping embedded quotes as necessary",
- .syntax = "QUOTE(<string>)",
.read = quote,
};
@@ -634,8 +822,6 @@ static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf,
static struct ast_custom_function len_function = {
.name = "LEN",
- .synopsis = "Returns the length of the argument given",
- .syntax = "LEN(<string>)",
.read = len,
};
@@ -670,16 +856,6 @@ static int acf_strftime(struct ast_channel *chan, const char *cmd, char *parse,
static struct ast_custom_function strftime_function = {
.name = "STRFTIME",
- .synopsis = "Returns the current date/time in a specified format.",
- .syntax = "STRFTIME([<epoch>][,[timezone][,format]])",
- .desc =
-"STRFTIME sports all of the same formats as the underlying C function\n"
-"strftime(3) - see the man page for details. It also supports the\n"
-"following format:\n"
-" %[n]q - fractions of a second, with leading zeroes. For example, %3q will\n"
-" give milliseconds and %1q will give tenths of a second. The default\n"
-" is to output milliseconds (n=3). The common case is to use it in\n"
-" combination with %S, as in \"%S.%3q\".\n",
.read = acf_strftime,
};
@@ -722,16 +898,6 @@ static int acf_strptime(struct ast_channel *chan, const char *cmd, char *data,
static struct ast_custom_function strptime_function = {
.name = "STRPTIME",
- .synopsis =
- "Returns the epoch of the arbitrary date/time string structured as described in the format.",
- .syntax = "STRPTIME(<datetime>,<timezone>,<format>)",
- .desc =
- "This is useful for converting a date into an EPOCH time, possibly to pass to\n"
- "an application like SayUnixTime or to calculate the difference between two\n"
- "date strings.\n"
- "\n"
- "Example:\n"
- " ${STRPTIME(2006-03-01 07:30:35,America/Chicago,%Y-%m-%d %H:%M:%S)} returns 1141219835\n",
.read = acf_strptime,
};
@@ -754,17 +920,6 @@ static int function_eval(struct ast_channel *chan, const char *cmd, char *data,
static struct ast_custom_function eval_function = {
.name = "EVAL",
- .synopsis = "Evaluate stored variables.",
- .syntax = "EVAL(<variable>)",
- .desc = "Using EVAL basically causes a string to be evaluated twice.\n"
- "When a variable or expression is in the dialplan, it will be\n"
- "evaluated at runtime. However, if the result of the evaluation\n"
- "is in fact a variable or expression, using EVAL will have it\n"
- "evaluated a second time. For example, if the variable ${MYVAR}\n"
- "contains \"${OTHERVAR}\", then the result of putting ${EVAL(${MYVAR})}\n"
- "in the dialplan will be the contents of the variable, OTHERVAR.\n"
- "Normally, by just putting ${MYVAR} in the dialplan, you would be\n"
- "left with \"${OTHERVAR}\".\n",
.read = function_eval,
};
@@ -805,10 +960,7 @@ static int keypadhash(struct ast_channel *chan, const char *cmd, char *data, cha
static struct ast_custom_function keypadhash_function = {
.name = "KEYPADHASH",
- .synopsis = "Hash the letters in the string into the equivalent keypad numbers.",
- .syntax = "KEYPADHASH(<string>)",
.read = keypadhash,
- .desc = "Example: ${KEYPADHASH(Les)} returns \"537\"\n",
};
static int string_toupper(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
@@ -822,10 +974,7 @@ static int string_toupper(struct ast_channel *chan, const char *cmd, char *data,
static struct ast_custom_function toupper_function = {
.name = "TOUPPER",
- .synopsis = "Convert the string to upper case.",
- .syntax = "TOUPPER(<string>)",
.read = string_toupper,
- .desc = "Example: ${TOUPPER(Example)} returns \"EXAMPLE\"\n",
};
static int string_tolower(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
@@ -839,10 +988,7 @@ static int string_tolower(struct ast_channel *chan, const char *cmd, char *data,
static struct ast_custom_function tolower_function = {
.name = "TOLOWER",
- .synopsis = "Convert the string to lower case.",
- .syntax = "TOLOWER(<string>)",
.read = string_tolower,
- .desc = "Example: ${TOLOWER(Example)} returns \"example\"\n",
};
static int unload_module(void)
@@ -886,7 +1032,7 @@ static int load_module(void)
res |= ast_custom_function_register(&sprintf_function);
res |= ast_custom_function_register(&hashkeys_function);
res |= ast_custom_function_register(&hash_function);
- res |= ast_register_application(app_clearhash, exec_clearhash, syn_clearhash, desc_clearhash);
+ res |= ast_register_application_xml(app_clearhash, exec_clearhash);
res |= ast_custom_function_register(&toupper_function);
res |= ast_custom_function_register(&tolower_function);
diff --git a/funcs/func_timeout.c b/funcs/func_timeout.c
index 625070217..a035a0563 100644
--- a/funcs/func_timeout.c
+++ b/funcs/func_timeout.c
@@ -34,6 +34,42 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/utils.h"
#include "asterisk/app.h"
+/*** DOCUMENTATION
+ <function name="TIMEOUT" language="en_US">
+ <synopsis>
+ Gets or sets timeouts on the channel. Timeout values are in seconds.
+ </synopsis>
+ <syntax>
+ <parameter name="timeouttype" required="true">
+ <para>The timeout that will be manipulated. The possible timeout types
+ are: <literal>absolute</literal>, <literal>digit</literal> or
+ <literal>response</literal></para>
+ </parameter>
+ </syntax>
+ <description>
+ <para>The timeouts that can be manipulated are:</para>
+ <para><literal>absolute</literal>: The absolute maximum amount of time permitted for a call.
+ Setting of 0 disables the timeout.</para>
+ <para><literal>digit</literal>: The maximum amount of time permitted between digits when the
+ user is typing in an extension. When this timeout expires,
+ after the user has started to type in an extension, the
+ extension will be considered complete, and will be
+ interpreted. Note that if an extension typed in is valid,
+ it will not have to timeout to be tested, so typically at
+ the expiry of this timeout, the extension will be considered
+ invalid (and thus control would be passed to the <literal>i</literal>
+ extension, or if it doesn't exist the call would be
+ terminated). The default timeout is 5 seconds.</para>
+ <para><literal>response</literal>: The maximum amount of time permitted after falling through a
+ series of priorities for a channel in which the user may
+ begin typing an extension. If the user does not type an
+ extension in this amount of time, control will pass to the
+ <literal>t</literal> extension if it exists, and if not the call would be
+ terminated. The default timeout is 10 seconds.</para>
+ </description>
+ </function>
+ ***/
+
static int timeout_read(struct ast_channel *chan, const char *cmd, char *data,
char *buf, size_t len)
{
@@ -149,29 +185,6 @@ static int timeout_write(struct ast_channel *chan, const char *cmd, char *data,
static struct ast_custom_function timeout_function = {
.name = "TIMEOUT",
- .synopsis = "Gets or sets timeouts on the channel. Timeout values are in seconds.",
- .syntax = "TIMEOUT(timeouttype)",
- .desc =
- "Gets or sets various channel timeouts. The timeouts that can be\n"
- "manipulated are:\n" "\n"
- "absolute: The absolute maximum amount of time permitted for a call. A\n"
- " setting of 0 disables the timeout.\n" "\n"
- "digit: The maximum amount of time permitted between digits when the\n"
- " user is typing in an extension. When this timeout expires,\n"
- " after the user has started to type in an extension, the\n"
- " extension will be considered complete, and will be\n"
- " interpreted. Note that if an extension typed in is valid,\n"
- " it will not have to timeout to be tested, so typically at\n"
- " the expiry of this timeout, the extension will be considered\n"
- " invalid (and thus control would be passed to the 'i'\n"
- " extension, or if it doesn't exist the call would be\n"
- " terminated). The default timeout is 5 seconds.\n" "\n"
- "response: The maximum amount of time permitted after falling through a\n"
- " series of priorities for a channel in which the user may\n"
- " begin typing an extension. If the user does not type an\n"
- " extension in this amount of time, control will pass to the\n"
- " 't' extension if it exists, and if not the call would be\n"
- " terminated. The default timeout is 10 seconds.\n",
.read = timeout_read,
.write = timeout_write,
};
diff --git a/funcs/func_uri.c b/funcs/func_uri.c
index 94ae220b6..5efa6ea38 100644
--- a/funcs/func_uri.c
+++ b/funcs/func_uri.c
@@ -38,6 +38,35 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/utils.h"
#include "asterisk/app.h"
+/*** DOCUMENTATION
+ <function name="URIENCODE" language="en_US">
+ <synopsis>
+ Encodes a string to URI-safe encoding according to RFC 2396.
+ </synopsis>
+ <syntax>
+ <parameter name="data" required="true">
+ <para>Input string to be encoded.</para>
+ </parameter>
+ </syntax>
+ <description>
+ <para>Returns the encoded string defined in <replaceable>data</replaceable>.</para>
+ </description>
+ </function>
+ <function name="URIDECODE" language="en_US">
+ <synopsis>
+ Decodes a URI-encoded string according to RFC 2396.
+ </synopsis>
+ <syntax>
+ <parameter name="data" required="true">
+ <para>Input string to be decoded.</para>
+ </parameter>
+ </syntax>
+ <description>
+ <para>Returns the decoded URI-encoded <replaceable>data</replaceable> string.</para>
+ </description>
+ </function>
+ ***/
+
/*! \brief uriencode: Encode URL according to RFC 2396 */
static int uriencode(struct ast_channel *chan, const char *cmd, char *data,
char *buf, size_t len)
@@ -69,15 +98,11 @@ static int uridecode(struct ast_channel *chan, const char *cmd, char *data,
static struct ast_custom_function urldecode_function = {
.name = "URIDECODE",
- .synopsis = "Decodes a URI-encoded string according to RFC 2396.",
- .syntax = "URIDECODE(<data>)",
.read = uridecode,
};
static struct ast_custom_function urlencode_function = {
.name = "URIENCODE",
- .synopsis = "Encodes a string to URI-safe encoding according to RFC 2396.",
- .syntax = "URIENCODE(<data>)",
.read = uriencode,
};
diff --git a/funcs/func_version.c b/funcs/func_version.c
index 973f866c6..8ed6c218f 100644
--- a/funcs/func_version.c
+++ b/funcs/func_version.c
@@ -34,6 +34,49 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/ast_version.h"
#include "asterisk/build.h"
+/*** DOCUMENTATION
+ <function name="VERSION" language="en_US">
+ <synopsis>
+ Return the Version info for this Asterisk.
+ </synopsis>
+ <syntax>
+ <parameter name="info">
+ <para>The possible values are:</para>
+ <enumlist>
+ <enum name="ASTERISK_VERSION_NUM">
+ <para>A string of digits is returned (right now fixed at 999999).</para>
+ </enum>
+ <enum name="BUILD_USER">
+ <para>The string representing the user's name whose account
+ was used to configure Asterisk, is returned.</para>
+ </enum>
+ <enum name="BUILD_HOSTNAME">
+ <para>The string representing the name of the host on which Asterisk was configured, is returned.</para>
+ </enum>
+ <enum name="BUILD_MACHINE">
+ <para>The string representing the type of machine on which Asterisk was configured, is returned.</para>
+ </enum>
+ <enum name="BUILD_OS">
+ <para>The string representing the OS of the machine on which Asterisk was configured, is returned.</para>
+ </enum>
+ <enum name="BUILD_DATE">
+ <para>The string representing the date on which Asterisk was configured, is returned.</para>
+ </enum>
+ <enum name="BUILD_KERNEL">
+ <para>The string representing the kernel version of the machine on which Asterisk
+ was configured, is returned.</para>
+ </enum>
+ </enumlist>
+ </parameter>
+ </syntax>
+ <description>
+ <para>If there are no arguments, return the version of Asterisk in this format: SVN-branch-1.4-r44830M</para>
+ <para>Example: Set(junky=${VERSION()};</para>
+ <para>Sets junky to the string <literal>SVN-branch-1.6-r74830M</literal>, or possibly, <literal>SVN-trunk-r45126M</literal>.</para>
+ </description>
+ </function>
+ ***/
+
static int acf_version_exec(struct ast_channel *chan, const char *cmd,
char *parse, char *buffer, size_t buflen)
{
@@ -70,19 +113,6 @@ static int acf_version_exec(struct ast_channel *chan, const char *cmd,
static struct ast_custom_function acf_version = {
.name = "VERSION",
- .synopsis = "Return the Version info for this Asterisk",
- .syntax = "VERSION([info])",
- .desc =
- "If there are no arguments, return the version of Asterisk in this format: SVN-branch-1.4-r44830M\n"
- "If the argument is 'ASTERISK_VERSION_NUM', a string of digits is returned (right now fixed at 999999).\n"
- "If the argument is 'BUILD_USER', the string representing the user's name whose account was used to configure Asterisk, is returned.\n"
- "If the argument is 'BUILD_HOSTNAME', the string representing the name of the host on which Asterisk was configured, is returned.\n"
- "If the argument is 'BUILD_MACHINE', the string representing the type of machine on which Asterisk was configured, is returned.\n"
- "If the argument is 'BUILD_OS', the string representing the OS of the machine on which Asterisk was configured, is returned.\n"
- "If the argument is 'BUILD_DATE', the string representing the date on which Asterisk was configured, is returned.\n"
- "If the argument is 'BUILD_KERNEL', the string representing the kernel version of the machine on which Asterisk was configured, is returned .\n"
- " Example: Set(junky=${VERSION()}; \n"
- " Sets junky to the string 'SVN-branch-1.6-r74830M', or possibly, 'SVN-trunk-r45126M'.\n",
.read = acf_version_exec,
};
diff --git a/funcs/func_vmcount.c b/funcs/func_vmcount.c
index 24d83140d..f79669b6d 100644
--- a/funcs/func_vmcount.c
+++ b/funcs/func_vmcount.c
@@ -39,6 +39,30 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/utils.h"
#include "asterisk/app.h"
+/*** DOCUMENTATION
+ <function name="VMCOUNT" language="en_US">
+ <synopsis>
+ Count the voicemails in a specified mailbox.
+ </synopsis>
+ <syntax>
+ <parameter name="vmbox" required="true" argsep="@">
+ <argument name="vmbox" required="true" />
+ <argument name="context" required="false">
+ <para>If not specified, defaults to <literal>default</literal>.</para>
+ </argument>
+ </parameter>
+ <parameter name="folder" required="false">
+ <para>If not specified, defaults to <literal>INBOX</literal></para>
+ </parameter>
+ </syntax>
+ <description>
+ <para>Count the number of voicemails in a specified mailbox, you could also specify
+ the <replaceable>context</replaceable> and the mailbox <replaceable>folder</replaceable>.</para>
+ <para>Example: <literal>exten => s,1,Set(foo=${VMCOUNT(125)})</literal></para>
+ </description>
+ </function>
+ ***/
+
static int acf_vmcount_exec(struct ast_channel *chan, const char *cmd, char *argsstr, char *buf, size_t len)
{
char *context;
@@ -72,11 +96,6 @@ static int acf_vmcount_exec(struct ast_channel *chan, const char *cmd, char *arg
struct ast_custom_function acf_vmcount = {
.name = "VMCOUNT",
- .synopsis = "Counts the voicemail in a specified mailbox",
- .syntax = "VMCOUNT(vmbox[@context][,folder])",
- .desc =
- " context - defaults to \"default\"\n"
- " folder - defaults to \"INBOX\"\n",
.read = acf_vmcount_exec,
};
diff --git a/funcs/func_volume.c b/funcs/func_volume.c
index 530f9b876..9c8b92b20 100644
--- a/funcs/func_volume.c
+++ b/funcs/func_volume.c
@@ -36,6 +36,26 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/utils.h"
#include "asterisk/audiohook.h"
+/*** DOCUMENTATION
+ <function name="VOLUME" language="en_US">
+ <synopsis>
+ Set the TX or RX volume of a channel.
+ </synopsis>
+ <syntax>
+ <parameter name="direction" required="true">
+ <para>Must be <literal>TX</literal> or <literal>RX</literal>.</para>
+ </parameter>
+ </syntax>
+ <description>
+ <para>The VOLUME function can be used to increase or decrease the <literal>tx</literal> or
+ <literal>rx</literal> gain of any channel.</para>
+ <para>For example:</para>
+ <para>Set(VOLUME(TX)=3)</para>
+ <para>Set(VOLUME(RX)=2)</para>
+ </description>
+ </function>
+ ***/
+
struct volume_information {
struct ast_audiohook audiohook;
int tx_gain;
@@ -137,13 +157,6 @@ static int volume_write(struct ast_channel *chan, const char *cmd, char *data, c
static struct ast_custom_function volume_function = {
.name = "VOLUME",
- .synopsis = "Set the TX or RX volume of a channel",
- .syntax = "VOLUME(TX|RX)",
- .desc =
- " The VOLUME function can be used to increase or decrease the tx or\n"
- "rx gain of any channel. For example:\n"
- " Set(VOLUME(TX)=3)\n"
- " Set(VOLUME(RX)=2)\n",
.write = volume_write,
};