diff --git a/UPGRADE b/UPGRADE index 3be1f034..2f400239 100644 --- a/UPGRADE +++ b/UPGRADE @@ -639,6 +639,9 @@ OTHER CHANGES: dropped, no-agent-no-queue and other transferred calls to a specific dialplan number per-user defined in the User Custom Five field. +144. Added last_inbound_call_time and last_inbound_call_finish Next Agent Call + routing options to in-groups. + diff --git a/agi/agi-VDAD_ALL_inbound.agi b/agi/agi-VDAD_ALL_inbound.agi index 7de78056..de52f6c4 100644 --- a/agi/agi-VDAD_ALL_inbound.agi +++ b/agi/agi-VDAD_ALL_inbound.agi @@ -152,6 +152,7 @@ # 110525-1555 - Added CLOSER compatibility with outbound and in-group calls that went through Call Menu # 110626-2343 - Added queuemetrics_pe_phone_append # 110707-0646 - Added AGENTEXT option in drop message to send to extension(user_custom_five) field +# 110707-1302 - Added last_inbound_call_time and finish to next agent call options # $script = 'agi-VDAD_ALL_inbound.agi'; @@ -163,7 +164,7 @@ $wait_prompt_runs=0; $at='@'; $S='*'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=173; +$mysql_log_count=178; $one_mysql_log=0; @@ -1051,7 +1052,7 @@ if ( ( ($hm < $ct_default_start) || ($hm > $ct_default_stop) ) && ($hm >= $ct_st $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; - $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$sthArows; &mysql_error_logging; + $dbhP=$dbhA; $mysql_count='02174'; $MEL_aff_rows=$sthArows; &mysql_error_logging; if ($sthArows > 0) { @aryA = $sthA->fetchrow_array; @@ -1248,7 +1249,7 @@ if ($no_agent_no_queue =~ /Y|NO_PAUSED/) $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; - $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$sthArows; &mysql_error_logging; + $dbhP=$dbhA; $mysql_count='02175'; $MEL_aff_rows=$sthArows; &mysql_error_logging; if ($sthArows > 0) { @aryA = $sthA->fetchrow_array; @@ -1796,6 +1797,8 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) ) 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 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 =~ /oldest_inbound_call_start/i) {$agent_call_order = 'order by vicidial_live_agents.last_inbound_call_time';} + if ($CAMP_callorder =~ /oldest_inbound_call_finish/i) {$agent_call_order = 'order by vicidial_live_agents.last_inbound_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';} @@ -3324,7 +3327,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) ) $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; - $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$sthArows; &mysql_error_logging; + $dbhP=$dbhA; $mysql_count='02176'; $MEL_aff_rows=$sthArows; &mysql_error_logging; if ($sthArows > 0) { @aryA = $sthA->fetchrow_array; @@ -3746,7 +3749,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) ) $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; - $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$sthArows; &mysql_error_logging; + $dbhP=$dbhA; $mysql_count='02177'; $MEL_aff_rows=$sthArows; &mysql_error_logging; if ($sthArows > 0) { @aryA = $sthA->fetchrow_array; @@ -4153,7 +4156,7 @@ if ($drop_timer > $DROP_TIME) $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; - $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$sthArows; &mysql_error_logging; + $dbhP=$dbhA; $mysql_count='02178'; $MEL_aff_rows=$sthArows; &mysql_error_logging; if ($sthArows > 0) { @aryA = $sthA->fetchrow_array; diff --git a/bin/AST_VDremote_agents.pl b/bin/AST_VDremote_agents.pl index 55b50ad7..61d653a0 100644 --- a/bin/AST_VDremote_agents.pl +++ b/bin/AST_VDremote_agents.pl @@ -41,6 +41,7 @@ # 110224-1903 - Added compatibility with QM phone environment logging # 110304-0007 - Added agent on-hook compatibility # 110626-0030 - Added queuemetrics_pe_phone_append +# 110707-1342 - Added last_inbound_call_time to next agent call options for inbound # ### begin parsing run-time options ### @@ -308,8 +309,11 @@ while($one_day_interval > 0) while ($vla_qh_ct > $w) { $start_call_url=''; + $licf_SQL = ''; + if ($QHcall_type[$w] =~ /IN/) + {$licf_SQL = ",last_inbound_call_time='$SQLdate'";} - $stmtA = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$SQLdate',comments='REMOTE',calls_today=(calls_today + 1),last_state_change='$SQLdate' where live_agent_id='$QHlive_agent_id[$w]';"; + $stmtA = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$SQLdate',comments='REMOTE',calls_today=(calls_today + 1),last_state_change='$SQLdate' $licf_SQL where live_agent_id='$QHlive_agent_id[$w]';"; $Aaffected_rows = $dbhA->do($stmtA); $stmtB = "UPDATE vicidial_list set status='XFER',user='$QHuser[$w]' where lead_id='$QHlead_id[$w]';"; @@ -608,7 +612,7 @@ while($one_day_interval > 0) } $sthA->finish(); - $stmtA = "INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,campaign_id,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,channel,uniqueid,callerid,user_level,comments,last_state_change,outbound_autodial,ra_user,on_hook_agent,on_hook_ring_time) values('$DBremote_user[$h]','$server_ip','$DBremote_conf_exten[$h]','R/$DBremote_user[$h]','READY','$DBremote_campaign[$h]','$DBremote_random[$h]','$SQLdate','$FDtsSQLdate','$SQLdate','$DBremote_closer[$h]','','','','$DBuser_level[$h]','REMOTE','$SQLdate','$CAMPAIGN_autodial[$h]','$DBuser_start[$h]','$DBon_hook_agent[$h]','$DBon_hook_ring_time[$h]');"; + $stmtA = "INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,campaign_id,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,channel,uniqueid,callerid,user_level,comments,last_state_change,outbound_autodial,ra_user,on_hook_agent,on_hook_ring_time,last_inbound_call_time,last_inbound_call_finish) values('$DBremote_user[$h]','$server_ip','$DBremote_conf_exten[$h]','R/$DBremote_user[$h]','READY','$DBremote_campaign[$h]','$DBremote_random[$h]','$SQLdate','$FDtsSQLdate','$SQLdate','$DBremote_closer[$h]','','','','$DBuser_level[$h]','REMOTE','$SQLdate','$CAMPAIGN_autodial[$h]','$DBuser_start[$h]','$DBon_hook_agent[$h]','$DBon_hook_ring_time[$h]','$SQLdate','$SQLdate');"; $affected_rows = $dbhA->do($stmtA); if ($DBX) {print STDERR "$DBremote_user[$h] NEW INSERT\n";} if ($TESTrun > 0) diff --git a/extras/MySQL_AST_CREATE_tables.sql b/extras/MySQL_AST_CREATE_tables.sql index 0f1a7e0b..ad96abec 100644 --- a/extras/MySQL_AST_CREATE_tables.sql +++ b/extras/MySQL_AST_CREATE_tables.sql @@ -389,7 +389,9 @@ external_park VARCHAR(40) default '', external_timer_action_destination VARCHAR(100) default '', on_hook_agent ENUM('Y','N') default 'N', on_hook_ring_time SMALLINT(5) default '15', -ring_callerid VARCHAR(20) default '' +ring_callerid VARCHAR(20) default '', +last_inbound_call_time DATETIME, +last_inbound_call_finish DATETIME, index (random_id), index (last_call_time), index (last_update_time), @@ -909,7 +911,7 @@ group_color VARCHAR(7), active ENUM('Y','N'), web_form_address TEXT, voicemail_ext VARCHAR(10), -next_agent_call ENUM('random','oldest_call_start','oldest_call_finish','overall_user_level','inbound_group_rank','campaign_rank','fewest_calls','fewest_calls_campaign','longest_wait_time','ring_all') default 'longest_wait_time', +next_agent_call VARCHAR(30) default 'longest_wait_time', fronter_display ENUM('Y','N') default 'Y', ingroup_script VARCHAR(10), get_call_launch ENUM('NONE','SCRIPT','WEBFORM','WEBFORMTWO','FORM') default 'NONE', @@ -2533,7 +2535,7 @@ ALTER TABLE vicidial_closer_log_archive MODIFY closecallid INT(9) UNSIGNED NOT N CREATE TABLE vicidial_outbound_ivr_log_archive LIKE vicidial_outbound_ivr_log; -UPDATE system_settings SET db_schema_version='1285',db_schema_update_date=NOW(); +UPDATE system_settings SET db_schema_version='1286',db_schema_update_date=NOW(); GRANT RELOAD ON *.* TO cron@'%'; GRANT RELOAD ON *.* TO cron@localhost; diff --git a/extras/upgrade_2.4.sql b/extras/upgrade_2.4.sql index 9d652cba..5a1fcdc7 100644 --- a/extras/upgrade_2.4.sql +++ b/extras/upgrade_2.4.sql @@ -868,3 +868,11 @@ ALTER TABLE system_settings ADD test_campaign_calls ENUM('0','1') default '0'; ALTER TABLE system_settings ADD agents_calls_reset ENUM('0','1') default '1'; UPDATE system_settings SET db_schema_version='1285',db_schema_update_date=NOW() where db_schema_version < 1285; + +ALTER TABLE vicidial_live_agents ADD last_inbound_call_time DATETIME; +ALTER TABLE vicidial_live_agents ADD last_inbound_call_finish DATETIME; + +ALTER TABLE vicidial_inbound_groups MODIFY next_agent_call VARCHAR(30) default 'longest_wait_time'; + +UPDATE system_settings SET db_schema_version='1286',db_schema_update_date=NOW() where db_schema_version < 1286; + diff --git a/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt b/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt index 408925c6..a600278b 100644 --- a/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt +++ b/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt @@ -650,6 +650,8 @@ The Custom 5 field can be used as a field to define a dialplan number to send a For AGENTDIRECT in-groups, if the user is unavailable, you can put AGENTEXT in this field and the system will look up the user custom five field and send the call to that dialplan number|| For AGENTDIRECT in-groups, you can put AGENTEXT in this field and the system will look up the user custom five field and send the call to that dialplan number|| You can also put AGENTEXT in this field if it is set to EXTENSION and the system will look up the user custom five field and send the call to that dialplan number|| +orders by the last time an agent was sent an inbound call. Results in agents receiving about the same number of calls overall|| +orders by the last time an agent finished an inbound call. AKA agent waiting longest receives first call|| lead_report_export.php diff --git a/www/agc/vdc_db_query.php b/www/agc/vdc_db_query.php index 9da6aad9..9bf3b84f 100644 --- a/www/agc/vdc_db_query.php +++ b/www/agc/vdc_db_query.php @@ -3887,7 +3887,10 @@ if ($stage == "end") if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00081',$user,$server_ip,$session_name,$one_mysql_log);} } - $stmt = "UPDATE vicidial_live_agents set status='PAUSED',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME',comments='',last_state_change='$NOW_TIME' where user='$user' and server_ip='$server_ip';"; + $licf_SQL = ''; + if ($VLA_inOUT == 'INBOUND') + {$licf_SQL = ",last_inbound_call_finish='$NOW_TIME'";} + $stmt = "UPDATE vicidial_live_agents set status='PAUSED',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME',comments='',last_state_change='$NOW_TIME' $licf_SQL where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00082',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5052,7 +5055,7 @@ if ($ACTION == 'VDADcheckINCOMING') } ### update the comments in vicidial_live_agents record - $stmt = "UPDATE vicidial_live_agents set comments='INBOUND' where user='$user' and server_ip='$server_ip';"; + $stmt = "UPDATE vicidial_live_agents set comments='INBOUND',last_inbound_call_time='$NOW_TIME' 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,'00120',$user,$server_ip,$session_name,$one_mysql_log);} diff --git a/www/agc/vicidial.php b/www/agc/vicidial.php index bcc8ad8e..4eae6a24 100644 --- a/www/agc/vicidial.php +++ b/www/agc/vicidial.php @@ -356,10 +356,11 @@ # 110619-2005 - Added disable_dispo_ options # 110624-2311 - Added screen labels option and status display fields option # 110626-2234 - Added queuemetrics_pe_phone_append +# 110707-1412 - Added last_inbound_call_time and finish compatibility # -$version = '2.4-333c'; -$build = '110626-2234'; +$version = '2.4-334c'; +$build = '110707-1412'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=73; $one_mysql_log=0; @@ -2469,7 +2470,7 @@ else echo "\n"; $closer_chooser_string=''; - $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,user_level,campaign_weight,calls_today,last_state_change,outbound_autodial,manager_ingroup_set,on_hook_ring_time,on_hook_agent) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$closer_chooser_string','$user_level','$campaign_weight','$calls_today','$NOW_TIME','Y','N','$phone_ring_timeout','$on_hook_agent');"; + $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,user_level,campaign_weight,calls_today,last_state_change,outbound_autodial,manager_ingroup_set,on_hook_ring_time,on_hook_agent,last_inbound_call_time,last_inbound_call_finish) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$closer_chooser_string','$user_level','$campaign_weight','$calls_today','$NOW_TIME','Y','N','$phone_ring_timeout','$on_hook_agent','$NOW_TIME','$NOW_TIME');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01044',$VD_login,$server_ip,$session_name,$one_mysql_log);} diff --git a/www/vicidial/admin.php b/www/vicidial/admin.php index 41e0fc0e..a82804f1 100644 --- a/www/vicidial/admin.php +++ b/www/vicidial/admin.php @@ -2780,12 +2780,13 @@ else # 110625-2338 - Added queuemetrics_pe_phone_append option # 110703-1400 - Added test_campaign_calls and agents_calls_reset features # 110707-0725 - Added AGENTEXT notes for in-groups settings +# 110707-1402 - Added last_inbound_call_time and finish to next agent call options for in-groups # # make sure you have added a user to the vicidial_users MySQL table with at least user_level 8 to access this page the first time -$admin_version = '2.4-323a'; -$build = '110707-0725'; +$admin_version = '2.4-324a'; +$build = '110707-1402'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -5299,6 +5300,8 @@ if ($ADD==99999)
  - random: orders by the random update value in the vicidial_live_agents table
  - oldest_call_start: orders by the last time an agent was sent a call. Results in agents receiving about the same number of calls overall.
  - oldest_call_finish: orders by the last time an agent finished a call. AKA agent waiting longest receives first call. +
  - oldest_inbound_call_start: orders by the last time an agent was sent an inbound call. Results in agents receiving about the same number of calls overall. +
  - oldest_inbound_call_finish: orders by the last time an agent finished an inbound call. AKA agent waiting longest receives first call.
  - overall_user_level: orders by the user_level of the agent as defined in the vicidial_users table a higher user_level will receive more calls.
  - inbound_group_rank: orders by the rank given to the agent for the specific inbound group. Highest to Lowest.
  - fewest_calls: orders by the number of calls received by an agent for that specific inbound group. Least calls first. @@ -8799,7 +8802,7 @@ if ($ADD==1111) echo "Active: $NWB#vicidial_inbound_groups-active$NWE\n"; echo "Web Form: $NWB#vicidial_inbound_groups-web_form_address$NWE\n"; echo "Voicemail: $NWB#vicidial_inbound_groups-voicemail_ext$NWE\n"; - echo "Next Agent Call: $NWB#vicidial_inbound_groups-next_agent_call$NWE\n"; + echo "Next Agent Call: $NWB#vicidial_inbound_groups-next_agent_call$NWE\n"; echo "Fronter Display: $NWB#vicidial_inbound_groups-fronter_display$NWE\n"; echo "Script: $NWB#vicidial_inbound_groups-web_form_address$NWE\n"; } - echo "Next Agent Call: $NWB#vicidial_inbound_groups-next_agent_call$NWE\n"; + echo "Next Agent Call: $NWB#vicidial_inbound_groups-next_agent_call$NWE\n"; echo "Queue Priority: