diff --git a/agc_2-X/trunk/UPGRADE b/agc_2-X/trunk/UPGRADE
index 84ee1605..019edd53 100644
--- a/agc_2-X/trunk/UPGRADE
+++ b/agc_2-X/trunk/UPGRADE
@@ -128,6 +128,13 @@ NOTE: Upgrading from 1.1.12-3 to 2.0.1 is at the bottom
agent frame to AGENTDIRECT transfers when clicking on the NUMBER TO CALL
field in the transfer conference frame
+34. Added Calls in Queue display to Agent screen, along with click to grab a
+ call from this listing.
+
+35. Added a Re-Queue Call button to send the current call back to an AGENTDIRECT
+ in-group for the agent to take later
+
+
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 1819af57..aed2a4b4 100644
--- a/agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi
+++ b/agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi
@@ -97,6 +97,7 @@
# 90627-0546 - Added no-agent-no-queue options
# 90702-2129 - Fixed rare agent alert bug, added option to send to remote agent as phone*vendor_id
# 90709-1648 - Fixed alt-number transfers
+# 90712-2307 - Added agent grab call in queue
#
$script = 'agi-VDAD_ALL_inbound.agi';
@@ -107,7 +108,7 @@ $start_moh=1;
$at='@';
$S='*';
$mel=1; # Mysql Error Log enabled = 1
-$mysql_log_count=103;
+$mysql_log_count=112;
$one_mysql_log=0;
@@ -1131,6 +1132,17 @@ if ($Uaffected_rows < 1)
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$affected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='02030'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
+ $stmtB = "select LAST_INSERT_ID() LIMIT 1;";
+ $sthA = $dbhA->prepare($stmtB) or die "preparing: ",$dbhA->errstr;
+ $sthA->execute or die "executing: $stmtB ", $dbhA->errstr;
+ $sthArows=$sthA->rows;
+ $dbhP=$dbhA; $stmtA=$stmtB; $mysql_count='02109'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
+ if ($sthArows > 0)
+ {
+ @aryA = $sthA->fetchrow_array;
+ $insert_call_id = "$aryA[0]";
+ }
+ $sthA->finish();
}
$stmtA = "INSERT INTO vicidial_closer_log SET lead_id='$insert_lead_id', campaign_id='$channel_group', call_date='$SQLdate', start_epoch='$now_date_epoch', status='QUEUE', phone_code='$phone_code', phone_number='$phone_number', user='VDCL', processed='N', xfercallid='$insert_xfer_id', uniqueid='$uniqueid' $adSQL;";
@@ -1206,8 +1218,8 @@ if ($channel_status < 1)
$aco_sub=0;
$agent_call_order='order by last_call_finish';
if ($CAMP_callorder =~ /overall_user_level/i) {$agent_call_order = 'order by user_level desc,last_call_finish';}
- if ($CAMP_callorder =~ /oldest_call_start/i) {$agent_call_order = 'order by last_call_time';}
- if ($CAMP_callorder =~ /oldest_call_finish/i) {$agent_call_order = 'order by last_call_finish';}
+ if ($CAMP_callorder =~ /oldest_call_start/i) {$agent_call_order = 'order by vicidial_live_agents.last_call_time';}
+ if ($CAMP_callorder =~ /oldest_call_finish/i) {$agent_call_order = 'order by vicidial_live_agents.last_call_finish';}
if ($CAMP_callorder =~ /random/i) {$agent_call_order = 'order by random_id';}
if ($CAMP_callorder =~ /campaign_rank/i) {$agent_call_order = 'order by campaign_weight desc,last_call_finish';}
if ($CAMP_callorder =~ /fewest_calls_campaign/i) {$agent_call_order = 'order by vicidial_live_agents.calls_today,vicidial_live_agents.last_call_finish';}
@@ -1231,6 +1243,27 @@ $sthArows=$sthA->rows;
}
$sthA->finish();
+
+################################################################
+##### BEGIN Check for Agent Grab of this call
+$AGENTgrab=0;
+$AGENTuser='';
+$stmtA = "SELECT agent_grab FROM vicidial_auto_calls where auto_call_id='$insert_call_id' and agent_grab!='';";
+$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
+$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
+$sthArows=$sthA->rows;
+ $dbhP=$dbhA; $mysql_count='02110'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
+if ($sthArows > 0)
+ {
+ @aryA = $sthA->fetchrow_array;
+ $AGENTuser = "$aryA[0]";
+ $AGENTgrab++;
+ }
+$sthA->finish();
+##### END Check for Agent Grab of this call
+################################################################
+
+
################################################################
##### Attempt to send call to an agent on this server only #####
if ( ($agent_search_method =~ /^SO|^LO/) && ($skipLOSO < 1) )
@@ -1250,7 +1283,7 @@ if ( ($agent_search_method =~ /^SO|^LO/) && ($skipLOSO < 1) )
}
$sthA->finish();
- if ($rec_countWAIT < 1)
+ if ( ($rec_countWAIT < 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
@@ -1272,7 +1305,7 @@ if ( ($agent_search_method =~ /^SO|^LO/) && ($skipLOSO < 1) )
$qp_groupWAIT_aco='';
$qp_groupWAIT_aco_SQL='';
$qp_groupWAIT_camp_SQL='';
- if ($qp_countWAIT > 0)
+ if ( ($qp_countWAIT > 0) && ($AGENTgrab < 1) )
{
### Get group/campaign ids of calls in higher priority groups than this call or the same priority with longer wait time
$stmtA = "SELECT distinct campaign_id FROM vicidial_auto_calls where status = 'LIVE' and server_ip='$VARserver_ip' and lead_id != '$insert_lead_id' and ( (queue_priority > '$queue_priority') or (queue_priority = '$queue_priority' and call_time < \"$SQLdateBEGIN\") );";
@@ -1303,7 +1336,7 @@ if ( ($agent_search_method =~ /^SO|^LO/) && ($skipLOSO < 1) )
$sthA->finish();
}
- if ($aco_sub>0)
+ if ( ($aco_sub>0) || ($AGENTgrab > 0) )
{
$stmtA = "LOCK TABLES vicidial_live_agents WRITE, vicidial_live_inbound_agents WRITE;";
my $LOCKaffected_rows = $dbhA->do($stmtA);
@@ -1316,7 +1349,7 @@ if ( ($agent_search_method =~ /^SO|^LO/) && ($skipLOSO < 1) )
$sthArows=$sthA->rows;
$dbhP=$dbhA; $mysql_count='02038'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
- if ($sthArows > 0)
+ if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$VDADconf_exten = "$aryA[0]";
@@ -1325,18 +1358,34 @@ if ( ($agent_search_method =~ /^SO|^LO/) && ($skipLOSO < 1) )
}
$sthA->finish();
+ if ($AGENTgrab > 0)
+ {
+ $stmtA = "SELECT conf_exten,extension from vicidial_live_agents WHERE user='$AGENTuser';";
+ if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
+ $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
+ $sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
+ $sthArows=$sthA->rows;
+ $dbhP=$dbhA; $mysql_count='02111'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
if ($sthArows > 0)
+ {
+ @aryA = $sthA->fetchrow_array;
+ $VDADconf_exten = "$aryA[0]";
+ $VDADextension = "$aryA[1]";
+ $VDADuser = $AGENTuser;
+ }
+ $sthA->finish();
+ }
+ if ($sthArows > 0)
{
$stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$insert_lead_id',uniqueid='$unique_id', channel='$channel', callerid='$callerid',comments='INBOUND' where user='$VDADuser';";
$Faffected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='02039'; $MEL_aff_rows=$Faffected_rows; &mysql_error_logging;
$found_agents=$Faffected_rows;
}
- else
+ else
{
$Faffected_rows=0;
}
-
$stmtA = "UNLOCK TABLES;";
$LOCKaffected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='02040'; $MEL_aff_rows=$LOCKaffected_rows; &mysql_error_logging;
@@ -1574,7 +1623,7 @@ if ($agent_search_method =~ /^LO|^LB/)
}
$sthA->finish();
- if ($rec_countWAITrem < 1)
+ if ( ($rec_countWAITrem < 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
@@ -1596,7 +1645,7 @@ if ($agent_search_method =~ /^LO|^LB/)
$qp_groupWAIT_aco='';
$qp_groupWAIT_aco_SQL='';
$qp_groupWAIT_camp_SQL='';
- if ($qp_countWAIT > 0)
+ if ( ($qp_countWAIT > 0) && ($AGENTgrab < 1) )
{
### Get group/campaign ids of calls in higher priority groups than this call or the same priority with longer wait time
$stmtA = "SELECT distinct campaign_id 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\") );";
@@ -1629,7 +1678,7 @@ if ($agent_search_method =~ /^LO|^LB/)
$sthA->finish();
}
- if ($aco_sub>0)
+ if ( ($aco_sub>0) || ($AGENTgrab > 0) )
{
$stmtA = "LOCK TABLES vicidial_live_agents WRITE, vicidial_live_inbound_agents WRITE;";
my $LOCKaffected_rows = $dbhA->do($stmtA);
@@ -1642,7 +1691,7 @@ if ($agent_search_method =~ /^LO|^LB/)
$rec_countCUSTDATA=0;
$dbhP=$dbhA; $mysql_count='02058'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
- if ($sthArows > 0)
+ if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
@@ -1652,16 +1701,33 @@ if ($agent_search_method =~ /^LO|^LB/)
$VDADserver_ip = "$aryA[3]";
}
$sthA->finish();
- if ($AGILOG) {$agi_string = "$VDADuser|$stmtA|"; &agi_output;}
+ if ($AGILOG) {$agi_string = "$VDADuser|$stmtA|"; &agi_output;}
+ if ($AGENTgrab > 0)
+ {
+ $stmtA = "SELECT conf_exten,extension from vicidial_live_agents WHERE user='$AGENTuser';";
+ if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
+ $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
+ $sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
+ $sthArows=$sthA->rows;
+ $dbhP=$dbhA; $mysql_count='02112'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
if ($sthArows > 0)
+ {
+ @aryA = $sthA->fetchrow_array;
+ $VDADconf_exten = "$aryA[0]";
+ $VDADextension = "$aryA[1]";
+ $VDADuser = $AGENTuser;
+ }
+ $sthA->finish();
+ }
+ if ($sthArows > 0)
{
$stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$insert_lead_id',uniqueid='$unique_id', channel='$channel', callerid='$callerid', call_server_ip='$VARserver_ip',comments='INBOUND' where user='$VDADuser';";
$Faffected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='02059'; $MEL_aff_rows=$Faffected_rows; &mysql_error_logging;
$found_agents=$Faffected_rows;
}
- else
+ else
{
$Faffected_rows=0;
}
diff --git a/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl b/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl
index e02769f7..e3829495 100644
--- a/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl
+++ b/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl
@@ -29,6 +29,7 @@
# 90621-1425 - Added tracking group for call menus
# 90622-2146 - Added 83047777777777 for dynamic agent alert extension
# 90630-2259 - Added vicidial_process_triggers functionality
+# 90713-0140 - Changed direct dial phone extensions to failover to voicemail forwarder
#
$DB=0; # Debug flag
@@ -884,8 +885,7 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
$Piax .= "host=dynamic\n";
}
$Pext .= "exten => $dialplan[$i],1,Dial(IAX2/$extension[$i]|$phone_ring_timeout[$i]|)\n";
- $Pext .= "exten => $dialplan[$i],2,Voicemail($voicemail[$i]|u)\n";
- $Pext .= "exten => $dialplan[$i],3,Hangup\n";
+ $Pext .= "exten => $dialplan[$i],2,Goto(default,85026666666666$voicemail[$i],1)\n";
$vm .= "$voicemail[$i] => $voicemail[$i],$extension[$i] Mailbox,$email[$i]\n";
@@ -966,8 +966,7 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
$Psip .= "host=dynamic\n";
}
$Pext .= "exten => $dialplan[$i],1,Dial(SIP/$extension[$i]|$phone_ring_timeout[$i]|)\n";
- $Pext .= "exten => $dialplan[$i],2,Voicemail($voicemail[$i]|u)\n";
- $Pext .= "exten => $dialplan[$i],3,Hangup\n";
+ $Pext .= "exten => $dialplan[$i],2,Goto(default,85026666666666$voicemail[$i],1)\n";
$vm .= "$voicemail[$i] => $voicemail[$i],$extension[$i] Mailbox,$email[$i]\n";
diff --git a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql
index d66b65d7..44dcefa8 100644
--- a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql
+++ b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql
@@ -368,6 +368,7 @@ last_update_time TIMESTAMP,
alt_dial VARCHAR(6) default 'NONE',
queue_priority TINYINT(2) default '0',
agent_only VARCHAR(20) default '',
+agent_grab VARCHAR(20) default '',
index (uniqueid),
index (callerid),
index (call_time),
@@ -656,7 +657,12 @@ survey_fourth_exten VARCHAR(20) default '8300',
drop_lockout_time VARCHAR(6) default '0',
quick_transfer_button ENUM('N','IN_GROUP','PRESET_1','PRESET_2') default 'N',
prepopulate_transfer_preset ENUM('N','PRESET_1','PRESET_2') default 'N',
-drop_rate_group VARCHAR(20) default 'DISABLED'
+drop_rate_group VARCHAR(20) default 'DISABLED',
+view_calls_in_queue ENUM('NONE','ALL','1','2','3','4','5') default 'NONE',
+view_calls_in_queue_launch ENUM('AUTO','MANUAL') default 'MANUAL',
+grab_calls_in_queue ENUM('Y','N') default 'N',
+call_requeue_button ENUM('Y','N') default 'N',
+pause_after_each_call ENUM('Y','N') default 'N'
);
CREATE TABLE vicidial_lists (
@@ -1721,7 +1727,7 @@ CREATE INDEX phone_number on vicidial_closer_log (phone_number);
CREATE INDEX date_user on vicidial_closer_log (call_date,user);
CREATE INDEX comment_a on live_inbound_log (comment_a);
-UPDATE system_settings SET db_schema_version='1161';
+UPDATE system_settings SET db_schema_version='1162';
GRANT RELOAD ON *.* TO cron@'%';
GRANT RELOAD ON *.* TO cron@localhost;
diff --git a/agc_2-X/trunk/extras/first_server_install.sql b/agc_2-X/trunk/extras/first_server_install.sql
index aa3d9b07..5a4830d5 100644
--- a/agc_2-X/trunk/extras/first_server_install.sql
+++ b/agc_2-X/trunk/extras/first_server_install.sql
@@ -351,3 +351,4 @@ INSERT INTO vicidial_statuses values('SVYVM','Survey sent to Voicemail','N','N',
INSERT INTO vicidial_statuses values('SVYHU','Survey Hungup','N','N','UNDEFINED','N','N','N','N','N');
INSERT INTO vicidial_statuses values('SVYREC','Survey sent to Record','N','N','UNDEFINED','N','N','N','N','N');
INSERT INTO vicidial_statuses values('QVMAIL','Queue Abandon Voicemail Left','N','N','UNDEFINED','N','N','N','N','N');
+INSERT INTO vicidial_statuses values('RQXFER','Re-Queue','N','Y','UNDEFINED','N','N','N','N','N');
diff --git a/agc_2-X/trunk/extras/upgrade_2.2.0.sql b/agc_2-X/trunk/extras/upgrade_2.2.0.sql
index 45586e18..bf8ddbc1 100644
--- a/agc_2-X/trunk/extras/upgrade_2.2.0.sql
+++ b/agc_2-X/trunk/extras/upgrade_2.2.0.sql
@@ -291,3 +291,13 @@ ALTER TABLE vicidial_user_groups ADD agent_status_viewable_groups TEXT;
ALTER TABLE vicidial_user_groups ADD agent_status_view_time ENUM('Y','N') default 'N';
UPDATE system_settings SET db_schema_version='1161';
+
+ALTER TABLE vicidial_campaigns ADD view_calls_in_queue ENUM('NONE','ALL','1','2','3','4','5') default 'NONE';
+ALTER TABLE vicidial_campaigns ADD view_calls_in_queue_launch ENUM('AUTO','MANUAL') default 'MANUAL';
+ALTER TABLE vicidial_campaigns ADD grab_calls_in_queue ENUM('Y','N') default 'N';
+ALTER TABLE vicidial_campaigns ADD call_requeue_button ENUM('Y','N') default 'N';
+ALTER TABLE vicidial_campaigns ADD pause_after_each_call ENUM('Y','N') default 'N';
+
+ALTER TABLE vicidial_auto_calls ADD agent_grab VARCHAR(20) default '';
+
+UPDATE system_settings SET db_schema_version='1162';
diff --git a/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.2.0.txt b/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.2.0.txt
index c1dfb1a2..e19b54a4 100644
--- a/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.2.0.txt
+++ b/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.2.0.txt
@@ -228,6 +228,16 @@ This is a selectable list of User Groups and user functions to which members of
Agent Status View Time||
This option defines whether the agent will see the amount of time that users in their agent sidebar have been in their current status. Default is N for no or disabled||
This option allows an agent to disposition a call as CALLBK and choose the date and time at which the lead will be re-activated||
+Agent View Calls in Queue||
+If set to anything but NONE, agents will be able to see details about the calls that are waiting in queue in their agent screen. If set to a number value, the calls displayed will be limited to the number selected. Default is NONE||
+View Calls in Queue Launch||
+This setting if set to AUTO will have the Calls in Queue frame show up upon login by the agent into the agent screen. Default is MANUAL||
+Agent Grab Calls in Queue||
+This option if set to Y will allow the agent to select the call that they want to take from the Calls in Queue display by clicking on it while paused. Agents will only be able to grab inbound calls or transferred calls, not outbound calls. Default is N||
+Agent Call Re-Queue Button||
+This option if set to Y will add a Re-Queue Customer button to the agent screen, allowing the agent to send the call into an AGENTDIRECT queue that is reserved for the agent only. Default is N||
+Agent Pause After Each Call||
+This option if set to Y will pause the agent after every call automatically. Default is N||
add-file: user_territories.php
@@ -241,6 +251,11 @@ You are not allowed to dial into other agent sessions||
QUICK TRANSFER||
Other Agents Status||
Available Agents Transfer||
+Show Calls In Queue||
+Calls In Queue||
+Hide Calls In Queue||
+Calls in Queue View Disabled for this campaign||
+YOU MUST BE PAUSED TO GRAB CALLS IN QUEUE||
############################################################ MANAGER Manual
diff --git a/agc_2-X/trunk/www/agc/images/vdc_LB_requeue_call.gif b/agc_2-X/trunk/www/agc/images/vdc_LB_requeue_call.gif
new file mode 100644
index 00000000..c5ef23f3
Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_LB_requeue_call.gif differ
diff --git a/agc_2-X/trunk/www/agc/images/vdc_LB_requeue_call_OFF.gif b/agc_2-X/trunk/www/agc/images/vdc_LB_requeue_call_OFF.gif
new file mode 100644
index 00000000..2db22e3a
Binary files /dev/null and b/agc_2-X/trunk/www/agc/images/vdc_LB_requeue_call_OFF.gif differ
diff --git a/agc_2-X/trunk/www/agc/vdc_db_query.php b/agc_2-X/trunk/www/agc/vdc_db_query.php
index 7e6ba19d..84b4d1bb 100644
--- a/agc_2-X/trunk/www/agc/vdc_db_query.php
+++ b/agc_2-X/trunk/www/agc/vdc_db_query.php
@@ -13,7 +13,7 @@
# - $pass
# optional variables:
# - $format - ('text','debug')
-# - $ACTION - ('regCLOSER','manDiaLnextCALL','manDiaLskip','manDiaLonly','manDiaLlookCALL','manDiaLlogCALL','userLOGout','updateDISPO','VDADpause','VDADready','VDADcheckINCOMING','UpdatEFavoritEs','CalLBacKLisT','CalLBacKCounT','PauseCodeSubmit','LogiNCamPaigns','alt_phone_change','AlertControl','AGENTSview')
+# - $ACTION - ('regCLOSER','manDiaLnextCALL','manDiaLskip','manDiaLonly','manDiaLlookCALL','manDiaLlogCALL','userLOGout','updateDISPO','VDADpause','VDADready','VDADcheckINCOMING','UpdatEFavoritEs','CalLBacKLisT','CalLBacKCounT','PauseCodeSubmit','LogiNCamPaigns','alt_phone_change','AlertControl','AGENTSview','CALLSINQUEUEview','CALLSINQUEUEgrab')
# - $stage - ('start','finish','lookup','new')
# - $closer_choice - ('CL_TESTCAMP_L CL_OUT123_L -')
# - $conf_exten - ('8600011',...)
@@ -203,12 +203,13 @@
# 90611-1423 - Fixed agent log and vicidial log bugs
# 90705-2008 - Added AGENTSview function
# 90706-1431 - Added Agent view transfer selection
+# 90712-2303 - Added view calls in queue, grab call from queue
#
-$version = '2.2.0-114';
-$build = '90706-1431';
+$version = '2.2.0-115';
+$build = '90712-2303';
$mel=1; # Mysql Error Log enabled = 1
-$mysql_log_count=227;
+$mysql_log_count=234;
$one_mysql_log=0;
require("dbconnect.php");
@@ -4251,21 +4252,24 @@ if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') )
$retry_count++;
}
- $stmt="UPDATE vicidial_live_agents set status='$stage' where user='$user' and server_ip='$server_ip';";
- if ($format=='debug') {echo "\n";}
- $rslt=mysql_query($stmt, $link);
- if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00166',$user,$server_ip,$session_name,$one_mysql_log);}
- $retry_count=0;
- while ( ($errno > 0) and ($retry_count < 9) )
- {
- $rslt=mysql_query($stmt, $link);
- $one_mysql_log=1;
- $errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9166$retry_count",$user,$server_ip,$session_name,$one_mysql_log);
- $one_mysql_log=0;
- $retry_count++;
- }
- $affected_rows = mysql_affected_rows($link);
- if ($affected_rows > 0)
+ if ($comments != 'NO_STATUS_CHANGE')
+ {
+ $stmt="UPDATE vicidial_live_agents set status='$stage' where user='$user' and server_ip='$server_ip';";
+ if ($format=='debug') {echo "\n";}
+ $rslt=mysql_query($stmt, $link);
+ if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00166',$user,$server_ip,$session_name,$one_mysql_log);}
+ $retry_count=0;
+ while ( ($errno > 0) and ($retry_count < 9) )
+ {
+ $rslt=mysql_query($stmt, $link);
+ $one_mysql_log=1;
+ $errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9166$retry_count",$user,$server_ip,$session_name,$one_mysql_log);
+ $one_mysql_log=0;
+ $retry_count++;
+ }
+ $affected_rows = mysql_affected_rows($link);
+ }
+ if ( ($affected_rows > 0) or ($comments == 'NO_STATUS_CHANGE') )
{
#############################################
##### START QUEUEMETRICS LOGGING LOOKUP #####
@@ -4552,11 +4556,10 @@ if ($ACTION == 'AGENTSview')
if (ereg("CAMPAIGN-AGENTS",$agent_status_viewable_groups))
{$AGENTviewSQL = "($AGENTviewSQL or (campaign_id='$campaign'))";}
- $andSQL=' and';
$AGENTviewSQL = "and $AGENTviewSQL";
}
if ($comments=='AgentXferViewSelect')
- {$AGENTviewSQL .= "$andSQL (vla.closer_campaigns LIKE \"%AGENTDIRECT%\")";}
+ {$AGENTviewSQL .= " and (vla.closer_campaigns LIKE \"%AGENTDIRECT%\")";}
echo "
";
@@ -4566,7 +4569,7 @@ if ($ACTION == 'AGENTSview')
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00227',$VD_login,$server_ip,$session_name,$one_mysql_log);}
if ($rslt) {$agents_count = mysql_num_rows($rslt);}
$loop_count=0;
- while ($agents_count > $loop_count)
+ while ($agents_count > $loop_count)
{
$row=mysql_fetch_row($rslt);
$user = $row[0];
@@ -4635,6 +4638,237 @@ if ($ACTION == 'AGENTSview')
}
+################################################################################
+### CALLSINQUEUEview - List calls in queue for the bottombar 228
+################################################################################
+if ($ACTION == 'CALLSINQUEUEview')
+ {
+ $stmt="SELECT view_calls_in_queue,grab_calls_in_queue from vicidial_campaigns where campaign_id='$campaign'";
+ if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+ $rslt=mysql_query($stmt, $link);
+ if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00228',$user,$server_ip,$session_name,$one_mysql_log);}
+ $row=mysql_fetch_row($rslt);
+ $view_calls_in_queue = $row[0];
+ $grab_calls_in_queue = $row[1];
+
+ if (eregi('NONE',$view_calls_in_queue))
+ {
+ echo "Calls in Queue View Disabled for this campaign\n";
+ exit;
+ }
+ else
+ {
+ $view_calls_in_queue = ereg_replace('ALL','99', $view_calls_in_queue);
+
+ ### grab the status and campaign/in-group information for this agent to display
+ $ADsql='';
+ $stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
+ if ($DB) {echo "|$stmt|\n";}
+ $rslt=mysql_query($stmt, $link);
+ if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00229',$user,$server_ip,$session_name,$one_mysql_log);}
+ $row=mysql_fetch_row($rslt);
+ $Alogin=$row[0];
+ $Acampaign=$row[1];
+ $AccampSQL=$row[2];
+ $AccampSQL = ereg_replace(' -','', $AccampSQL);
+ $AccampSQL = ereg_replace(' ',"','", $AccampSQL);
+ if (eregi('AGENTDIRECT', $AccampSQL))
+ {
+ $AccampSQL = ereg_replace('AGENTDIRECT','', $AccampSQL);
+ $ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )";
+ }
+
+ ### grab the basic data on calls in the queue for this agent
+ $stmt="SELECT lead_id,campaign_id,phone_number,uniqueid,UNIX_TIMESTAMP(call_time),call_type,auto_call_id from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql) order by queue_priority,call_time;";
+ if ($DB) {echo "|$stmt|\n";}
+ $rslt=mysql_query($stmt, $link);
+ if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00230',$user,$server_ip,$session_name,$one_mysql_log);}
+ if ($rslt) {$calls_count = mysql_num_rows($rslt);}
+ $loop_count=0;
+ while ($calls_count > $loop_count)
+ {
+ $row=mysql_fetch_row($rslt);
+ $CQlead_id[$loop_count] = $row[0];
+ $CQcampaign_id[$loop_count] = $row[1];
+ $CQphone_number[$loop_count] = $row[2];
+ $CQuniqueid[$loop_count] = $row[3];
+ $CQcall_time[$loop_count] = $row[4];
+ $CQcall_type[$loop_count] = $row[5];
+ $CQauto_call_id[$loop_count] = $row[6];
+ $loop_count++;
+ }
+
+ ### re-order the calls to always make sure the AGENTDIRECT calls are first
+ $loop_count=0;
+ $o=0;
+ while ($calls_count > $loop_count)
+ {
+ if (eregi('AGENTDIRECT', $CQcampaign_id[$loop_count]))
+ {
+ $OQlead_id[$o] = $CQlead_id[$loop_count];
+ $OQcampaign_id[$o] = $CQcampaign_id[$loop_count];
+ $OQphone_number[$o] = $CQphone_number[$loop_count];
+ $OQuniqueid[$o] = $CQuniqueid[$loop_count];
+ $OQcall_time[$o] = $CQcall_time[$loop_count];
+ $OQcall_type[$o] = $CQcall_type[$loop_count];
+ $OQauto_call_id[$o] = $CQauto_call_id[$loop_count];
+ $o++;
+ }
+ $loop_count++;
+ }
+ $loop_count=0;
+ while ($calls_count > $loop_count)
+ {
+ if (!eregi('AGENTDIRECT', $CQcampaign_id[$loop_count]))
+ {
+ $OQlead_id[$o] = $CQlead_id[$loop_count];
+ $OQcampaign_id[$o] = $CQcampaign_id[$loop_count];
+ $OQphone_number[$o] = $CQphone_number[$loop_count];
+ $OQuniqueid[$o] = $CQuniqueid[$loop_count];
+ $OQcall_time[$o] = $CQcall_time[$loop_count];
+ $OQcall_type[$o] = $CQcall_type[$loop_count];
+ $OQauto_call_id[$o] = $CQauto_call_id[$loop_count];
+ $o++;
+ }
+ $loop_count++;
+ }
+
+ echo "
";
+ echo "
";
+ echo "
";
+ echo "
PHONE
";
+ echo "
NAME
";
+ echo "
WAIT
";
+ echo "
AGENT
";
+ echo "
";
+ echo "
CALL GROUP
";
+ echo "
TYPE
";
+ echo "
";
+
+ ### Print call information and gather more info on the calls as they are printed
+ $loop_count=0;
+ while ( ($calls_count > $loop_count) and ($view_calls_in_queue > $loop_count) )
+ {
+ $call_time = ($StarTtime - $OQcall_time[$loop_count]);
+ $Fminutes_M = ($call_time / 60);
+ $Fminutes_M_int = floor($Fminutes_M);
+ $Fminutes_M_int = intval("$Fminutes_M_int");
+ $Fminutes_S = ($Fminutes_M - $Fminutes_M_int);
+ $Fminutes_S = ($Fminutes_S * 60);
+ $Fminutes_S = round($Fminutes_S, 0);
+ if ($Fminutes_S < 10) {$Fminutes_S = "0$Fminutes_S";}
+ $call_time = "$Fminutes_M_int:$Fminutes_S";
+ $call_handle_method='';
+
+ if ($OQcall_type[$loop_count]=='IN')
+ {
+ $stmt="SELECT group_name,group_color from vicidial_inbound_groups where group_id='$OQcampaign_id[$loop_count]';";
+ $rslt=mysql_query($stmt, $link);
+ if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00231',$user,$server_ip,$session_name,$one_mysql_log);}
+ $row=mysql_fetch_row($rslt);
+ $group_name = $row[0];
+ $group_color = $row[1];
+ }
+ $stmt="SELECT comments,user,first_name,last_name from vicidial_list where lead_id='$OQlead_id[$loop_count]'";
+ $rslt=mysql_query($stmt, $link);
+ if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00232',$user,$server_ip,$session_name,$one_mysql_log);}
+ $row=mysql_fetch_row($rslt);
+ $comments = $row[0];
+ $agent = $row[1];
+ $first_last_name = "$row[2] $row[3]";
+ $caller_name = $first_last_name;
+
+ $stmt="SELECT full_name from vicidial_users where user='$agent'";
+ $rslt=mysql_query($stmt, $link);
+ if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00232',$user,$server_ip,$session_name,$one_mysql_log);}
+ if ($rslt) {$agent_name_count = mysql_num_rows($rslt);}
+ if ($agent_name_count > 0)
+ {
+ $row=mysql_fetch_row($rslt);
+ $agent_name = $row[0];
+ }
+ else
+ {$agent_name='';}
+
+ if (strlen($caller_name)<2)
+ {$caller_name = $comments;}
+ if (strlen($caller_name) > 30) {$caller_name = substr("$caller_name", 0, 30);}
+
+ if (eregi("0$|2$|4$|6$|8$", $loop_count)) {$Qcolor='bgcolor="#FCFCFC"';}
+ else{$Qcolor='bgcolor="#ECECEC"';}
+
+ if ( (eregi('Y',$grab_calls_in_queue)) and ($OQcall_type[$loop_count]=='IN') )
+ {
+ echo "