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"
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) |
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, 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 = "ac1f6a56484a8820659555499174e588" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_APP_DEPEND, .nonoptreq = "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 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 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 1274 of file app_stack.c.
|
static |
Definition at line 1274 of file app_stack.c.
|
static |
Definition at line 895 of file app_stack.c.
References 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, and LOG_WARNING.
Referenced by gosub_run(), and handle_gosub().
|
static |
Definition at line 419 of file app_stack.c.
References ast_channel_lock, ast_channel_unlock, ast_debug, ast_log(), ast_malloc, ast_strdupa, ast_strlen_zero(), gosub_stack_frame::context, ast_channel::context, exten, ast_channel::exten, len(), LOG_WARNING, parse(), and strsep().
Referenced by load_module().
|
static |
Definition at line 234 of file app_stack.c.
References AST_LIST_INSERT_HEAD, AST_LIST_TRAVERSE, ast_var_assign(), ast_var_name(), EVENT_FLAG_DIALPLAN, manager_event, pbx_builtin_pushvar_helper(), and pbx_builtin_setvar_helper().
Referenced by gosub_exec(), and local_write().
|
static |
Definition at line 284 of file app_stack.c.
References gosub_stack_frame::arguments, ast_calloc, AST_LIST_HEAD_INIT_NOLOCK, and gosub_stack_frame::priority.
Referenced by gosub_exec().
|
static |
Definition at line 485 of file app_stack.c.
References gosub_stack_frame::arguments, AST_APP_ARG, ast_calloc, ast_channel_datastore_add(), ast_channel_datastore_find(), ast_channel_lock, ast_channel_unlock, ast_copy_string(), ast_datastore_alloc(), ast_datastore_free(), ast_debug, AST_DECLARE_APP_ARGS, ast_exists_extension(), AST_FLAG_IN_AUTOLOOP, AST_LIST_FIRST, AST_LIST_HEAD_INIT, AST_LIST_INSERT_HEAD, AST_LIST_LOCK, AST_LIST_UNLOCK, ast_log(), ast_parseable_goto(), AST_STANDARD_RAW_ARGS, ast_strdupa, ast_strlen_zero(), ast_test_flag, ast_channel::caller, ast_channel::context, ast_datastore::data, gosub_stack_frame::entries, ast_channel::exten, frame_set_var(), gosub_allocate_frame(), ast_party_caller::id, LOG_ERROR, LOG_WARNING, ast_channel::name, ast_party_id::number, orig_exten(), parse(), ast_channel::priority, S_COR, ast_party_number::str, strsep(), and ast_party_number::valid.
Referenced by gosub_run(), gosubif_exec(), handle_gosub(), and load_module().
|
static |
Definition at line 300 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, and gosub_release_frame().
|
static |
Definition at line 265 of file app_stack.c.
References ast_free, AST_LIST_REMOVE_HEAD, ast_var_delete(), ast_var_name(), gosub_stack_frame::entries, pbx_builtin_setvar_helper(), and gosub_stack_frame::varshead.
Referenced by balance_stack(), gosub_free(), pop_exec(), and return_exec().
|
static |
Definition at line 936 of file app_stack.c.
References ast_channel::_softhangup, ast_channel_datastore_find(), ast_channel_lock, ast_channel_unlock, ast_check_hangup(), ast_copy_string(), ast_debug, AST_FLAG_IN_AUTOLOOP, AST_LIST_FIRST, ast_log(), ast_set2_flag, ast_set_flag, AST_SOFTHANGUP_ASYNCGOTO, ast_softhangup_nolock(), AST_SOFTHANGUP_UNBRIDGE, ast_spawn_extension(), ast_strdupa, ast_test_flag, ast_verb, balance_stack(), ast_channel::caller, ast_channel::context, ast_datastore::data, ast_channel::exten, gosub_exec(), ast_party_caller::id, gosub_stack_frame::is_special, LOG_ERROR, LOG_NOTICE, ast_channel::name, ast_party_id::number, pbx_builtin_getvar_helper(), pbx_builtin_setvar_helper(), ast_channel::priority, S_COR, S_OR, ast_party_number::str, and ast_party_number::valid.
Referenced by load_module().
|
static |
Definition at line 638 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 1075 of file app_stack.c.
References ast_agi_send(), ast_asprintf, ast_channel_datastore_find(), ast_channel_lock, ast_channel_unlock, ast_copy_string(), ast_debug, ast_exists_extension(), ast_findlabel_extension(), AST_FLAG_IN_AUTOLOOP, 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_channel::caller, ast_channel::context, ast_datastore::data, ast_channel::exten, agi_state::fd, free, gosub_exec(), ast_party_caller::id, gosub_stack_frame::is_special, LOG_ERROR, LOG_NOTICE, ast_channel::name, ast_pbx_args::no_hangup_chan, ast_party_id::number, ast_channel::pbx, pbx_builtin_getvar_helper(), pbx_builtin_setvar_helper(), gosub_stack_frame::priority, ast_channel::priority, RESULT_FAILURE, RESULT_SHOWUSAGE, RESULT_SUCCESS, S_COR, S_OR, ast_party_number::str, and ast_party_number::valid.
|
static |
Definition at line 1245 of file app_stack.c.
References 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 675 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(), ast_datastore::data, gosub_stack_frame::entries, LOG_WARNING, pbx_builtin_getvar_helper(), S_OR, and gosub_stack_frame::varshead.
|
static |
Definition at line 715 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, and LOG_WARNING.
|
static |
Definition at line 753 of file app_stack.c.
References args, AST_APP_ARG, ast_channel_lock, ast_channel_unlock, 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(), gosub_stack_frame::entries, LOG_ERROR, name, and ast_channel::varshead.
|
static |
Definition at line 314 of file app_stack.c.
References 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_stack_frame::entries, gosub_release_frame(), gosub_stack_frame::is_special, and LOG_WARNING.
Referenced by load_module().
|
static |
Definition at line 349 of file app_stack.c.
References ast_channel_datastore_find(), ast_channel_lock, ast_channel_unlock, ast_copy_string(), AST_FLAG_IN_AUTOLOOP, AST_LIST_LOCK, AST_LIST_REMOVE_HEAD, AST_LIST_UNLOCK, ast_log(), ast_test_flag, gosub_stack_frame::context, ast_channel::context, ast_datastore::data, gosub_stack_frame::entries, ast_channel::exten, gosub_stack_frame::extension, gosub_release_frame(), gosub_stack_frame::is_special, LOG_ERROR, pbx_builtin_setvar_helper(), gosub_stack_frame::priority, ast_channel::priority, and S_OR.
Referenced by load_module().
|
static |
Definition at line 793 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, LOG_ERROR, and gosub_stack_frame::priority.
|
static |
Definition at line 1228 of file app_stack.c.
References ast_agi_unregister(), ast_custom_function_unregister(), ast_install_stack_functions(), ast_unregister_application(), gosub_agi_command, local_function, peek_function, ast_module_info::self, and stackpeek_function.
|
static |
Definition at line 1274 of file app_stack.c.
|
static |
Definition at line 208 of file app_stack.c.
|
static |
Definition at line 209 of file app_stack.c.
|
static |
Definition at line 211 of file app_stack.c.
|
static |
Definition at line 210 of file app_stack.c.
|
static |
Definition at line 1274 of file app_stack.c.
|
static |
Definition at line 1225 of file app_stack.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 747 of file app_stack.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 788 of file app_stack.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 215 of file app_stack.c.
|
static |
Definition at line 878 of file app_stack.c.
Referenced by load_module(), and unload_module().