app_chanspy: Fix a test that was failing on account of r413551
authorJonathan Rose <jrose@digium.com>
Mon, 12 May 2014 22:33:28 +0000 (22:33 +0000)
committerJonathan Rose <jrose@digium.com>
Mon, 12 May 2014 22:33:28 +0000 (22:33 +0000)
ASTERISK-23381 #close
ASTERISK-23381 #comment Reported by: Robert Moss
Review: https://reviewboard.asterisk.org/r/3505/
........

Merged revisions 413710 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 413712 from http://svn.asterisk.org/svn/asterisk/branches/12

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@413713 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_chanspy.c

index 987eacf..306e6e8 100644 (file)
@@ -725,16 +725,16 @@ static int channel_spy(struct ast_channel *chan, struct ast_autochan *spyee_auto
                                bridge_connected = 1;
                        }
 
-                       if (!bridge_connected) {
-                               continue;
-                       }
-
                        ast_audiohook_lock(&csth.whisper_audiohook);
-                       ast_audiohook_lock(&csth.bridge_whisper_audiohook);
                        ast_audiohook_write_frame(&csth.whisper_audiohook, AST_AUDIOHOOK_DIRECTION_WRITE, f);
-                       ast_audiohook_write_frame(&csth.bridge_whisper_audiohook, AST_AUDIOHOOK_DIRECTION_WRITE, f);
                        ast_audiohook_unlock(&csth.whisper_audiohook);
-                       ast_audiohook_unlock(&csth.bridge_whisper_audiohook);
+
+                       if (bridge_connected) {
+                               ast_audiohook_lock(&csth.bridge_whisper_audiohook);
+                               ast_audiohook_write_frame(&csth.bridge_whisper_audiohook, AST_AUDIOHOOK_DIRECTION_WRITE, f);
+                               ast_audiohook_unlock(&csth.bridge_whisper_audiohook);
+                       }
+
                        ast_frfree(f);
                        continue;
                } else if (ast_test_flag(flags, OPTION_WHISPER) && f->frametype == AST_FRAME_VOICE) {