diff --git a/bin/AST_update.pl b/bin/AST_update.pl index facde223..dfe41101 100644 --- a/bin/AST_update.pl +++ b/bin/AST_update.pl @@ -51,13 +51,15 @@ # 60807-1605 - Changed to DBI # 60808-1005 - changed to use /etc/astguiclient.conf for configs # 60808-1500 - Fixed another bug in that caused crash with ** in extension +# 60814-1523 - SYSLOG and SYSPERF looked up from database, dynamic settings # -$build = '60808-1500'; +$build = '60814-1523'; # constants $SYSPERF=0; # system performance logging to MySQL server_performance table every 5 seconds $SYSPERF_rec=0; # is dial-time recording turned on +$SYSLOG=0; # set to 1 to write log to a file $DB=0; # Debug flag, set to 1 for debug messages WARNING LOTS OF OUTPUT!!! $DBX=0; # Debug flag, set to 1 for debug messages WARNING LOTS OF OUTPUT!!! $US='__'; @@ -186,7 +188,7 @@ $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA &event_logger; ### Grab Server values from the database -$stmtA = "SELECT telnet_host,telnet_port,ASTmgrUSERNAME,ASTmgrSECRET,ASTmgrUSERNAMEupdate,ASTmgrUSERNAMElisten,ASTmgrUSERNAMEsend,max_vicidial_trunks,answer_transfer_agent,local_gmt,ext_context,asterisk_version FROM servers where server_ip = '$server_ip';"; +$stmtA = "SELECT telnet_host,telnet_port,ASTmgrUSERNAME,ASTmgrSECRET,ASTmgrUSERNAMEupdate,ASTmgrUSERNAMElisten,ASTmgrUSERNAMEsend,max_vicidial_trunks,answer_transfer_agent,local_gmt,ext_context,asterisk_version,sys_perf_log,vd_server_logs FROM servers where server_ip = '$server_ip';"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -206,6 +208,8 @@ while ($sthArows > $rec_count) $DBSERVER_GMT = "$aryA[9]"; $DBext_context = "$aryA[10]"; $DBasterisk_version = "$aryA[11]"; + $DBsys_perf_log = "$aryA[12]"; + $DBvd_server_logs = "$aryA[13]"; if ($DBtelnet_host) {$telnet_host = $DBtelnet_host;} if ($DBtelnet_port) {$telnet_port = $DBtelnet_port;} if ($DBASTmgrUSERNAME) {$ASTmgrUSERNAME = $DBASTmgrUSERNAME;} @@ -218,6 +222,8 @@ while ($sthArows > $rec_count) if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} if ($DBext_context) {$ext_context = $DBext_context;} if ($DBasterisk_version) {$AST_ver = $DBasterisk_version;} + if ($DBsys_perf_log =~ /Y/) {$SYSPERF = '1';} + if ($DBvd_server_logs =~ /Y/) {$SYSLOG = '1';} $rec_count++; } $sthA->finish(); @@ -626,6 +632,26 @@ if (!$telnet_port) {$telnet_port = '5038';} print STDERR "Zap Clients: $Zap_client_list\n"; print STDERR "IAX2 Clients: $IAX2_client_list\n"; print STDERR "SIP Clients: $SIP_client_list\n"; + ### Grab Server values from the database + $stmtA = "SELECT sys_perf_log,vd_server_logs FROM servers where server_ip = '$server_ip';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBsys_perf_log = "$aryA[0]"; + $DBvd_server_logs = "$aryA[1]"; + if ($DBsys_perf_log =~ /Y/) {$SYSPERF = '1';} + else {$SYSPERF = '0';} + if ($DBvd_server_logs =~ /Y/) {$SYSLOG = '1';} + else {$SYSLOG = '0';} + $rec_count++; + } + $sthA->finish(); + if ($SYSPERFDB) + {print "SYSPERF RELOAD: $DBsys_perf_log:$SYSPERF|$DBvd_server_logs:$SYSLOG\n";} } @list_chan_12=@MT; @@ -1163,9 +1189,12 @@ $now_date = "$year-$mon-$mday $hour:$min:$sec"; ##### open the log file for writing ### sub event_logger { -open(Lout, ">>$UPLOGfile") - || die "Can't open $UPLOGfile: $!\n"; -print Lout "$now_date|$event_string|\n"; -close(Lout); +if ($SYSLOG) + { + open(Lout, ">>$UPLOGfile") + || die "Can't open $UPLOGfile: $!\n"; + print Lout "$now_date|$event_string|\n"; + close(Lout); + } $event_string=''; } diff --git a/extras/MySQL_AST_CREATE_tables.sql b/extras/MySQL_AST_CREATE_tables.sql index 6b37871d..3f10ef1b 100644 --- a/extras/MySQL_AST_CREATE_tables.sql +++ b/extras/MySQL_AST_CREATE_tables.sql @@ -85,7 +85,9 @@ ASTmgrUSERNAMEsend VARCHAR(20) NOT NULL default 'sendcron', local_gmt VARCHAR(5) default '-5', voicemail_dump_exten VARCHAR(20) NOT NULL default '85026666666666', answer_transfer_agent VARCHAR(20) NOT NULL default '8365', -ext_context VARCHAR(20) NOT NULL default 'default' +ext_context VARCHAR(20) NOT NULL default 'default', +sys_perf_log ENUM('Y','N') default 'N', +vd_server_logs ENUM('Y','N') default 'Y' ); diff --git a/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.txt b/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.txt index 351720cb..b9f584bf 100644 --- a/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.txt +++ b/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.txt @@ -1,7 +1,8 @@ ############################################################ ADMIN If you want to allow Consultative Transfers, a fronter to a closer, you can place CXFER as one of the number-to-dial presets and the proper dialstring will be sent to do a Local Consultative Transfer, then the agent can just LEAVE-3WAY-CALL and move on to their next call. If you want to allow Blind transfers of customers to a VICIDIAL AGI script for logging or an IVR, then place AXFER in the number-to-dial field. You can also specify an custom extension after the AXFER or CXFER, for instance if you want to do Internal Consultative transfers instead of Local you would put CXFER90009 in the number-to-dial field|| - +System Performance -<\/B> Setting this option to Y will enable logging of system performance stats for the server machine including system load, system processes and Asterisk channels in use. Default is N|| +Server Logs -<\/B> Setting this option to Y will enable logging of all VICIDIAL related scripts to their text log files. Setting this to N will stop writing logs to files for these processes, also the screen logging of asterisk will be disabled if this is set to N when Asterisk is started. Default is Y|| ############################################################ CLIENT diff --git a/www/astguiclient/admin.php b/www/astguiclient/admin.php index 394b2426..1c91c46a 100644 --- a/www/astguiclient/admin.php +++ b/www/astguiclient/admin.php @@ -16,10 +16,11 @@ # 60427-1137 - Fixed phone search bug # 60620-1243 - Added variable filtering to eliminate SQL injection attack threat # 60814-1402 - Added off-hour gmt values (India, Australia, etc...) +# 60814-1540 - Added system performance logging and script logging options # $version = '2.0.1'; -$build = '60814-1402'; +$build = '60814-1540'; require("dbconnect.php"); @@ -198,6 +199,10 @@ if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} if (isset($_GET["CoNfIrM"])) {$CoNfIrM=$_GET["CoNfIrM"];} elseif (isset($_POST["CoNfIrM"])) {$CoNfIrM=$_POST["CoNfIrM"];} +if (isset($_GET["sys_perf_log"])) {$sys_perf_log=$_GET["sys_perf_log"];} + elseif (isset($_POST["sys_perf_log"])) {$sys_perf_log=$_POST["sys_perf_log"];} +if (isset($_GET["vd_server_logs"])) {$vd_server_logs=$_GET["vd_server_logs"];} + elseif (isset($_POST["vd_server_logs"])) {$vd_server_logs=$_POST["vd_server_logs"];} ##### BEGIN VARIABLE FILTERING FOR SECURITY ##### @@ -209,6 +214,8 @@ $computer_ip = ereg_replace("[^\.0-9]","",$computer_ip); ### Y or N ONLY ### $active = ereg_replace("[^NY]","",$active); +$sys_perf_log = ereg_replace("[^NY]","",$sys_perf_log); +$vd_server_logs = ereg_replace("[^NY]","",$vd_server_logs); ### DIGITS ONLY ### $dialplan_number = ereg_replace("[^0-9]","",$dialplan_number); @@ -857,6 +864,16 @@ echo "\n"; echo "\n"; echo "\n"; +echo "\n"; +echo "\n"; echo "\n"; echo "
Default Context - The default dialplan context used for scripts that operate for this server. Default is 'default' +
+ +
+System Performance - Setting this option to Y will enable logging of system performance stats for the server machine including system load, system processes and Asterisk channels in use. Default is N. + +
+
+
+Server Logs - Setting this option to Y will enable logging of all VICIDIAL related scripts to their text log files. Setting this to N will stop writing logs to files for these processes, also the screen logging of asterisk will be disabled if this is set to N when Asterisk is started. Default is Y. +



