app_chanspy: fix audiohook options in non read-only mode
authorJean Aunis <jean.aunis@prescom.fr>
Mon, 2 May 2016 10:56:24 +0000 (12:56 +0200)
committerKevin Harwell <kharwell@digium.com>
Tue, 3 May 2016 22:17:48 +0000 (17:17 -0500)
When option 'o' was not set, ChanSpy created its audiohook with the flag
AST_AUDIOHOOK_MUTE_WRITE, which caused ChanSpy to listen audio from one
direction only.

ASTERISK-25866 #close

Change-Id: I5c745855eea29a3fbc4e4aed0b0c0f53580535e0

apps/app_chanspy.c

index 400eed1..df2deae 100644 (file)
@@ -509,8 +509,10 @@ static struct ast_generator spygen = {
 static int start_spying(struct ast_autochan *autochan, const char *spychan_name, struct ast_audiohook *audiohook, struct ast_flags *flags)
 {
        ast_log(LOG_NOTICE, "Attaching %s to %s\n", spychan_name, ast_channel_name(autochan->chan));
-       if(!ast_test_flag(flags, OPTION_READONLY)) {
-               ast_set_flag(audiohook, AST_AUDIOHOOK_TRIGGER_SYNC | AST_AUDIOHOOK_MUTE_WRITE);
+       if(ast_test_flag(flags, OPTION_READONLY)) {
+               ast_set_flag(audiohook, AST_AUDIOHOOK_MUTE_WRITE);
+       } else {
+               ast_set_flag(audiohook, AST_AUDIOHOOK_TRIGGER_SYNC);
        }
        if(ast_test_flag(flags, OPTION_LONG_QUEUE)) {
                ast_debug(9, "Using a long queue to store audio frames in spy audiohook\n");