mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-24 22:58:21 +00:00
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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user