Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
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... More... | |
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.
References app.
Referenced by __stasis_app_register(), app_exec(), app_handle_subscriptions(), app_subscribe(), app_unsubscribe(), application_tuple_alloc(), ast_ari_callback(), ast_bridge_channel_queue_app(), ast_bridge_channel_run_app(), ast_bridge_channel_write_app(), ast_json_dialplan_cep_app(), ast_pbx_exec_application(), AST_TEST_DEFINE(), bridge_stasis_run_cb(), device_state_subscription_create(), device_to_json_cb(), dynamic_dtmf_hook_add(), find_app_by_name(), handle_exec(), is_app_subscribed(), lua_pbx_exec(), lua_pbx_findapp(), messaging_app_subscribe_endpoint(), messaging_app_unsubscribe_endpoint(), payload_helper_app(), pbx_extension_helper(), run_app_helper(), stasis_app_control_move(), stasis_app_event_allowed(), stasis_app_exec(), stasis_app_get_debug_by_name(), stasis_app_message_handler(), stasis_app_register(), stasis_app_register_all(), stasis_app_send(), stasis_app_set_debug_by_name(), stasis_app_set_global_debug(), stasis_app_subscribe(), stasis_app_subscribe_channel(), stasis_app_to_json(), stasis_app_unregister(), stasis_app_unsubscribe(), and stasis_app_user_event().
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_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 app, app_name(), ast_channel_publish_snapshot(), ast_free, ast_log, ast_str_buffer(), ast_str_create, ast_str_substitute_variables(), ast_strlen_zero(), LOG_WARNING, NULL, pbx_exec(), and pbx_findapp().
Referenced by answer_exec_run(), conf_kick_all(), conf_run(), disa_exec(), dundi_exec(), pbx_builtin_execiftime(), run_app_helper(), 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 app, 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::description, execute(), LOG_WARNING, pbx_findapp_nolock(), ast_app::seealso, synopsis, 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 app, 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 |
'show application' CLI command implementation function...
Definition at line 260 of file pbx_app.c.
References a, app, 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, NULL, print_app_docs(), and ast_cli_entry::usage.
|
static |
Definition at line 310 of file pbx_app.c.
References a, 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, NULL, strcasestr(), ast_app::synopsis, and ast_cli_entry::usage.
int load_pbx_app | ( | void | ) |
Provided by pbx_app.c
Definition at line 538 of file pbx_app.c.
References app_cli, 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 |
app | Application |
data | Data for execution |
Definition at line 471 of file pbx_app.c.
References __ast_module_user_add(), __ast_module_user_remove(), app, ast_channel_appl(), ast_channel_appl_set(), ast_channel_data(), ast_channel_data_set(), ast_channel_lock, ast_channel_publish_snapshot(), ast_channel_unlock, c, NULL, and S_OR.
Referenced by aelsub_exec(), ari_channel_thread(), ari_originate_dial(), ast_pbx_exec_application(), AST_TEST_DEFINE(), bridge_stasis_run_cb(), conf_run(), conf_start_record(), exec_exec(), execif_exec(), forward_message(), handle_exec(), iax2_exec(), lua_pbx_exec(), page_exec(), pbx_extension_helper(), pbx_outgoing_exec(), realtime_exec(), 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 app, AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, and pbx_findapp_nolock().
Referenced by ast_pbx_exec_application().
|
static |
Definition at line 69 of file pbx_app.c.
References AST_RWLIST_TRAVERSE, name, 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, synopsis, ast_app::synopsis, and ast_app::syntax.
Referenced by handle_show_application().
|
static |
Definition at line 533 of file pbx_app.c.
References app_cli, ARRAY_LEN, and ast_cli_unregister_multiple().
Referenced by load_pbx_app().
|
static |
Definition at line 528 of file pbx_app.c.
Referenced by load_pbx_app(), and unload_pbx_app().
|
static |
Referenced by ari_show_apps(), and stasis_app_get_all().