don't play any sounds when using the quiet option (bug #4348)
[asterisk/asterisk.git] / apps / app_chanspy.c
index c12f262..292a151 100755 (executable)
  * the GNU General Public License
  */
 
-#define AST_MONITOR_DIR AST_SPOOL_DIR "/monitor"
-
-#include <../asterisk.h>
-#include <asterisk/file.h>
-#include <asterisk/logger.h>
-#include <asterisk/channel.h>
-#include <asterisk/features.h>
-#include <asterisk/options.h>
-#include <asterisk/app.h>
-#include <asterisk/utils.h>
-#include <asterisk/say.h>
-#include <asterisk/pbx.h>
-#include <asterisk/translate.h>
-#include <asterisk/module.h>
-#include <asterisk/lock.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
 #include <ctype.h>
 
+#include "asterisk.h"
+#include "asterisk/file.h"
+#include "asterisk/logger.h"
+#include "asterisk/channel.h"
+#include "asterisk/features.h"
+#include "asterisk/options.h"
+#include "asterisk/app.h"
+#include "asterisk/utils.h"
+#include "asterisk/say.h"
+#include "asterisk/pbx.h"
+#include "asterisk/translate.h"
+#include "asterisk/module.h"
+#include "asterisk/lock.h"
+
+#define AST_MONITOR_DIR AST_SPOOL_DIR "/monitor"
+
 AST_MUTEX_DEFINE_STATIC(modlock);
 
 #define ast_fit_in_short(in) (in < -32768 ? -32768 : in > 32767 ? 32767 : in)
@@ -103,7 +104,6 @@ struct chanspy_translation_helper {
 };
 
 /* Prototypes */
-static struct ast_channel *local_get_channel_by_name(char *name);
 static struct ast_channel *local_get_channel_begin_name(char *name);
 static struct ast_channel *local_channel_walk(struct ast_channel *chan);
 static void spy_release(struct ast_channel *chan, void *data);
@@ -117,6 +117,7 @@ static int channel_spy(struct ast_channel *chan, struct ast_channel *spyee, int
 static int chanspy_exec(struct ast_channel *chan, void *data);
 
 
+#if 0
 static struct ast_channel *local_get_channel_by_name(char *name) 
 {
        struct ast_channel *ret;
@@ -128,6 +129,7 @@ static struct ast_channel *local_get_channel_by_name(char *name)
 
        return ret;
 }
+#endif
 
 static struct ast_channel *local_channel_walk(struct ast_channel *chan) 
 {
@@ -710,13 +712,15 @@ static int chanspy_exec(struct ast_channel *chan, void *data)
        }
 
        for(;;) {
-               res = ast_streamfile(chan, "beep", chan->language);
-               if (!res)
-                       res = ast_waitstream(chan, "");
-               if (res < 0) {
-                       ast_clear_flag(chan, AST_FLAG_SPYING);
-                       break;
-               }                       
+               if (!silent) {
+                       res = ast_streamfile(chan, "beep", chan->language);
+                       if (!res)
+                               res = ast_waitstream(chan, "");
+                       if (res < 0) {
+                               ast_clear_flag(chan, AST_FLAG_SPYING);
+                               break;
+                       }
+               }
 
                count = 0;
                res = ast_waitfordigit(chan, waitms);