From 3ee69f75ab0891dbdd66cd8a373e1f1ffc47d05e Mon Sep 17 00:00:00 2001 From: mattf Date: Tue, 27 Oct 2020 03:37:01 +0000 Subject: [PATCH] Fix for LIVE call issue in top_panel Fix for short CIDnumber issue in inbound calltime check AGI Fix for AGENTDIRECT issue in ALL inbound AGI git-svn-id: svn://192.168.202.10@3307 3d104415-ff17-0410-8863-d5cf3c621b8a --- agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi | 36 +++++++++++++++-- .../agi/agi-VDAD_inbound_calltime_check.agi | 3 +- agc_2-X/trunk/www/agc/alt_display.php | 40 ++++++++++--------- 3 files changed, 57 insertions(+), 22 deletions(-) diff --git a/agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi b/agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi index 4ebdfc46..bdc952cc 100644 --- a/agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi +++ b/agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi @@ -238,6 +238,7 @@ # 200624-0011 - Added options for Answer signal settings # 200708-1126 - Added some list override settings # 200816-0910 - Fixed issue with cid_cb_confirmed_filename multi-prompt not playing last file +# 201026-2333 - Fix for AGENTDIRECT issue # $script = 'agi-VDAD_ALL_inbound.agi'; @@ -2893,6 +2894,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override if ( ( ($rec_countWAITrem < 1) && ($rec_countWAITqueue < 1) ) || ($AGENTgrab > 0) ) { $qp_countWAIT=0; + ### Get count of number of waiting calls in higher priority groups than this call or the same priority with longer wait time $stmtA = "SELECT count(*) FROM vicidial_auto_calls where status = 'LIVE' and lead_id != '$insert_lead_id' $ADfindSQL and ( (queue_priority > '$queue_priority') or (queue_priority = '$queue_priority' and call_time < \"$SQLdateBEGIN\") );"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; @@ -2907,6 +2909,34 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override $sthA->finish(); if ($AGILOG) {$agi_string = "$qp_countWAIT|$stmtA|"; &agi_output;} + $AGENTDIRECT_higher_count=0; + $AGENTDIRECT_higher_users=''; + $AGENTDIRECT_higherSQL=''; + if ($channel_group !~ /AGENTDIRECT/) + { + ### Get count of number of waiting calls in higher priority AGENTDIRECT groups than this call or the same priority with longer wait time + $stmtA = "SELECT agent_only FROM vicidial_auto_calls where status = 'LIVE' and campaign_id LIKE \"%AGENTDIRECT%\" and ( (queue_priority > '$queue_priority') or (queue_priority = '$queue_priority' and call_time < \"$SQLdateBEGIN\") );"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $AGENTDIRECT_higher_count=$sthA->rows; + $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$AGENTDIRECT_higher_count; &mysql_error_logging; + $ad_ct=0; + while ($AGENTDIRECT_higher_count > $ad_ct) + { + @aryA = $sthA->fetchrow_array; + if ($ad_ct > 0) + {$AGENTDIRECT_higher_users .= ",";} + $AGENTDIRECT_higher_users .= "'$aryA[0]'"; + $ad_ct++; + } + $sthA->finish(); + if ($AGENTDIRECT_higher_count > 0) + { + $AGENTDIRECT_higherSQL = "and vicidial_live_agents.user NOT IN($AGENTDIRECT_higher_users)"; + } + if ($AGILOG) {$agi_string = "AGENTDIRECT calls check: $AGENTDIRECT_higher_count|$AGENTDIRECT_higher_users|$AGENTDIRECT_higherSQL|$stmtA|"; &agi_output;} + } + $qp_countWAITqueue=0; ### Get count of number of waiting calls in higher priority groups than this call or the same priority with longer wait time $stmtA = "SELECT count(*) FROM vicidial_inbound_callback_queue where icbq_status IN('LIVE','SENDING') and lead_id != '$insert_lead_id' and ( (queue_priority > '$queue_priority') or (queue_priority = '$queue_priority' and call_date < \"$SQLdateBEGIN\") );"; @@ -3027,7 +3057,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override @GRADEuser=@MT; @GRADEgrade=@MT; @userGRADEarray=@MT; - $stmtA = "SELECT vicidial_live_agents.user,vicidial_live_inbound_agents.group_grade,vicidial_live_agents.campaign_grade from vicidial_live_agents, vicidial_live_inbound_agents WHERE vicidial_live_agents.user=vicidial_live_inbound_agents.user and status IN('CLOSER','READY') and lead_id<1 $ADUfindSQL and vicidial_live_inbound_agents.group_id='$channel_group' and last_update_time > '$BDtsSQLdate' and vicidial_live_agents.user NOT IN($ring_no_answer_agents$vlia_users) and ring_callerid='' $qp_groupWAIT_camp_SQL limit 1000;"; + $stmtA = "SELECT vicidial_live_agents.user,vicidial_live_inbound_agents.group_grade,vicidial_live_agents.campaign_grade from vicidial_live_agents, vicidial_live_inbound_agents WHERE vicidial_live_agents.user=vicidial_live_inbound_agents.user and status IN('CLOSER','READY') and lead_id<1 $ADUfindSQL and vicidial_live_inbound_agents.group_id='$channel_group' and last_update_time > '$BDtsSQLdate' and vicidial_live_agents.user NOT IN($ring_no_answer_agents$vlia_users) and ring_callerid='' $qp_groupWAIT_camp_SQL $AGENTDIRECT_higherSQL limit 1000;"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -3091,7 +3121,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override ### END grade random next-agent-call routing ### else { - $stmtA = "SELECT vicidial_live_agents.conf_exten,vicidial_live_agents.user,vicidial_live_agents.extension,vicidial_live_agents.server_ip,vicidial_live_inbound_agents.group_weight,ra_user,vicidial_live_agents.campaign_id,on_hook_agent,on_hook_ring_time,vicidial_live_inbound_agents.group_grade,vicidial_live_agents.campaign_grade from vicidial_live_agents, vicidial_live_inbound_agents WHERE vicidial_live_agents.user=vicidial_live_inbound_agents.user and status IN('CLOSER','READY') and lead_id<1 $ADUfindSQL and vicidial_live_inbound_agents.group_id='$channel_group' and last_update_time > '$BDtsSQLdate' and vicidial_live_agents.user NOT IN($ring_no_answer_agents$vlia_users) and ring_callerid='' $qp_groupWAIT_camp_SQL $agent_call_order limit 1;"; + $stmtA = "SELECT vicidial_live_agents.conf_exten,vicidial_live_agents.user,vicidial_live_agents.extension,vicidial_live_agents.server_ip,vicidial_live_inbound_agents.group_weight,ra_user,vicidial_live_agents.campaign_id,on_hook_agent,on_hook_ring_time,vicidial_live_inbound_agents.group_grade,vicidial_live_agents.campaign_grade from vicidial_live_agents, vicidial_live_inbound_agents WHERE vicidial_live_agents.user=vicidial_live_inbound_agents.user and status IN('CLOSER','READY') and lead_id<1 $ADUfindSQL and vicidial_live_inbound_agents.group_id='$channel_group' and last_update_time > '$BDtsSQLdate' and vicidial_live_agents.user NOT IN($ring_no_answer_agents$vlia_users) and ring_callerid='' $qp_groupWAIT_camp_SQL $AGENTDIRECT_higherSQL $agent_call_order limit 1;"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -3130,7 +3160,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override else { $SQL_group_id=$channel_group; $SQL_group_id =~ s/_/\\_/gi; - $stmtA = "SELECT conf_exten,user,extension,server_ip,last_call_time,ra_user,campaign_id,on_hook_agent,on_hook_ring_time FROM vicidial_live_agents where status IN('CLOSER','READY') and lead_id<1 $ADUfindSQL and campaign_id IN($INBOUNDcampsSQL) and closer_campaigns LIKE \"% $SQL_group_id %\" and last_update_time > '$BDtsSQLdate' and vicidial_live_agents.user NOT IN($ring_no_answer_agents'') $qp_groupWAIT_SQL $qp_groupWAIT_camp_SQL $agent_call_order limit 1;"; + $stmtA = "SELECT conf_exten,user,extension,server_ip,last_call_time,ra_user,campaign_id,on_hook_agent,on_hook_ring_time FROM vicidial_live_agents where status IN('CLOSER','READY') and lead_id<1 $ADUfindSQL and campaign_id IN($INBOUNDcampsSQL) and closer_campaigns LIKE \"% $SQL_group_id %\" and last_update_time > '$BDtsSQLdate' and vicidial_live_agents.user NOT IN($ring_no_answer_agents'') $qp_groupWAIT_SQL $qp_groupWAIT_camp_SQL $AGENTDIRECT_higherSQL $agent_call_order limit 1;"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; diff --git a/agc_2-X/trunk/agi/agi-VDAD_inbound_calltime_check.agi b/agc_2-X/trunk/agi/agi-VDAD_inbound_calltime_check.agi index af59cff8..375a948d 100644 --- a/agc_2-X/trunk/agi/agi-VDAD_inbound_calltime_check.agi +++ b/agc_2-X/trunk/agi/agi-VDAD_inbound_calltime_check.agi @@ -56,6 +56,7 @@ # 161102-1038 - Fixed QM partition problem # 180213-0935 - Fixed issues with VMAIL_NO_INST timecheck route # 200624-2302 - Added play sip-silence audio option +# 201026-1501 - Fix for overwriting short CIDnum # $script = 'agi-VDAD_inbound_calltime_check.agi'; @@ -302,7 +303,7 @@ else else {$VLcomments = '';} } -if (length($callerid)<8) {$callerid = $parked_by;} +if ( (length($callerid)<8) && (length($parked_by) > 6) ) {$callerid = $parked_by;} if (length($pin)>0) {$callerid = $pin;} if ($sip_silence_playback !~ /YES|NO/i) {$sip_silence_playback='YES';} diff --git a/agc_2-X/trunk/www/agc/alt_display.php b/agc_2-X/trunk/www/agc/alt_display.php index d63e7c50..ae07c123 100644 --- a/agc_2-X/trunk/www/agc/alt_display.php +++ b/agc_2-X/trunk/www/agc/alt_display.php @@ -17,10 +17,11 @@ # CHANGELOG: # 200827-1157 - First build # 200920-0906 - Added agent-lag-time to agent_status action +# 201026-1504 - Fix for LIVE call issue in top_panel # -$version = '2.14-2'; -$build = '200920-0906'; +$version = '2.14-3'; +$build = '201026-1504'; $php_script = 'alt_display.php'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=11; @@ -239,23 +240,26 @@ if ($ACTION == 'top_panel') } ### 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,'09005',$user,$server_ip,$session_name,$one_mysql_log);} - $cl_calls_ct = mysqli_num_rows($rslt); - if ($cl_calls_ct > 0) + if (strlen($VLAcallerid) > 5) { - $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]; - $live_call = 'LIVE'; + $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,'09005',$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]; + $live_call = 'LIVE'; + } } if ( ($live_call != 'NONE') and ($live_call != 'PREVIEW') )