From: Richard Mudgett Date: Tue, 15 May 2012 19:36:26 +0000 (+0000) Subject: The predial routine must be run on the local;1 channel. X-Git-Tag: 11.0.0-beta1~316 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d5d984daa55590b70dfaa4e3b8d78563fe96d740;p=thirdparty%2Fasterisk.git The predial routine must be run on the local;1 channel. When ast_call() operates on a local channel, it copies a lot of things from the local;1 channel to the local;2 channel. This includes among other things, channel variables and party id information. Other reasons it was a bad idea to run predial on the local;2 channel: 1) The channel has not been completely setup. The ast_call() completes the setup. 2) The local;2 caller and connected line party information is opposite to any other channels predial runs on. (And it hasn't been setup yet.) * Partially back out -r366183 by removing the chan_local implementation of the struct ast_channel_tech.pre_call callback. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366546 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_local.c b/channels/chan_local.c index 66f8814320..bed9eebdcd 100644 --- a/channels/chan_local.c +++ b/channels/chan_local.c @@ -95,7 +95,6 @@ static struct ast_jb_conf g_jb_conf = { static struct ast_channel *local_request(const char *type, struct ast_format_cap *cap, const struct ast_channel *requestor, const char *data, int *cause); static int local_digit_begin(struct ast_channel *ast, char digit); static int local_digit_end(struct ast_channel *ast, char digit, unsigned int duration); -static int local_pre_call(struct ast_channel *ast, const char *sub_args); static int local_call(struct ast_channel *ast, const char *dest, int timeout); static int local_hangup(struct ast_channel *ast); static int local_answer(struct ast_channel *ast); @@ -117,7 +116,6 @@ static struct ast_channel_tech local_tech = { .requester = local_request, .send_digit_begin = local_digit_begin, .send_digit_end = local_digit_end, - .pre_call = local_pre_call, .call = local_call, .hangup = local_hangup, .answer = local_answer, @@ -1256,34 +1254,6 @@ static struct ast_channel *local_request(const char *type, struct ast_format_cap return chan; } -static int local_pre_call(struct ast_channel *ast, const char *sub_args) -{ - struct local_pvt *p = ast_channel_tech_pvt(ast); - struct ast_channel *chan; - int res; - - ao2_lock(p); - chan = p->chan; - if (chan) { - ast_channel_ref(chan); - } - ao2_unlock(p); - if (!chan) { - return -1; - } - - /* - * Execute the predial routine on the ;2 channel so any channel - * variables set by the predial will be available to the local - * channel PBX. - */ - ast_channel_unlock(ast); - res = ast_app_exec_sub(NULL, chan, sub_args); - ast_channel_unref(chan); - ast_channel_lock(ast); - return res; -} - /*! \brief CLI command "local show channels" */ static char *locals_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) {