[asterisk-commits] tilghman: branch 1.6.2 r229354 - in /branches/1.6.2: ./ apps/app_stack.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Nov 10 15:33:43 CST 2009


Author: tilghman
Date: Tue Nov 10 15:33:40 2009
New Revision: 229354

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=229354
Log:
Merged revisions 229351 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
  r229351 | tilghman | 2009-11-10 15:22:50 -0600 (Tue, 10 Nov 2009) | 7 lines
  
  When GOSUB is invoked within an AGI, it may not exit correctly.
  (closes issue #16216)
   Reported by: atis
   Patches: 
         20091110__atis_work.diff.txt uploaded by tilghman (license 14)
   Tested by: atis
........

Modified:
    branches/1.6.2/   (props changed)
    branches/1.6.2/apps/app_stack.c

Propchange: branches/1.6.2/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.2/apps/app_stack.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/apps/app_stack.c?view=diff&rev=229354&r1=229353&r2=229354
==============================================================================
--- branches/1.6.2/apps/app_stack.c (original)
+++ branches/1.6.2/apps/app_stack.c Tue Nov 10 15:33:40 2009
@@ -184,6 +184,7 @@
 	unsigned char arguments;
 	struct varshead varshead;
 	int priority;
+	unsigned int is_agi:1;
 	char *context;
 	char extension[0];
 };
@@ -296,6 +297,7 @@
 	struct gosub_stack_frame *oldframe;
 	AST_LIST_HEAD(, gosub_stack_frame) *oldlist;
 	char *retval = data;
+	int res = 0;
 
 	if (!stack_store) {
 		ast_log(LOG_ERROR, "Return without Gosub: stack is unallocated\n");
@@ -310,6 +312,9 @@
 	if (!oldframe) {
 		ast_log(LOG_ERROR, "Return without Gosub: stack is empty\n");
 		return -1;
+	} else if (oldframe->is_agi) {
+		/* Exit from AGI */
+		res = -1;
 	}
 
 	ast_explicit_goto(chan, oldframe->context, oldframe->extension, oldframe->priority);
@@ -317,7 +322,7 @@
 
 	/* Set a return value, if any */
 	pbx_builtin_setvar_helper(chan, "GOSUB_RETVAL", S_OR(retval, ""));
-	return 0;
+	return res;
 }
 
 static int gosub_exec(struct ast_channel *chan, void *data)
@@ -604,6 +609,11 @@
 		if ((res = pbx_exec(chan, theapp, gosub_args)) == 0) {
 			struct ast_pbx *pbx = chan->pbx;
 			struct ast_pbx_args args;
+			struct ast_datastore *stack_store = ast_channel_datastore_find(chan, &stack_info, NULL);
+			AST_LIST_HEAD(, gosub_stack_frame) *oldlist = stack_store->data;
+			struct gosub_stack_frame *cur = AST_LIST_FIRST(oldlist);
+			cur->is_agi = 1;
+
 			memset(&args, 0, sizeof(args));
 			args.no_hangup_chan = 1;
 			/* Suppress warning about PBX already existing */




More information about the asterisk-commits mailing list