From f1c30b9bfaa97443cf80e1f4b56b1a5bf13992d4 Mon Sep 17 00:00:00 2001 From: mattf Date: Tue, 29 Dec 2015 22:33:17 +0000 Subject: [PATCH] Added utility to gather and display Asterisk debug information. Includes a server setting and Admin Utilities report. git-svn-id: svn://192.168.202.10@2445 3d104415-ff17-0410-8863-d5cf3c621b8a --- UPGRADE | 3 + bin/ADMIN_keepalive_ALL.pl | 25 ++- extras/MySQL_AST_CREATE_tables.sql | 14 +- extras/upgrade_2.12.sql | 13 ++ www/vicidial/admin.php | 21 +- www/vicidial/asterisk_debug.php | 305 +++++++++++++++++++++++++++++ www/vicidial/help.php | 6 + 7 files changed, 375 insertions(+), 12 deletions(-) create mode 100644 www/vicidial/asterisk_debug.php diff --git a/UPGRADE b/UPGRADE index 6e4492bf..c9dc5010 100644 --- a/UPGRADE +++ b/UPGRADE @@ -212,6 +212,9 @@ OTHER CHANGES: 52. Added example code for a CRM Iframe agent screen skin(extras/crm_iframe) See the CRM_EXAMPLE_SKIN.txt doc for more information +53. Added utility to gather and display Asterisk debug information. Includes + a server setting and Admin Utilities report. + diff --git a/bin/ADMIN_keepalive_ALL.pl b/bin/ADMIN_keepalive_ALL.pl index e3f8d8b8..bc310524 100644 --- a/bin/ADMIN_keepalive_ALL.pl +++ b/bin/ADMIN_keepalive_ALL.pl @@ -105,9 +105,10 @@ # 151204-0639 - Added phones-unavail_dialplan_fwd_exten options # 151211-1509 - Added launching of the AST_chat_timeout_cron.pl process on the voicemail server # 151226-1024 - Fix for double-write of extension in conf files for IAX and SIP, Issue #908 +# 151229-1623 - Added asterisk output logger launching, tied to server setting, runs every 5 minutes if active # -$build = '151226-1024'; +$build = '151229-1623'; $DB=0; # Debug flag @@ -1388,7 +1389,7 @@ $sthA->finish(); if ($DBXXX > 0) {print "SYSTEM SETTINGS: $sounds_central_control_active|$active_voicemail_server|$SScustom_dialplan_entry|$SSdefault_codecs\n";} ##### Get the settings for this server's server_ip ##### -$stmtA = "SELECT active_asterisk_server,generate_vicidial_conf,rebuild_conf_files,asterisk_version,sounds_update,conf_secret,custom_dialplan_entry,auto_restart_asterisk,asterisk_temp_no_restart FROM servers where server_ip='$server_ip';"; +$stmtA = "SELECT active_asterisk_server,generate_vicidial_conf,rebuild_conf_files,asterisk_version,sounds_update,conf_secret,custom_dialplan_entry,auto_restart_asterisk,asterisk_temp_no_restart,gather_asterisk_output FROM servers where server_ip='$server_ip';"; # print "$stmtA\n"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; @@ -1405,6 +1406,7 @@ if ($sthArows > 0) $SERVERcustom_dialplan_entry = $aryA[6]; $auto_restart_asterisk = $aryA[7]; $asterisk_temp_no_restart = $aryA[8]; + $gather_asterisk_output = $aryA[9]; } $sthA->finish(); @@ -3558,6 +3560,25 @@ if (length($uptimebin)>3) ################################################################################ + + + +################################################################################ +##### BEGIN Gathering asterisk output and peers/registry +################################################################################ +if ( ($active_asterisk_server =~ /Y/) && ($gather_asterisk_output =~ /Y/) && ($reset_test =~ /0$|5$/) ) + { + if ($DB) {print "Gathering asterisk output and peers/registry\n";} + `/usr/bin/screen -d -m -S GatherOutput $PATHhome/AST_output_update.pl 2>/dev/null 1>&2`; + } +################################################################################ +##### BEGIN Gathering asterisk output and peers/registry +################################################################################ + + + + + ################################################################################ ##### BEGIN Confirm Asterisk is running, and if not restart it from the screen ################################################################################ diff --git a/extras/MySQL_AST_CREATE_tables.sql b/extras/MySQL_AST_CREATE_tables.sql index c55266fe..9f3cda0e 100644 --- a/extras/MySQL_AST_CREATE_tables.sql +++ b/extras/MySQL_AST_CREATE_tables.sql @@ -151,7 +151,8 @@ svn_info TEXT, system_uptime VARCHAR(255) default '', auto_restart_asterisk ENUM('Y','N') default 'N', asterisk_temp_no_restart ENUM('Y','N') default 'N', -voicemail_dump_exten_no_inst VARCHAR(20) default '85026666666667' +voicemail_dump_exten_no_inst VARCHAR(20) default '85026666666667', +gather_asterisk_output ENUM('Y','N') default 'N' ) ENGINE=MyISAM; CREATE UNIQUE INDEX server_id on servers (server_id); @@ -3412,6 +3413,15 @@ tld VARCHAR(20) default '', index(iso3) )ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_unicode_ci; +CREATE TABLE vicidial_asterisk_output ( +server_ip VARCHAR(15) NOT NULL, +sip_peers MEDIUMTEXT, +iax_peers MEDIUMTEXT, +asterisk MEDIUMTEXT, +update_date DATETIME, +unique index(server_ip) +)ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_unicode_ci; + ALTER TABLE vicidial_email_list MODIFY message text character set utf8; @@ -3661,4 +3671,4 @@ UPDATE vicidial_configuration set value='1766' where name='qc_database_version'; UPDATE system_settings set vdc_agent_api_active='1'; -UPDATE system_settings SET db_schema_version='1442',db_schema_update_date=NOW(),reload_timestamp=NOW(); +UPDATE system_settings SET db_schema_version='1443',db_schema_update_date=NOW(),reload_timestamp=NOW(); diff --git a/extras/upgrade_2.12.sql b/extras/upgrade_2.12.sql index b44cd8a8..903b3617 100644 --- a/extras/upgrade_2.12.sql +++ b/extras/upgrade_2.12.sql @@ -423,3 +423,16 @@ index(iso3) )ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_unicode_ci; UPDATE system_settings SET db_schema_version='1442',db_schema_update_date=NOW() where db_schema_version < 1442; + +CREATE TABLE vicidial_asterisk_output ( +server_ip VARCHAR(15) NOT NULL, +sip_peers MEDIUMTEXT, +iax_peers MEDIUMTEXT, +asterisk MEDIUMTEXT, +update_date DATETIME, +unique index(server_ip) +)ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_unicode_ci; + +ALTER TABLE servers ADD gather_asterisk_output ENUM('Y','N') default 'N'; + +UPDATE system_settings SET db_schema_version='1443',db_schema_update_date=NOW() where db_schema_version < 1443; diff --git a/www/vicidial/admin.php b/www/vicidial/admin.php index e0aa9f0c..bdde81ed 100644 --- a/www/vicidial/admin.php +++ b/www/vicidial/admin.php @@ -111,13 +111,13 @@ $PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; $PHP_SELF=$_SERVER['PHP_SELF']; $QUERY_STRING = getenv("QUERY_STRING"); -$Vreports = 'NONE, Real-Time Main Report, Real-Time Campaign Summary, Inbound Report, Inbound Service Level Report, Inbound Summary Hourly Report, Inbound Daily Report, Inbound DID Report, Inbound IVR Report, Outbound Calling Report, Outbound Summary Interval Report, Outbound IVR Report, Fronter - Closer Report, Lists Campaign Statuses Report, Lists Statuses Report, Campaign Status List Report, Export Calls Report, Export Leads Report, Agent Time Detail, Agent Status Detail, Agent Performance Detail, Team Performance Detail, Performance Comparison Report, Single Agent Daily, Single Agent Daily Time, User Group Login Report, User Timeclock Report, User Group Timeclock Status Report, User Timeclock Detail Report, Server Performance Report, Administration Change Log, List Update Stats, User Stats, User Time Sheet, Download List, Dialer Inventory Report, Maximum System Stats, Maximum Stats Detail, Search Leads Logs, Email Log Report, Carrier Log Report, Campaign Debug, Hangup Cause Report, Lists Pass Report, Called Counts List IDs Report, Agent Debug Log Report, Agent-Manager Chat Log'; +$Vreports = 'NONE, Real-Time Main Report, Real-Time Campaign Summary, Inbound Report, Inbound Service Level Report, Inbound Summary Hourly Report, Inbound Daily Report, Inbound DID Report, Inbound IVR Report, Outbound Calling Report, Outbound Summary Interval Report, Outbound IVR Report, Fronter - Closer Report, Lists Campaign Statuses Report, Lists Statuses Report, Campaign Status List Report, Export Calls Report, Export Leads Report, Agent Time Detail, Agent Status Detail, Agent Performance Detail, Team Performance Detail, Performance Comparison Report, Single Agent Daily, Single Agent Daily Time, User Group Login Report, User Timeclock Report, User Group Timeclock Status Report, User Timeclock Detail Report, Server Performance Report, Administration Change Log, List Update Stats, User Stats, User Time Sheet, Download List, Dialer Inventory Report, Maximum System Stats, Maximum Stats Detail, Search Leads Logs, Email Log Report, Carrier Log Report, Campaign Debug, Asterisk Debug, Hangup Cause Report, Lists Pass Report, Called Counts List IDs Report, Agent Debug Log Report, Agent-Manager Chat Log'; $UGreports = 'ALL REPORTS, NONE, Real-Time Main Report, Real-Time Campaign Summary, Inbound Report, Inbound Report by DID, Inbound Service Level Report, Inbound Summary Hourly Report, Inbound Daily Report, Inbound DID Report, Inbound Email Report, Inbound Chat Report, Inbound IVR Report, Outbound Calling Report, Outbound Summary Interval Report, Outbound IVR Report, Fronter - Closer Report, Lists Campaign Statuses Report, Lists Statuses Report, Campaign Status List Report, Export Calls Report, Export Leads Report, Agent Time Detail, Agent Status Detail, Agent Performance Detail, Team Performance Detail, Performance Comparison Report, Single Agent Daily, Single Agent Daily Time, User Group Login Report, User Timeclock Report, User Group Timeclock Status Report, User Timeclock Detail Report, Server Performance Report, Administration Change Log, List Update Stats, User Stats, User Time Sheet, Download List, Dialer Inventory Report, Custom Reports Links, CallCard Search, Maximum System Stats, Maximum Stats Detail, Search Leads Logs, Email Log Report, Lists Pass Report, Called Counts List IDs Report, Front Page System Summary, Report Page Servers Summary, Admin Utilities Page, Agent Debug Log Report, Agent-Manager Chat Log'; $Vtables = 'NONE,log_noanswer,did_agent_log,contact_information'; -$APIfunctions = 'ALL_FUNCTIONS add_group_alias add_lead add_list add_phone add_phone_alias add_user agent_ingroup_info agent_stats_export agent_status audio_playback blind_monitor call_agent callid_info change_ingroups check_phone_number did_log_export external_add_lead external_dial external_hangup external_pause external_status in_group_status logout moh_list park_call pause_code preview_dial_action ra_call_control recording recording_lookup send_dtmf server_refresh set_timer_action sounds_list st_get_agent_active_lead st_login_log transfer_conference update_fields update_lead update_list update_log_entry update_phone update_phone_alias update_user user_group_status vm_list webphone_url webserver'; +$APIfunctions = 'ALL_FUNCTIONS add_group_alias add_lead add_list add_phone add_phone_alias add_user agent_ingroup_info agent_stats_export agent_status audio_playback blind_monitor call_agent callid_info change_ingroups check_phone_number did_log_export external_add_lead external_dial external_hangup external_pause external_status in_group_status logout moh_list park_call pause_code preview_dial_action ra_call_control recording recording_lookup send_dtmf server_refresh set_timer_action sounds_list st_get_agent_active_lead st_login_log transfer_conference update_fields update_lead update_list update_log_entry update_phone update_phone_alias update_user user_group_status vm_list webphone_url webserver logged_in_agents'; ###################################################################################################### ###################################################################################################### @@ -2016,6 +2016,8 @@ if (isset($_GET["nva_new_phone_code"])) {$nva_new_phone_code=$_GET["nva_new_p elseif (isset($_POST["nva_new_phone_code"])) {$nva_new_phone_code=$_POST["nva_new_phone_code"];} if (isset($_GET["nva_new_status"])) {$nva_new_status=$_GET["nva_new_status"];} elseif (isset($_POST["nva_new_status"])) {$nva_new_status=$_POST["nva_new_status"];} +if (isset($_GET["gather_asterisk_output"])) {$gather_asterisk_output=$_GET["gather_asterisk_output"];} + elseif (isset($_POST["gather_asterisk_output"])) {$gather_asterisk_output=$_POST["gather_asterisk_output"];} if (isset($script_id)) {$script_id= strtoupper($script_id);} @@ -2493,6 +2495,7 @@ if ($non_latin < 1) $wait_time_lead_reset = preg_replace('/[^NY]/','',$wait_time_lead_reset); $hold_time_lead_reset = preg_replace('/[^NY]/','',$hold_time_lead_reset); $am_message_wildcards = preg_replace('/[^NY]/','',$am_message_wildcards); + $gather_asterisk_output = preg_replace('/[^NY]/','',$gather_asterisk_output); $qc_enabled = preg_replace('/[^0-9NY]/','',$qc_enabled); $active = preg_replace('/[^0-9NY]/','',$active); @@ -3664,12 +3667,13 @@ else # 151216-1053 - Added links to Inbound Chat Report # 151220-1545 - Added more phone NVA settings # 151221-0750 - Changes to Chat In-group Modify page +# 151229-1653 - Added gather_asterisk_output server option # # make sure you have added a user to the vicidial_users MySQL table with at least user_level 9 to access this page the first time -$admin_version = '2.12-526a'; -$build = '151221-0750'; +$admin_version = '2.12-527a'; +$build = '151229-1653'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -14797,7 +14801,7 @@ if ($ADD==411111111111) $custom_dialplanSQL=''; if ($LOGmodify_custom_dialplans > 0) {$custom_dialplanSQL = ",custom_dialplan_entry='$custom_dialplan_entry'";} - $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', agi_output='$agi_output', vicidial_balance_active='$vicidial_balance_active',balance_trunks_offlimits='$balance_trunks_offlimits',recording_web_link='$recording_web_link',alt_server_ip='$alt_server_ip',active_asterisk_server='$active_asterisk_server',generate_vicidial_conf='$generate_vicidial_conf',rebuild_conf_files='$rebuild_conf_files',outbound_calls_per_second='$outbound_calls_per_second',sounds_update='$sounds_update',vicidial_recording_limit='$vicidial_recording_limit',carrier_logging_active='$carrier_logging_active',vicidial_balance_rank='$vicidial_balance_rank',rebuild_music_on_hold='$rebuild_music_on_hold',active_agent_login_server='$active_agent_login_server',conf_secret='$conf_secret',external_server_ip='$external_server_ip',active_twin_server_ip='$active_twin_server_ip',user_group='$user_group',auto_restart_asterisk='$auto_restart_asterisk',asterisk_temp_no_restart='$asterisk_temp_no_restart',voicemail_dump_exten_no_inst='$voicemail_dump_exten_no_inst'$custom_dialplanSQL 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', agi_output='$agi_output', vicidial_balance_active='$vicidial_balance_active',balance_trunks_offlimits='$balance_trunks_offlimits',recording_web_link='$recording_web_link',alt_server_ip='$alt_server_ip',active_asterisk_server='$active_asterisk_server',generate_vicidial_conf='$generate_vicidial_conf',rebuild_conf_files='$rebuild_conf_files',outbound_calls_per_second='$outbound_calls_per_second',sounds_update='$sounds_update',vicidial_recording_limit='$vicidial_recording_limit',carrier_logging_active='$carrier_logging_active',vicidial_balance_rank='$vicidial_balance_rank',rebuild_music_on_hold='$rebuild_music_on_hold',active_agent_login_server='$active_agent_login_server',conf_secret='$conf_secret',external_server_ip='$external_server_ip',active_twin_server_ip='$active_twin_server_ip',user_group='$user_group',auto_restart_asterisk='$auto_restart_asterisk',asterisk_temp_no_restart='$asterisk_temp_no_restart',voicemail_dump_exten_no_inst='$voicemail_dump_exten_no_inst',gather_asterisk_output='$gather_asterisk_output'$custom_dialplanSQL where server_id='$old_server_id';"; $rslt=mysql_to_mysqli($stmt, $link); $stmtA="UPDATE servers SET rebuild_conf_files='Y',rebuild_music_on_hold='Y' where generate_vicidial_conf='Y' and active_asterisk_server='Y';"; @@ -30261,7 +30265,7 @@ if ($ADD==311111111111) echo "\n"; echo "\n"; echo "\n"; - - #$%^ + echo "\n"; echo "\n"; echo "\n"; @@ -36169,6 +36173,7 @@ if ($ADD==999994) echo "
  • "._QXZ("Dial Log Report")."\n"; echo "
  • "._QXZ("Carrier Log Report")."\n"; echo "
  • "._QXZ("Hangup Cause Report")."\n"; + echo "
  • "._QXZ("Asterisk Debug Page")."\n"; echo "
  • "._QXZ("Export Calls Report Carrier")."\n"; echo "
  • "._QXZ("URL Log Report")."\n"; echo "
  • "._QXZ("Webserver-URL Report")."\n"; diff --git a/www/vicidial/asterisk_debug.php b/www/vicidial/asterisk_debug.php new file mode 100644 index 00000000..1565a9f6 --- /dev/null +++ b/www/vicidial/asterisk_debug.php @@ -0,0 +1,305 @@ + LICENSE: AGPLv2 +# +# CHANGES +# 151229-1703 - First build +# + +$startMS = microtime(); + +$report_name='Asterisk Debug'; + +require("dbconnect_mysqli.php"); +require("functions.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +############################################# +##### START SYSTEM_SETTINGS LOOKUP ##### +$stmt = "SELECT use_non_latin,webroot_writable,outbound_autodial_active,user_territories_active,enable_languages,language_method FROM system_settings;"; +$rslt=mysql_to_mysqli($stmt, $link); +if ($DB) {echo "$stmt\n";} +$qm_conf_ct = mysqli_num_rows($rslt); +if ($qm_conf_ct > 0) + { + $row=mysqli_fetch_row($rslt); + $non_latin = $row[0]; + $webroot_writable = $row[1]; + $SSoutbound_autodial_active = $row[2]; + $user_territories_active = $row[3]; + $SSenable_languages = $row[4]; + $SSlanguage_method = $row[5]; + } +##### END SETTINGS LOOKUP ##### +########################################### + +if ($non_latin < 1) + { + $PHP_AUTH_USER = preg_replace('/[^-_0-9a-zA-Z]/', '', $PHP_AUTH_USER); + $PHP_AUTH_PW = preg_replace('/[^-_0-9a-zA-Z]/', '', $PHP_AUTH_PW); + } +else + { + $PHP_AUTH_PW = preg_replace("/'|\"|\\\\|;/","",$PHP_AUTH_PW); + $PHP_AUTH_USER = preg_replace("/'|\"|\\\\|;/","",$PHP_AUTH_USER); + } + +$stmt="SELECT selected_language from vicidial_users where user='$PHP_AUTH_USER';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_to_mysqli($stmt, $link); +$sl_ct = mysqli_num_rows($rslt); +if ($sl_ct > 0) + { + $row=mysqli_fetch_row($rslt); + $VUselected_language = $row[0]; + } + +$auth=0; +$reports_auth=0; +$admin_auth=0; +$auth_message = user_authorization($PHP_AUTH_USER,$PHP_AUTH_PW,'',1); +if ($auth_message == 'GOOD') + {$auth=1;} + +if ($auth > 0) + { + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and user_level > 7 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_to_mysqli($stmt, $link); + $row=mysqli_fetch_row($rslt); + $admin_auth=$row[0]; + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_to_mysqli($stmt, $link); + $row=mysqli_fetch_row($rslt); + $reports_auth=$row[0]; + + if ($reports_auth < 1) + { + $VDdisplayMESSAGE = _QXZ("You are not allowed to view reports"); + Header ("Content-type: text/html; charset=utf-8"); + echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n"; + exit; + } + if ( ($reports_auth > 0) and ($admin_auth < 1) ) + { + $ADD=999999; + $reports_only_user=1; + } + } +else + { + $VDdisplayMESSAGE = _QXZ("Login incorrect, please try again"); + if ($auth_message == 'LOCK') + { + $VDdisplayMESSAGE = _QXZ("Too many login attempts, try again in 15 minutes"); + Header ("Content-type: text/html; charset=utf-8"); + echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n"; + exit; + } + Header("WWW-Authenticate: Basic realm=\"CONTACT-CENTER-ADMIN\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$PHP_AUTH_PW|$auth_message|\n"; + exit; + } + +$stmt="SELECT modify_servers,user_group from vicidial_users where user='$PHP_AUTH_USER';"; +$rslt=mysql_to_mysqli($stmt, $link); +$row=mysqli_fetch_row($rslt); +$LOGmodify_servers = $row[0]; +$LOGuser_group = $row[1]; + +if ($LOGmodify_servers < 1) + { + Header ("Content-type: text/html; charset=utf-8"); + echo _QXZ("You do not have permissions for asterisk debugging").": |$PHP_AUTH_USER|\n"; + exit; + } + + +##### BEGIN log visit to the vicidial_report_log table ##### +$LOGip = getenv("REMOTE_ADDR"); +$LOGbrowser = getenv("HTTP_USER_AGENT"); +$LOGscript_name = getenv("SCRIPT_NAME"); +$LOGserver_name = getenv("SERVER_NAME"); +$LOGserver_port = getenv("SERVER_PORT"); +$LOGrequest_uri = getenv("REQUEST_URI"); +$LOGhttp_referer = getenv("HTTP_REFERER"); +if (preg_match("/443/i",$LOGserver_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +if (($LOGserver_port == '80') or ($LOGserver_port == '443') ) {$LOGserver_port='';} +else {$LOGserver_port = ":$LOGserver_port";} +$LOGfull_url = "$HTTPprotocol$LOGserver_name$LOGserver_port$LOGrequest_uri"; + +$LOGhostname = php_uname('n'); +if (strlen($LOGhostname)<1) {$LOGhostname='X';} +if (strlen($LOGserver_name)<1) {$LOGserver_name='X';} + +$stmt="SELECT webserver_id FROM vicidial_webservers where webserver='$LOGserver_name' and hostname='$LOGhostname' LIMIT 1;"; +$rslt=mysql_to_mysqli($stmt, $link); +if ($DB) {echo "$stmt\n";} +$webserver_id_ct = mysqli_num_rows($rslt); +if ($webserver_id_ct > 0) + { + $row=mysqli_fetch_row($rslt); + $webserver_id = $row[0]; + } +else + { + ##### insert webserver entry + $stmt="INSERT INTO vicidial_webservers (webserver,hostname) values('$LOGserver_name','$LOGhostname');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_to_mysqli($stmt, $link); + $affected_rows = mysqli_affected_rows($link); + $webserver_id = mysqli_insert_id($link); + } + +$stmt="INSERT INTO vicidial_report_log set event_date=NOW(), user='$PHP_AUTH_USER', ip_address='$LOGip', report_name='$report_name', browser='$LOGbrowser', referer='$LOGhttp_referer', notes='$LOGserver_name:$LOGserver_port $LOGscript_name', url='$LOGfull_url', webserver='$webserver_id';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_to_mysqli($stmt, $link); +$report_log_id = mysqli_insert_id($link); +##### END log visit to the vicidial_report_log table ##### + +if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) ) + { + mysqli_close($link); + $use_slave_server=1; + $db_source = 'S'; + require("dbconnect_mysqli.php"); + $MAIN.="\n"; + } + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($group)) {$group = '';} +if (!isset($query_date)) {$query_date = $NOW_DATE;} +if (!isset($server_ip)) {$server_ip = '10.10.10.15';} + +$stmt="SELECT server_id,server_ip from servers order by server_id;"; +$rslt=mysql_to_mysqli($stmt, $link); +if ($DB) {echo "$stmt\n";} +$servers_to_print = mysqli_num_rows($rslt); +$i=0; +while ($i < $servers_to_print) + { + $row=mysqli_fetch_row($rslt); + $server_id[$i] = $row[0]; + $Aserver_ip[$i] = $row[1]; + $i++; + } +?> + + + + + +\n"; +echo ""._QXZ("Asterisk Debug")."\n"; + + $short_header=1; + + require("admin_header.php"); + +echo "
  • \n"; echo ""; - $stmt="SELECT server_id,server_description,server_ip,active,asterisk_version,max_vicidial_trunks,telnet_host,telnet_port,ASTmgrUSERNAME,ASTmgrSECRET,ASTmgrUSERNAMEupdate,ASTmgrUSERNAMElisten,ASTmgrUSERNAMEsend,local_gmt,voicemail_dump_exten,answer_transfer_agent,ext_context,sys_perf_log,vd_server_logs,agi_output,vicidial_balance_active,balance_trunks_offlimits,recording_web_link,alt_server_ip,active_asterisk_server,generate_vicidial_conf,rebuild_conf_files,outbound_calls_per_second,sysload,channels_total,cpu_idle_percent,disk_usage,sounds_update,vicidial_recording_limit,carrier_logging_active,vicidial_balance_rank,rebuild_music_on_hold,active_agent_login_server,conf_secret,external_server_ip,custom_dialplan_entry,active_twin_server_ip,user_group,system_uptime,auto_restart_asterisk,asterisk_temp_no_restart,voicemail_dump_exten_no_inst from servers where ( (server_id='$server_id') or (server_ip='$server_ip') ) $LOGadmin_viewable_groupsSQL;"; + $stmt="SELECT server_id,server_description,server_ip,active,asterisk_version,max_vicidial_trunks,telnet_host,telnet_port,ASTmgrUSERNAME,ASTmgrSECRET,ASTmgrUSERNAMEupdate,ASTmgrUSERNAMElisten,ASTmgrUSERNAMEsend,local_gmt,voicemail_dump_exten,answer_transfer_agent,ext_context,sys_perf_log,vd_server_logs,agi_output,vicidial_balance_active,balance_trunks_offlimits,recording_web_link,alt_server_ip,active_asterisk_server,generate_vicidial_conf,rebuild_conf_files,outbound_calls_per_second,sysload,channels_total,cpu_idle_percent,disk_usage,sounds_update,vicidial_recording_limit,carrier_logging_active,vicidial_balance_rank,rebuild_music_on_hold,active_agent_login_server,conf_secret,external_server_ip,custom_dialplan_entry,active_twin_server_ip,user_group,system_uptime,auto_restart_asterisk,asterisk_temp_no_restart,voicemail_dump_exten_no_inst,gather_asterisk_output from servers where ( (server_id='$server_id') or (server_ip='$server_ip') ) $LOGadmin_viewable_groupsSQL;"; $rslt=mysql_to_mysqli($stmt, $link); $row=mysqli_fetch_row($rslt); $server_id = $row[0]; @@ -30311,6 +30315,7 @@ if ($ADD==311111111111) $auto_restart_asterisk = $row[44]; $asterisk_temp_no_restart = $row[45]; $voicemail_dump_exten_no_inst = $row[46]; + $gather_asterisk_output = $row[47]; $cpu = (100 - $cpu_idle_percent); @@ -30360,8 +30365,7 @@ if ($ADD==311111111111) echo "
    "._QXZ("Server Logs").": $NWB#servers-vd_server_logs$NWE
    "._QXZ("AGI Output").": $NWB#servers-agi_output$NWE
    "._QXZ("Carrier Logging Active").": $NWB#servers-carrier_logging_active$NWE
    "._QXZ("Gather Asterisk Output").": $NWB#servers-gather_asterisk_output$NWE
    "._QXZ("Recording Web Link").": $NWB#servers-recording_web_link$NWE
    "._QXZ("Alternate Recording Server IP").": $NWB#servers-alt_server_ip$NWE
    "; +echo "
    \n"; +echo "\n"; +echo "\n"; +#echo "           "._QXZ("MODIFY")." \n"; +echo "
    \n\n"; + +echo "
    \n\n";
    +
    +
    +if (!$group)
    +	{
    +	echo "\n\n";
    +	echo _QXZ("PLEASE SELECT A SERVER ABOVE AND CLICK SUBMIT")."\n";
    +	}
    +
    +else
    +	{
    +	$stmt="select sip_peers,iax_peers,asterisk,update_date from vicidial_asterisk_output where server_ip='" . mysqli_real_escape_string($link, $group) . "';";
    +	$rslt=mysql_to_mysqli($stmt, $link);
    +	if ($DB) {echo "$stmt\n";}
    +	$camps_to_print = mysqli_num_rows($rslt);
    +	if ($camps_to_print > 0)
    +		{
    +		$row=mysqli_fetch_row($rslt);
    +		$sip_peers =	$row[0];
    +		$iax_peers =	$row[1];
    +		$asterisk =		$row[2];
    +		$update_date =	$row[3];
    +
    +		echo _QXZ("Asterisk Debug").": $group - $update_date           $NOW_TIME\n\n";
    +		echo "----------------------------------------------------------------------------------------------------\n";
    +		echo _QXZ("SIP PEERS AND REGISTRY OUTPUT").":\n";
    +		echo "----------------------------------------------------------------------------------------------------\n\n";
    +		echo "$sip_peers\n\n\n";
    +		echo "----------------------------------------------------------------------------------------------------\n";
    +		echo _QXZ("IAX PEERS AND REGISTRY OUTPUT").":\n";
    +		echo "----------------------------------------------------------------------------------------------------\n\n";
    +		echo "$iax_peers\n\n\n";
    +		echo "----------------------------------------------------------------------------------------------------\n";
    +		echo _QXZ("LAST 1000 LINES OF ASTERISK OUTPUT").":\n";
    +		echo "----------------------------------------------------------------------------------------------------\n\n";
    +		echo "$asterisk\n\n\n";
    +		echo "----------------------------------------------------------------------------------------------------\n";
    +		}
    +	}
    +
    +if ($db_source == 'S')
    +	{
    +	mysqli_close($link);
    +	$use_slave_server=0;
    +	$db_source = 'M';
    +	require("dbconnect_mysqli.php");
    +	}
    +
    +$endMS = microtime();
    +$startMSary = explode(" ",$startMS);
    +$endMSary = explode(" ",$endMS);
    +$runS = ($endMSary[0] - $startMSary[0]);
    +$runM = ($endMSary[1] - $startMSary[1]);
    +$TOTALrun = ($runS + $runM);
    +
    +$stmt="UPDATE vicidial_report_log set run_time='$TOTALrun' where report_log_id='$report_log_id';";
    +if ($DB) {echo "|$stmt|\n";}
    +$rslt=mysql_to_mysqli($stmt, $link);
    +
    +?>
    +
    +
    + +
    + + diff --git a/www/vicidial/help.php b/www/vicidial/help.php index 023854bc..39b57193 100644 --- a/www/vicidial/help.php +++ b/www/vicidial/help.php @@ -71,6 +71,7 @@ # 151209-1437 - Added phones-nva entries # 151220-1553 - Added more phones nva options # 151221-0751 - Changed in-group download link to customer chat links +# 151229-1659 - Added servers-gather_asterisk_output entry # @@ -4506,6 +4507,11 @@ if ($SSoutbound_autodial_active > 0)
    - +
    + +
    + - +