@@ -1292,6 +1309,8 @@ echo "
Local GMT: VMail Dump Exten: $NWB#servers-voicemail_dump_exten$NWE
VICIDIAL AD extension: $NWB#servers-answer_transfer_agent$NWE
Default Context: $NWB#servers-ext_context$NWE
System Performance: $NWB#servers-sys_perf_log$NWE
Server Logs: $NWB#servers-vd_server_logs$NWE
\n"; @@ -1510,7 +1529,7 @@ if ($ADD==41) { echo "
SERVER MODIFIED: $server_ip\n"; - $stmt="UPDATE servers set server_id='$server_id',server_description='$server_description',server_ip='$server_ip',active='$active',asterisk_version='$asterisk_version', max_vicidial_trunks='$max_vicidial_trunks', telnet_host='$telnet_host', telnet_port='$telnet_port', ASTmgrUSERNAME='$ASTmgrUSERNAME', ASTmgrSECRET='$ASTmgrSECRET', ASTmgrUSERNAMEupdate='$ASTmgrUSERNAMEupdate', ASTmgrUSERNAMElisten='$ASTmgrUSERNAMElisten', ASTmgrUSERNAMEsend='$ASTmgrUSERNAMEsend', local_gmt='$local_gmt', voicemail_dump_exten='$voicemail_dump_exten', answer_transfer_agent='$answer_transfer_agent', ext_context='$ext_context' where server_id='$old_server_id';"; + $stmt="UPDATE servers set server_id='$server_id',server_description='$server_description',server_ip='$server_ip',active='$active',asterisk_version='$asterisk_version', max_vicidial_trunks='$max_vicidial_trunks', telnet_host='$telnet_host', telnet_port='$telnet_port', ASTmgrUSERNAME='$ASTmgrUSERNAME', ASTmgrSECRET='$ASTmgrSECRET', ASTmgrUSERNAMEupdate='$ASTmgrUSERNAMEupdate', ASTmgrUSERNAMElisten='$ASTmgrUSERNAMElisten', ASTmgrUSERNAMEsend='$ASTmgrUSERNAMEsend', local_gmt='$local_gmt', voicemail_dump_exten='$voicemail_dump_exten', answer_transfer_agent='$answer_transfer_agent', ext_context='$ext_context', sys_perf_log='$sys_perf_log', vd_server_logs='$vd_server_logs' where server_id='$old_server_id';"; $rslt=mysql_query($stmt, $link); } } @@ -1542,6 +1561,8 @@ echo "Local GMT: $NWB#servers-voicemail_dump_exten$NWE\n"; echo "VICIDIAL AD extension: $NWB#servers-answer_transfer_agent$NWE\n"; echo "Default Context: $NWB#servers-ext_context$NWE\n"; +echo "System Performance: $NWB#servers-sys_perf_log$NWE\n"; +echo "Server Logs: $NWB#servers-vd_server_logs$NWE\n"; echo "\n"; echo "\n";