From 5a8a23f9baae99c9e28d506d0e47875f036b3606 Mon Sep 17 00:00:00 2001
From: Mark Michelson <mmichelson@digium.com>
Date: Thu, 3 Jul 2008 20:37:21 +0000
Subject: [PATCH] Thanks to a suggestion from seanbright, print a warning if
 the attachment of the whisper or barge audiohooks fails.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@127856 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 apps/app_chanspy.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c
index fcf015cdd3..ca19294df4 100644
--- a/apps/app_chanspy.c
+++ b/apps/app_chanspy.c
@@ -361,10 +361,14 @@ static int channel_spy(struct ast_channel *chan, struct chanspy_ds *spyee_chansp
 
  	ast_audiohook_init(&csth.whisper_audiohook, AST_AUDIOHOOK_TYPE_WHISPER, "ChanSpy");
 	ast_audiohook_init(&csth.bridge_whisper_audiohook, AST_AUDIOHOOK_TYPE_WHISPER, "Chanspy");
-  	start_spying(spyee, spyer_name, &csth.whisper_audiohook); /* Unlocks spyee */
+  	if (start_spying(spyee, spyer_name, &csth.whisper_audiohook)) {
+		ast_log(LOG_WARNING, "Unable to attach whisper audiohook to spyee %s. Whisper mode disabled!\n", spyee->name);
+	}
 	if ((spyee_bridge = ast_bridged_channel(spyee))) {
 		ast_channel_lock(spyee_bridge);
-		start_spying(ast_bridged_channel(spyee), spyer_name, &csth.bridge_whisper_audiohook);
+		if (start_spying(ast_bridged_channel(spyee), spyer_name, &csth.bridge_whisper_audiohook)) {
+			ast_log(LOG_WARNING, "Unable to attach barge audiohook on spyee %s. Barge mode disabled!\n", spyee->name);
+		}
 		ast_channel_unlock(spyee_bridge);
 	}
 	ast_channel_unlock(spyee);
-- 
GitLab