[svn-commits] murf: branch 1.2 r45134 - /branches/1.2/pbx/pbx_ael.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Fri Oct 13 17:16:59 MST 2006


Author: murf
Date: Fri Oct 13 19:16:58 2006
New Revision: 45134

URL: http://svn.digium.com/view/asterisk?rev=45134&view=rev
Log:
Made a small update to solve bug 8128; The switch-case fallthru goto to a pattern extension needed to resolved the wildcards to an appropriate digit for extension matching to work

Modified:
    branches/1.2/pbx/pbx_ael.c

Modified: branches/1.2/pbx/pbx_ael.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/pbx/pbx_ael.c?rev=45134&r1=45133&r2=45134&view=diff
==============================================================================
--- branches/1.2/pbx/pbx_ael.c (original)
+++ branches/1.2/pbx/pbx_ael.c Fri Oct 13 19:16:58 2006
@@ -474,6 +474,29 @@
 	return NULL;
 }
 
+static void gen_match_to_pattern(const char *pattern, char *result)
+{
+       /* the result will be a string that will be matched by pattern */
+       char *p=(char *)pattern, *t=result;
+       while (*p) {
+               if (*p == 'x' || *p == 'n' || *p == 'z' || *p == 'X' || *p == 'N' || *p == 'Z')
+                       *t++ = '9';
+               else if (*p == '[') {
+                       char *z = p+1;
+                       while (*z != ']')
+                               z++;
+                       if (*(z+1)== ']')
+                               z++;
+                       *t++=*(p+1); /* use the first char in the set */
+                       p = z;
+               } else {
+                       *t++ = *p;
+               }
+               p++;
+       }
+       *t++ = 0; /* cap it off */
+}
+
 static int build_step(const char *what, const char *name, const char *filename, int lineno, struct ast_context *con, char *exten, int *pos, char *data, struct fillin **fillout, char **label);
 static int __build_step(const char *what, const char *name, const char *filename, int lineno, struct ast_context *con, char *exten, int *pos, char *data, struct fillin **fillout, char **label)
 {
@@ -541,9 +564,12 @@
 					if (aeldebug & DEBUG_TOKENS)
 						ast_verbose("--NEWCASE: '%s'!\n", newcase);
 					if (curcase) {
+						char zbuf[256];
+
 						/* Handle fall through */
 						char tmp[strlen(newcase) + strlen(name) + 40];
-						sprintf(tmp, "sw-%d-%s|%d", *pos - 2, newcase, 1);
+						gen_match_to_pattern(newcase,zbuf);
+						sprintf(tmp, "sw-%d-%s|%d", *pos - 2, zbuf, 1);
 						ast_add_extension2(con, 0, margs, cpos, NULL, NULL, "Goto", strdup(tmp), FREE, registrar);
 					}
 					curcase = newcase;



More information about the svn-commits mailing list