[asterisk-commits] mmichelson: trunk r127831 - /trunk/apps/app_chanspy.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 3 15:19:11 CDT 2008


Author: mmichelson
Date: Thu Jul  3 15:19:10 2008
New Revision: 127831

URL: http://svn.digium.com/view/asterisk?view=rev&rev=127831
Log:
Fix a crash when attempting to spy on an unbridged channel.

(closes issue #12986)
Reported by: andrew53


Modified:
    trunk/apps/app_chanspy.c

Modified: trunk/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_chanspy.c?view=diff&rev=127831&r1=127830&r2=127831
==============================================================================
--- trunk/apps/app_chanspy.c (original)
+++ trunk/apps/app_chanspy.c Thu Jul  3 15:19:10 2008
@@ -359,17 +359,20 @@
 		return 0;
 	}
 
+ 	ast_audiohook_init(&csth.whisper_audiohook, AST_AUDIOHOOK_TYPE_WHISPER, "ChanSpy");
+	ast_audiohook_init(&csth.bridge_whisper_audiohook, AST_AUDIOHOOK_TYPE_WHISPER, "Chanspy");
+  	start_spying(spyee, spyer_name, &csth.whisper_audiohook); /* Unlocks spyee */
+	if ((spyee_bridge = ast_bridged_channel(spyee))) {
+		ast_channel_lock(spyee_bridge);
+		start_spying(ast_bridged_channel(spyee), spyer_name, &csth.bridge_whisper_audiohook);
+		ast_channel_unlock(spyee_bridge);
+	}
+	ast_channel_unlock(spyee);
+	spyee = NULL;
+
 	ast_channel_lock(chan);
 	ast_set_flag(chan, AST_FLAG_END_DTMF_ONLY);
 	ast_channel_unlock(chan);
-
- 	ast_audiohook_init(&csth.whisper_audiohook, AST_AUDIOHOOK_TYPE_WHISPER, "ChanSpy");
-	ast_audiohook_init(&csth.bridge_whisper_audiohook, AST_AUDIOHOOK_TYPE_WHISPER, "Chanspy");
-  	start_spying(spyee, spyer_name, &csth.whisper_audiohook); /* Unlocks spyee */
-	start_spying(ast_bridged_channel(spyee), spyer_name, &csth.bridge_whisper_audiohook);
-
-	ast_channel_unlock(spyee);
-	spyee = NULL;
 
 	csth.volfactor = *volfactor;
 




More information about the asterisk-commits mailing list