[asterisk-commits] rmudgett: trunk r366546 - /trunk/channels/chan_local.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue May 15 14:36:31 CDT 2012


Author: rmudgett
Date: Tue May 15 14:36:26 2012
New Revision: 366546

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=366546
Log:
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.

Modified:
    trunk/channels/chan_local.c

Modified: trunk/channels/chan_local.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_local.c?view=diff&rev=366546&r1=366545&r2=366546
==============================================================================
--- trunk/channels/chan_local.c (original)
+++ trunk/channels/chan_local.c Tue May 15 14:36:26 2012
@@ -95,7 +95,6 @@
 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 @@
 	.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 @@
 	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)
 {




More information about the asterisk-commits mailing list