Asterisk - The Open Source Telephony Project
21.4.1
|
Custom function management routines. More...
#include "asterisk.h"
#include "asterisk/_private.h"
#include "asterisk/cli.h"
#include "asterisk/linkedlists.h"
#include "asterisk/module.h"
#include "asterisk/pbx.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/strings.h"
#include "asterisk/term.h"
#include "asterisk/utils.h"
#include "asterisk/xmldoc.h"
#include "pbx_private.h"
Go to the source code of this file.
Data Structures | |
struct | apps |
Registered applications container. More... | |
struct | ast_app |
ast_app: A registered application More... | |
Functions | |
const char * | app_name (struct ast_app *app) |
char * | ast_complete_applications (const char *line, const char *word, int state) |
Command completion for the list of installed applications. More... | |
int | ast_pbx_exec_application (struct ast_channel *chan, const char *app_name, const char *app_args) |
Execute an application. More... | |
int | ast_register_application2 (const char *app, int(*execute)(struct ast_channel *, const char *), const char *synopsis, const char *description, void *mod) |
Dynamically register a new dial plan application. More... | |
int | ast_unregister_application (const char *app) |
Unregister an application. More... | |
static char * | handle_show_application (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
'show application' CLI command implementation function... | |
static char * | handle_show_applications (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
int | load_pbx_app (void) |
int | pbx_exec (struct ast_channel *c, struct ast_app *app, const char *data) |
Execute an application. More... | |
struct ast_app * | pbx_findapp (const char *app) |
Look up an application. More... | |
static struct ast_app * | pbx_findapp_nolock (const char *name) |
static void | print_app_docs (struct ast_app *aa, int fd) |
static void | unload_pbx_app (void) |
Variables | |
static struct ast_cli_entry | app_cli [] |
static struct apps | apps = { .first = NULL, .last = NULL, .lock = { PTHREAD_RWLOCK_INITIALIZER , NULL, {1, 0} } , } |
Custom function management routines.
Definition in file pbx_app.c.
const char* app_name | ( | struct ast_app * | app | ) |
pbx_app.c functions needed by pbx.c
Definition at line 463 of file pbx_app.c.
Referenced by app_exec(), handle_exec(), lua_pbx_exec(), lua_pbx_findapp(), pbx_extension_helper(), and stasis_app_set_global_debug().
char* ast_complete_applications | ( | const char * | line, |
const char * | word, | ||
int | state | ||
) |
Command completion for the list of installed applications.
This can be called from a CLI command completion function that wants to complete from the list of available applications.
Definition at line 429 of file pbx_app.c.
References ast_cli_completion_add(), AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, and ast_strdup.
Referenced by handle_orig(), and handle_show_application().
int ast_pbx_exec_application | ( | struct ast_channel * | chan, |
const char * | app_name, | ||
const char * | app_args | ||
) |
Execute an application.
chan | channel to execute on |
app_name | name of app to execute |
app_args | the data passed into the app |
This application executes an application by name on a given channel. It is a wrapper around pbx_exec that will perform variable substitution and then execute the application if it exists. If the application is not found, a warning is logged.
0 | success |
-1 | failure (including application not found) |
Definition at line 501 of file pbx_app.c.
References ast_channel_publish_snapshot(), ast_str_buffer(), ast_str_create, ast_str_substitute_variables(), pbx_exec(), and pbx_findapp().
Referenced by answer_exec_run(), and snoop_stasis_thread().
int ast_register_application2 | ( | const char * | app, |
int(*)(struct ast_channel *, const char *) | execute, | ||
const char * | synopsis, | ||
const char * | description, | ||
void * | mod | ||
) |
Dynamically register a new dial plan application.
Register an application.
Definition at line 103 of file pbx_app.c.
References ast_app::arguments, ast_calloc, ast_module_name(), AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, AST_STATIC_DOC, ast_string_field_init, ast_string_field_set, AST_XML_DOC, ast_xmldoc_build_arguments(), ast_xmldoc_build_description(), ast_xmldoc_build_seealso(), ast_xmldoc_build_synopsis(), ast_xmldoc_build_syntax(), COLORIZE_FMT, ast_app::docsrc, ast_app::seealso, and ast_app::syntax.
Referenced by ast_msg_init(), load_pbx_builtins(), and load_pbx_variables().
int ast_unregister_application | ( | const char * | app | ) |
Unregister an application.
app | name of the application (does not have to be the same string as the one that was registered) |
This unregisters an application from Asterisk's internal application list.
0 | success |
-1 | failure |
Definition at line 392 of file pbx_app.c.
References ast_rdlock_contexts(), AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_string_field_free_memory, ast_unlock_contexts(), and unreference_cached_app().
Referenced by load_module(), unload_module(), and unload_parking_applications().
int load_pbx_app | ( | void | ) |
Provided by pbx_app.c
Definition at line 538 of file pbx_app.c.
References ast_cli_register_multiple, and ast_register_cleanup().
int pbx_exec | ( | struct ast_channel * | c, |
struct ast_app * | app, | ||
const char * | data | ||
) |
Execute an application.
c | Channel |
app | Application |
data | Data for execution |
Definition at line 471 of file pbx_app.c.
References ast_channel_publish_snapshot(), and S_OR.
Referenced by ari_channel_thread(), ari_originate_dial(), ast_pbx_exec_application(), forward_message(), handle_exec(), iax2_exec(), lua_pbx_exec(), pbx_extension_helper(), and pbx_outgoing_exec().
struct ast_app* pbx_findapp | ( | const char * | app | ) |
Look up an application.
app | name of the app |
This function searches for the ast_app structure within the apps that are registered for the one with the name you passed in.
Definition at line 91 of file pbx_app.c.
References AST_RWLIST_RDLOCK, and AST_RWLIST_UNLOCK.
Referenced by ast_pbx_exec_application().
|
static |