summaryrefslogtreecommitdiff
path: root/apps/app_talkdetect.c
diff options
context:
space:
mode:
authorMatt O'Gorman <mogorman@digium.com>2006-10-03 15:53:07 +0000
committerMatt O'Gorman <mogorman@digium.com>2006-10-03 15:53:07 +0000
commitae8cc3e18be72c2e074ed33d7cfdc172f8e5f3b1 (patch)
tree27a80e26cf8f6ea1728ab5b2b8cc7573fd9f7cdc /apps/app_talkdetect.c
parentc9c161350343720c2e5f41069c397933c7cbcc56 (diff)
bug #8076 check option_debug before printing to debug channel.
patch provided in bugnote, with minor changes. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@44253 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_talkdetect.c')
-rw-r--r--apps/app_talkdetect.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/apps/app_talkdetect.c b/apps/app_talkdetect.c
index 79cbbd5d0..7d9376a13 100644
--- a/apps/app_talkdetect.c
+++ b/apps/app_talkdetect.c
@@ -42,6 +42,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/translate.h"
#include "asterisk/utils.h"
#include "asterisk/dsp.h"
+#include "asterisk/options.h"
static char *app = "BackgroundDetect";
@@ -102,7 +103,8 @@ static int background_detect_exec(struct ast_channel *chan, void *data)
}
}
}
- ast_log(LOG_DEBUG, "Preparing detect of '%s', sil=%d,min=%d,max=%d\n",
+ if (option_debug)
+ ast_log(LOG_DEBUG, "Preparing detect of '%s', sil=%d,min=%d,max=%d\n",
tmp, sil, min, max);
if (chan->_state != AST_STATE_UP) {
/* Otherwise answer unless we're supposed to send this while on-hook */
@@ -162,7 +164,8 @@ static int background_detect_exec(struct ast_channel *chan, void *data)
ms = 0;
if ((ms > min) && ((max < 0) || (ms < max))) {
char ms_str[10];
- ast_log(LOG_DEBUG, "Found qualified token of %d ms\n", ms);
+ if (option_debug)
+ ast_log(LOG_DEBUG, "Found qualified token of %d ms\n", ms);
/* Save detected talk time (in milliseconds) */
sprintf(ms_str, "%d", ms );
@@ -172,15 +175,18 @@ static int background_detect_exec(struct ast_channel *chan, void *data)
res = 0;
ast_frfree(fr);
break;
- } else
- ast_log(LOG_DEBUG, "Found unqualified token of %d ms\n", ms);
+ } else {
+ if (option_debug)
+ ast_log(LOG_DEBUG, "Found unqualified token of %d ms\n", ms);
+ }
notsilent = 0;
}
} else {
if (!notsilent) {
/* Heard some audio, mark the begining of the token */
start = ast_tvnow();
- ast_log(LOG_DEBUG, "Start of voice token!\n");
+ if (option_debug)
+ ast_log(LOG_DEBUG, "Start of voice token!\n");
notsilent = 1;
}
}