diff options
author | Joshua Colp <jcolp@digium.com> | 2008-12-13 00:59:24 +0000 |
---|---|---|
committer | Joshua Colp <jcolp@digium.com> | 2008-12-13 00:59:24 +0000 |
commit | d6b70deee57f8db1de88e92bbf5319ca8d293e8f (patch) | |
tree | 9bbfcecb23d423084c43c6a5a1a1e16eec54c12d | |
parent | 74de8fdaa7e785ff3937ef17a7973381d3f5e201 (diff) |
Only detach and destroy the whisper audiohooks if they are actually in use.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@163912 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r-- | apps/app_chanspy.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c index 0f9ae4438..ccde2a6fa 100644 --- a/apps/app_chanspy.c +++ b/apps/app_chanspy.c @@ -611,14 +611,19 @@ static int channel_spy(struct ast_channel *chan, struct chanspy_ds *spyee_chansp ast_clear_flag(chan, AST_FLAG_END_DTMF_ONLY); ast_channel_unlock(chan); - ast_audiohook_lock(&csth.whisper_audiohook); - ast_audiohook_detach(&csth.whisper_audiohook); - ast_audiohook_unlock(&csth.whisper_audiohook); - ast_audiohook_destroy(&csth.whisper_audiohook); - ast_audiohook_lock(&csth.bridge_whisper_audiohook); - ast_audiohook_detach(&csth.bridge_whisper_audiohook); - ast_audiohook_unlock(&csth.bridge_whisper_audiohook); - ast_audiohook_destroy(&csth.bridge_whisper_audiohook); + if (ast_test_flag(flags, OPTION_WHISPER)) { + ast_audiohook_lock(&csth.whisper_audiohook); + ast_audiohook_detach(&csth.whisper_audiohook); + ast_audiohook_unlock(&csth.whisper_audiohook); + ast_audiohook_destroy(&csth.whisper_audiohook); + } + + if (ast_test_flag(flags, OPTION_BARGE)) { + ast_audiohook_lock(&csth.bridge_whisper_audiohook); + ast_audiohook_detach(&csth.bridge_whisper_audiohook); + ast_audiohook_unlock(&csth.bridge_whisper_audiohook); + ast_audiohook_destroy(&csth.bridge_whisper_audiohook); + } ast_audiohook_lock(&csth.spy_audiohook); ast_audiohook_detach(&csth.spy_audiohook); |