Asterisk - The Open Source Telephony Project
18.5.0
|
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_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) |
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 _ast_bridge_channel_unlock(), app_exec(), app_subscribe(), app_unsubscribe(), ast_ari_callback(), AST_TEST_DEFINE(), bridge_stasis_run_cb(), 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 app, ast_cli_completion_add(), AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, ast_strdup, and NULL.
Referenced by handle_orig(), and handle_show_application().
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_free, ast_log, ast_module_name(), AST_RWLIST_INSERT_BEFORE_CURRENT, AST_RWLIST_INSERT_TAIL, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, AST_STATIC_DOC, ast_string_field_init, ast_string_field_set, ast_strlen_zero, ast_verb, AST_XML_DOC, ast_xmldoc_build_arguments(), ast_xmldoc_build_description(), ast_xmldoc_build_seealso(), ast_xmldoc_build_synopsis(), ast_xmldoc_build_syntax(), COLOR_BRCYAN, COLORIZE, COLORIZE_FMT, ast_app::docsrc, ast_app::execute, LOG_WARNING, pbx_findapp_nolock(), ast_app::seealso, ast_app::syntax, and tmp().
Referenced by ast_msg_init(), load_module(), 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_free, ast_rdlock_contexts(), AST_RWLIST_REMOVE_CURRENT, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_string_field_free_memory, ast_unlock_contexts(), ast_verb, NULL, and unreference_cached_app().
Referenced by __unload_module(), load_module(), message_shutdown(), unload_module(), unload_parking_applications(), unload_pbx_builtins(), and unload_pbx_variables().
|
static |
Definition at line 260 of file pbx_app.c.
References app, ast_cli_args::argc, ast_cli_args::argv, ast_cli(), ast_complete_applications(), AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, ast_cli_args::line, NULL, print_app_docs(), ast_cli_entry::usage, and ast_cli_args::word.
|
static |
Definition at line 310 of file pbx_app.c.
References ast_cli_args::argc, ast_cli_args::argv, ast_cli(), AST_RWLIST_EMPTY, AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, ast_app::description, ast_cli_args::fd, NULL, strcasestr(), ast_app::synopsis, and ast_cli_entry::usage.
int load_pbx_app | ( | void | ) |
Provided by pbx_app.c
Definition at line 511 of file pbx_app.c.
References ARRAY_LEN, ast_cli_register_multiple, ast_register_cleanup(), and unload_pbx_app().
Referenced by asterisk_daemon().
int pbx_exec | ( | struct ast_channel * | c, |
struct ast_app * | app, | ||
const char * | data | ||
) |
Execute an application.
c | channel to execute on |
app | which app to execute |
data | the data passed into the app |
This application executes an application on a given channel. It saves the stack and executes the given application passing in the given data.
0 | success |
-1 | failure |
c | Channel |
app | Application |
data | Data for execution |
Definition at line 471 of file pbx_app.c.
References __ast_module_user_add(), __ast_module_user_remove(), ast_channel_appl(), ast_channel_appl_set(), ast_channel_data(), ast_channel_data_set(), ast_channel_lock, ast_channel_publish_snapshot(), ast_channel_unlock, ast_app::execute, NULL, and S_OR.
Referenced by aelsub_exec(), answer_exec_run(), ari_channel_thread(), ari_originate_dial(), ast_app_exec_macro(), AST_TEST_DEFINE(), bridge_check_monitor(), bridge_stasis_run_cb(), conf_run(), conf_start_record(), disa_exec(), do_magic_pickup(), dundi_exec(), exec_exec(), execif_exec(), forward_message(), handle_exec(), iax2_exec(), lua_pbx_exec(), page_exec(), pbx_builtin_execiftime(), pbx_extension_helper(), pbx_outgoing_exec(), realtime_exec(), run_app_helper(), snoop_stasis_thread(), try_calling(), and tryexec_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, AST_RWLIST_UNLOCK, and pbx_findapp_nolock().
|
static |
Definition at line 69 of file pbx_app.c.
References AST_RWLIST_TRAVERSE, and NULL.
Referenced by ast_register_application2(), and pbx_findapp().
|
static |
Definition at line 192 of file pbx_app.c.
References ast_app::arguments, ast_cli(), ast_free, ast_term_color(), ast_term_reset(), AST_XML_DOC, ast_xmldoc_printable(), COLOR_CYAN, COLOR_MAGENTA, COLORIZE, COLORIZE_FMT, ast_app::description, ast_app::docsrc, NULL, S_OR, ast_app::seealso, ast_app::synopsis, and ast_app::syntax.
Referenced by handle_show_application().
|
static |
Definition at line 506 of file pbx_app.c.
References ARRAY_LEN, and ast_cli_unregister_multiple().
Referenced by load_pbx_app().
|
static |
|
static |
Referenced by ari_show_apps(), and stasis_app_get_all().