Index: pbx.c
===================================================================
RCS file: /usr/cvsroot/asterisk/pbx.c,v
retrieving revision 1.8
diff -u -r1.8 pbx.c
--- pbx.c	3 Apr 2003 07:35:14 -0000	1.8
+++ pbx.c	6 Apr 2003 18:36:17 -0000
@@ -1428,7 +1428,6 @@
 	char exten[256];
 	int pos;
 	int waittime;
-	int res=0;
 
 	/* A little initial setup here */
 	if (c->pbx)
@@ -1479,17 +1478,17 @@
 				"Extension: %s\r\n"
 				"Priority: %d\r\n",
 				c->name, c->context, c->exten, c->priority);			
-			if ((res = ast_spawn_extension(c, c->context, c->exten, c->priority, c->callerid))) {
+			if ((c->res = ast_spawn_extension(c, c->context, c->exten, c->priority, c->callerid))) {
 				/* Something bad happened, or a hangup has been requested. */
-				if (((res >= '0') && (res <= '9')) || ((res >= 'A') && (res <= 'F')) ||
-					(res == '*') || (res == '#')) {
-					ast_log(LOG_DEBUG, "Oooh, got something to jump out with ('%c')!\n", res);
+				if (((c->res >= '0') && (c->res <= '9')) || ((c->res >= 'A') && (c->res <= 'F')) ||
+					(c->res == '*') || (c->res == '#')) {
+					ast_log(LOG_DEBUG, "Oooh, got something to jump out with ('%c')!\n", c->res);
 					memset(exten, 0, sizeof(exten));
 					pos = 0;
-					exten[pos++] = digit = res;
+					exten[pos++] = digit = c->res;
 					break;
 				}
-				switch(res) {
+				switch(c->res) {
 				case AST_PBX_KEEPALIVE:
 					if (option_debug)
 						ast_log(LOG_DEBUG, "Spawn extension (%s,%s,%d) exited KEEPALIVE on '%s'\n", c->context, c->exten, c->priority, c->name);
@@ -1602,7 +1601,7 @@
 		strcpy(c->exten, "h");
 		c->priority = 1;
 		while(ast_exists_extension(c, c->context, c->exten, c->priority, c->callerid)) {
-			if ((res = ast_spawn_extension(c, c->context, c->exten, c->priority, c->callerid))) {
+			if ((c->res = ast_spawn_extension(c, c->context, c->exten, c->priority, c->callerid))) {
 				/* Something bad happened, or a hangup has been requested. */
 				if (option_debug)
 					ast_log(LOG_DEBUG, "Spawn extension (%s,%s,%d) exited non-zero on '%s'\n", c->context, c->exten, c->priority, c->name);
@@ -1616,7 +1615,7 @@
 
 	pbx_destroy(c->pbx);
 	c->pbx = NULL;
-	if (res != AST_PBX_KEEPALIVE)
+	if (c->res != AST_PBX_KEEPALIVE)
 		ast_hangup(c);
 	return 0;
 }
Index: include/asterisk/channel.h
===================================================================
RCS file: /usr/cvsroot/asterisk/include/asterisk/channel.h,v
retrieving revision 1.3
diff -u -r1.3 channel.h
--- include/asterisk/channel.h	30 Mar 2003 22:55:42 -0000	1.3
+++ include/asterisk/channel.h	6 Apr 2003 18:36:18 -0000
@@ -99,6 +99,8 @@
 	char *appl;				
 	/*! Data passed to current application */
 	char *data;				
+	/*! Result code from the prior executed application */
+	int res;
 	
 	/*! Has an exception been detected */
 	int exception;				
