From 3b1574c879fa19c71f2f9fc7a99d0be2dacd859d Mon Sep 17 00:00:00 2001 From: mattf Date: Thu, 8 Dec 2022 22:26:00 +0000 Subject: [PATCH] Added vicidial_inbound_callback_queue stats to Inbound Report v2 git-svn-id: svn://192.168.202.10@3661 3d104415-ff17-0410-8863-d5cf3c621b8a --- docs/Email_user_manual.txt | 4 +- extras/MySQL_AST_CREATE_tables.sql | 7 ++- extras/upgrade_2.14.sql | 10 ++++ www/vicidial/AST_CLOSERstats_v2.php | 71 +++++++++++++++++++++++++++++ 4 files changed, 89 insertions(+), 3 deletions(-) diff --git a/docs/Email_user_manual.txt b/docs/Email_user_manual.txt index 98e602af..c5d5a163 100644 --- a/docs/Email_user_manual.txt +++ b/docs/Email_user_manual.txt @@ -1,4 +1,4 @@ -EMAIL HANDLING DOC Started: 2012-12-23 Updated: 2022-12-05 +EMAIL HANDLING DOC Started: 2012-12-23 Updated: 2022-12-08 (example of how to set up an email account with Gmail is at the bottom) @@ -302,3 +302,5 @@ You have to give your server a Fully Qualified Domain Name(FQDN), if only locall 2. Edit the "/etc/hostname" file on that server and enter in the FQDN that you have added to DNS 3. Edit the "/etc/hosts" file on that server and enter in the new FQDN and the local IP Address, with another entry for the real-world IP Address if there is one 4. Reboot your server. + +You may also need to define your FQDN in your email configuration files, for example if you are using Postfix for email, in the “/etc/postfix/main.cf" you will need to change the “myhostname” setting to your FQDN(i.e.: “myhostname = dialer01.dialer-domain.com”). Also, if you are using a mail relay server, you will need to set the “relayhost” setting as well(i.e.: “relayhost = mail.relay-domain.com:587”). diff --git a/extras/MySQL_AST_CREATE_tables.sql b/extras/MySQL_AST_CREATE_tables.sql index 442c6e3f..0914e581 100644 --- a/extras/MySQL_AST_CREATE_tables.sql +++ b/extras/MySQL_AST_CREATE_tables.sql @@ -4141,7 +4141,10 @@ queue_priority TINYINT(2) default '0', call_date DATETIME, gmt_offset_now DECIMAL(4,2) DEFAULT '0.00', modify_date TIMESTAMP, -index (icbq_status) +index (icbq_status), +index (group_id), +index (icbq_date), +index (call_date) ) ENGINE=MyISAM; CREATE TABLE recording_log_deletion_queue ( @@ -5177,4 +5180,4 @@ INSERT INTO `wallboard_reports` VALUES ('AGENTS_AND_QUEUES','Agents and Queues', UPDATE system_settings set vdc_agent_api_active='1'; -UPDATE system_settings SET db_schema_version='1670',db_schema_update_date=NOW(),reload_timestamp=NOW(); +UPDATE system_settings SET db_schema_version='1671',db_schema_update_date=NOW(),reload_timestamp=NOW(); diff --git a/extras/upgrade_2.14.sql b/extras/upgrade_2.14.sql index 3c0c691a..bc9ea845 100644 --- a/extras/upgrade_2.14.sql +++ b/extras/upgrade_2.14.sql @@ -2059,3 +2059,13 @@ index (call_date) ) ENGINE=MyISAM; UPDATE system_settings SET db_schema_version='1670',db_schema_update_date=NOW() where db_schema_version < 1670; + +CREATE INDEX vicq_group_id on vicidial_inbound_callback_queue(group_id); +CREATE INDEX vicq_icbq_date on vicidial_inbound_callback_queue(icbq_date); +CREATE INDEX vicq_call_date on vicidial_inbound_callback_queue(call_date); + +CREATE INDEX vicqa_group_id on vicidial_inbound_callback_queue_archive(group_id); +CREATE INDEX vicqa_icbq_date on vicidial_inbound_callback_queue_archive(icbq_date); +CREATE INDEX vicqa_call_date on vicidial_inbound_callback_queue_archive(call_date); + +UPDATE system_settings SET db_schema_version='1671',db_schema_update_date=NOW() where db_schema_version < 1671; diff --git a/www/vicidial/AST_CLOSERstats_v2.php b/www/vicidial/AST_CLOSERstats_v2.php index d6ba6dc2..58b430c1 100644 --- a/www/vicidial/AST_CLOSERstats_v2.php +++ b/www/vicidial/AST_CLOSERstats_v2.php @@ -74,6 +74,7 @@ # 211022-0734 - Added IR_SLA_all_statuses options.php setting # 211027-1050 - Added optional campaign selection(camp_select), for calculation of OCR only # 212207-2227 - Added IQNANQ to drop SQL calculation queries, fix for AHT calculation in show_camp mode +# 221208-1013 - Added vicidial_inbound_callback_queue stats # $startMS = microtime(); @@ -1041,6 +1042,7 @@ $orig_call_time_clause.=" )"; $calldate_call_time_clause=preg_replace('//', 'call_date', $orig_call_time_clause); $starttime_call_time_clause=preg_replace('//', 'start_time', $orig_call_time_clause); $eventtime_call_time_clause=preg_replace('//', 'event_time', $orig_call_time_clause); +$icbq_date_call_time_clause=preg_replace('//', 'icbq_date', $orig_call_time_clause); # Calculate first record in interval and last @@ -1735,6 +1737,75 @@ else $rpt_type_verbiages=_QXZ("CALLS",6); } + +############################## +######### CALLBACK QUEUE STATS +if ($DID != 'Y') + { + $MAIN.="\n"; + $MAIN.="---------- "._QXZ("CALLBACK QUEUE STATS")."\n"; + + $CSV_text1.="\n\""._QXZ("CALLBACK QUEUE STATS")."\"\n"; + + $stmt="SELECT count(*) from vicidial_inbound_callback_queue where icbq_date >= '$query_date_BEGIN' and icbq_date <= '$query_date_END' $icbq_date_call_time_clause and group_id IN($group_SQL);"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {$MAIN.="$stmt\n";} + $row=mysqli_fetch_row($rslt); + $today_cbQUEUEcalls = $row[0]; + + $stmt="SELECT count(*) from vicidial_inbound_callback_queue_archive where icbq_date >= '$query_date_BEGIN' and icbq_date <= '$query_date_END' $icbq_date_call_time_clause and group_id IN($group_SQL);"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {$MAIN.="$stmt\n";} + $row=mysqli_fetch_row($rslt); + $archive_cbQUEUEcalls = $row[0]; + $temp_cbQUEUE_calls = ($today_cbQUEUEcalls + $archive_cbQUEUEcalls); + $cbQUEUEstatus_output=''; + + if ($temp_cbQUEUE_calls > 0) + { + $cbQUEUEstatus_output .= _QXZ("Callback Queue Statuses").":\n"; + $cbQUEUEstatus_outputCSV .= '"'._QXZ("Callback Queue Statuses").":\"\n"; + + $stmt="SELECT sum(qty), icbq_status FROM ( (SELECT count(*) as qty, t.icbq_status FROM vicidial_inbound_callback_queue t WHERE icbq_date >= '$query_date_BEGIN' and icbq_date <= '$query_date_END' $icbq_date_call_time_clause and group_id IN($group_SQL) group by t.icbq_status) UNION ALL (SELECT count(*) as qty, c.icbq_status FROM vicidial_inbound_callback_queue_archive c WHERE icbq_date >= '$query_date_BEGIN' and icbq_date <= '$query_date_END' $icbq_date_call_time_clause and group_id IN($group_SQL) group by c.icbq_status) ) t group by icbq_status order by icbq_status;"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {$MAIN.="$stmt\n";} + $icbq_to_print = mysqli_num_rows($rslt); + + $i=0; + while ($i < $icbq_to_print) + { + $row=mysqli_fetch_row($rslt); + $campaigns_allowed[$i] = $row[0]; + $campaigns_names[$i] = $row[1]; + + $temp_count = sprintf("%10s", $row[0]); + $temp_status = sprintf("%10s", $row[1]); + + $cbQUEUEstatus_output .= "$temp_status $temp_count\n"; + $cbQUEUEstatus_outputCSV .= "\"$temp_status\",\"$temp_count\"\n"; + $i++; + } + } + + $cbQUEUEcalls = sprintf("%10s", $temp_cbQUEUE_calls); + $cbQUEUEpercent = (MathZDC($cbQUEUEcalls, $TOTALcalls) * 100); + $cbQUEUEpercent = round($cbQUEUEpercent, 0); + + $MAIN.=_QXZ("Total Callback Queue Calls:",46)." $cbQUEUEcalls $cbQUEUEpercent%\n"; + $MAIN.=$cbQUEUEstatus_output; +# $MAIN.=_QXZ("Average QUEUE Length for queue calls:",46)." $average_queue_seconds "._QXZ("seconds")."\n"; +# $MAIN.=_QXZ("Average QUEUE Length across all calls:",46)." $average_total_queue_seconds "._QXZ("seconds")."\n"; + + $CSV_text1.="\""._QXZ("Total Callback Queue Calls").":\",\"$cbQUEUEcalls\",\"$cbQUEUEpercent%\"\n"; + $CSV_text1.=$cbQUEUEstatus_outputCSV; +# $CSV_text1.="\""._QXZ("Average QUEUE Length for queue calls").":\",\"$average_queue_seconds "._QXZ("seconds")."\"\n"; +# $CSV_text1.="\""._QXZ("Average QUEUE Length across all calls").":\",\"$average_total_queue_seconds "._QXZ("seconds")."\"\n"; + + $rpt_type_verbiage=_QXZ("CALLBACK QUEUE CALL",6); + $rpt_type_verbiages=_QXZ("CALLBACK QUEUE CALLS",6); + } + + ############################## ######### CALL HOLD TIME BREAKDOWN IN SECONDS