mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 20:20:07 +00:00
add a LOG_DTMF logging channel and send all bridged DTMF events out that channel (issue #4835)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6358 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1966,6 +1966,14 @@ int ast_write(struct ast_channel *chan, struct ast_frame *fr)
|
|||||||
res = 0;
|
res = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* It's possible this is a translated frame */
|
||||||
|
if (f && f->frametype == AST_FRAME_DTMF) {
|
||||||
|
ast_log(LOG_DTMF, "%s : %c\n", chan->name, f->subclass);
|
||||||
|
} else if (fr->frametype == AST_FRAME_DTMF) {
|
||||||
|
ast_log(LOG_DTMF, "%s : %c\n", chan->name, fr->subclass);
|
||||||
|
}
|
||||||
|
|
||||||
if (f && (f != fr))
|
if (f && (f != fr))
|
||||||
ast_frfree(f);
|
ast_frfree(f);
|
||||||
ast_clear_flag(chan, AST_FLAG_BLOCKING);
|
ast_clear_flag(chan, AST_FLAG_BLOCKING);
|
||||||
|
@@ -40,6 +40,7 @@
|
|||||||
; warning
|
; warning
|
||||||
; error
|
; error
|
||||||
; verbose
|
; verbose
|
||||||
|
; dtmf
|
||||||
;
|
;
|
||||||
; Special filename "console" represents the system console
|
; Special filename "console" represents the system console
|
||||||
;
|
;
|
||||||
|
@@ -99,6 +99,12 @@ extern void ast_console_puts(const char *string);
|
|||||||
#define __LOG_VERBOSE 5
|
#define __LOG_VERBOSE 5
|
||||||
#define LOG_VERBOSE __LOG_VERBOSE, _A_
|
#define LOG_VERBOSE __LOG_VERBOSE, _A_
|
||||||
|
|
||||||
|
#ifdef LOG_DTMF
|
||||||
|
#undef LOG_DTMF
|
||||||
|
#endif
|
||||||
|
#define __LOG_DTMF 6
|
||||||
|
#define LOG_DTMF __LOG_DTMF, _A_
|
||||||
|
|
||||||
#if defined(__cplusplus) || defined(c_plusplus)
|
#if defined(__cplusplus) || defined(c_plusplus)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
14
logger.c
14
logger.c
@@ -44,6 +44,7 @@ static int syslog_level_map[] = {
|
|||||||
LOG_NOTICE,
|
LOG_NOTICE,
|
||||||
LOG_WARNING,
|
LOG_WARNING,
|
||||||
LOG_ERR,
|
LOG_ERR,
|
||||||
|
LOG_DEBUG,
|
||||||
LOG_DEBUG
|
LOG_DEBUG
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -107,7 +108,8 @@ static char *levels[] = {
|
|||||||
"NOTICE",
|
"NOTICE",
|
||||||
"WARNING",
|
"WARNING",
|
||||||
"ERROR",
|
"ERROR",
|
||||||
"VERBOSE"
|
"VERBOSE",
|
||||||
|
"DTMF"
|
||||||
};
|
};
|
||||||
|
|
||||||
static int colors[] = {
|
static int colors[] = {
|
||||||
@@ -116,7 +118,8 @@ static int colors[] = {
|
|||||||
COLOR_YELLOW,
|
COLOR_YELLOW,
|
||||||
COLOR_BRRED,
|
COLOR_BRRED,
|
||||||
COLOR_RED,
|
COLOR_RED,
|
||||||
COLOR_GREEN
|
COLOR_GREEN,
|
||||||
|
COLOR_BRGREEN
|
||||||
};
|
};
|
||||||
|
|
||||||
static int make_components(char *s, int lineno)
|
static int make_components(char *s, int lineno)
|
||||||
@@ -141,6 +144,8 @@ static int make_components(char *s, int lineno)
|
|||||||
res |= (1 << __LOG_DEBUG);
|
res |= (1 << __LOG_DEBUG);
|
||||||
else if (!strcasecmp(w, "verbose"))
|
else if (!strcasecmp(w, "verbose"))
|
||||||
res |= (1 << __LOG_VERBOSE);
|
res |= (1 << __LOG_VERBOSE);
|
||||||
|
else if (!strcasecmp(w, "dtmf"))
|
||||||
|
res |= (1 << __LOG_DTMF);
|
||||||
else {
|
else {
|
||||||
fprintf(stderr, "Logfile Warning: Unknown keyword '%s' at line %d of logger.conf\n", w, lineno);
|
fprintf(stderr, "Logfile Warning: Unknown keyword '%s' at line %d of logger.conf\n", w, lineno);
|
||||||
}
|
}
|
||||||
@@ -495,6 +500,8 @@ static int handle_logger_show_channels(int fd, int argc, char *argv[])
|
|||||||
ast_cli(fd, " - ");
|
ast_cli(fd, " - ");
|
||||||
if (chan->logmask & (1 << __LOG_DEBUG))
|
if (chan->logmask & (1 << __LOG_DEBUG))
|
||||||
ast_cli(fd, "Debug ");
|
ast_cli(fd, "Debug ");
|
||||||
|
if (chan->logmask & (1 << __LOG_DTMF))
|
||||||
|
ast_cli(fd, "DTMF ");
|
||||||
if (chan->logmask & (1 << __LOG_VERBOSE))
|
if (chan->logmask & (1 << __LOG_VERBOSE))
|
||||||
ast_cli(fd, "Verbose ");
|
ast_cli(fd, "Verbose ");
|
||||||
if (chan->logmask & (1 << __LOG_WARNING))
|
if (chan->logmask & (1 << __LOG_WARNING))
|
||||||
@@ -653,6 +660,9 @@ static void ast_log_vsyslog(int level, const char *file, int line, const char *f
|
|||||||
if (level == __LOG_VERBOSE) {
|
if (level == __LOG_VERBOSE) {
|
||||||
snprintf(buf, sizeof(buf), "VERBOSE[%ld]: ", (long)GETTID());
|
snprintf(buf, sizeof(buf), "VERBOSE[%ld]: ", (long)GETTID());
|
||||||
level = __LOG_DEBUG;
|
level = __LOG_DEBUG;
|
||||||
|
} else if (level == __LOG_DTMF) {
|
||||||
|
snprintf(buf, sizeof(buf), "DTMF[%ld]: ", (long)GETTID());
|
||||||
|
level = __LOG_DEBUG;
|
||||||
} else {
|
} else {
|
||||||
snprintf(buf, sizeof(buf), "%s[%ld]: %s:%d in %s: ",
|
snprintf(buf, sizeof(buf), "%s[%ld]: %s:%d in %s: ",
|
||||||
levels[level], (long)GETTID(), file, line, function);
|
levels[level], (long)GETTID(), file, line, function);
|
||||||
|
Reference in New Issue
Block a user