From 6a37c5e648c512d84026c16048baba598938f41c Mon Sep 17 00:00:00 2001 From: mattf Date: Mon, 15 Mar 2021 02:48:41 +0000 Subject: [PATCH] Added optional DID Description display for inbound calls git-svn-id: svn://192.168.202.10@3379 3d104415-ff17-0410-8863-d5cf3c621b8a --- www/vicidial/AST_timeonVDADall.php | 143 +++++++++++++++++++++++++++-- www/vicidial/options-example.php | 4 +- www/vicidial/realtime_report.php | 10 +- 3 files changed, 142 insertions(+), 15 deletions(-) diff --git a/www/vicidial/AST_timeonVDADall.php b/www/vicidial/AST_timeonVDADall.php index d2bd4096..4b143fff 100644 --- a/www/vicidial/AST_timeonVDADall.php +++ b/www/vicidial/AST_timeonVDADall.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2021 Matt Florell LICENSE: AGPLv2 # # live real-time stats for the VICIDIAL Auto-Dialer all servers # @@ -121,10 +121,11 @@ # 200506-1642 - Added RS_CUSTINFOminUL options.php setting # 200815-0930 - Added agent-paused 10 & 15 minute indicators # 201107-2253 - Added display of parked calls, inbound SLA stats and LIMITED report type +# 210314-2040 - Added optional DID Description display for inbound calls # -$version = '2.14-106'; -$build = '201107-2253'; +$version = '2.14-107'; +$build = '210314-2040'; header ("Content-type: text/html; charset=utf-8"); @@ -289,6 +290,7 @@ if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_ $RS_ListenBarge = 'MONITOR|BARGE|WHISPER'; $RS_agentWAIT = 3; $RS_INcolumnsHIDE = 0; +$RS_DIDdesc = 0; if (file_exists('options.php')) { @@ -392,6 +394,7 @@ $epochSIXhoursAGO = ($STARTtime - 21600); $timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO); $epochTWENTYFOURhoursAGO = ($STARTtime - 86400); $timeTWENTYFOURhoursAGO = date("Y-m-d H:i:s",$epochTWENTYFOURhoursAGO); +$timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO); if ($non_latin < 1) { @@ -2735,7 +2738,7 @@ if ( ($report_display_type=='HTML') or ($report_display_type=='WALL_2') or ($rep $section_width=860; echo ""; - echo "\n"; + echo "
\n"; echo ""; # echo ""; echo ""; @@ -3033,8 +3036,13 @@ if ($report_display_type=='TEXT') $HTcalls = " "._QXZ("CALLS",5)." |"; $HDpause = ''; $HTpause = ''; - $HDigcall = "------+------------------"; + $HDigcall = "------+-------------------"; $HTigcall = " "._QXZ("HOLD",4)." | "._QXZ("IN-GROUP",8)." "; + if ($RS_DIDdesc > 0) + { + $HDigcall = "------+-----------------------------+-----------------"; + $HTigcall = " "._QXZ("HOLD",4)." | "._QXZ("IN-GROUP",8)." | "._QXZ("DID DESCRIPTION",15)." "; + } if ($RS_INcolumnsHIDE > 0) { $HDigcall = ''; @@ -3133,6 +3141,11 @@ if ( ($report_display_type=='HTML') or ($report_display_type=='LIMITED') ) $HTpause = ''; $HDigcall = ""; $HTigcall = ""; + if ($RS_DIDdesc > 0) + { + $HDigcall = ""; + $HTigcall = ""; + } if ($RS_INcolumnsHIDE > 0) { $HDigcall = ''; @@ -3834,9 +3847,10 @@ if ($talking_to_print > 0) $vac_campaign=''; $INGRP=''; $INORcolor=''; + $INuniqueid=''; if ($CM == 'I') { - $stmt="SELECT vac.campaign_id,vac.stage,vig.group_name,vig.group_id from vicidial_auto_calls vac,vicidial_inbound_groups vig where vac.callerid='$Acallerid[$i]' and vac.campaign_id=vig.group_id LIMIT 1;"; + $stmt="SELECT vac.campaign_id,vac.stage,vig.group_name,vig.group_id,uniqueid from vicidial_auto_calls vac,vicidial_inbound_groups vig where vac.callerid='$Acallerid[$i]' and vac.campaign_id=vig.group_id LIMIT 1;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $ING=$G; $INEG=$EG; @@ -3849,10 +3863,11 @@ if ($talking_to_print > 0) { $filtered_ingroup=0; } - $vac_campaign = sprintf("%-20s", "$row[0] - $row[2]"); + $vac_campaign = sprintf("%-27s", "$row[0] - $row[2]"); $row[1] = preg_replace('/.*\-/i', '',$row[1]); $vac_stage = sprintf("%-4s", $row[1]); - $INORcolor = $row[3]; + $INORcolor = $row[3]; + $INuniqueid = $row[4]; if ( ($INGROUPcolorOVERRIDE>0) or ($INGROUPcolorOVERRIDE=='YES') ) { @@ -3860,6 +3875,59 @@ if ($talking_to_print > 0) } } $INGRP = " $ING$vac_stage$INEG | $ING$vac_campaign$INEG "; + if ( ($RS_DIDdesc > 0) and (strlen($INuniqueid) > 0) ) + { + $did_id=''; + $did_extension=''; + $did_description=''; + $stmt="SELECT did_id,extension from vicidial_did_log where uniqueid='$INuniqueid' and call_date > \"$timeSIXhoursAGO\" order by call_date asc LIMIT 1;"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} + $didL_to_print = mysqli_num_rows($rslt); + if ($didL_to_print > 0) + { + $row=mysqli_fetch_row($rslt); + $did_id = $row[0]; + $did_extension = $row[1]; + } + else + { + $newINuniqueid=''; + $stmt="SELECT uniqueid from vicidial_closer_log where lead_id='$Alead_id[$j]' and uniqueid!='$INuniqueid' and call_date > \"$timeSIXhoursAGO\" order by call_date desc LIMIT 1;"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} + $didL_to_print = mysqli_num_rows($rslt); + if ($didL_to_print > 0) + { + $row=mysqli_fetch_row($rslt); + $newINuniqueid = $row[0]; + } + if (strlen($newINuniqueid) > 4) + { + $stmt="SELECT did_id,extension from vicidial_did_log where uniqueid='$newINuniqueid' and call_date > \"$timeSIXhoursAGO\" order by call_date asc LIMIT 1;"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} + $didL_to_print = mysqli_num_rows($rslt); + if ($didL_to_print > 0) + { + $row=mysqli_fetch_row($rslt); + $did_id = $row[0]; + $did_extension = $row[1]; + } + } + } + $stmt="SELECT did_description from vicidial_inbound_dids where did_id='$did_id' LIMIT 1;"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} + $did_to_print = mysqli_num_rows($rslt); + if ($did_to_print > 0) + { + $row=mysqli_fetch_row($rslt); + $did_description = $row[0]; + } + + $INGRP = " $ING$vac_stage$INEG | $ING$vac_campaign$INEG | $ING$did_description$INEG "; + } if ($RS_INcolumnsHIDE > 0) { $INGRP = ''; @@ -3944,9 +4012,10 @@ if ($talking_to_print > 0) $vac_stage=''; $vac_campaign=''; $INGRP=''; + $INuniqueid=''; if ($CM == 'I') { - $stmt="SELECT vac.campaign_id,vac.stage,vig.group_name,vig.group_id from vicidial_auto_calls vac,vicidial_inbound_groups vig where vac.callerid='$Acallerid[$i]' and vac.campaign_id=vig.group_id LIMIT 1;"; + $stmt="SELECT vac.campaign_id,vac.stage,vig.group_name,vig.group_id,uniqueid from vicidial_auto_calls vac,vicidial_inbound_groups vig where vac.callerid='$Acallerid[$i]' and vac.campaign_id=vig.group_id LIMIT 1;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $ING=$G; $INEG=$EG; @@ -3962,7 +4031,8 @@ if ($talking_to_print > 0) $vac_campaign = sprintf("%-20s", "$row[0] - $row[2]"); $row[1] = preg_replace('/.*\-/i', '',$row[1]); $vac_stage = sprintf("%-4s", $row[1]); - $INORcolor = $row[3]; + $INORcolor = $row[3]; + $INuniqueid = $row[4]; if ( ($INGROUPcolorOVERRIDE>0) or ($INGROUPcolorOVERRIDE=='YES') ) { @@ -3970,6 +4040,59 @@ if ($talking_to_print > 0) } } $INGRP = ""; + if ( ($RS_DIDdesc > 0) and (strlen($INuniqueid) > 0) ) + { + $did_id=''; + $did_extension=''; + $did_description=''; + $stmt="SELECT did_id,extension from vicidial_did_log where uniqueid='$INuniqueid' and call_date > \"$timeSIXhoursAGO\" order by call_date asc LIMIT 1;"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} + $didL_to_print = mysqli_num_rows($rslt); + if ($didL_to_print > 0) + { + $row=mysqli_fetch_row($rslt); + $did_id = $row[0]; + $did_extension = $row[1]; + } + else + { + $newINuniqueid=''; + $stmt="SELECT uniqueid from vicidial_closer_log where lead_id='$Alead_id[$j]' and uniqueid!='$INuniqueid' and call_date > \"$timeSIXhoursAGO\" order by call_date desc LIMIT 1;"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} + $didL_to_print = mysqli_num_rows($rslt); + if ($didL_to_print > 0) + { + $row=mysqli_fetch_row($rslt); + $newINuniqueid = $row[0]; + } + if (strlen($newINuniqueid) > 4) + { + $stmt="SELECT did_id,extension from vicidial_did_log where uniqueid='$newINuniqueid' and call_date > \"$timeSIXhoursAGO\" order by call_date asc LIMIT 1;"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} + $didL_to_print = mysqli_num_rows($rslt); + if ($didL_to_print > 0) + { + $row=mysqli_fetch_row($rslt); + $did_id = $row[0]; + $did_extension = $row[1]; + } + } + } + $stmt="SELECT did_description from vicidial_inbound_dids where did_id='$did_id' LIMIT 1;"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} + $did_to_print = mysqli_num_rows($rslt); + if ($did_to_print > 0) + { + $row=mysqli_fetch_row($rslt); + $did_description = $row[0]; + } + + $INGRP = ""; + } if ($RS_INcolumnsHIDE > 0) { $INGRP = ''; diff --git a/www/vicidial/options-example.php b/www/vicidial/options-example.php index 05559040..697eaff6 100644 --- a/www/vicidial/options-example.php +++ b/www/vicidial/options-example.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2021 Matt Florell LICENSE: AGPLv2 # # rename this file to options.php for the settings here to go into effect # @@ -29,6 +29,7 @@ # 200428-1336 - Added RS_INcolumnsHIDE, RS_report_default_format & RS_AGENTstatusTALLY options # 200506-1628 - Added RS_CUSTINFOdisplay & RS_CUSTINFOminUL options # 201107-2257 - Added RS_parkSTATS option +# 210314-2101 - Added RS_DIDdesc option # # used by the realtime_report.php script @@ -77,6 +78,7 @@ $RS_SLAinSTATS = 0; # 0=no, 1=yes, 2=TMA $RS_ListenBarge = 'MONITOR|BARGE|WHISPER'; # list of listen-related features separated by pipes: "MONITOR|BARGE|WHISPER" $RS_agentWAIT = 3; # 3 or 4 $RS_INcolumnsHIDE = 0; # 0=no, 1=yes # whether to hide the 'HOLD' & 'IN-GROUP' columns in the agent detail section +$RS_DIDdesc = 0; # 0=no, 1=yes # whether to show a 'DID DESCRIPTION' column in the agent detail section $RS_report_default_format = ''; # 'TEXT', 'HTML' or '': If set, this will override the System Setting for this report only $RS_AGENTstatusTALLY = ''; # : If set, will look at the number of calls statused by the agent in this status for today # WARNING!!! Using the above option may cause system lag issues, USE WITH CAUTION! diff --git a/www/vicidial/realtime_report.php b/www/vicidial/realtime_report.php index 16073414..c1285c53 100644 --- a/www/vicidial/realtime_report.php +++ b/www/vicidial/realtime_report.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2021 Matt Florell LICENSE: AGPLv2 # # live real-time stats for the VICIDIAL Auto-Dialer all servers # @@ -52,12 +52,13 @@ # 200506-1633 - Added RS_CUSTINFOminUL options.php setting # 200815-0928 - Added agent-paused 10 & 15 minute indicators # 201107-2254 - Added optional display of parked calls stats, inbound SLA and LIMITED report type +# 210314-2039 - Added DID Description for inbound calls # $startMS = microtime(); -$version = '2.14-39'; -$build = '201107-2254'; +$version = '2.14-40'; +$build = '210314-2039'; header ("Content-type: text/html; charset=utf-8"); @@ -1914,7 +1915,8 @@ function update_variables(task_option,task_choice,force_reload) .realtime_img_icon {width: 42px; height: 42px;} .realtime_img_text {font-family:HELVETICA; font-size:11; color:white; font-weight:bold;} - .realtime_table {width: 860px; max-width: 860px; } + .realtime_table {width: 960px; max-width: 960px; } + .realtime_calls_table {width: 860px; max-width: 860px; } .realtime_settings_table {width: 700px; max-width: 700px; }
    "._QXZ("HOLD")."   "._QXZ("IN-GROUP",8)."   "._QXZ("HOLD")."   "._QXZ("IN-GROUP",8)."   "._QXZ("DID DESCRIPTION",15)." $ING$vac_stage$INEG $ING$vac_campaign$INEG $ING$vac_stage$INEG $ING$vac_campaign$INEG $ING$did_description$INEG