diff options
author | mogorman <mogorman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-10-03 15:53:07 +0000 |
---|---|---|
committer | mogorman <mogorman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-10-03 15:53:07 +0000 |
commit | 4a1aaf52ae4189e660ad57ba69253f54603a2beb (patch) | |
tree | 27a80e26cf8f6ea1728ab5b2b8cc7573fd9f7cdc /apps/app_talkdetect.c | |
parent | 1bd1494da59a95dce73628aafc4ba892036b82b2 (diff) |
bug #8076 check option_debug before printing to debug channel.
patch provided in bugnote, with minor changes.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@44253 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_talkdetect.c')
-rw-r--r-- | apps/app_talkdetect.c | 16 |
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; } } |