Merged revisions 173902 via svnmerge from

https://origsvn.digium.com/svn/asterisk/trunk

........
  r173902 | file | 2009-02-06 11:59:17 -0400 (Fri, 06 Feb 2009) | 4 lines
  
  Always detach and destroy the whisper and barge audiohooks. Additionally also allow an audiohook to be detached if it has not been attached.
  (closes issue #14414)
  Reported by: bluecrow76
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.1@173904 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Joshua Colp
2009-02-06 16:01:01 +00:00
parent da8622724d
commit 993d0af118
2 changed files with 10 additions and 14 deletions

View File

@@ -495,19 +495,15 @@ 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);
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.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);
ast_audiohook_lock(&csth.spy_audiohook);
ast_audiohook_detach(&csth.spy_audiohook);

View File

@@ -354,7 +354,7 @@ int ast_audiohook_attach(struct ast_channel *chan, struct ast_audiohook *audioho
*/
int ast_audiohook_detach(struct ast_audiohook *audiohook)
{
if (audiohook->status == AST_AUDIOHOOK_STATUS_DONE)
if (audiohook->status == AST_AUDIOHOOK_STATUS_NEW || audiohook->status == AST_AUDIOHOOK_STATUS_DONE)
return 0;
audiohook->status = AST_AUDIOHOOK_STATUS_SHUTDOWN;