aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/asterisk/logger.h2
-rw-r--r--main/asterisk.c24
-rw-r--r--main/cli.c9
3 files changed, 22 insertions, 13 deletions
diff --git a/include/asterisk/logger.h b/include/asterisk/logger.h
index d99dfe74c..2cfc8ecc3 100644
--- a/include/asterisk/logger.h
+++ b/include/asterisk/logger.h
@@ -85,7 +85,7 @@ int ast_unregister_verbose(void (*verboser)(const char *string));
void ast_console_puts(const char *string);
void ast_console_puts_mutable(const char *string);
-void ast_console_toggle_mute(int fd);
+void ast_console_toggle_mute(int fd, int silent);
#define _A_ __FILE__, __LINE__, __PRETTY_FUNCTION__
diff --git a/main/asterisk.c b/main/asterisk.c
index 6e9ccb7d4..ab8b0696a 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -857,16 +857,18 @@ int ast_safe_system(const char *s)
/*!
* \brief mute or unmute a console from logging
*/
-void ast_console_toggle_mute(int fd) {
+void ast_console_toggle_mute(int fd, int silent) {
int x;
for (x = 0;x < AST_MAX_CONNECTS; x++) {
if (fd == consoles[x].fd) {
if (consoles[x].mute) {
consoles[x].mute = 0;
- ast_cli(fd, "Console is not muted anymore.\n");
+ if (!silent)
+ ast_cli(fd, "Console is not muted anymore.\n");
} else {
consoles[x].mute = 1;
- ast_cli(fd, "Console is muted.\n");
+ if (!silent)
+ ast_cli(fd, "Console is muted.\n");
}
return;
}
@@ -1022,7 +1024,7 @@ static void *listener(void *unused)
flags = fcntl(consoles[x].p[1], F_GETFL);
fcntl(consoles[x].p[1], F_SETFL, flags | O_NONBLOCK);
consoles[x].fd = s;
- consoles[x].mute = ast_opt_mute;
+ consoles[x].mute = 1; /* Default is muted, we will un-mute if necessary */
if (ast_pthread_create_detached_background(&consoles[x].t, NULL, netconsole, &consoles[x])) {
ast_log(LOG_ERROR, "Unable to spawn thread to handle connection: %s\n", strerror(errno));
close(consoles[x].p[0]);
@@ -2281,13 +2283,15 @@ static void ast_remotecontrol(char * data)
pid = atoi(cpid);
else
pid = -1;
- snprintf(tmp, sizeof(tmp), "core set verbose atleast %d", option_verbose);
- fdprint(ast_consock, tmp);
- snprintf(tmp, sizeof(tmp), "core set debug atleast %d", option_debug);
- fdprint(ast_consock, tmp);
- if (ast_opt_mute) {
- ast_copy_string(tmp, "log and verbose output currently muted ('logger unmute' to unmute)", sizeof(tmp));
+ if (!data) {
+ snprintf(tmp, sizeof(tmp), "core set verbose atleast %d", option_verbose);
fdprint(ast_consock, tmp);
+ snprintf(tmp, sizeof(tmp), "core set debug atleast %d", option_debug);
+ fdprint(ast_consock, tmp);
+ if (!ast_opt_mute)
+ fdprint(ast_consock, "logger mute silent");
+ else
+ printf("log and verbose output currently muted ('logger mute' to unmute)\n");
}
ast_verbose("Connected to Asterisk %s currently running on %s (pid = %d)\n", version, hostname, pid);
remotehostname = hostname;
diff --git a/main/cli.c b/main/cli.c
index da4c25fe3..3a08eae7c 100644
--- a/main/cli.c
+++ b/main/cli.c
@@ -371,9 +371,14 @@ static char *handle_logger_mute(struct ast_cli_entry *e, int cmd, struct ast_cli
return NULL;
}
- if (a->argc != 2)
+ if (a->argc < 2 || a->argc > 3)
return CLI_SHOWUSAGE;
- ast_console_toggle_mute(a->fd);
+
+ if (a->argc == 3 && !strcasecmp(argv[2], "silent"))
+ ast_console_toggle_mute(a->fd, 1);
+ else
+ ast_console_toggle_mute(a->fd, 0);
+
return CLI_SUCCESS;
}