[asterisk-commits] murf: branch murf/AEL2-1.2 r45140 -
/team/murf/AEL2-1.2/pbx/pbx_ael2.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Fri Oct 13 18:46:54 MST 2006
Author: murf
Date: Fri Oct 13 20:46:53 2006
New Revision: 45140
URL: http://svn.digium.com/view/asterisk?rev=45140&view=rev
Log:
This commit fixes bug 8128 in the 1.2/AEL2 tree
Modified:
team/murf/AEL2-1.2/pbx/pbx_ael2.c
Modified: team/murf/AEL2-1.2/pbx/pbx_ael2.c
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2-1.2/pbx/pbx_ael2.c?rev=45140&r1=45139&r2=45140&view=diff
==============================================================================
--- team/murf/AEL2-1.2/pbx/pbx_ael2.c (original)
+++ team/murf/AEL2-1.2/pbx/pbx_ael2.c Fri Oct 13 20:46:53 2006
@@ -2785,6 +2785,29 @@
}
}
+static void gen_match_to_pattern(char *pattern, char *result)
+{
+ /* the result will be a string that will be matched by pattern */
+ char *p=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 void gen_prios(struct ael_extension *exten, char *label, pval *statement, struct ael_extension *mother_exten, struct ast_context *this_context )
{
pval *p,*p2,*p3;
@@ -3031,14 +3054,15 @@
fall_thru = new_prio();
fall_thru->type = AEL_APPCALL;
fall_thru->app = strdup("Goto");
- snprintf(buf1,sizeof(buf1),"_sw-%d-%s|1",local_control_statement_count, p2->next->u1.str);
+ gen_match_to_pattern(p2->next->u1.str, buf2);
+ snprintf(buf1,sizeof(buf1),"sw-%d-%s|1", 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-.|1",local_control_statement_count);
+ snprintf(buf1,sizeof(buf1),"sw-%d-.|1",local_control_statement_count);
fall_thru->appargs = strdup(buf1);
linkprio(switch_case, fall_thru);
} else if (!p2->next) {
@@ -3092,14 +3116,15 @@
fall_thru = new_prio();
fall_thru->type = AEL_APPCALL;
fall_thru->app = strdup("Goto");
- snprintf(buf1,sizeof(buf1),"_sw-%d-%s|1",local_control_statement_count, p2->next->u1.str);
+ gen_match_to_pattern(p2->next->u1.str, buf2);
+ snprintf(buf1,sizeof(buf1),"sw-%d-%s|1",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-.|1",local_control_statement_count);
+ snprintf(buf1,sizeof(buf1),"sw-%d-.|1",local_control_statement_count);
fall_thru->appargs = strdup(buf1);
linkprio(switch_case, fall_thru);
} else if (!p2->next) {
@@ -3155,14 +3180,15 @@
fall_thru = new_prio();
fall_thru->type = AEL_APPCALL;
fall_thru->app = strdup("Goto");
- snprintf(buf1,sizeof(buf1),"_sw-%d-%s|1",local_control_statement_count, p2->next->u1.str);
+ gen_match_to_pattern(p2->next->u1.str, buf2);
+ snprintf(buf1,sizeof(buf1),"sw-%d-%s|1",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-.|1",local_control_statement_count);
+ snprintf(buf1,sizeof(buf1),"sw-%d-.|1",local_control_statement_count);
fall_thru->appargs = strdup(buf1);
linkprio(switch_case, fall_thru);
} else if (!p2->next) {
More information about the asterisk-commits
mailing list