Updates to notification_data function in the agc/alt_display.php script
git-svn-id: svn://192.168.202.10@3861 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
+13
-122
@@ -13,7 +13,7 @@
|
||||
# - top_panel = static agent dashboard
|
||||
# - top_panel_realtime = agent dashboard reloading every second
|
||||
# - agent_status = data-only compressed details for logged-in agent status
|
||||
# - notification_data = data-only, designed to check for and send notification data for this agent for outside display
|
||||
# - notification_data = data-only, designed to check for and send ALT_DISPLAY recipient notification data only for this agent for outside display
|
||||
#
|
||||
# CHANGELOG:
|
||||
# 200827-1157 - First build
|
||||
@@ -25,10 +25,11 @@
|
||||
# 220220-0940 - Added allow_web_debug system setting
|
||||
# 231214-0912 - Added notification_data action
|
||||
# 240320-1047 - Added input filtering for error output
|
||||
# 240805-0121 - Updates to notification_data function
|
||||
#
|
||||
|
||||
$version = '2.14-9';
|
||||
$build = '240320-1047';
|
||||
$version = '2.14-10';
|
||||
$build = '240805-0121';
|
||||
$php_script = 'alt_display.php';
|
||||
$mel=1; # Mysql Error Log enabled = 1
|
||||
$mysql_log_count=11;
|
||||
@@ -76,7 +77,7 @@ $alt_display_enabled = '0'; # set to 1 to allow the alt_display.php script to be
|
||||
# see the options-example.php file for more information
|
||||
if (file_exists('options.php'))
|
||||
{
|
||||
require_once('options.php');
|
||||
require('options.php');
|
||||
}
|
||||
|
||||
header ("Content-type: text/html; charset=utf-8");
|
||||
@@ -1005,7 +1006,10 @@ if ($ACTION == 'agent_status')
|
||||
################################################################################
|
||||
if ($ACTION == 'notification_data')
|
||||
{
|
||||
# gather all READY notifications to be triggered, limit with $user, $VU_user_group, $campaign
|
||||
$notif_queued_ct=0;
|
||||
$notif_sent_ct=0;
|
||||
$notif_ids='';
|
||||
# gather only ALT_DISPLAY READY notifications to be triggered, for this $user only
|
||||
$alert_stmt="select * from vicidial_agent_notifications where notification_status='READY' and (recipient_type='ALT_DISPLAY' and recipient='$user') order by notification_date asc limit 1;";
|
||||
$alert_rslt=mysql_to_mysqli($alert_stmt, $link);
|
||||
while ($alert_row=mysqli_fetch_array($alert_rslt))
|
||||
@@ -1025,6 +1029,7 @@ if ($ACTION == 'notification_data')
|
||||
{
|
||||
$ins_stmt="INSERT INTO vicidial_agent_notifications_queue(notification_id, user) VALUES('$notification_id', '$agent_row[0]')";
|
||||
$ins_rslt=mysql_to_mysqli($ins_stmt, $link);
|
||||
$notif_queued_ct++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1042,6 +1047,8 @@ if ($ACTION == 'notification_data')
|
||||
$notification_rslt=mysql_to_mysqli($notification_stmt, $link);
|
||||
while($notif_row=mysqli_fetch_array($notification_rslt))
|
||||
{
|
||||
$notif_sent_ct++;
|
||||
$notif_ids .= "-$notification_id";
|
||||
echo "$acr_rows|$notif_row[notification_text]|$notif_row[text_size]|$notif_row[text_font]|$notif_row[text_color]|$notif_row[text_weight]|$notif_row[show_confetti]|$notif_row[confetti_options]";
|
||||
}
|
||||
|
||||
@@ -1049,121 +1056,8 @@ if ($ACTION == 'notification_data')
|
||||
$del_rslt=mysql_to_mysqli($del_stmt, $link);
|
||||
}
|
||||
|
||||
|
||||
$stmt="SELECT server_ip,status,lead_id,campaign_id,callerid,last_update_time,closer_campaigns,calls_today,pause_code,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_state_change),preview_lead_id,pause_code,UNIX_TIMESTAMP(last_update_time) from vicidial_live_agents where user='$user';";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09008',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$cl_user_ct = mysqli_num_rows($rslt);
|
||||
if ($cl_user_ct > 0)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$VLAserver_ip = $row[0];
|
||||
$VLAstatus = $row[1];
|
||||
$VLAlead_id = $row[2];
|
||||
$VLAcampaign_id = $row[3];
|
||||
$VLAcallerid = $row[4];
|
||||
$VLAlast_update_time = $row[5];
|
||||
$VLAcloser_campaigns = $row[6];
|
||||
$VLAcalls_today = $row[7];
|
||||
$VLApause_code = $row[8];
|
||||
$VLAlast_call_time_epoch = $row[9];
|
||||
$VLAlast_state_change_epoch = $row[10];
|
||||
$VLApreview_lead_id = ($row[11] + 0);
|
||||
$VLApause_code = $row[12];
|
||||
$VLAlast_update_time_epoch = $row[13];
|
||||
if ( ($VLAstatus == 'INCALL') or ($VLAstatus == 'QUEUE') or ($VLAstatus == 'MQUEUE') ) {$notification_data = 'DEAD';}
|
||||
if ( ($VLAstatus == 'PAUSED') and ($VLAlead_id > 0) ) {$notification_data = 'DISPO';}
|
||||
if ( ($VLAstatus == 'PAUSED') and ($VLApreview_lead_id > 0) ) {$notification_data = 'PREVIEW';}
|
||||
if ( ($VLAstatus == 'PAUSED') and ($VLApause_code == 'LAGGED') ) {$notification_data = 'LAGGED';}
|
||||
if ( ($VLAstatus == 'PAUSED') and ($notification_data == 'NONE') ) {$notification_data = 'PAUSED';}
|
||||
if ($VLAstatus == 'READY') {$notification_data = 'READY';}
|
||||
if ($VLAstatus == 'CLOSER') {$notification_data = 'CLOSER';}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo _QXZ("ERROR: user is not logged in").": $user\n";
|
||||
$stage = "user is not logged in";
|
||||
exit;
|
||||
}
|
||||
|
||||
if (strlen($VLAcallerid) > 15)
|
||||
{
|
||||
### BEGIN Live Call Display section ###
|
||||
$stmt="SELECT server_ip,status,lead_id,campaign_id,callerid,call_time,call_type,UNIX_TIMESTAMP(call_time) from vicidial_auto_calls where callerid='$VLAcallerid';";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09009',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$cl_calls_ct = mysqli_num_rows($rslt);
|
||||
if ($cl_calls_ct > 0)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$VACserver_ip = $row[0];
|
||||
$VACstatus = $row[1];
|
||||
$VAClead_id = $row[2];
|
||||
$VACcampaign_id = $row[3];
|
||||
$VACcallerid = $row[4];
|
||||
$VACcall_time = $row[5];
|
||||
$VACcall_type = $row[6];
|
||||
$VACcalls_today = $row[7];
|
||||
$VACcall_time_epoch = $row[8];
|
||||
$notification_data = 'LIVE';
|
||||
}
|
||||
|
||||
if ( ($notification_data != 'NONE') and ($notification_data != 'PREVIEW') )
|
||||
{
|
||||
if ($notification_data == 'LIVE')
|
||||
{
|
||||
$call_length = ($StarTtime - $VLAlast_state_change_epoch);
|
||||
}
|
||||
if ($notification_data == 'DEAD')
|
||||
{
|
||||
$call_length = ($VLAlast_state_change_epoch - $VLAlast_call_time_epoch);
|
||||
$hangup_length = ($StarTtime - $VLAlast_state_change_epoch);
|
||||
}
|
||||
}
|
||||
### END Live Call Display section ###
|
||||
}
|
||||
|
||||
### BEGIN Calls in Queue section ###
|
||||
$AccampSQL = preg_replace('/\s\-/','', $VLAcloser_campaigns);
|
||||
$AccampSQL = preg_replace('/\s/',"','", $AccampSQL);
|
||||
if (preg_match('/AGENTDIRECT/i', $AccampSQL))
|
||||
{
|
||||
$AccampSQL = preg_replace('/AGENTDIRECT/i','', $AccampSQL);
|
||||
$ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )";
|
||||
}
|
||||
|
||||
### grab the number of calls waiting in queue for this agent's campaign and selected in-groups
|
||||
$stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$VLAcampaign_id') or (campaign_id IN('$AccampSQL')) $ADsql);";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09010',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$cl_calls_ct = mysqli_num_rows($rslt);
|
||||
if ($cl_calls_ct > 0)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$CIQcount = $row[0];
|
||||
}
|
||||
|
||||
if ($CIQcount > 0)
|
||||
{
|
||||
### grab the number of calls waiting in queue for this agent's campaign and selected in-groups
|
||||
$stmt="SELECT UNIX_TIMESTAMP(call_time) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$VLAcampaign_id') or (campaign_id IN('$AccampSQL')) $ADsql) order by call_time limit 1;";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09011',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$cl_calls_ct = mysqli_num_rows($rslt);
|
||||
if ($cl_calls_ct > 0)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$CIQcall_time_epoch = $row[0];
|
||||
$wait_length = ($StarTtime - $CIQcall_time_epoch);
|
||||
}
|
||||
}
|
||||
if ($VLAlast_update_time_epoch > 10)
|
||||
{
|
||||
$lagged_length = ($StarTtime - $VLAlast_update_time_epoch);
|
||||
}
|
||||
|
||||
### END Calls in Queue section ###
|
||||
$stage="$notification_data|$call_length|$hangup_length|$VLApause_code|$VLAcalls_today|$CIQcount|$wait_length|$lagged_length";
|
||||
$stage="$notif_queued_ct|$notif_sent_ct|$notif_ids|";
|
||||
echo "$stage\n";
|
||||
|
||||
if ($SSagent_debug_logging > 0) {vicidial_ajax_log($NOW_TIME,$startMS,$link,$ACTION,$php_script,$user,$stage,$lead_id,$session_name,$stmt);}
|
||||
@@ -1175,9 +1069,6 @@ if ($ACTION == 'notification_data')
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if ($DB > 0)
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
|
||||
Reference in New Issue
Block a user