[svn-commits] murf: trunk r89329 - in /trunk: main/pbx.c res/res_features.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Nov 16 12:59:02 CST 2007


Author: murf
Date: Fri Nov 16 12:59:02 2007
New Revision: 89329

URL: http://svn.digium.com/view/asterisk?view=rev&rev=89329
Log:
This fixes a problem with pattern ranges; and corrects a situation in res_features, where an extension would be created with the name Zap/51, as an example. THe / is bad because it would tend to mean that the 51 is to be cid matched.

Modified:
    trunk/main/pbx.c
    trunk/res/res_features.c

Modified: trunk/main/pbx.c
URL: http://svn.digium.com/view/asterisk/trunk/main/pbx.c?view=diff&rev=89329&r1=89328&r2=89329
==============================================================================
--- trunk/main/pbx.c (original)
+++ trunk/main/pbx.c Fri Nov 16 12:59:02 2007
@@ -868,8 +868,10 @@
 static void cli_match_char_tree(struct match_char *node, char *prefix, int fd)
 {
 	char my_prefix[1024];
-	
-	ast_cli(fd, "%s%s:%c:%d:%s%s\n", prefix, node->x, node->is_pattern ? 'Y':'N', node->specificity, node->exten? "EXTEN:":"", node->exten ? node->exten->exten : "");
+	if (strlen(node->x) > 1 )
+		ast_cli(fd, "%s[%s]:%c:%d:%s%s\n", prefix, node->x, node->is_pattern ? 'Y':'N', node->specificity, node->exten? "EXTEN:":"", node->exten ? node->exten->exten : "");
+	else
+		ast_cli(fd, "%s%s:%c:%d:%s%s\n", prefix, node->x, node->is_pattern ? 'Y':'N', node->specificity, node->exten? "EXTEN:":"", node->exten ? node->exten->exten : "");
 	strcpy(my_prefix,prefix);
 	strcat(my_prefix,"+       ");
 	if (node->next_char)
@@ -1084,6 +1086,7 @@
 		if (pattern && *s1 == '[' && *(s1-1) != '\\') {
 			char *s2 = buf;
 			buf[0] = 0;
+			s1++; /* get past the '[' */
 			while (*s1 != ']' && *(s1-1) != '\\' ) {
 				if (*s1 == '\\') {
 					if (*(s1+1) == ']') {
@@ -1110,6 +1113,7 @@
 					*s2++ = *s1++;
 				}
 			}
+			*s2 = 0; /* null terminate the exploded range */
 			specif = strlen(buf);
 		} else {
 			if (*s1 == '\\') {

Modified: trunk/res/res_features.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_features.c?view=diff&rev=89329&r1=89328&r2=89329
==============================================================================
--- trunk/res/res_features.c (original)
+++ trunk/res/res_features.c Fri Nov 16 12:59:02 2007
@@ -2104,8 +2104,15 @@
 					}
 					if (con) {
 						char returnexten[AST_MAX_EXTENSION];
+						char peername_flat[AST_MAX_EXTENSION]; /* using something like Zap/52 for an extension name is NOT a good idea */
+						int i;
+						ast_copy_string(peername_flat,peername,sizeof(peername_flat));
+						for(i=0; peername_flat[i] && i < AST_MAX_EXTENSION; i++) {
+							if (peername_flat[i] == '/') 
+								peername_flat[i]= '0';
+						}
 						snprintf(returnexten, sizeof(returnexten), "%s,,t", peername);
-						ast_add_extension2(con, 1, peername, 1, NULL, NULL, "Dial", ast_strdup(returnexten), ast_free_ptr, registrar);
+						ast_add_extension2(con, 1, peername_flat, 1, NULL, NULL, "Dial", ast_strdup(returnexten), ast_free_ptr, registrar);
 					}
 					if (comebacktoorigin) { 
 						set_c_e_p(chan, parking_con_dial, peername, 1);




More information about the svn-commits mailing list