@ -832,16 +832,18 @@ int ast_safe_system(const char *s)
/*!
/*!
* \ brief mute or unmute a console from logging
* \ 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 ;
int x ;
for ( x = 0 ; x < AST_MAX_CONNECTS ; x + + ) {
for ( x = 0 ; x < AST_MAX_CONNECTS ; x + + ) {
if ( fd = = consoles [ x ] . fd ) {
if ( fd = = consoles [ x ] . fd ) {
if ( consoles [ x ] . mute ) {
if ( consoles [ x ] . mute ) {
consoles [ x ] . mute = 0 ;
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 {
} else {
consoles [ x ] . mute = 1 ;
consoles [ x ] . mute = 1 ;
ast_cli ( fd , " Console is muted. \n " ) ;
if ( ! silent )
ast_cli ( fd , " Console is muted. \n " ) ;
}
}
return ;
return ;
}
}
@ -1000,7 +1002,7 @@ static void *listener(void *unused)
flags = fcntl ( consoles [ x ] . p [ 1 ] , F_GETFL ) ;
flags = fcntl ( consoles [ x ] . p [ 1 ] , F_GETFL ) ;
fcntl ( consoles [ x ] . p [ 1 ] , F_SETFL , flags | O_NONBLOCK ) ;
fcntl ( consoles [ x ] . p [ 1 ] , F_SETFL , flags | O_NONBLOCK ) ;
consoles [ x ] . fd = s ;
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_background ( & consoles [ x ] . t , & attr , netconsole , & consoles [ x ] ) ) {
if ( ast_pthread_create_background ( & consoles [ x ] . t , & attr , netconsole , & consoles [ x ] ) ) {
ast_log ( LOG_ERROR , " Unable to spawn thread to handle connection: %s \n " , strerror ( errno ) ) ;
ast_log ( LOG_ERROR , " Unable to spawn thread to handle connection: %s \n " , strerror ( errno ) ) ;
close ( consoles [ x ] . p [ 0 ] ) ;
close ( consoles [ x ] . p [ 0 ] ) ;
@ -2256,13 +2258,15 @@ static void ast_remotecontrol(char * data)
pid = atoi ( cpid ) ;
pid = atoi ( cpid ) ;
else
else
pid = - 1 ;
pid = - 1 ;
snprintf ( tmp , sizeof ( tmp ) , " core set verbose atleast %d " , option_verbose ) ;
if ( ! data ) {
fdprint ( ast_consock , tmp ) ;
snprintf ( tmp , sizeof ( tmp ) , " core set verbose atleast %d " , option_verbose ) ;
snprintf ( tmp , sizeof ( tmp ) , " core set debug atleast %d " , option_debug ) ;
fdprint ( ast_consock , tmp ) ;
if ( ast_opt_mute ) {
snprintf ( tmp , sizeof ( tmp ) , " log and verbose output currently muted ('logger unmute' to unmute) " ) ;
fdprint ( ast_consock , tmp ) ;
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 ) ;
ast_verbose ( " Connected to Asterisk %s currently running on %s (pid = %d) \n " , version , hostname , pid ) ;
remotehostname = hostname ;
remotehostname = hostname ;