diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-10-13 05:53:19 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-10-13 05:53:19 +0000 |
commit | ac808d6bde47ded2e36eb4af4380d5cad8547488 (patch) | |
tree | 51ee6d917d6469412efe549d68ab306ae38002de /main/asterisk.c | |
parent | 07fe72da0e1e81f51e47f65e9f6cc8ad6fad7c46 (diff) |
Merged revisions 85533 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r85533 | russell | 2007-10-13 01:48:10 -0400 (Sat, 13 Oct 2007) | 12 lines
Fix an issue with console verbosity when running asterisk -rx to execute a command
and retrieve its output. The issue was that there was no way for the main Asterisk
process to know that the remote console was connecting in the -rx mode. The way that
James has fixed this is to have all remote consoles muted by default. Then, regular
remote consoles automatically execute a CLI command to unmute themselves when they
first start up.
(closes issue #10847)
Reported by: atis
Patches:
asterisk-consolemute.diff.txt uploaded by jamesgolovich (license 176)
........
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@85534 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/asterisk.c')
-rw-r--r-- | main/asterisk.c | 24 |
1 files changed, 14 insertions, 10 deletions
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; |