mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-02 03:48:02 +00:00
Merge changes from team/group/appdocsxml
This commit introduces the first phase of an effort to manage documentation of the interfaces in Asterisk in an XML format. Currently, a new format is available for applications and dialplan functions. A good number of conversions to the new format are also included. For more information, see the following message to asterisk-dev: http://lists.digium.com/pipermail/asterisk-dev/2008-October/034968.html git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@153365 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
107
apps/app_exec.c
107
apps/app_exec.c
@@ -36,6 +36,80 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
#include "asterisk/module.h"
|
||||
#include "asterisk/app.h"
|
||||
|
||||
/*** DOCUMENTATION
|
||||
<application name="Exec" language="en_US">
|
||||
<synopsis>
|
||||
Executes dialplan application.
|
||||
</synopsis>
|
||||
<syntax>
|
||||
<parameter name="appname" required="true" hasparams="true">
|
||||
<para>Application name and arguments of the dialplan application to execute.</para>
|
||||
<argument name="arguments" required="true" />
|
||||
</parameter>
|
||||
</syntax>
|
||||
<description>
|
||||
<para>Allows an arbitrary application to be invoked even when not
|
||||
hardcoded into the dialplan. If the underlying application
|
||||
terminates the dialplan, or if the application cannot be found,
|
||||
Exec will terminate the dialplan.</para>
|
||||
<para>To invoke external applications, see the application System.
|
||||
If you would like to catch any error instead, see TryExec.</para>
|
||||
</description>
|
||||
</application>
|
||||
<application name="TryExec" language="en_US">
|
||||
<synopsis>
|
||||
Executes dialplan application, always returning.
|
||||
</synopsis>
|
||||
<syntax>
|
||||
<parameter name="appname" required="true" hasparams="true">
|
||||
<argument name="arguments" required="true" />
|
||||
</parameter>
|
||||
</syntax>
|
||||
<description>
|
||||
<para>Allows an arbitrary application to be invoked even when not
|
||||
hardcoded into the dialplan. To invoke external applications
|
||||
see the application System. Always returns to the dialplan.
|
||||
The channel variable TRYSTATUS will be set to one of:
|
||||
</para>
|
||||
<variablelist>
|
||||
<variable name="TRYSTATUS">
|
||||
<value name="SUCCESS">
|
||||
If the application returned zero.
|
||||
</value>
|
||||
<value name="FAILED">
|
||||
If the application returned non-zero.
|
||||
</value>
|
||||
<value name="NOAPP">
|
||||
If the application was not found or was not specified.
|
||||
</value>
|
||||
</variable>
|
||||
</variablelist>
|
||||
</description>
|
||||
</application>
|
||||
<application name="ExecIf" language="en_US">
|
||||
<synopsis>
|
||||
Executes dialplan application, conditionally.
|
||||
</synopsis>
|
||||
<syntax argsep="?">
|
||||
<parameter name="expression" required="true" />
|
||||
<parameter name="execapp" required="true" argsep=":">
|
||||
<argument name="appiftrue" required="true" hasparams="true">
|
||||
<argument name="args" required="true" />
|
||||
</argument>
|
||||
<argument name="appiffalse" required="false" hasparams="true">
|
||||
<argument name="args" required="true" />
|
||||
</argument>
|
||||
</parameter>
|
||||
</syntax>
|
||||
<description>
|
||||
<para>If <replaceable>expr</replaceable> is true, execute and return the
|
||||
result of <replaceable>appiftrue(args)</replaceable>.</para>
|
||||
<para>If <replaceable>expr</replaceable> is true, but <replaceable>appiftrue</replaceable> is not found,
|
||||
then the application will return a non-zero value.</para>
|
||||
</description>
|
||||
</application>
|
||||
***/
|
||||
|
||||
/* Maximum length of any variable */
|
||||
#define MAXRESULT 1024
|
||||
|
||||
@@ -52,35 +126,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
*/
|
||||
|
||||
static char *app_exec = "Exec";
|
||||
static char *exec_synopsis = "Executes dialplan application";
|
||||
static char *exec_descrip =
|
||||
" Exec(appname(arguments)):\n"
|
||||
"Allows an arbitrary application to be invoked even when not\n"
|
||||
"hardcoded into the dialplan. If the underlying application\n"
|
||||
"terminates the dialplan, or if the application cannot be found,\n"
|
||||
"Exec will terminate the dialplan.\n"
|
||||
" To invoke external applications, see the application System.\n"
|
||||
" If you would like to catch any error instead, see TryExec.\n";
|
||||
|
||||
static char *app_tryexec = "TryExec";
|
||||
static char *tryexec_synopsis = "Executes dialplan application, always returning";
|
||||
static char *tryexec_descrip =
|
||||
" TryExec(appname(arguments)):\n"
|
||||
"Allows an arbitrary application to be invoked even when not\n"
|
||||
"hardcoded into the dialplan. To invoke external applications\n"
|
||||
"see the application System. Always returns to the dialplan.\n"
|
||||
"The channel variable TRYSTATUS will be set to one of:\n"
|
||||
" SUCCESS if the application returned zero\n"
|
||||
" FAILED if the application returned non-zero\n"
|
||||
" NOAPP if the application was not found or was not specified\n";
|
||||
|
||||
static char *app_execif = "ExecIf";
|
||||
static char *execif_synopsis = "Executes dialplan application, conditionally";
|
||||
static char *execif_descrip =
|
||||
" ExecIF (<expr>?<appiftrue>(<args>)[:<appiffalse>(<args>)])\n"
|
||||
"If <expr> is true, execute and return the result of <appiftrue>(<args>).\n"
|
||||
"If <expr> is true, but <appiftrue> is not found, then the application\n"
|
||||
"will return a non-zero value.\n";
|
||||
|
||||
static int exec_exec(struct ast_channel *chan, void *data)
|
||||
{
|
||||
@@ -237,9 +284,9 @@ static int unload_module(void)
|
||||
|
||||
static int load_module(void)
|
||||
{
|
||||
int res = ast_register_application(app_exec, exec_exec, exec_synopsis, exec_descrip);
|
||||
res |= ast_register_application(app_tryexec, tryexec_exec, tryexec_synopsis, tryexec_descrip);
|
||||
res |= ast_register_application(app_execif, execif_exec, execif_synopsis, execif_descrip);
|
||||
int res = ast_register_application_xml(app_exec, exec_exec);
|
||||
res |= ast_register_application_xml(app_tryexec, tryexec_exec);
|
||||
res |= ast_register_application_xml(app_execif, execif_exec);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user