Index: channels/chan_zap.c =================================================================== --- channels/chan_zap.c (revision 66979) +++ channels/chan_zap.c (working copy) @@ -3906,7 +3906,7 @@ if (strcmp(ast->exten, "fax")) { const char *target_context = S_OR(ast->macrocontext, ast->context); - if (ast_exists_extension(ast, target_context, "fax", 1, ast->cid.cid_num)) { + if (ast_goto_if_exists(ast, target_context, "fax", 1)) { if (option_verbose > 2) ast_verbose(VERBOSE_PREFIX_3 "Redirecting %s to fax extension\n", ast->name); /* Save the DID/DNIS when we transfer the fax call to a "fax" extension */ @@ -6087,7 +6087,7 @@ } } - if (ast_exists_extension(chan, chan->context, exten, 1, chan->cid.cid_num)) { + if (ast_goto_if_exists(chan, chan->context, exten, 1)) { ast_copy_string(chan->exten, exten, sizeof(chan->exten)); if (p->dsp) ast_dsp_digitreset(p->dsp); res = ast_pbx_run(chan); Index: channels/chan_agent.c =================================================================== --- channels/chan_agent.c (revision 66979) +++ channels/chan_agent.c (working copy) @@ -2161,7 +2161,7 @@ } else { pbx_builtin_setvar_helper(chan, "AGENTSTATUS", "fail"); } - if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 1, chan->cid.cid_num)) { + if (ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 1)) { ast_module_user_remove(u); return 0; } @@ -2250,7 +2250,7 @@ /* check if there is n + 101 priority */ /*! \todo XXX Needs to check option priorityjump etc etc */ if (res) { - if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->cid.cid_num)) { + if (ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101)) { chan->priority+=100; if (option_verbose > 2) ast_verbose(VERBOSE_PREFIX_3 "Going to %d priority because there is no callerid or the agentid cannot be found.\n",chan->priority); Index: channels/chan_oss.c =================================================================== --- channels/chan_oss.c (revision 66979) +++ channels/chan_oss.c (working copy) @@ -1354,7 +1354,7 @@ tmp = ast_ext_ctx(argv[2], &ext, &ctx); if (ctx == NULL) /* supply default context if needed */ ctx = o->owner->context; - if (!ast_exists_extension(b, ctx, ext, 1, b->cid.cid_num)) + if (!ast_goto_if_exists(b, ctx, ext, 1)) ast_cli(fd, "No such extension exists\n"); else { ast_cli(fd, "Whee, transferring %s to %s@%s.\n", b->name, ext, ctx); Index: channels/chan_misdn.c =================================================================== --- channels/chan_misdn.c (revision 66979) +++ channels/chan_misdn.c (working copy) @@ -2579,7 +2579,7 @@ char context_tmp[BUFFERSIZE]; misdn_cfg_get(tmp->bc->port, MISDN_CFG_FAXDETECT_CONTEXT, &context_tmp, sizeof(context_tmp)); context = ast_strlen_zero(context_tmp) ? (ast_strlen_zero(ast->macrocontext) ? ast->context : ast->macrocontext) : context_tmp; - if (ast_exists_extension(ast, context, "fax", 1, ast->cid.cid_num)) { + if (ast_goto_if_exists(ast, context, "fax", 1)) { if (option_verbose > 2) ast_verbose(VERBOSE_PREFIX_3 "Redirecting %s to fax extension (context:%s)\n", ast->name, context); /* Save the DID/DNIS when we transfer the fax call to a "fax" extension */ Index: apps/app_parkandannounce.c =================================================================== --- apps/app_parkandannounce.c (revision 66979) +++ apps/app_parkandannounce.c (working copy) @@ -162,7 +162,7 @@ if(option_verbose > 2) { ast_verbose( VERBOSE_PREFIX_3 "Return Context: (%s,%s,%d) ID: %s\n", chan->context,chan->exten, chan->priority, chan->cid.cid_num); - if(!ast_exists_extension(chan, chan->context, chan->exten, chan->priority, chan->cid.cid_num)) { + if(!ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority)) { ast_verbose( VERBOSE_PREFIX_3 "Warning: Return Context Invalid, call will return to default|s\n"); } } Index: apps/app_minivm.c =================================================================== --- apps/app_minivm.c (revision 66979) +++ apps/app_minivm.c (working copy) @@ -1915,26 +1915,26 @@ /* Check current or macro-calling context for special extensions */ if (ast_test_flag(vmu, MVM_OPERATOR)) { if (!ast_strlen_zero(vmu->exit)) { - if (ast_exists_extension(chan, vmu->exit, "o", 1, chan->cid.cid_num)) { + if (ast_goto_if_exists(chan, vmu->exit, "o", 1)) { strncat(ecodes, "0", sizeof(ecodes) - strlen(ecodes) - 1); ouseexten = 1; } - } else if (ast_exists_extension(chan, chan->context, "o", 1, chan->cid.cid_num)) { + } else if (ast_goto_if_exists(chan, chan->context, "o", 1)) { strncat(ecodes, "0", sizeof(ecodes) - strlen(ecodes) - 1); ouseexten = 1; } - else if (!ast_strlen_zero(chan->macrocontext) && ast_exists_extension(chan, chan->macrocontext, "o", 1, chan->cid.cid_num)) { + else if (!ast_strlen_zero(chan->macrocontext) && ast_goto_if_exists(chan, chan->macrocontext, "o", 1)) { strncat(ecodes, "0", sizeof(ecodes) - strlen(ecodes) - 1); ousemacro = 1; } } if (!ast_strlen_zero(vmu->exit)) { - if (ast_exists_extension(chan, vmu->exit, "a", 1, chan->cid.cid_num)) + if (ast_goto_if_exists(chan, vmu->exit, "a", 1)) strncat(ecodes, "*", sizeof(ecodes) - strlen(ecodes) - 1); - } else if (ast_exists_extension(chan, chan->context, "a", 1, chan->cid.cid_num)) + } else if (ast_goto_if_exists(chan, chan->context, "a", 1)) strncat(ecodes, "*", sizeof(ecodes) - strlen(ecodes) - 1); - else if (!ast_strlen_zero(chan->macrocontext) && ast_exists_extension(chan, chan->macrocontext, "a", 1, chan->cid.cid_num)) { + else if (!ast_strlen_zero(chan->macrocontext) && ast_goto_if_exists(chan, chan->macrocontext, "a", 1)) { strncat(ecodes, "*", sizeof(ecodes) - strlen(ecodes) - 1); ausemacro = 1; } Index: apps/app_macro.c =================================================================== --- apps/app_macro.c (revision 66979) +++ apps/app_macro.c (working copy) @@ -209,7 +209,7 @@ } snprintf(fullmacro, sizeof(fullmacro), "macro-%s", macro); - if (!ast_exists_extension(chan, fullmacro, "s", 1, chan->cid.cid_num)) { + if (!ast_goto_if_exists(chan, fullmacro, "s", 1)) { if (!ast_context_find(fullmacro)) ast_log(LOG_WARNING, "No such context '%s' for macro '%s'\n", fullmacro, macro); else @@ -277,7 +277,7 @@ } autoloopflag = ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP); ast_set_flag(chan, AST_FLAG_IN_AUTOLOOP); - while(ast_exists_extension(chan, chan->context, chan->exten, chan->priority, chan->cid.cid_num)) { + while(ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority)) { struct ast_context *c; struct ast_exten *e; runningapp[0] = '\0'; @@ -459,7 +459,7 @@ /* Handle macro offset if it's set by checking the availability of step n + offset + 1, otherwise continue normally if there is any problem */ if (sscanf(offsets, "%d", &offset) == 1) { - if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + offset + 1, chan->cid.cid_num)) { + if (ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + offset + 1)) { chan->priority += offset; } } Index: apps/app_voicemail.c =================================================================== --- apps/app_voicemail.c (revision 66979) +++ apps/app_voicemail.c (working copy) @@ -3034,26 +3034,26 @@ /* Check current or macro-calling context for special extensions */ if (ast_test_flag(vmu, VM_OPERATOR)) { if (!ast_strlen_zero(vmu->exit)) { - if (ast_exists_extension(chan, vmu->exit, "o", 1, chan->cid.cid_num)) { + if (ast_goto_if_exists(chan, vmu->exit, "o", 1)) { strncat(ecodes, "0", sizeof(ecodes) - strlen(ecodes) - 1); ouseexten = 1; } - } else if (ast_exists_extension(chan, chan->context, "o", 1, chan->cid.cid_num)) { + } else if (ast_goto_if_exists(chan, chan->context, "o", 1)) { strncat(ecodes, "0", sizeof(ecodes) - strlen(ecodes) - 1); ouseexten = 1; } - else if (!ast_strlen_zero(chan->macrocontext) && ast_exists_extension(chan, chan->macrocontext, "o", 1, chan->cid.cid_num)) { + else if (!ast_strlen_zero(chan->macrocontext) && ast_goto_if_exists(chan, chan->macrocontext, "o", 1)) { strncat(ecodes, "0", sizeof(ecodes) - strlen(ecodes) - 1); ousemacro = 1; } } if (!ast_strlen_zero(vmu->exit)) { - if (ast_exists_extension(chan, vmu->exit, "a", 1, chan->cid.cid_num)) + if (ast_goto_if_exists(chan, vmu->exit, "a", 1)) strncat(ecodes, "*", sizeof(ecodes) - strlen(ecodes) - 1); - } else if (ast_exists_extension(chan, chan->context, "a", 1, chan->cid.cid_num)) + } else if (ast_goto_if_exists(chan, chan->context, "a", 1)) strncat(ecodes, "*", sizeof(ecodes) - strlen(ecodes) - 1); - else if (!ast_strlen_zero(chan->macrocontext) && ast_exists_extension(chan, chan->macrocontext, "a", 1, chan->cid.cid_num)) { + else if (!ast_strlen_zero(chan->macrocontext) && ast_goto_if_exists(chan, chan->macrocontext, "a", 1)) { strncat(ecodes, "*", sizeof(ecodes) - strlen(ecodes) - 1); ausemacro = 1; } Index: apps/app_disa.c =================================================================== --- apps/app_disa.c (revision 66979) +++ apps/app_disa.c (working copy) @@ -335,13 +335,13 @@ int recheck = 0; struct ast_flags flags = { AST_CDR_FLAG_POSTED }; - if (!ast_exists_extension(chan, args.context, exten, 1, chan->cid.cid_num)) { + if (!ast_goto_if_exists(chan, args.context, exten, 1)) { pbx_builtin_setvar_helper(chan, "INVALID_EXTEN", exten); exten[0] = 'i'; exten[1] = '\0'; recheck = 1; } - if (!recheck || ast_exists_extension(chan, args.context, exten, 1, chan->cid.cid_num)) { + if (!recheck || ast_goto_if_exists(chan, args.context, exten, 1)) { ast_playtones_stop(chan); /* We're authenticated and have a target extension */ if (!ast_strlen_zero(args.cid)) { Index: main/app.c =================================================================== --- main/app.c (revision 66979) +++ main/app.c (working copy) @@ -94,7 +94,7 @@ break; } if (res >= 0) - res = ast_exists_extension(chan, context, collect, 1, chan->cid.cid_num) ? 1 : 0; + res = ast_goto_if_exists(chan, context, collect, 1) ? 1 : 0; return res; } Index: main/pbx.c =================================================================== --- main/pbx.c (revision 66979) +++ main/pbx.c (working copy) @@ -2349,7 +2349,7 @@ ast_set_flag(c, AST_FLAG_IN_AUTOLOOP); /* Start by trying whatever the channel is set to */ - if (!ast_exists_extension(c, c->context, c->exten, c->priority, c->cid.cid_num)) { + if (!ast_goto_if_exists(c, c->context, c->exten, c->priority)) { /* If not successful fall back to 's' */ if (option_verbose > 1) ast_verbose( VERBOSE_PREFIX_2 "Starting %s at %s,%s,%d failed so falling back to exten 's'\n", c->name, c->context, c->exten, c->priority); @@ -2358,7 +2358,7 @@ * I believe the correct thing is to set it to 1 immediately. */ set_ext_pri(c, "s", 1); - if (!ast_exists_extension(c, c->context, c->exten, c->priority, c->cid.cid_num)) { + if (!ast_goto_if_exists(c, c->context, c->exten, c->priority)) { /* JK02: And finally back to default if everything else failed */ if (option_verbose > 1) ast_verbose( VERBOSE_PREFIX_2 "Starting %s at %s,%s,%d still failed so falling back to context 'default'\n", c->name, c->context, c->exten, c->priority); @@ -2373,7 +2373,7 @@ int digit = 0; /* loop on priorities in this context/exten */ - while (ast_exists_extension(c, c->context, c->exten, c->priority, c->cid.cid_num)) { + while (ast_goto_if_exists(c, c->context, c->exten, c->priority)) { found = 1; if ((res = ast_spawn_extension(c, c->context, c->exten, c->priority, c->cid.cid_num))) { /* Something bad happened, or a hangup has been requested. */ @@ -2408,7 +2408,7 @@ break; } } - if (c->_softhangup == AST_SOFTHANGUP_TIMEOUT && ast_exists_extension(c,c->context,"T",1,c->cid.cid_num)) { + if (c->_softhangup == AST_SOFTHANGUP_TIMEOUT && ast_goto_if_exists(c,c->context,"T",1)) { set_ext_pri(c, "T", 0); /* 0 will become 1 with the c->priority++; at the end */ /* If the AbsoluteTimeout is not reset to 0, we'll get an infinite loop */ c->whentohangup = 0; @@ -2427,11 +2427,11 @@ /* XXX we get here on non-existing extension or a keypress or hangup ? */ - if (!ast_exists_extension(c, c->context, c->exten, 1, c->cid.cid_num)) { + if (!ast_goto_if_exists(c, c->context, c->exten, 1)) { /* If there is no match at priority 1, it is not a valid extension anymore. * Try to continue at "i", 1 or exit if the latter does not exist. */ - if (ast_exists_extension(c, c->context, "i", 1, c->cid.cid_num)) { + if (ast_goto_if_exists(c, c->context, "i", 1)) { if (option_verbose > 2) ast_verbose(VERBOSE_PREFIX_3 "Sent into invalid extension '%s' in context '%s' on %s\n", c->exten, c->context, c->name); pbx_builtin_setvar_helper(c, "INVALID_EXTEN", c->exten); @@ -2469,13 +2469,13 @@ if (collect_digits(c, waittime, dst_exten, sizeof(dst_exten), pos)) break; - if (ast_exists_extension(c, c->context, dst_exten, 1, c->cid.cid_num)) /* Prepare the next cycle */ + if (ast_goto_if_exists(c, c->context, dst_exten, 1)) /* Prepare the next cycle */ set_ext_pri(c, dst_exten, 1); else { /* No such extension */ if (!ast_strlen_zero(dst_exten)) { /* An invalid extension */ - if (ast_exists_extension(c, c->context, "i", 1, c->cid.cid_num)) { + if (ast_goto_if_exists(c, c->context, "i", 1)) { if (option_verbose > 2) ast_verbose( VERBOSE_PREFIX_3 "Invalid extension '%s' in context '%s' on %s\n", dst_exten, c->context, c->name); pbx_builtin_setvar_helper(c, "INVALID_EXTEN", dst_exten); @@ -2487,7 +2487,7 @@ } } else { /* A simple timeout */ - if (ast_exists_extension(c, c->context, "t", 1, c->cid.cid_num)) { + if (ast_goto_if_exists(c, c->context, "t", 1)) { if (option_verbose > 2) ast_verbose( VERBOSE_PREFIX_3 "Timeout on %s\n", c->name); set_ext_pri(c, "t", 1); @@ -2507,11 +2507,11 @@ } if (!found && !error) ast_log(LOG_WARNING, "Don't know what to do with '%s'\n", c->name); - if ((res != AST_PBX_KEEPALIVE) && ast_exists_extension(c, c->context, "h", 1, c->cid.cid_num)) { + if ((res != AST_PBX_KEEPALIVE) && ast_goto_if_exists(c, c->context, "h", 1)) { if (c->cdr && ast_opt_end_cdr_before_h_exten) ast_cdr_end(c->cdr); set_ext_pri(c, "h", 1); - while (ast_exists_extension(c, c->context, c->exten, c->priority, c->cid.cid_num)) { + while (ast_goto_if_exists(c, c->context, c->exten, c->priority)) { if ((res = ast_spawn_extension(c, c->context, c->exten, c->priority, c->cid.cid_num))) { /* Something bad happened, or a hangup has been requested. */ if (option_debug) @@ -5685,10 +5685,10 @@ res = ast_waitfordigit(chan, ms); if (!res) { - if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 1, chan->cid.cid_num)) { + if (ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 1)) { if (option_verbose > 2) ast_verbose(VERBOSE_PREFIX_3 "Timeout on %s, continuing...\n", chan->name); - } else if (ast_exists_extension(chan, chan->context, "t", 1, chan->cid.cid_num)) { + } else if (ast_goto_if_exists(chan, chan->context, "t", 1)) { if (option_verbose > 2) ast_verbose(VERBOSE_PREFIX_3 "Timeout on %s, going to 't'\n", chan->name); set_ext_pri(chan, "t", 0); /* XXX is the 0 correct ? */ @@ -6359,7 +6359,7 @@ exten = chan->exten; goto_func = (async) ? ast_async_goto : ast_explicit_goto; - if (ast_exists_extension(chan, context, exten, priority, chan->cid.cid_num)) + if (ast_goto_if_exists(chan, context, exten, priority)) return goto_func(chan, context, exten, priority); else return -3; Index: main/file.c =================================================================== --- main/file.c (revision 66979) +++ main/file.c (working copy) @@ -1030,7 +1030,7 @@ case AST_FRAME_DTMF_END: if (context) { const char exten[2] = { fr->subclass, '\0' }; - if (ast_exists_extension(c, context, exten, 1, c->cid.cid_num)) { + if (ast_goto_if_exists(c, context, exten, 1)) { res = fr->subclass; ast_frfree(fr); return res;