[asterisk-commits] dhubbard: trunk r84275 - in /trunk: ./ channels/ main/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Oct 1 16:31:16 CDT 2007
Author: dhubbard
Date: Mon Oct 1 16:31:16 2007
New Revision: 84275
URL: http://svn.digium.com/view/asterisk?view=rev&rev=84275
Log:
Merged revisions 84274 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r84274 | dhubbard | 2007-10-01 16:25:37 -0500 (Mon, 01 Oct 2007) | 1 line
moved get_base_channel() code from action_redirect to ast_channel_masquerade() for issue 7706 and BE-160
........
Modified:
trunk/ (props changed)
trunk/channels/chan_agent.c
trunk/main/channel.c
trunk/main/manager.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Modified: trunk/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_agent.c?view=diff&rev=84275&r1=84274&r2=84275
==============================================================================
--- trunk/channels/chan_agent.c (original)
+++ trunk/channels/chan_agent.c Mon Oct 1 16:31:16 2007
@@ -702,17 +702,20 @@
pbx_builtin_setvar_helper(NULL, buf, agent);
}
+/*! \brief return the channel or base channel if one exists. This function assumes the channel it is called on is already locked */
struct ast_channel* agent_get_base_channel(struct ast_channel *chan)
{
struct agent_pvt *p = NULL;
- struct ast_channel *base = NULL;
-
+ struct ast_channel *base = chan;
+
+ /* chan is locked by the calling function */
if (!chan || !chan->tech_pvt) {
ast_log(LOG_ERROR, "whoa, you need a channel (0x%ld) with a tech_pvt (0x%ld) to get a base channel.\n", (long)chan, (chan)?(long)chan->tech_pvt:(long)NULL);
- } else {
- p = chan->tech_pvt;
+ return NULL;
+ }
+ p = chan->tech_pvt;
+ if (p->chan)
base = p->chan;
- }
return base;
}
Modified: trunk/main/channel.c
URL: http://svn.digium.com/view/asterisk/trunk/main/channel.c?view=diff&rev=84275&r1=84274&r2=84275
==============================================================================
--- trunk/main/channel.c (original)
+++ trunk/main/channel.c Mon Oct 1 16:31:16 2007
@@ -3333,7 +3333,7 @@
int ast_channel_masquerade(struct ast_channel *original, struct ast_channel *clone)
{
int res = -1;
- struct ast_channel *final_orig, *final_clone;
+ struct ast_channel *final_orig, *final_clone, *base;
retrymasq:
final_orig = original;
@@ -3353,6 +3353,10 @@
if (clone->_bridge && (clone->_bridge != ast_bridged_channel(clone)) && (clone->_bridge->_bridge != clone))
final_clone = clone->_bridge;
+
+ if (final_clone->tech->get_base_channel && (base = final_clone->tech->get_base_channel(final_clone))) {
+ final_clone = base;
+ }
if ((final_orig != original) || (final_clone != clone)) {
/* Lots and lots of deadlock avoidance. The main one we're competing with
Modified: trunk/main/manager.c
URL: http://svn.digium.com/view/asterisk/trunk/main/manager.c?view=diff&rev=84275&r1=84274&r2=84275
==============================================================================
--- trunk/main/manager.c (original)
+++ trunk/main/manager.c Mon Oct 1 16:31:16 2007
@@ -1787,7 +1787,7 @@
const char *exten = astman_get_header(m, "Exten");
const char *context = astman_get_header(m, "Context");
const char *priority = astman_get_header(m, "Priority");
- struct ast_channel *base, *chan, *chan2 = NULL;
+ struct ast_channel *chan, *chan2 = NULL;
int pi = 0;
int res;
@@ -1809,14 +1809,6 @@
astman_send_error(s, m, buf);
return 0;
}
- if (chan->tech->get_base_channel) {
- base = chan->tech->get_base_channel(chan);
- if (base) {
- ast_mutex_unlock(&chan->lock);
- chan = base;
- ast_mutex_lock(&chan->lock);
- }
- }
if (ast_check_hangup(chan)) {
astman_send_error(s, m, "Redirect failed, channel not up.\n");
ast_channel_unlock(chan);
@@ -1829,14 +1821,6 @@
ast_channel_unlock(chan);
ast_channel_unlock(chan2);
return 0;
- }
- if (chan2 && chan2->tech->get_base_channel) {
- base = chan2->tech->get_base_channel(chan2);
- if (base) {
- ast_mutex_unlock(&chan2->lock);
- chan2 = base;
- ast_mutex_lock(&chan2->lock);
- }
}
res = ast_async_goto(chan, context, exten, pi);
if (!res) {
More information about the asterisk-commits
mailing list