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
This commit is contained in:
Matt O'Gorman
2006-10-03 15:53:07 +00:00
parent c9c1613503
commit ae8cc3e18b
67 changed files with 1718 additions and 922 deletions

View File

@@ -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;
}
}