summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2012-04-20 23:29:56 +0000
committerRichard Mudgett <rmudgett@digium.com>2012-04-20 23:29:56 +0000
commit3a874139d4ae0f38f5d2ffaf470b62d4f120dc2d (patch)
tree619db20b50170f0279246abb8b56124289c83ad8 /apps
parente6d08d92e35e176d02b6d1cc7da3696d2c12e86f (diff)
Fix connected-line/redirecting interception gosubs executing more than intended.
* Redo ast_app_run_sub()/ast_app_exec_sub() to use a known return point so execution will stop after the routine returns there. (s@gosub_virtual_context:1) * Create ast_app_exec_macro() and ast_app_exec_sub() to run the macro and gosub application respectively with the parameter string already created. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@362962 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps')
-rw-r--r--apps/app_stack.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/apps/app_stack.c b/apps/app_stack.c
index 8f7ab0e78..355591e74 100644
--- a/apps/app_stack.c
+++ b/apps/app_stack.c
@@ -801,6 +801,8 @@ static struct agi_command gosub_agi_command =
static int unload_module(void)
{
+ struct ast_context *con;
+
ast_agi_unregister(ast_module_info->self, &gosub_agi_command);
ast_unregister_application(app_return);
@@ -811,11 +813,30 @@ static int unload_module(void)
ast_custom_function_unregister(&peek_function);
ast_custom_function_unregister(&stackpeek_function);
+ con = ast_context_find("gosub_virtual_context");
+ if (con) {
+ /* leave nothing behind */
+ ast_context_remove_extension2(con, "s", 1, NULL, 0);
+ ast_context_destroy(con, "app_stack");
+ }
+
return 0;
}
static int load_module(void)
{
+ struct ast_context *con;
+
+ /* Create internal gosub return target to indicate successful completion. */
+ con = ast_context_find_or_create(NULL, NULL, "gosub_virtual_context", "app_stack");
+ if (!con) {
+ ast_log(LOG_ERROR, "'gosub_virtual_context' does not exist and unable to create\n");
+ } else {
+ ast_add_extension2(con, 1, "s", 1, NULL, NULL, "NoOp",
+ ast_strdup("Internal Gosub call complete GOSUB_RETVAL=${GOSUB_RETVAL}"),
+ ast_free_ptr, "app_stack");
+ }
+
ast_agi_register(ast_module_info->self, &gosub_agi_command);
ast_register_application_xml(app_pop, pop_exec);