From: Tilghman Lesher Date: Sat, 25 Dec 2010 10:04:06 +0000 (+0000) Subject: Move check for extension existence below variable inheritance, due to the possible... X-Git-Tag: 1.4.40-rc1~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e913a299692113d47958077a54613514df2ab1e0;p=thirdparty%2Fasterisk.git Move check for extension existence below variable inheritance, due to the possible use of an eswitch. (closes issue #16228) Reported by: jlaguilar git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@299624 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_local.c b/channels/chan_local.c index a798046eb9..ef06830de4 100644 --- a/channels/chan_local.c +++ b/channels/chan_local.c @@ -595,12 +595,6 @@ static int local_call(struct ast_channel *ast, char *dest, int timeout) ast_cdr_update(p->chan); p->chan->cdrflags = p->owner->cdrflags; - if (!ast_exists_extension(NULL, p->chan->context, p->chan->exten, 1, p->owner->cid.cid_num)) { - ast_log(LOG_NOTICE, "No such extension/context %s@%s while calling Local channel\n", p->chan->exten, p->chan->context); - ao2_unlock(p); - return -1; - } - /* copy the channel variables from the incoming channel to the outgoing channel */ /* Note that due to certain assumptions, they MUST be in the same order */ AST_LIST_TRAVERSE(&p->owner->varshead, varptr, entries) { @@ -614,6 +608,12 @@ static int local_call(struct ast_channel *ast, char *dest, int timeout) } ast_channel_datastore_inherit(p->owner, p->chan); + if (!ast_exists_extension(p->chan, p->chan->context, p->chan->exten, 1, p->owner->cid.cid_num)) { + ast_log(LOG_NOTICE, "No such extension/context %s@%s while calling Local channel\n", p->chan->exten, p->chan->context); + ao2_unlock(p); + return -1; + } + /* Start switch on sub channel */ if (!(res = ast_pbx_start(p->chan))) ast_set_flag(p, LOCAL_LAUNCHED_PBX);