[asterisk-commits] murf: branch murf/bug_7638 r77539 - in /team/murf/bug_7638: ./ apps/ pbx/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jul 27 11:32:15 CDT 2007


Author: murf
Date: Fri Jul 27 11:32:14 2007
New Revision: 77539

URL: http://svn.digium.com/view/asterisk?view=rev&rev=77539
Log:
Merged revisions 77520,77534 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
r77520 | murf | 2007-07-27 09:46:20 -0600 (Fri, 27 Jul 2007) | 1 line

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.
........
r77534 | tilghman | 2007-07-27 10:20:55 -0600 (Fri, 27 Jul 2007) | 2 lines

'dialplan save' shouldn't be converting '|' back to ',' anymore.

........

Modified:
    team/murf/bug_7638/   (props changed)
    team/murf/bug_7638/apps/app_dial.c
    team/murf/bug_7638/pbx/pbx_ael.c
    team/murf/bug_7638/pbx/pbx_config.c

Propchange: team/murf/bug_7638/
------------------------------------------------------------------------------
    automerge = yes

Propchange: team/murf/bug_7638/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Jul 27 11:32:14 2007
@@ -1,1 +1,1 @@
-/trunk:1-77497
+/trunk:1-77535

Modified: team/murf/bug_7638/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/apps/app_dial.c?view=diff&rev=77539&r1=77538&r2=77539
==============================================================================
--- team/murf/bug_7638/apps/app_dial.c (original)
+++ team/murf/bug_7638/apps/app_dial.c Fri Jul 27 11:32:14 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: team/murf/bug_7638/pbx/pbx_ael.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/pbx/pbx_ael.c?view=diff&rev=77539&r1=77538&r2=77539
==============================================================================
--- team/murf/bug_7638/pbx/pbx_ael.c (original)
+++ team/murf/bug_7638/pbx/pbx_ael.c Fri Jul 27 11:32:14 2007
@@ -293,9 +293,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;
 			
@@ -1067,16 +1067,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");
@@ -1214,7 +1214,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);
@@ -1260,7 +1260,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) {
@@ -1268,14 +1268,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) {
@@ -1323,7 +1323,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) {
@@ -1331,14 +1331,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) {
@@ -1388,7 +1388,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) {
@@ -1396,14 +1396,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) {
@@ -1438,7 +1438,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)
@@ -1507,7 +1507,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, 
@@ -1570,7 +1570,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;

Modified: team/murf/bug_7638/pbx/pbx_config.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/pbx/pbx_config.c?view=diff&rev=77539&r1=77538&r2=77539
==============================================================================
--- team/murf/bug_7638/pbx/pbx_config.c (original)
+++ team/murf/bug_7638/pbx/pbx_config.c Fri Jul 27 11:32:14 2007
@@ -848,31 +848,11 @@
 					fprintf(output, "exten => %s,hint,%s\n",
 						    ast_get_extension_name(p),
 						    ast_get_extension_app(p));
-				} else { /* copy and replace '|' with ',' */
+				} else {
 					const char *sep, *cid;
-					char *tempdata = "";
-					char *s;
 					const char *el = ast_get_extension_label(p);
 					char label[128] = "";
  
- 					s = ast_get_extension_app_data(p);
-					if (s) {
-						char *t;
-						tempdata = alloca(strlen(tempdata) * 2 + 1);
-
-						for (t = tempdata; *s; s++, t++) {
-							if (*s == '|')
-								*t = ',';
-							else {
-								if (*s == ',')
-									*t++ = '\\';
-								*t = *s;
-							}
-						}
-						/* Terminating NULL */
-						*t = *s;
-					}
-
 					if (ast_get_extension_matchcid(p)) {
 						sep = "/";
 						cid = ast_get_extension_cidmatch(p);
@@ -885,7 +865,7 @@
 					fprintf(output, "exten => %s%s%s,%d%s,%s(%s)\n",
 					    ast_get_extension_name(p), (ast_strlen_zero(sep) ? "" : sep), (ast_strlen_zero(cid) ? "" : cid),
 					    ast_get_extension_priority(p), label,
-					    ast_get_extension_app(p), (ast_strlen_zero(tempdata) ? "" : tempdata));
+					    ast_get_extension_app(p), (ast_strlen_zero(ast_get_extension_app_data(p)) ? "" : (const char *)ast_get_extension_app_data(p)));
 				}
 			}
 		}
@@ -984,7 +964,6 @@
 	if (app && (start = strchr(app, '(')) && (end = strrchr(app, ')'))) {
 		*start = *end = '\0';
 		app_data = start + 1;
-		ast_process_quotes_and_slashes(app_data, ',', '|');
 	} else {
 		if (app) {
 			app_data = strchr(app, ',');
@@ -1584,7 +1563,7 @@
 			ast_add_extension2(con, 0, cat, -1, NULL, NULL, iface, NULL, NULL, registrar);
 			/* If voicemail, use "stdexten" else use plain old dial */
 			if (hasvoicemail) {
-				snprintf(tmp, sizeof(tmp), "stdexten|%s|${HINT}", cat);
+				snprintf(tmp, sizeof(tmp), "stdexten,%s,${HINT}", cat);
 				ast_add_extension2(con, 0, cat, 1, NULL, NULL, "Macro", strdup(tmp), ast_free, registrar);
 			} else {
 				ast_add_extension2(con, 0, cat, 1, NULL, NULL, "Dial", strdup("${HINT}"), ast_free, registrar);




More information about the asterisk-commits mailing list