[Asterisk-cvs] asterisk/apps app_dial.c, 1.150, 1.151 app_macro.c, 1.22, 1.23

kpfleming at lists.digium.com kpfleming at lists.digium.com
Fri Apr 29 10:14:53 CDT 2005


Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv12139/apps

Modified Files:
	app_dial.c app_macro.c 
Log Message:
make 'goto' APIs aware of auto-processing loops, so they know exactly when to set the requested priority or one priority lower


Index: app_dial.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_dial.c,v
retrieving revision 1.150
retrieving revision 1.151
diff -u -d -r1.150 -r1.151
--- app_dial.c	27 Apr 2005 01:50:53 -0000	1.150
+++ app_dial.c	29 Apr 2005 15:04:26 -0000	1.151
@@ -201,24 +201,19 @@
 } while (0)
 
 
-static int ast_onedigit_goto(struct ast_channel *chan, char *context, char exten, int pri, char *cid) 
+static int onedigit_goto(struct ast_channel *chan, char *context, char exten, int pri) 
 {
-	char rexten[2];
-	snprintf(rexten, 2, "%c", exten);
+	char rexten[2] = { exten, '\0' };
+
 	if (context) {
-		if (ast_exists_extension(chan, context, rexten, pri, cid)) {
-			ast_explicit_goto(chan, context, rexten, pri-1);
+		if (ast_goto_if_exists(chan, context, rexten, pri))
 			return 1;
-		}
 	} else {
-		if (ast_exists_extension(chan, chan->context, rexten, pri, cid)) {
-			ast_explicit_goto(chan, chan->context, rexten, pri-1);
+		if (ast_goto_if_exists(chan, chan->context, rexten, pri))
 			return 1;
-		} else if (!ast_strlen_zero(chan->macrocontext)) {
-			if (ast_exists_extension(chan, chan->macrocontext, rexten, pri, cid)) {
-				ast_explicit_goto(chan, chan->macrocontext, rexten, pri-1);
+		else if (!ast_strlen_zero(chan->macrocontext)) {
+			if (ast_goto_if_exists(chan, chan->macrocontext, rexten, pri))
 				return 1;
-			}
 		}
 	}
 	return 0;
@@ -552,7 +547,7 @@
 			if (f && (f->frametype == AST_FRAME_DTMF)) {
 				if (ast_test_flag(peerflags, DIAL_HALT_ON_DTMF)) {
 					context = pbx_builtin_getvar_helper(in, "EXITCONTEXT");
-					if (ast_onedigit_goto(in, context, (char) f->subclass, 1, in->cid.cid_num)) {
+					if (onedigit_goto(in, context, (char) f->subclass, 1)) {
 						if (option_verbose > 3)
 							ast_verbose(VERBOSE_PREFIX_3 "User hit %c to disconnect call.\n", f->subclass);
 						*to=0;
@@ -1448,7 +1443,7 @@
 		if (res < 0)
 			break;
 		else if (res > 0) { /* Trying to send the call elsewhere (1 digit ext) */
-			if (ast_onedigit_goto(chan, context, (char) res, 1, chan->cid.cid_num)) {
+			if (onedigit_goto(chan, context, (char) res, 1)) {
 				res = 0;
 				break;
 			}

Index: app_macro.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_macro.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- app_macro.c	21 Apr 2005 06:02:43 -0000	1.22
+++ app_macro.c	29 Apr 2005 15:04:26 -0000	1.23
@@ -88,6 +88,7 @@
 	char *offsets;
 	int offset;
 	int setmacrocontext=0;
+	int autoloopflag;
   
 	char *save_macro_exten;
 	char *save_macro_context;
@@ -166,6 +167,8 @@
 		pbx_builtin_setvar_helper(chan, varname, cur);
 		argc++;
 	}
+	autoloopflag = ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP);
+	ast_set_flag(chan, AST_FLAG_IN_AUTOLOOP);
 	while(ast_exists_extension(chan, chan->context, chan->exten, chan->priority, chan->cid.cid_num)) {
 		if ((res = ast_spawn_extension(chan, chan->context, chan->exten, chan->priority, chan->cid.cid_num))) {
 			/* Something bad happened, or a hangup has been requested. */
@@ -208,6 +211,7 @@
 		chan->priority++;
   	}
 	out:
+	ast_set2_flag(chan, autoloopflag, AST_FLAG_IN_AUTOLOOP);
   	for (x=1; x<argc; x++) {
   		/* Restore old arguments and delete ours */
 		snprintf(varname, sizeof(varname), "ARG%d", x);




More information about the svn-commits mailing list