[asterisk-commits] mmichelson: branch 1.4 r114662 - /branches/1.4/apps/app_chanspy.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Apr 25 14:32:03 CDT 2008


Author: mmichelson
Date: Fri Apr 25 14:32:02 2008
New Revision: 114662

URL: http://svn.digium.com/view/asterisk?view=rev&rev=114662
Log:
Move the unlock of the spyee channel to outside the start_spying() function so that
the channel is not unlocked twice when using whisper mode.


Modified:
    branches/1.4/apps/app_chanspy.c

Modified: branches/1.4/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/apps/app_chanspy.c?view=diff&rev=114662&r1=114661&r2=114662
==============================================================================
--- branches/1.4/apps/app_chanspy.c (original)
+++ branches/1.4/apps/app_chanspy.c Fri Apr 25 14:32:02 2008
@@ -208,12 +208,9 @@
 
 	res = ast_audiohook_attach(chan, audiohook);
 
-	if (!res && ast_test_flag(chan, AST_FLAG_NBRIDGE) && (peer = ast_bridged_channel(chan))) {
-		ast_channel_unlock(chan);
+	if (!res && ast_test_flag(chan, AST_FLAG_NBRIDGE) && (peer = ast_bridged_channel(chan))) { 
 		ast_softhangup(peer, AST_SOFTHANGUP_UNBRIDGE);	
-	} else
-		ast_channel_unlock(chan);
-
+	}
 	return res;
 }
 
@@ -263,16 +260,18 @@
 	
 	ast_audiohook_init(&csth.spy_audiohook, AST_AUDIOHOOK_TYPE_SPY, "ChanSpy");
 
-	if (start_spying(spyee, spyer_name, &csth.spy_audiohook)) { /* Unlocks spyee */
+	if (start_spying(spyee, spyer_name, &csth.spy_audiohook)) {
 		ast_audiohook_destroy(&csth.spy_audiohook);
+		ast_channel_unlock(spyee);
 		return 0;
 	}
 	
 	if (ast_test_flag(flags, OPTION_WHISPER)) {
 		ast_audiohook_init(&csth.whisper_audiohook, AST_AUDIOHOOK_TYPE_WHISPER, "ChanSpy");
-		start_spying(spyee, spyer_name, &csth.whisper_audiohook); /* Unlocks spyee */
-	}
-
+		start_spying(spyee, spyer_name, &csth.whisper_audiohook);
+	}
+
+	ast_channel_unlock(spyee);
 	spyee = NULL;
 
 	csth.volfactor = *volfactor;




More information about the asterisk-commits mailing list