[asterisk-commits] mmichelson: trunk r99427 - in /trunk: ./ channels/chan_local.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jan 22 10:39:55 CST 2008
Author: mmichelson
Date: Mon Jan 21 17:56:40 2008
New Revision: 99427
URL: http://svn.digium.com/view/asterisk?view=rev&rev=99427
Log:
Merged revisions 99426 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r99426 | mmichelson | 2008-01-21 17:55:26 -0600 (Mon, 21 Jan 2008) | 12 lines
Fixing an issue wherein monitoring local channels was not possible. During a channel
masquerade, the monitors on the two channels involved are swapped. In 99% of the cases
this results in the desired effect. However, if monitoring a local channel, this caused
the monitor which was on the local channel to get moved onto a channel which is immediately
hung up after the masquerade has completed. By swapping the monitors prior to the masquerade,
we avoid the problem by tricking the masquerade into placing the monitor back onto the channel
where we want it.
During the investigation of the issue, the channel's monitor was the only thing that was swapped
in such a manner which did not make sense to have done. All other variable swapping made sense.
........
Modified:
trunk/ (props changed)
trunk/channels/chan_local.c
Change Statistics:
trunk/channels/chan_local.c | 11 +++++++++++
1 file changed, 11 insertions(+)
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Modified: trunk/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_local.c?view=diff&rev=99427&r1=99426&r2=99427
==============================================================================
--- trunk/channels/chan_local.c (original)
+++ trunk/channels/chan_local.c Mon Jan 21 17:56:40 2008
@@ -228,6 +228,7 @@
static void check_bridge(struct local_pvt *p, int isoutbound)
{
+ struct ast_channel_monitor *tmp;
if (ast_test_flag(p, LOCAL_ALREADY_MASQED) || ast_test_flag(p, LOCAL_NO_OPTIMIZATION) || !p->chan || !p->owner || (p->chan->_bridge != ast_bridged_channel(p->chan)))
return;
@@ -245,6 +246,16 @@
if (!ast_check_hangup(p->chan->_bridge)) {
if (!ast_channel_trylock(p->owner)) {
if (!ast_check_hangup(p->owner)) {
+ if(p->owner->monitor && !p->chan->_bridge->monitor) {
+ /* If a local channel is being monitored, we don't want a masquerade
+ * to cause the monitor to go away. Since the masquerade swaps the monitors,
+ * pre-swapping the monitors before the masquerade will ensure that the monitor
+ * ends up where it is expected.
+ */
+ tmp = p->owner->monitor;
+ p->owner->monitor = p->chan->_bridge->monitor;
+ p->chan->_bridge->monitor = tmp;
+ }
ast_channel_masquerade(p->owner, p->chan->_bridge);
ast_set_flag(p, LOCAL_ALREADY_MASQED);
}
More information about the asterisk-commits
mailing list