[svn-commits] branch murf/AEL2-1.2 r32951 - in /team/murf/AEL2-1.2:
include/asterisk/ pbx/
svn-commits at lists.digium.com
svn-commits at lists.digium.com
Wed Jun 7 17:23:43 MST 2006
Author: murf
Date: Wed Jun 7 19:23:43 2006
New Revision: 32951
URL: http://svn.digium.com/view/asterisk?rev=32951&view=rev
Log:
Fixed the switch-in-switch and the cidmatch spec in the extension name
problems, as they are fixed in the trunk.
Modified:
team/murf/AEL2-1.2/include/asterisk/ael_structs.h
team/murf/AEL2-1.2/pbx/pbx_ael2.c
Modified: team/murf/AEL2-1.2/include/asterisk/ael_structs.h
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2-1.2/include/asterisk/ael_structs.h?rev=32951&r1=32950&r2=32951&view=diff
==============================================================================
--- team/murf/AEL2-1.2/include/asterisk/ael_structs.h (original)
+++ team/murf/AEL2-1.2/include/asterisk/ael_structs.h Wed Jun 7 19:23:43 2006
@@ -164,6 +164,7 @@
struct ael_extension
{
char *name;
+ char *cidmatch;
char *hints;
int regexten;
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=32951&r1=32950&r2=32951&view=diff
==============================================================================
--- team/murf/AEL2-1.2/pbx/pbx_ael2.c (original)
+++ team/murf/AEL2-1.2/pbx/pbx_ael2.c Wed Jun 7 19:23:43 2006
@@ -2436,6 +2436,10 @@
if (ne->name)
free(ne->name);
+ /* cidmatch fields are allocated with name, and freed when
+ the name field is freed. Don't do a free for this field,
+ unless you LIKE to see a crash! */
+
if (ne->hints)
free(ne->hints);
@@ -2485,6 +2489,7 @@
char *strp, *strp2;
char new_label[2000];
int default_exists;
+ int local_control_statement_count;
struct ael_priority *loop_break_save;
struct ael_priority *loop_continue_save;
struct ael_extension *switch_case;
@@ -2644,6 +2649,7 @@
case PV_SWITCH:
control_statement_count++;
+ local_control_statement_count = control_statement_count;
loop_break_save = exten->loop_break; /* save them, then restore before leaving */
loop_continue_save = exten->loop_continue;
snprintf(new_label,sizeof(new_label),"sw-%s-%d", label, control_statement_count);
@@ -2696,21 +2702,21 @@
fall_thru = new_prio();
fall_thru->type = AEL_APPCALL;
fall_thru->app = strdup("Goto");
- snprintf(buf1,sizeof(buf1),"sw-%d-%s|1",control_statement_count, p2->next->u1.str);
+ snprintf(buf1,sizeof(buf1),"sw-%d-%s|1",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) {
fall_thru = new_prio();
fall_thru->type = AEL_APPCALL;
fall_thru->app = strdup("Goto");
- snprintf(buf1,sizeof(buf1),"_sw-%d-%s|1",control_statement_count, p2->next->u1.str);
+ snprintf(buf1,sizeof(buf1),"_sw-%d-%s|1",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_DEFAULT) {
fall_thru = new_prio();
fall_thru->type = AEL_APPCALL;
fall_thru->app = strdup("Goto");
- snprintf(buf1,sizeof(buf1),"_sw-%d-.|1",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) {
@@ -2739,9 +2745,9 @@
switch_case->loop_continue = exten->loop_continue;
linkexten(exten,switch_case);
- snprintf(buf1,sizeof(buf1),"_sw-%d-%s", control_statement_count, p2->u1.str);
+ snprintf(buf1,sizeof(buf1),"_sw-%d-%s", local_control_statement_count, p2->u1.str);
switch_case->name = strdup(buf1);
- snprintf(new_label,sizeof(new_label),"sw-%s-%s-%d", label, p2->u1.str, control_statement_count);
+ snprintf(new_label,sizeof(new_label),"sw-%s-%s-%d", label, p2->u1.str, local_control_statement_count);
gen_prios(switch_case, new_label, p2->u2.statements, exten); /* this will link in all the while body statements here */
/* here is where we write code to "fall thru" to the next case... if there is one... */
@@ -2756,21 +2762,21 @@
fall_thru = new_prio();
fall_thru->type = AEL_APPCALL;
fall_thru->app = strdup("Goto");
- snprintf(buf1,sizeof(buf1),"sw-%d-%s|1",control_statement_count, p2->next->u1.str);
+ snprintf(buf1,sizeof(buf1),"sw-%d-%s|1",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) {
fall_thru = new_prio();
fall_thru->type = AEL_APPCALL;
fall_thru->app = strdup("Goto");
- snprintf(buf1,sizeof(buf1),"_sw-%d-%s|1",control_statement_count, p2->next->u1.str);
+ snprintf(buf1,sizeof(buf1),"_sw-%d-%s|1",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_DEFAULT) {
fall_thru = new_prio();
fall_thru->type = AEL_APPCALL;
fall_thru->app = strdup("Goto");
- snprintf(buf1,sizeof(buf1),"_sw-%d-.|1",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) {
@@ -2799,10 +2805,10 @@
switch_case->loop_break = exten->loop_break;
switch_case->loop_continue = exten->loop_continue;
linkexten(exten,switch_case);
- snprintf(buf1,sizeof(buf1),"_sw-%d-.", control_statement_count);
+ snprintf(buf1,sizeof(buf1),"_sw-%d-.", local_control_statement_count);
switch_case->name = strdup(buf1);
- snprintf(new_label,sizeof(new_label),"sw-%s-default-%d", label, control_statement_count);
+ snprintf(new_label,sizeof(new_label),"sw-%s-default-%d", label, local_control_statement_count);
gen_prios(switch_case, new_label, p2->u2.statements, exten); /* this will link in all the while body statements here */
@@ -2818,21 +2824,21 @@
fall_thru = new_prio();
fall_thru->type = AEL_APPCALL;
fall_thru->app = strdup("Goto");
- snprintf(buf1,sizeof(buf1),"sw-%d-%s|1",control_statement_count, p2->next->u1.str);
+ snprintf(buf1,sizeof(buf1),"sw-%d-%s|1",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) {
fall_thru = new_prio();
fall_thru->type = AEL_APPCALL;
fall_thru->app = strdup("Goto");
- snprintf(buf1,sizeof(buf1),"_sw-%d-%s|1",control_statement_count, p2->next->u1.str);
+ snprintf(buf1,sizeof(buf1),"_sw-%d-%s|1",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_DEFAULT) {
fall_thru = new_prio();
fall_thru->type = AEL_APPCALL;
fall_thru->app = strdup("Goto");
- snprintf(buf1,sizeof(buf1),"_sw-%d-.|1",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) {
@@ -3129,7 +3135,7 @@
struct ael_priority *last = 0;
if (exten->hints) {
- if (ast_add_extension2(context, 0 /*no replace*/, exten->name, PRIORITY_HINT, NULL, NULL,
+ if (ast_add_extension2(context, 0 /*no replace*/, exten->name, PRIORITY_HINT, NULL, exten->cidmatch,
exten->hints, NULL, FREE, registrar)) {
ast_log(LOG_WARNING, "Unable to add step at priority 'hint' of extension '%s'\n",
exten->name);
@@ -3211,7 +3217,7 @@
label = 0;
- if (ast_add_extension2(context, 0 /*no replace*/, exten->name, pr->priority_num, (label?label:NULL), NULL,
+ if (ast_add_extension2(context, 0 /*no replace*/, exten->name, pr->priority_num, (label?label:NULL), exten->cidmatch,
app, strdup(appargs), FREE, registrar)) {
ast_log(LOG_WARNING, "Unable to add step at priority '%d' of extension '%s'\n", pr->priority_num,
exten->name);
@@ -3284,12 +3290,19 @@
/* contexts contain: ignorepat, includes, switches, eswitches, extensions, */
for (p2=p->u2.statements; p2; p2=p2->next) {
+ char *s3;
pval *p3;
switch (p2->type) {
case PV_EXTENSION:
exten = new_exten();
exten->name = strdup(p2->u1.str);
+ if( (s3=strchr(exten->name, '/') ) != 0 )
+ {
+ *s3 = 0;
+ exten->cidmatch = s3+1;
+ }
+
if ( p2->u3.hints )
exten->hints = strdup(p2->u3.hints);
exten->regexten = p2->u4.regexten;
More information about the svn-commits
mailing list