From 070497048a8b412e6239de681578bacf8fc64205 Mon Sep 17 00:00:00 2001 From: Mark Michelson Date: Fri, 25 Apr 2008 19:34:11 +0000 Subject: [PATCH] Merged revisions 114663 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ................ r114663 | mmichelson | 2008-04-25 14:33:27 -0500 (Fri, 25 Apr 2008) | 12 lines Merged revisions 114662 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r114662 | mmichelson | 2008-04-25 14:32:02 -0500 (Fri, 25 Apr 2008) | 4 lines 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. ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.0@114664 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- apps/app_chanspy.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c index 0561b542d7..9e525b2f0e 100644 --- a/apps/app_chanspy.c +++ b/apps/app_chanspy.c @@ -233,12 +233,9 @@ static int start_spying(struct ast_channel *chan, const char *spychan_name, stru 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; } @@ -287,16 +284,18 @@ static int channel_spy(struct ast_channel *chan, struct chanspy_ds *spyee_chansp 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;