diff options
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; } } |