[asterisk-commits] file: trunk r42453 - in /trunk: ./ main/channel.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Sep 8 11:53:41 MST 2006


Author: file
Date: Fri Sep  8 13:53:41 2006
New Revision: 42453

URL: http://svn.digium.com/view/asterisk?rev=42453&view=rev
Log:
Merged revisions 42452 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r42452 | file | 2006-09-08 14:50:43 -0400 (Fri, 08 Sep 2006) | 2 lines

Swap spies during masquerading

........

Modified:
    trunk/   (props changed)
    trunk/main/channel.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Modified: trunk/main/channel.c
URL: http://svn.digium.com/view/asterisk/trunk/main/channel.c?rev=42453&r1=42452&r2=42453&view=diff
==============================================================================
--- trunk/main/channel.c (original)
+++ trunk/main/channel.c Fri Sep  8 13:53:41 2006
@@ -3154,6 +3154,8 @@
 	void *t_pvt;
 	struct ast_callerid tmpcid;
 	struct ast_channel *clone = original->masq;
+	struct ast_channel_spy_list *spy_list = NULL;
+	struct ast_channel_spy *spy = NULL;
 	int rformat = original->readformat;
 	int wformat = original->writeformat;
 	char newn[100];
@@ -3231,6 +3233,27 @@
 	x = original->rawwriteformat;
 	original->rawwriteformat = clone->rawwriteformat;
 	clone->rawwriteformat = x;
+
+	/* Swap the spies */
+	spy_list = original->spies;
+	original->spies = clone->spies;
+	clone->spies = spy_list;
+
+	/* Update channel on respective spy lists if present */
+	if (original->spies) {
+		AST_LIST_TRAVERSE(&original->spies->list, spy, list) {
+			ast_mutex_lock(&spy->lock);
+			spy->chan = original;
+			ast_mutex_unlock(&spy->lock);
+		}
+	}
+	if (clone->spies) {
+		AST_LIST_TRAVERSE(&clone->spies->list, spy, list) {
+			ast_mutex_lock(&spy->lock);
+			spy->chan = clone;
+			ast_mutex_unlock(&spy->lock);
+		}
+	}
 
 	/* Save any pending frames on both sides.  Start by counting
 	 * how many we're going to need... */



More information about the asterisk-commits mailing list