Index: include/asterisk/channel.h =================================================================== --- include/asterisk/channel.h (revision 235656) +++ include/asterisk/channel.h (working copy) @@ -564,6 +564,10 @@ AST_FLAG_BRIDGE_HANGUP_DONT = (1 << 18), /*! This flag indicates whether the channel is in the channel list or not. */ AST_FLAG_IN_CHANNEL_LIST = (1 << 19), + /*! Disable certain workarounds. This reintroduces certain bugs, but allows + * some non-traditional dialplans (like AGI) to continue to function. + */ + AST_FLAG_DISABLE_WORKAROUNDS = (1 << 20), }; /*! \brief ast_bridge_config flags */ Index: main/pbx.c =================================================================== --- main/pbx.c (revision 235656) +++ main/pbx.c (working copy) @@ -8305,7 +8305,8 @@ * gone immediately to the "i" extension, but will now need to wait for a * timeout. */ - if ((exten[0] = res) && + if (!ast_test_flag(chan, AST_FLAG_DISABLE_WORKAROUNDS) && + (exten[0] = res) && ast_canmatch_extension(chan, args.context, exten, 1, chan->cid.cid_num) && !ast_matchmore_extension(chan, args.context, exten, 1, chan->cid.cid_num)) { snprintf(chan->exten, sizeof(chan->exten), "%c", res); Index: res/res_agi.c =================================================================== --- res/res_agi.c (revision 235656) +++ res/res_agi.c (working copy) @@ -1459,7 +1459,7 @@ static int handle_exec(struct ast_channel *chan, AGI *agi, int argc, char **argv) { - int res; + int res, workaround; struct ast_app *app_to_exec; if (argc < 2) @@ -1467,6 +1467,10 @@ ast_verb(3, "AGI Script Executing Application: (%s) Options: (%s)\n", argv[1], argv[2]); + if (!(workaround = ast_test_flag(chan, AST_FLAG_DISABLE_WORKAROUNDS))) { + ast_set_flag(chan, AST_FLAG_DISABLE_WORKAROUNDS); + } + if ((app_to_exec = pbx_findapp(argv[1]))) { if(!strcasecmp(argv[1], PARK_APP_NAME)) { ast_masq_park_call(chan, NULL, 0, NULL); @@ -1492,6 +1496,10 @@ ast_log(LOG_WARNING, "Could not find application (%s)\n", argv[1]); res = -2; } + + if (!workaround) { + ast_clear_flag(chan, AST_FLAG_DISABLE_WORKAROUNDS); + } ast_agi_send(agi->fd, chan, "200 result=%d\n", res); /* Even though this is wrong, users are depending upon this result. */