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
This commit is contained in:
Richard Mudgett
2012-05-15 19:36:26 +00:00
parent 1ae31fd2a9
commit d5d984daa5

View File

@@ -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)
{