From f06a4016be1f789ffe94ce5ef04bb2409d8348d0 Mon Sep 17 00:00:00 2001
From: Mark Spencer <markster@digium.com>
Date: Mon, 12 Sep 2005 03:49:54 +0000
Subject: [PATCH] Properly install appropriate sound files, prefix spy ones
 with spy- (bug #5192)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6563 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 Makefile                              |   2 +-
 apps/app_chanspy.c                    |   6 +++---
 sounds.txt                            |  16 ++++++++--------
 sounds/{agent.gsm => spy-agent.gsm}   | Bin
 sounds/{h323.gsm => spy-h323.gsm}     | Bin
 sounds/{iax.gsm => spy-iax.gsm}       | Bin
 sounds/{iax2.gsm => spy-iax2.gsm}     | Bin
 sounds/{mgcp.gsm => spy-mgcp.gsm}     | Bin
 sounds/{sip.gsm => spy-sip.gsm}       | Bin
 sounds/{skinny.gsm => spy-skinny.gsm} | Bin
 sounds/{zap.gsm => spy-zap.gsm}       | Bin
 11 files changed, 12 insertions(+), 12 deletions(-)
 rename sounds/{agent.gsm => spy-agent.gsm} (100%)
 rename sounds/{h323.gsm => spy-h323.gsm} (100%)
 rename sounds/{iax.gsm => spy-iax.gsm} (100%)
 rename sounds/{iax2.gsm => spy-iax2.gsm} (100%)
 rename sounds/{mgcp.gsm => spy-mgcp.gsm} (100%)
 rename sounds/{sip.gsm => spy-sip.gsm} (100%)
 rename sounds/{skinny.gsm => spy-skinny.gsm} (100%)
 rename sounds/{zap.gsm => spy-zap.gsm} (100%)

diff --git a/Makefile b/Makefile
index ac981e78de..caca64f019 100755
--- a/Makefile
+++ b/Makefile
@@ -514,7 +514,7 @@ datafiles: all
 			exit 1; \
 		fi; \
 	done
-	for x in sounds/demo-* sounds/vm-* sounds/transfer* sounds/pbx-* sounds/ss-* sounds/beep* sounds/dir-* sounds/conf-* sounds/agent-* sounds/invalid* sounds/tt-* sounds/auth-* sounds/privacy-* sounds/queue-*; do \
+	for x in sounds/demo-* sounds/vm-* sounds/transfer* sounds/pbx-* sounds/ss-* sounds/beep* sounds/dir-* sounds/conf-* sounds/agent-* sounds/invalid* sounds/tt-* sounds/auth-* sounds/privacy-* sounds/queue-* sounds/spy-* sounds/priv-* sounds/screen-*; do \
 		if $(GREP) -q "^%`basename $$x`%" sounds.txt; then \
 			install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds ; \
 		else \
diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c
index 89ee070eb3..f1ae6d2c1e 100755
--- a/apps/app_chanspy.c
+++ b/apps/app_chanspy.c
@@ -514,7 +514,7 @@ static int chanspy_exec(struct ast_channel *chan, void *data)
 	struct localuser *u;
 	struct ast_channel *peer=NULL, *prev=NULL;
 	char name[AST_NAME_STRLEN],
-		peer_name[AST_NAME_STRLEN],
+		peer_name[AST_NAME_STRLEN + 5],
 		*args,
 		*ptr = NULL,
 		*options = NULL,
@@ -643,8 +643,8 @@ static int chanspy_exec(struct ast_channel *chan, void *data)
 					if (peer && (!bronly || ast_bridged_channel(peer)) &&
 					    !ast_check_hangup(peer) && !ast_test_flag(peer, AST_FLAG_SPYING)) {
 						int x = 0;
-
-						strncpy(peer_name, peer->name, AST_NAME_STRLEN);
+						strncpy(peer_name, "spy-", 5);
+						strncpy(peer_name + strlen(peer_name), peer->name, AST_NAME_STRLEN);
 						ptr = strchr(peer_name, '/');
 						*ptr = '\0';
 						ptr++;
diff --git a/sounds.txt b/sounds.txt
index a8a16571e0..06865545ae 100755
--- a/sounds.txt
+++ b/sounds.txt
@@ -710,18 +710,18 @@
 %conf-onlyone.gsm%There is currently only one other participant in the conference.
 
 
-%agent.gsm%Agent
+%spy-agent.gsm%Agent
 
-%h323.gsm%H.323
+%spy-h323.gsm%H.323
 
-%iax.gsm%IAX
+%spy-iax.gsm%IAX
 
-%iax2.gsm%IAX (note: does not say "2")
+%spy-iax2.gsm%IAX (note: does not say "2")
 
-%mgcp.gsm%MGCP
+%spy-mgcp.gsm%MGCP
 
-%sip.gsm%SIP
+%spy-sip.gsm%SIP
 
-%skinny.gsm%Skinny
+%spy-skinny.gsm%Skinny
 
-%zap.gsm%Zap
+%spy-zap.gsm%Zap
diff --git a/sounds/agent.gsm b/sounds/spy-agent.gsm
similarity index 100%
rename from sounds/agent.gsm
rename to sounds/spy-agent.gsm
diff --git a/sounds/h323.gsm b/sounds/spy-h323.gsm
similarity index 100%
rename from sounds/h323.gsm
rename to sounds/spy-h323.gsm
diff --git a/sounds/iax.gsm b/sounds/spy-iax.gsm
similarity index 100%
rename from sounds/iax.gsm
rename to sounds/spy-iax.gsm
diff --git a/sounds/iax2.gsm b/sounds/spy-iax2.gsm
similarity index 100%
rename from sounds/iax2.gsm
rename to sounds/spy-iax2.gsm
diff --git a/sounds/mgcp.gsm b/sounds/spy-mgcp.gsm
similarity index 100%
rename from sounds/mgcp.gsm
rename to sounds/spy-mgcp.gsm
diff --git a/sounds/sip.gsm b/sounds/spy-sip.gsm
similarity index 100%
rename from sounds/sip.gsm
rename to sounds/spy-sip.gsm
diff --git a/sounds/skinny.gsm b/sounds/spy-skinny.gsm
similarity index 100%
rename from sounds/skinny.gsm
rename to sounds/spy-skinny.gsm
diff --git a/sounds/zap.gsm b/sounds/spy-zap.gsm
similarity index 100%
rename from sounds/zap.gsm
rename to sounds/spy-zap.gsm
-- 
GitLab