[asterisk-commits] murf: trunk r77520 - in /trunk: apps/app_dial.c pbx/pbx_ael.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jul 27 10:46:21 CDT 2007


Author: murf
Date: Fri Jul 27 10:46:20 2007
New Revision: 77520

URL: http://svn.digium.com/view/asterisk?view=rev&rev=77520
Log:
These fixes take care of two problems: a complaint in asterisk-dev that goto's aren't working in trunk, a side effect of the move to commas as arg seps in apps and funcs; and a problem I spotted myself with dial's 'e' option, where gotos were off by one, because I forgot to set the AUTOLOOP flag in the peer channel.

Modified:
    trunk/apps/app_dial.c
    trunk/pbx/pbx_ael.c

Modified: trunk/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_dial.c?view=diff&rev=77520&r1=77519&r2=77520
==============================================================================
--- trunk/apps/app_dial.c (original)
+++ trunk/apps/app_dial.c Fri Jul 27 10:46:20 2007
@@ -1771,8 +1771,12 @@
 		strcpy(peer->context, chan->context);
 
 		if (ast_test_flag64(&opts, OPT_PEER_H) && ast_exists_extension(peer, peer->context, "h", 1, peer->cid.cid_num)) {
+			int autoloopflag;
 			strcpy(peer->exten, "h");
 			peer->priority = 1;
+			autoloopflag = ast_test_flag(peer, AST_FLAG_IN_AUTOLOOP);	/* save value to restore at the end */
+			ast_set_flag(peer, AST_FLAG_IN_AUTOLOOP);
+			
 			while (ast_exists_extension(peer, peer->context, peer->exten, peer->priority, peer->cid.cid_num)) {
 				if ((res = ast_spawn_extension(peer, peer->context, peer->exten, peer->priority, peer->cid.cid_num))) {
 					/* Something bad happened, or a hangup has been requested. */
@@ -1782,6 +1786,7 @@
 				}
 				peer->priority++;
 			}
+			ast_set2_flag(peer, autoloopflag, AST_FLAG_IN_AUTOLOOP);  /* set it back the way it was */
 		}
 		if (res != AST_PBX_NO_HANGUP_PEER) {
 			if (!chan->_softhangup)

Modified: trunk/pbx/pbx_ael.c
URL: http://svn.digium.com/view/asterisk/trunk/pbx/pbx_ael.c?view=diff&rev=77520&r1=77519&r2=77520
==============================================================================
--- trunk/pbx/pbx_ael.c (original)
+++ trunk/pbx/pbx_ael.c Fri Jul 27 10:46:20 2007
@@ -322,9 +322,9 @@
 	case PV_GOTO:
 		fprintf(fin,"goto %s", item->u1.list->u1.str);
 		if ( item->u1.list->next )
-			fprintf(fin,"|%s", item->u1.list->next->u1.str);
+			fprintf(fin,",%s", item->u1.list->next->u1.str);
 		if ( item->u1.list->next && item->u1.list->next->next )
-			fprintf(fin,"|%s", item->u1.list->next->next->u1.str);
+			fprintf(fin,",%s", item->u1.list->next->next->u1.str);
 		fprintf(fin,"\n");
 		break;
 			
@@ -3094,16 +3094,16 @@
 				if (!mother_exten)
 					pr->appargs = strdup(p->u1.list->u1.str);
 				else {  /* for the case of simple within-extension gotos in case/pattern/default statement blocks: */ 
-					snprintf(buf1,sizeof(buf1),"%s|%s", mother_exten->name, p->u1.list->u1.str);
+					snprintf(buf1,sizeof(buf1),"%s,%s", mother_exten->name, p->u1.list->u1.str);
 					pr->appargs = strdup(buf1);
 				}
 				
 			} else if (p->u1.list->next && !p->u1.list->next->next) /* two */ {
-				snprintf(buf1,sizeof(buf1),"%s|%s", p->u1.list->u1.str, p->u1.list->next->u1.str);
+				snprintf(buf1,sizeof(buf1),"%s,%s", p->u1.list->u1.str, p->u1.list->next->u1.str);
 				pr->app = strdup("Goto");
 				pr->appargs = strdup(buf1);
 			} else if (p->u1.list->next && p->u1.list->next->next) {
-				snprintf(buf1,sizeof(buf1),"%s|%s|%s", p->u1.list->u1.str, 
+				snprintf(buf1,sizeof(buf1),"%s,%s,%s", p->u1.list->u1.str, 
 						p->u1.list->next->u1.str,
 						p->u1.list->next->next->u1.str);
 				pr->app = strdup("Goto");
@@ -3241,7 +3241,7 @@
 			switch_end = new_prio();
 			switch_test->type = AEL_APPCALL;
 			switch_end->type = AEL_APPCALL;
-			snprintf(buf1,sizeof(buf1),"sw-%d-%s|10",control_statement_count, p->u1.str);
+			snprintf(buf1,sizeof(buf1),"sw-%d-%s,10",control_statement_count, p->u1.str);
 			switch_test->app = strdup("Goto");
 			switch_test->appargs = strdup(buf1);
 			snprintf(buf1,sizeof(buf1),"Finish switch-%s-%d", label, control_statement_count);
@@ -3287,7 +3287,7 @@
 							fall_thru = new_prio();
 							fall_thru->type = AEL_APPCALL;
 							fall_thru->app = strdup("Goto");
-							snprintf(buf1,sizeof(buf1),"sw-%d-%s|10",local_control_statement_count, p2->next->u1.str);
+							snprintf(buf1,sizeof(buf1),"sw-%d-%s,10",local_control_statement_count, p2->next->u1.str);
 							fall_thru->appargs = strdup(buf1);
 							linkprio(switch_case, fall_thru);
 						} else if (p2->next && p2->next->type == PV_PATTERN) {
@@ -3295,14 +3295,14 @@
 							fall_thru->type = AEL_APPCALL;
 							fall_thru->app = strdup("Goto");
 							gen_match_to_pattern(p2->next->u1.str, buf2);
-							snprintf(buf1,sizeof(buf1),"sw-%d-%s|10", local_control_statement_count, buf2);
+							snprintf(buf1,sizeof(buf1),"sw-%d-%s,10", local_control_statement_count, buf2);
 							fall_thru->appargs = strdup(buf1);
 							linkprio(switch_case, fall_thru);
 						} else if (p2->next && p2->next->type == PV_DEFAULT) {
 							fall_thru = new_prio();
 							fall_thru->type = AEL_APPCALL;
 							fall_thru->app = strdup("Goto");
-							snprintf(buf1,sizeof(buf1),"sw-%d-.|10",local_control_statement_count);
+							snprintf(buf1,sizeof(buf1),"sw-%d-.,10",local_control_statement_count);
 							fall_thru->appargs = strdup(buf1);
 							linkprio(switch_case, fall_thru);
 						} else if (!p2->next) {
@@ -3350,7 +3350,7 @@
 							fall_thru = new_prio();
 							fall_thru->type = AEL_APPCALL;
 							fall_thru->app = strdup("Goto");
-							snprintf(buf1,sizeof(buf1),"sw-%d-%s|10",local_control_statement_count, p2->next->u1.str);
+							snprintf(buf1,sizeof(buf1),"sw-%d-%s,10",local_control_statement_count, p2->next->u1.str);
 							fall_thru->appargs = strdup(buf1);
 							linkprio(switch_case, fall_thru);
 						} else if (p2->next && p2->next->type == PV_PATTERN) {
@@ -3358,14 +3358,14 @@
 							fall_thru->type = AEL_APPCALL;
 							fall_thru->app = strdup("Goto");
 							gen_match_to_pattern(p2->next->u1.str, buf2);
-							snprintf(buf1,sizeof(buf1),"sw-%d-%s|10",local_control_statement_count, buf2);
+							snprintf(buf1,sizeof(buf1),"sw-%d-%s,10",local_control_statement_count, buf2);
 							fall_thru->appargs = strdup(buf1);
 							linkprio(switch_case, fall_thru);
 						} else if (p2->next && p2->next->type == PV_DEFAULT) {
 							fall_thru = new_prio();
 							fall_thru->type = AEL_APPCALL;
 							fall_thru->app = strdup("Goto");
-							snprintf(buf1,sizeof(buf1),"sw-%d-.|10",local_control_statement_count);
+							snprintf(buf1,sizeof(buf1),"sw-%d-.,10",local_control_statement_count);
 							fall_thru->appargs = strdup(buf1);
 							linkprio(switch_case, fall_thru);
 						} else if (!p2->next) {
@@ -3415,7 +3415,7 @@
 							fall_thru = new_prio();
 							fall_thru->type = AEL_APPCALL;
 							fall_thru->app = strdup("Goto");
-							snprintf(buf1,sizeof(buf1),"sw-%d-%s|10",local_control_statement_count, p2->next->u1.str);
+							snprintf(buf1,sizeof(buf1),"sw-%d-%s,10",local_control_statement_count, p2->next->u1.str);
 							fall_thru->appargs = strdup(buf1);
 							linkprio(switch_case, fall_thru);
 						} else if (p2->next && p2->next->type == PV_PATTERN) {
@@ -3423,14 +3423,14 @@
 							fall_thru->type = AEL_APPCALL;
 							fall_thru->app = strdup("Goto");
 							gen_match_to_pattern(p2->next->u1.str, buf2);
-							snprintf(buf1,sizeof(buf1),"sw-%d-%s|10",local_control_statement_count, buf2);
+							snprintf(buf1,sizeof(buf1),"sw-%d-%s,10",local_control_statement_count, buf2);
 							fall_thru->appargs = strdup(buf1);
 							linkprio(switch_case, fall_thru);
 						} else if (p2->next && p2->next->type == PV_DEFAULT) {
 							fall_thru = new_prio();
 							fall_thru->type = AEL_APPCALL;
 							fall_thru->app = strdup("Goto");
-							snprintf(buf1,sizeof(buf1),"sw-%d-.|10",local_control_statement_count);
+							snprintf(buf1,sizeof(buf1),"sw-%d-.,10",local_control_statement_count);
 							fall_thru->appargs = strdup(buf1);
 							linkprio(switch_case, fall_thru);
 						} else if (!p2->next) {
@@ -3465,7 +3465,7 @@
 		case PV_MACRO_CALL:
 			pr = new_prio();
 			pr->type = AEL_APPCALL;
-			snprintf(buf1,sizeof(buf1),"%s|s|1", p->u1.str);
+			snprintf(buf1,sizeof(buf1),"%s,s,1", p->u1.str);
 			first = 1;
 			for (p2 = p->u2.arglist; p2; p2 = p2->next) {
 				if (first)
@@ -3534,7 +3534,7 @@
 			
 			if_test = new_prio();
 			if_test->type = AEL_IFTIME_CONTROL;
-			snprintf(buf1,sizeof(buf1),"%s|%s|%s|%s",
+			snprintf(buf1,sizeof(buf1),"%s,%s,%s,%s",
 					 p->u1.list->u1.str, 
 					 p->u1.list->next->u1.str, 
 					 p->u1.list->next->next->u1.str, 
@@ -3597,7 +3597,7 @@
 			if_test->type = AEL_IF_CONTROL;
 			if_end->type = AEL_APPCALL;
 			if ( p->type == PV_RANDOM )
-				snprintf(buf1,sizeof(buf1),"$[${RAND(0|99)} < (%s)]",p->u1.str);
+				snprintf(buf1,sizeof(buf1),"$[${RAND(0,99)} < (%s)]",p->u1.str);
 			else
 				snprintf(buf1,sizeof(buf1),"$[%s]",p->u1.str);
 			if_test->app = 0;
@@ -3741,7 +3741,7 @@
 				/* simple, unconditional goto. */
 				strcpy(app,"Goto");
 				if (pr->goto_true->origin && pr->goto_true->origin->type == PV_SWITCH ) {
-					snprintf(appargs,sizeof(appargs),"%s|%d", pr->goto_true->exten->name, pr->goto_true->priority_num);
+					snprintf(appargs,sizeof(appargs),"%s,%d", pr->goto_true->exten->name, pr->goto_true->priority_num);
 				} else if (pr->goto_true->origin && pr->goto_true->origin->type == PV_IFTIME && pr->goto_true->origin->u3.else_statements ) {
 					snprintf(appargs,sizeof(appargs),"%d", pr->goto_true->priority_num+1);
 				} else
@@ -3853,14 +3853,14 @@
 				
 				p->appargs = 0;
 				if (!pv2->u1.list->next) /* just one  -- it won't hurt to repeat the extension */ {
-					snprintf(buf1,sizeof(buf1),"%s|%s", z->name, pv2->u1.list->u1.str);
+					snprintf(buf1,sizeof(buf1),"%s,%s", z->name, pv2->u1.list->u1.str);
 					p->appargs = strdup(buf1);
 					
 				} else if (pv2->u1.list->next && !pv2->u1.list->next->next) /* two */ {
-					snprintf(buf1,sizeof(buf1),"%s|%s", z->name, pv2->u1.list->next->u1.str);
+					snprintf(buf1,sizeof(buf1),"%s,%s", z->name, pv2->u1.list->next->u1.str);
 					p->appargs = strdup(buf1);
 				} else if (pv2->u1.list->next && pv2->u1.list->next->next) {
-					snprintf(buf1,sizeof(buf1),"%s|%s|%s", pv2->u1.list->u1.str, 
+					snprintf(buf1,sizeof(buf1),"%s,%s,%s", pv2->u1.list->u1.str, 
 							 z->name,
 							 pv2->u1.list->next->next->u1.str);
 					p->appargs = strdup(buf1);
@@ -3916,7 +3916,7 @@
 				case PV_INCLUDES:
 					for (p3 = p2->u1.list; p3 ;p3=p3->next) {
 						if ( p3->u2.arglist ) {
-							snprintf(buf,sizeof(buf), "%s|%s|%s|%s|%s", 
+							snprintf(buf,sizeof(buf), "%s,%s,%s,%s,%s", 
 									 p3->u1.str,
 									 p3->u2.arglist->u1.str,
 									 p3->u2.arglist->next->u1.str,
@@ -4016,7 +4016,7 @@
 				case PV_INCLUDES:
 					for (p3 = p2->u1.list; p3 ;p3=p3->next) {
 						if ( p3->u2.arglist ) {
-							snprintf(buf,sizeof(buf), "%s|%s|%s|%s|%s", 
+							snprintf(buf,sizeof(buf), "%s,%s,%s,%s,%s", 
 									 p3->u1.str,
 									 p3->u2.arglist->u1.str,
 									 p3->u2.arglist->next->u1.str,




More information about the asterisk-commits mailing list