Index: pbx.c =================================================================== RCS file: /usr/cvsroot/asterisk/pbx.c,v retrieving revision 1.188 diff -u -r1.188 pbx.c --- pbx.c 23 Dec 2004 15:11:46 -0000 1.188 +++ pbx.c 27 Dec 2004 23:52:15 -0000 @@ -696,6 +696,7 @@ struct ast_include *i; struct ast_sw *sw; struct ast_switch *asw; + char swdata[256]; /* Initialize status if appropriate */ if (!*stacklen) { @@ -755,17 +756,30 @@ /* Check alternative switches */ sw = tmp->alts; while(sw) { + char tmp[256]=""; + int dataptr, tmpptr=0, datalen; + datalen = strlen(sw->data); + for (dataptr=0;dataptrdata[dataptr] == '\\') { + dataptr++; + } + tmp[tmpptr++] = sw->data[dataptr]; + if (tmpptr >= sizeof(tmp)) { + break; + } + } + pbx_substitute_variables_helper(chan, tmp, swdata, sizeof(swdata) - 1); if ((asw = pbx_findswitch(sw->name))) { if (action == HELPER_CANMATCH) - res = asw->canmatch ? asw->canmatch(chan, context, exten, priority, callerid, sw->data) : 0; + res = asw->canmatch ? asw->canmatch(chan, context, exten, priority, callerid, swdata) : 0; else if (action == HELPER_MATCHMORE) - res = asw->matchmore ? asw->matchmore(chan, context, exten, priority, callerid, sw->data) : 0; + res = asw->matchmore ? asw->matchmore(chan, context, exten, priority, callerid, swdata) : 0; else - res = asw->exists ? asw->exists(chan, context, exten, priority, callerid, sw->data) : 0; + res = asw->exists ? asw->exists(chan, context, exten, priority, callerid, swdata) : 0; if (res) { /* Got a match */ *swo = asw; - *data = sw->data; + *data = swdata; *foundcontext = context; return NULL; }