Asterisk - The Open Source Telephony Project GIT-master-754dea3
|
Stack applications Gosub, Return, etc. More...
#include "asterisk.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/app.h"
#include "asterisk/manager.h"
#include "asterisk/channel.h"
#include "asterisk/agi.h"
#include "asterisk/stasis_channels.h"
Go to the source code of this file.
Data Structures | |
struct | gosub_stack_frame |
struct | gosub_stack_list |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
static void | balance_stack (struct ast_channel *chan) |
static const char * | expand_gosub_args (struct ast_channel *chan, const char *args) |
static int | frame_set_var (struct ast_channel *chan, struct gosub_stack_frame *frame, const char *var, const char *value) |
static struct gosub_stack_frame * | gosub_allocate_frame (const char *context, const char *extension, int priority, int in_subroutine, unsigned char arguments) |
static int | gosub_exec (struct ast_channel *chan, const char *data) |
static void | gosub_free (void *data) |
static void | gosub_release_frame (struct ast_channel *chan, struct gosub_stack_frame *frame) |
static int | gosub_run (struct ast_channel *chan, const char *sub_args, int ignore_hangup) |
static int | gosubif_exec (struct ast_channel *chan, const char *data) |
static int | handle_gosub (struct ast_channel *chan, AGI *agi, int argc, const char *const *argv) |
static int | load_module (void) |
static int | local_read (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
static int | local_write (struct ast_channel *chan, const char *cmd, char *var, const char *value) |
static int | peek_read (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
static int | pop_exec (struct ast_channel *chan, const char *data) |
static int | return_exec (struct ast_channel *chan, const char *data) |
static int | stackpeek_read (struct ast_channel *chan, const char *cmd, char *data, struct ast_str **str, ssize_t len) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT | AST_MODFLAG_LOAD_ORDER , .description = "Dialplan subroutines (Gosub, Return, etc)" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_APP_DEPEND, .optional_modules = "res_agi", } |
static const char | app_gosub [] = "Gosub" |
static const char | app_gosubif [] = "GosubIf" |
static const char | app_pop [] = "StackPop" |
static const char | app_return [] = "Return" |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct agi_command | gosub_agi_command |
static struct ast_custom_function | local_function |
static struct ast_custom_function | peek_function |
static const struct ast_datastore_info | stack_info |
static struct ast_custom_function | stackpeek_function |
Stack applications Gosub, Return, etc.
Definition in file app_stack.c.
|
static |
Definition at line 1346 of file app_stack.c.
|
static |
Definition at line 1346 of file app_stack.c.
struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 1346 of file app_stack.c.
|
static |
Definition at line 951 of file app_stack.c.
References app_gosub, ast_channel_datastore_find(), AST_LIST_LOCK, AST_LIST_REMOVE_HEAD, AST_LIST_UNLOCK, ast_log, ast_datastore::data, gosub_stack_frame::entries, gosub_release_frame(), gosub_stack_frame::is_special, LOG_WARNING, NULL, and stack_info.
Referenced by gosub_run(), and handle_gosub().
|
static |
Definition at line 473 of file app_stack.c.
References args, ast_channel_context(), ast_channel_exten(), ast_channel_lock, ast_channel_unlock, ast_debug, ast_log, ast_malloc, ast_strdupa, ast_strlen_zero(), voicemailpwcheck::context, len(), LOG_WARNING, NULL, and strsep().
Referenced by load_module().
|
static |
Definition at line 283 of file app_stack.c.
References ast_channel_publish_varset(), ast_free, AST_LIST_INSERT_HEAD, AST_LIST_TRAVERSE, ast_malloc, ast_var_assign, ast_var_name(), ast_var_t::entries, len(), NULL, pbx_builtin_pushvar_helper(), pbx_builtin_setvar_helper(), RAII_VAR, value, var, and gosub_stack_frame::varshead.
Referenced by gosub_exec(), and local_write().
|
static |
Definition at line 336 of file app_stack.c.
References gosub_stack_frame::arguments, ast_calloc, ast_copy_string(), AST_LIST_HEAD_INIT_NOLOCK, voicemailpwcheck::context, gosub_stack_frame::in_subroutine, NULL, and priority.
Referenced by gosub_exec().
|
static |
Definition at line 539 of file app_stack.c.
References app_gosub, gosub_stack_frame::arguments, AST_APP_ARG, ast_calloc, ast_channel_caller(), ast_channel_context(), ast_channel_context_set(), ast_channel_datastore_add(), ast_channel_datastore_find(), ast_channel_exten(), ast_channel_exten_set(), ast_channel_flags(), ast_channel_lock, ast_channel_name(), ast_channel_priority(), ast_channel_priority_set(), ast_channel_unlock, ast_datastore_alloc, ast_datastore_free(), ast_debug, AST_DECLARE_APP_ARGS, ast_exists_extension(), AST_FLAG_IN_AUTOLOOP, AST_FLAG_SUBROUTINE_EXEC, AST_LIST_FIRST, AST_LIST_HEAD_INIT, AST_LIST_INSERT_HEAD, AST_LIST_LOCK, AST_LIST_UNLOCK, ast_log, ast_parseable_goto(), ast_set_flag, AST_STANDARD_RAW_ARGS, ast_strdupa, ast_strlen_zero(), ast_test_flag, ast_datastore::data, gosub_stack_frame::entries, frame_set_var(), gosub_allocate_frame(), LOG_ERROR, LOG_WARNING, NULL, orig_exten(), S_COR, stack_info, and strsep().
Referenced by gosub_run(), gosubif_exec(), handle_gosub(), and load_module().
|
static |
Definition at line 354 of file app_stack.c.
References ast_free, AST_LIST_HEAD_DESTROY, AST_LIST_LOCK, AST_LIST_REMOVE_HEAD, AST_LIST_UNLOCK, gosub_stack_frame::entries, gosub_release_frame(), and NULL.
|
static |
Definition at line 317 of file app_stack.c.
References ast_free, AST_LIST_REMOVE_HEAD, ast_var_delete(), ast_var_name(), ast_var_t::entries, NULL, pbx_builtin_setvar_helper(), and gosub_stack_frame::varshead.
Referenced by balance_stack(), gosub_free(), pop_exec(), and return_exec().
|
static |
Definition at line 991 of file app_stack.c.
References app_gosub, ast_channel_caller(), ast_channel_clear_softhangup(), ast_channel_context(), ast_channel_context_set(), ast_channel_datastore_find(), ast_channel_exten(), ast_channel_exten_set(), ast_channel_flags(), ast_channel_lock, ast_channel_name(), ast_channel_priority(), ast_channel_priority_set(), ast_channel_softhangup_internal_flag(), ast_channel_unlock, ast_check_hangup(), ast_debug, AST_FLAG_IN_AUTOLOOP, AST_FLAG_SUBROUTINE_EXEC, AST_LIST_FIRST, ast_log, ast_set2_flag, ast_set_flag, AST_SOFTHANGUP_ASYNCGOTO, ast_softhangup_nolock(), ast_spawn_extension(), ast_strdupa, ast_test_flag, ast_verb, balance_stack(), ast_datastore::data, gosub_exec(), ignore_hangup, gosub_stack_frame::is_special, LOG_ERROR, LOG_WARNING, NULL, pbx_builtin_getvar_helper(), pbx_builtin_setvar_helper(), S_COR, S_OR, and stack_info.
Referenced by load_module().
|
static |
Definition at line 697 of file app_stack.c.
References args, AST_APP_ARG, AST_DECLARE_APP_ARGS, ast_log, AST_NONSTANDARD_RAW_ARGS, ast_strdupa, ast_strlen_zero(), cond, gosub_exec(), LOG_WARNING, and pbx_checkcondition().
Referenced by load_module().
|
static |
Definition at line 1139 of file app_stack.c.
References app_gosub, args, ast_agi_send(), ast_asprintf, ast_channel_caller(), ast_channel_context(), ast_channel_context_set(), ast_channel_datastore_find(), ast_channel_exten(), ast_channel_exten_set(), ast_channel_flags(), ast_channel_lock, ast_channel_name(), ast_channel_pbx(), ast_channel_pbx_set(), ast_channel_priority(), ast_channel_priority_set(), ast_channel_unlock, ast_debug, ast_exists_extension(), ast_findlabel_extension(), AST_FLAG_IN_AUTOLOOP, AST_FLAG_SUBROUTINE_EXEC, ast_free, AST_LIST_FIRST, ast_log, ast_pbx_run_args(), ast_set2_flag, ast_set_flag, ast_strdupa, ast_test_flag, ast_verb, balance_stack(), ast_datastore::data, agi_state::fd, gosub_exec(), gosub_stack_frame::is_special, LOG_ERROR, LOG_NOTICE, NULL, pbx_builtin_getvar_helper(), pbx_builtin_setvar_helper(), priority, RESULT_FAILURE, RESULT_SHOWUSAGE, RESULT_SUCCESS, S_COR, S_OR, and stack_info.
|
static |
Definition at line 1316 of file app_stack.c.
References app_gosub, app_gosubif, app_pop, app_return, ast_agi_register(), ast_custom_function_register, ast_install_stack_functions(), ast_register_application_xml, expand_gosub_args(), gosub_agi_command, gosub_exec(), gosub_run(), gosubif_exec(), local_function, ast_app_stack_funcs::module, peek_function, pop_exec(), return_exec(), ast_app_stack_funcs::run_sub, ast_module_info::self, and stackpeek_function.
|
static |
Definition at line 734 of file app_stack.c.
References ast_channel_datastore_find(), ast_channel_lock, ast_channel_unlock, ast_copy_string(), AST_LIST_FIRST, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_log, ast_var_name(), buf, ast_datastore::data, ast_var_t::entries, len(), LOG_WARNING, NULL, pbx_builtin_getvar_helper(), S_OR, stack_info, and gosub_stack_frame::varshead.
|
static |
Definition at line 774 of file app_stack.c.
References ast_channel_datastore_find(), ast_channel_lock, ast_channel_unlock, AST_LIST_FIRST, AST_LIST_LOCK, AST_LIST_UNLOCK, ast_log, ast_datastore::data, frame_set_var(), LOG_ERROR, LOG_WARNING, NULL, stack_info, value, and var.
|
static |
Definition at line 812 of file app_stack.c.
References args, AST_APP_ARG, ast_channel_lock, ast_channel_unlock, ast_channel_varshead(), ast_copy_string(), AST_DECLARE_APP_ARGS, AST_LIST_TRAVERSE, ast_log, AST_STANDARD_RAW_ARGS, ast_strlen_zero(), ast_var_name(), ast_var_value(), buf, ast_var_t::entries, len(), LOG_ERROR, and name.
|
static |
Definition at line 368 of file app_stack.c.
References app_pop, ast_channel_datastore_find(), ast_channel_lock, ast_channel_unlock, ast_debug, AST_LIST_FIRST, AST_LIST_LOCK, AST_LIST_REMOVE_HEAD, AST_LIST_UNLOCK, ast_log, ast_datastore::data, gosub_release_frame(), gosub_stack_frame::is_special, LOG_WARNING, NULL, and stack_info.
Referenced by load_module().
|
static |
Definition at line 403 of file app_stack.c.
References ast_channel_context_set(), ast_channel_datastore_find(), ast_channel_exten_set(), ast_channel_flags(), ast_channel_lock, ast_channel_priority_set(), ast_channel_unlock, AST_FLAG_IN_AUTOLOOP, AST_FLAG_SUBROUTINE_EXEC, AST_LIST_LOCK, AST_LIST_REMOVE_HEAD, AST_LIST_UNLOCK, ast_log, ast_set2_flag, ast_test_flag, gosub_stack_frame::context, ast_datastore::data, gosub_stack_frame::extension, gosub_release_frame(), gosub_stack_frame::in_subroutine, gosub_stack_frame::is_special, LOG_ERROR, NULL, pbx_builtin_setvar_helper(), gosub_stack_frame::priority, S_OR, and stack_info.
Referenced by load_module().
|
static |
Definition at line 852 of file app_stack.c.
References args, AST_APP_ARG, ast_channel_datastore_find(), ast_channel_lock, ast_channel_unlock, AST_DECLARE_APP_ARGS, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_log, ast_skip_blanks(), AST_STANDARD_APP_ARGS, ast_str_set(), ast_strdupa, ast_strlen_zero(), ast_true(), gosub_stack_frame::context, ast_datastore::data, gosub_stack_frame::entries, gosub_stack_frame::extension, len(), LOG_ERROR, NULL, gosub_stack_frame::priority, stack_info, and str.
|
static |
Definition at line 1299 of file app_stack.c.
References app_gosub, app_gosubif, app_pop, app_return, ast_agi_unregister(), ast_custom_function_unregister(), ast_install_stack_functions(), ast_unregister_application(), gosub_agi_command, local_function, NULL, peek_function, and stackpeek_function.
|
static |
Definition at line 1346 of file app_stack.c.
|
static |
Definition at line 255 of file app_stack.c.
Referenced by balance_stack(), gosub_exec(), gosub_run(), handle_gosub(), load_module(), and unload_module().
|
static |
Definition at line 256 of file app_stack.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 258 of file app_stack.c.
Referenced by load_module(), pop_exec(), and unload_module().
|
static |
Definition at line 257 of file app_stack.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 1346 of file app_stack.c.
|
static |
Definition at line 1296 of file app_stack.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 806 of file app_stack.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 847 of file app_stack.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 262 of file app_stack.c.
Referenced by balance_stack(), gosub_exec(), gosub_run(), handle_gosub(), local_read(), local_write(), pop_exec(), return_exec(), and stackpeek_read().
|
static |
Definition at line 937 of file app_stack.c.
Referenced by load_module(), and unload_module().