diff --git a/agc_2-X/trunk/LANG_www/agc_it/vdc_db_query.php b/agc_2-X/trunk/LANG_www/agc_it/vdc_db_query.php index cac592ae..c48ecc73 100644 --- a/agc_2-X/trunk/LANG_www/agc_it/vdc_db_query.php +++ b/agc_2-X/trunk/LANG_www/agc_it/vdc_db_query.php @@ -170,12 +170,16 @@ # 81104-0134 - Added mysql error logging capability # 81104-1617 - Added multi-retry for some vicidial_live_agents table MySQL queries # 81106-0410 - Added force_timeclock_login option to LoginCampaigns function +# 81107-0424 - Added carryover of script and presets for in-group calls from campaign settings +# 81110-0058 - Changed Pause time to start new vicidial_agent_log on every pause +# 81110-1512 - Added hangup_all_non_reserved to fix non-Hangup bug +# 81111-1630 - Added another hangup fix for non-hangup # -$version = '2.0.5-88'; -$build = '81106-0410'; +$version = '2.0.5-92'; +$build = '81111-1630'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=180; +$mysql_log_count=183; $one_mysql_log=0; require("dbconnect.php"); @@ -327,6 +331,8 @@ if (isset($_GET["conf_dialed"])) {$conf_dialed=$_GET["conf_dialed"];} elseif (isset($_POST["conf_dialed"])) {$conf_dialed=$_POST["conf_dialed"];} if (isset($_GET["leaving_threeway"])) {$leaving_threeway=$_GET["leaving_threeway"];} elseif (isset($_POST["leaving_threeway"])) {$leaving_threeway=$_POST["leaving_threeway"];} +if (isset($_GET["hangup_all_non_reserved"])) {$hangup_all_non_reserved=$_GET["hangup_all_non_reserved"];} + elseif (isset($_POST["hangup_all_non_reserved"])) {$hangup_all_non_reserved=$_POST["hangup_all_non_reserved"];} header ("Content-type: text/html; charset=utf-8"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 @@ -2088,7 +2094,7 @@ if ($stage == "end") else { # if (preg_match("/$agentchannel/i",$row[0])) - if ($agentchannel == "$row[0]") + if ( ($agentchannel == "$row[0]") or (ereg('ASTblind',$row[0])) ) { $donothing=1; } @@ -2102,8 +2108,40 @@ if ($stage == "end") $loop_count++; } + $loop_count=0; + $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and extension = '$conf_exten' order by channel desc;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00184',$user,$server_ip,$session_name,$one_mysql_log);} + if ($rslt) {$rec_list = mysql_num_rows($rslt);} + while ($rec_list>$loop_count) + { + $row=mysql_fetch_row($rslt); + if (preg_match("/Local\/$conf_silent_prefix$conf_exten\@/i",$row[0])) + { + $rec_channels[$total_rec] = "$row[0]"; + $total_rec++; + } + else + { + # if (preg_match("/$agentchannel/i",$row[0])) + if ( ($agentchannel == "$row[0]") or (ereg('ASTblind',$row[0])) ) + { + $donothing=1; + } + else + { + $hangup_channels[$total_hangup] = "$row[0]"; + $total_hangup++; + } + } + if ($format=='debug') {echo "\n";} + $loop_count++; + } + + ### if a conference call or 3way call was attempted, then hangup all channels except for the agentchannel - if ( ($conf_dialed > 0) and ($leaving_threeway < 1) ) + if ( ( ($conf_dialed > 0) or ($hangup_all_non_reserved > 0) ) and ($leaving_threeway < 1) ) { $loop_count=0; while($loop_count < $total_hangup) @@ -2417,16 +2455,16 @@ if ($ACTION == 'VDADcheckINCOMING') ### update the log status to INCALL $user_group=''; - $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00111',$user,$server_ip,$session_name,$one_mysql_log);} - if ($DB) {echo "$stmt\n";} - $ug_record_ct = mysql_num_rows($rslt); - if ($ug_record_ct > 0) - { - $row=mysql_fetch_row($rslt); - $user_group = trim("$row[0]"); - } + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00111',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } $stmt = "select campaign_id,phone_number,alt_dial,call_type from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; @@ -2444,10 +2482,31 @@ if ($ACTION == 'VDADcheckINCOMING') } else { + $dialed_number = $phone_number; + $dialed_label = 'MAIN'; + if (preg_match('/^M|^V/',$callerid)) + { + $call_type = 'OUT'; + $VDADchannel_group = $campaign; + } + else + { + $call_type = 'IN'; + $stmt = "select campaign_id from vicidial_closer_log where lead_id = '$lead_id' order by call_date desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00183',$user,$server_ip,$session_name,$one_mysql_log);} + $VDCL_mvac_ct = mysql_num_rows($rslt); + if ($VDCL_mvac_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDADchannel_group =$row[0]; + } + } if ($WeBRooTWritablE > 0) { $fp = fopen ("./vicidial_debug.txt", "a"); - fwrite ($fp, "$NOW_TIME|INBND|$callerid|$user|$user_group|$list_id|$lead_id|$phone_number|$uniqueid|\n"); + fwrite ($fp, "$NOW_TIME|INBND|$callerid|$user|$user_group|$list_id|$lead_id|$phone_number|$uniqueid|$VDADchannel_group|$call_type|\n"); fclose($fp); } } @@ -2459,7 +2518,7 @@ if ($ACTION == 'VDADcheckINCOMING') $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00113',$user,$server_ip,$session_name,$one_mysql_log);} - $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$campaign';"; + $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,default_xfer_group from vicidial_campaigns where campaign_id='$campaign';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00114',$user,$server_ip,$session_name,$one_mysql_log);} @@ -2473,8 +2532,10 @@ if ($ACTION == 'VDADcheckINCOMING') $VDCL_xferconf_a_number = $row[3]; $VDCL_xferconf_b_dtmf = $row[4]; $VDCL_xferconf_b_number = $row[5]; + $VDCL_default_xfer_group = $row[6]; + if (strlen($VDCL_default_xfer_group)<2) {$VDCL_default_xfer_group='X';} } - echo "|||||$VDCL_campaign_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number||||\n|\n"; + echo "|||||$VDCL_campaign_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|X|X|\n|\n"; $stmt = "select phone_number,alt_dial from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; if ($DB) {echo "$stmt\n";} @@ -2487,6 +2548,11 @@ if ($ACTION == 'VDADcheckINCOMING') $dialed_number =$row[0]; $dialed_label =$row[1]; } + else + { + $dialed_number = $phone_number; + $dialed_label = 'MAIN'; + } if (ereg('X',$dialed_label)) { if (ereg('LAST',$dialed_label)) @@ -3030,12 +3096,12 @@ if ($ACTION == 'updateDISPO') $user_group = trim("$row[0]"); } - $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group) values('$user','$server_ip','$NOW_TIME','$campaign','$StarTtime','0','$StarTtime','$user_group');"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00153',$user,$server_ip,$session_name,$one_mysql_log);} - $affected_rows = mysql_affected_rows($link); - $agent_log_id = mysql_insert_id($link); +# $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group) values('$user','$server_ip','$NOW_TIME','$campaign','$StarTtime','0','$StarTtime','$user_group');"; +# if ($DB) {echo "$stmt\n";} +# $rslt=mysql_query($stmt, $link); +# if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00153',$user,$server_ip,$session_name,$one_mysql_log);} +# $affected_rows = mysql_affected_rows($link); +# $agent_log_id = mysql_insert_id($link); ### CHIAMATABACK ENTRY if ( ($dispo_choice == 'CBHOLD') and (strlen($CallBackDatETimE)>10) ) @@ -3297,6 +3363,18 @@ if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); mysql_select_db("$queuemetrics_dbname", $linkB); + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00182',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + } + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='$QMstatus',serverid='$queuemetrics_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); @@ -3307,47 +3385,66 @@ if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) } } - if ($agent_log == 'NO') - {$donothing=1;} - else + $pause_sec=0; + $stmt = "select pause_epoch,pause_sec,wait_epoch,wait_sec,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00169',$user,$server_ip,$session_name,$one_mysql_log);} + $VDpr_ct = mysql_num_rows($rslt); + if ($VDpr_ct > 0) { - $pause_sec=0; - $stmt = "select pause_epoch,pause_sec,wait_epoch,wait_sec,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; - if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $wait_sec=0; + if ($row[2] > 0) + { + $wait_sec = (($StarTtime - $row[2]) + $row[3]); + } + if ( (eregi("NULL",$row[4])) or ($row[4] < 1000) ) + {$pause_sec = (($StarTtime - $row[0]) + $row[1]);} + else + {$pause_sec = (($row[4] - $row[0]) + $row[1]);} + + } + if ($ACTION == 'VDADready') + { + $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00169',$user,$server_ip,$session_name,$one_mysql_log);} - $VDpr_ct = mysql_num_rows($rslt); - if ($VDpr_ct > 0) + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00170',$user,$server_ip,$session_name,$one_mysql_log);} + } + if ($ACTION == 'VDADpause') + { + $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00171',$user,$server_ip,$session_name,$one_mysql_log);} + + $agent_log = 'NEW_ID'; + } + + if ($agent_log == 'NEW_ID') + { + $user_group=''; + $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00182',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) { $row=mysql_fetch_row($rslt); - $wait_sec=0; - if ($row[2] > 0) - { - $wait_sec = (($StarTtime - $row[2]) + $row[3]); - } - if ( (eregi("NULL",$row[4])) or ($row[4] < 1000) ) - {$pause_sec = (($StarTtime - $row[0]) + $row[1]);} - else - {$pause_sec = (($row[4] - $row[0]) + $row[1]);} + $user_group = trim("$row[0]"); + } - } - if ($ACTION == 'VDADready') - { - $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; - if ($format=='debug') {echo "\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00170',$user,$server_ip,$session_name,$one_mysql_log);} - } - if ($ACTION == 'VDADpause') - { - $stmt="UPDATE vicidial_agent_log set pause_epoch='$StarTtime',wait_sec='$wait_sec' where agent_log_id='$agent_log_id';"; - if ($format=='debug') {echo "\n";} - $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00171',$user,$server_ip,$session_name,$one_mysql_log);} - } + $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group) values('$user','$server_ip','$NOW_TIME','$campaign','$StarTtime','0','$StarTtime','$user_group');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00153',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($link); + $agent_log_id = mysql_insert_id($link); } } - echo 'Agent ' . $user . ' e` ora nello stato ' . $stage . "\n"; + echo 'Agent ' . $user . ' e` ora nello stato ' . $stage . "\nNext agent_log_id:\n$agent_log_id\n"; } diff --git a/agc_2-X/trunk/LANG_www/agc_it/vicidial.php b/agc_2-X/trunk/LANG_www/agc_it/vicidial.php index c40d665a..12de61b6 100644 --- a/agc_2-X/trunk/LANG_www/agc_it/vicidial.php +++ b/agc_2-X/trunk/LANG_www/agc_it/vicidial.php @@ -205,10 +205,12 @@ # 81104-0140 - Added mysql error logging capability # 81104-1618 - Changed MySQL queries logging # 81106-0411 - Changedthe campaign login list behaviour +# 81110-0057 - Changed Pause time to start new vicidial_agent_log on every pause +# 81110-1514 - Added hangup_all_non_reserved to fix non-Hangup bug # -$version = '2.0.5-184'; -$build = '81106-0411'; +$version = '2.0.5-186'; +$build = '81110-1514'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=51; $one_mysql_log=0; @@ -327,6 +329,7 @@ $volumecontrol_active = '1'; # set to 1 to allow agents to alter volume of chann $PreseT_DiaL_LinKs = '0'; # set to 1 to show a CHIAMA link for Dial Presets $LogiNAJAX = '1'; # set to 1 to do lookups su campaigns for login $HidEMonitoRSessionS = '1'; # set to 1 to hide remote monitoring channels from "session calls" +$hangup_all_non_reserved= '1'; # set to 1 to force hangup all non-reserved channels upon Riaggancia il cliente $LogouTKicKAlL = '1'; # set to 1 to hangup all calls in session upon agent logout $TelefonoSComPIP = '1'; # set to 1 to log computer IP to phone if blank, set to 2 to force log each login $DefaulTAlTDiaL = '0'; # set to 1 to enable ALT CHIAMA by default if enabled for the campaign @@ -2093,6 +2096,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var agentphonelive = 0; var conf_dialed = 0; var leaving_threeway = 0; + var hangup_all_non_reserved = ''; var dial_method = ''; var DiaLControl_auto_HTML = "\"\"Riprendi\""; var DiaLControl_auto_HTML_ready = "\"\"Riprendi\""; @@ -3219,7 +3223,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} "&list_id=" + document.vicidial_form.list_id.value + "&length_in_sec=0&phone_code=" + document.vicidial_form.phone_code.value + "&phone_number=" + lead_dial_number + - "&exten=" + extension + "&channel=" + lastcustchannel + "&start_epoch=" + MDlogEPOCH + "&auto_dial_level=" + auto_dial_level + "&VDstop_rec_after_each_call=" + VDstop_rec_after_each_call + "&conf_silent_prefix=" + conf_silent_prefix + "&protocol=" + protocol + "&extension=" + extension + "&ext_context=" + ext_context + "&conf_exten=" + session_id + "&user_abb=" + user_abb + "&agent_log_id=" + agent_log_id + "&MDnextCID=" + LasTCID + "&inOUT=" + inOUT + "&alt_dial=" + dialed_label + "&DB=0" + "&agentchannel=" + agentchannel + "&conf_dialed=" + conf_dialed + "&leaving_threeway=" + leaving_threeway; + "&exten=" + extension + "&channel=" + lastcustchannel + "&start_epoch=" + MDlogEPOCH + "&auto_dial_level=" + auto_dial_level + "&VDstop_rec_after_each_call=" + VDstop_rec_after_each_call + "&conf_silent_prefix=" + conf_silent_prefix + "&protocol=" + protocol + "&extension=" + extension + "&ext_context=" + ext_context + "&conf_exten=" + session_id + "&user_abb=" + user_abb + "&agent_log_id=" + agent_log_id + "&MDnextCID=" + LasTCID + "&inOUT=" + inOUT + "&alt_dial=" + dialed_label + "&DB=0" + "&agentchannel=" + agentchannel + "&conf_dialed=" + conf_dialed + "&leaving_threeway=" + leaving_threeway + "&hangup_all_non_reserved=" + hangup_all_non_reserved; xmlhttp.open('POST', 'vdc_db_query.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); // document.getElementById("busycallsdebug").innerHTML = "vdc_db_query.php?" + manDiaLlog_query; @@ -4322,7 +4326,14 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { - // alert(xmlhttp.responseText); + var check_dispo = null; + check_dispo = xmlhttp.responseText; + var check_DS_array=check_dispo.split("\n"); + // alert(xmlhttp.responseText + "\n|" + check_DS_array[1] + "\n|" + check_DS_array[2] + "|"); + if (check_DS_array[1] == 'Next agent_log_id:') + { + agent_log_id = check_DS_array[2]; + } } } delete xmlhttp; @@ -5530,14 +5541,14 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { - var check_dispo = null; - check_dispo = xmlhttp.responseText; - var check_DS_array=check_dispo.split("\n"); + // var check_dispo = null; + // check_dispo = xmlhttp.responseText; + // var check_DS_array=check_dispo.split("\n"); // alert(xmlhttp.responseText + "\n|" + check_DS_array[1] + "\n|" + check_DS_array[2] + "|"); - if (check_DS_array[1] == 'Next agent_log_id:') - { - agent_log_id = check_DS_array[2]; - } + // if (check_DS_array[1] == 'Next agent_log_id:') + // { + // agent_log_id = check_DS_array[2]; + // } } } delete xmlhttp; @@ -5603,7 +5614,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} if (auto_dial_level != '0') { AutoDialWaiting = 0; - AutoDial_ReSume_PauSe("VDADpause","NO"); + AutoDial_ReSume_PauSe("VDADpause"); // document.getElementById("DiaLControl").innerHTML = DiaLControl_auto_HTML; } VICIDiaL_pause_calling = 1; @@ -5617,7 +5628,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} if (auto_dial_level != '0') { AutoDialWaiting = 1; - AutoDial_ReSume_PauSe("VDADready","NO"); + AutoDial_ReSume_PauSe("VDADready","NEW_ID"); // document.getElementById("DiaLControl").innerHTML = DiaLControl_auto_HTML_ready; } else @@ -5805,7 +5816,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} } if (auto_dial_level > 0) { - AutoDial_ReSume_PauSe("VDADpause","NO"); + AutoDial_ReSume_PauSe("VDADpause"); } } @@ -6846,7 +6857,7 @@ else if (auto_dial_level != '0') { AutoDialWaiting = 0; - AutoDial_ReSume_PauSe("VDADpause","NO"); + AutoDial_ReSume_PauSe("VDADpause"); // document.getElementById("DiaLControl").innerHTML = DiaLControl_auto_HTML; } VICIDiaL_pause_calling = 1; @@ -6860,7 +6871,7 @@ else if (auto_dial_level != '0') { AutoDialWaiting = 1; - AutoDial_ReSume_PauSe("VDADready","NO"); + AutoDial_ReSume_PauSe("VDADready"); // document.getElementById("DiaLControl").innerHTML = DiaLControl_auto_HTML_ready; } } diff --git a/agc_2-X/trunk/LANG_www/vicidial_it/AST_CLOSERstats.php b/agc_2-X/trunk/LANG_www/vicidial_it/AST_CLOSERstats.php index c0b685bb..839490f5 100644 --- a/agc_2-X/trunk/LANG_www/vicidial_it/AST_CLOSERstats.php +++ b/agc_2-X/trunk/LANG_www/vicidial_it/AST_CLOSERstats.php @@ -17,6 +17,7 @@ # 81015-0705 - Added IVR calls count # 81024-0037 - Added multi-select inbound-groups # 81105-2118 - Added Answered calls 15-minute breakdown +# 81109-2340 - Added custom indicators section # require("dbconnect.php"); @@ -271,7 +272,7 @@ if ($group_ct > 1) if ($DB) {echo "$stmt\n";} $rowx=mysql_fetch_row($rslt); - $stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='$group[$i]' and status IN('DROP','XDROP') and (length_in_sec <= 9999 or length_in_sec is null);"; + $stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='$group[$i]' and status IN('DROP','XDROP') and (length_in_sec <= 49999 or length_in_sec is null);"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $rowy=mysql_fetch_row($rslt); @@ -307,7 +308,7 @@ $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $row=mysql_fetch_row($rslt); -$stmt="select count(*),sum(queue_seconds) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE');"; +$stmt="select count(*),sum(queue_seconds) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE');"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $rowy=mysql_fetch_row($rslt); @@ -352,10 +353,11 @@ echo "Answered Calls: $ANSWEREDcalls $ANSWEREDper echo "Average queue time for Answered Calls: $average_answer_seconds seconds\n"; echo "Calls taken into the IVR for this In-Gruppo: $IVRcalls\n"; + echo "\n"; echo "---------- ABBATTUTE\n"; -$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status IN('DROP','XDROP') and (length_in_sec <= 9999 or length_in_sec is null);"; +$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status IN('DROP','XDROP') and (length_in_sec <= 49999 or length_in_sec is null);"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $row=mysql_fetch_row($rslt); @@ -391,6 +393,47 @@ echo "Totale Chiamate ABBATTUTE: $DROPcalls $DROPpercent% drop/an echo "Average hold time for DROP Calls: $average_hold_seconds seconds\n"; + + +if (strlen($group_SQL)>3) + { + $stmt = "SELECT answer_sec_pct_rt_stat_one,answer_sec_pct_rt_stat_two from vicidial_inbound_groups where group_id IN($group_SQL) order by answer_sec_pct_rt_stat_one desc limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $Sanswer_sec_pct_rt_stat_one = $row[0]; + $Sanswer_sec_pct_rt_stat_two = $row[1]; + + $stmt = "SELECT count(*) from vicidial_closer_log where campaign_id IN($group_SQL) and call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and queue_seconds <= $Sanswer_sec_pct_rt_stat_one;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $answer_sec_pct_rt_stat_one = $row[0]; + + $stmt = "SELECT count(*) from vicidial_closer_log where campaign_id IN($group_SQL) and call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and queue_seconds <= $Sanswer_sec_pct_rt_stat_two;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $answer_sec_pct_rt_stat_two = $row[0]; + + if ( ($ANSWEREDcalls > 0) and ($answer_sec_pct_rt_stat_one > 0) and ($answer_sec_pct_rt_stat_two > 0) ) + { + $PCTanswer_sec_pct_rt_stat_one = (($answer_sec_pct_rt_stat_one / $ANSWEREDcalls) * 100); + $PCTanswer_sec_pct_rt_stat_one = round($PCTanswer_sec_pct_rt_stat_one, 0); + #$PCTanswer_sec_pct_rt_stat_one = sprintf("%10s", $PCTanswer_sec_pct_rt_stat_one); + $PCTanswer_sec_pct_rt_stat_two = (($answer_sec_pct_rt_stat_two / $ANSWEREDcalls) * 100); + $PCTanswer_sec_pct_rt_stat_two = round($PCTanswer_sec_pct_rt_stat_two, 0); + #$PCTanswer_sec_pct_rt_stat_two = sprintf("%10s", $PCTanswer_sec_pct_rt_stat_two); + } + } +echo "\n"; +echo "---------- CUSTOM INDICATORS\n"; +echo "GDE (Answered/Llamadas totales tomadas in to this In-Group): $ANSWEREDpercent%\n"; +echo "ACR (Dropped/Answered): $DROP_ANSWEREDpercent%\n"; +echo "TMR1 (Answered within $Sanswer_sec_pct_rt_stat_one seconds/Answered): $PCTanswer_sec_pct_rt_stat_one%\n"; +echo "TMR2 (Answered within $Sanswer_sec_pct_rt_stat_two seconds/Answered): $PCTanswer_sec_pct_rt_stat_two%\n"; + + # GET LIST OF ALL STATUSES and create SQL from human_answered statuses $q=0; $stmt = "SELECT status,status_name,human_answered,category from vicidial_statuses;"; @@ -609,7 +652,7 @@ echo " +--------------------------------------------------------------- echo " | 0 5 10 15 20 25 30 35 40 45 50 55 60 90 +90 | TOTAL |\n"; echo "----------+-------------------------------------------------------------------------------------------+------------+\n"; -$stmt="select count(*),queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE') group by queue_seconds;"; +$stmt="select count(*),queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE') group by queue_seconds;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $reasons_to_print = mysql_num_rows($rslt); @@ -1375,7 +1418,7 @@ while ($i <= 96) $ad_0=0; $ad_5=0; $ad10=0; $ad15=0; $ad20=0; $ad25=0; $ad30=0; $ad35=0; $ad40=0; $ad45=0; $ad50=0; $ad55=0; $ad60=0; $ad90=0; $ad99=0; $BDansweredCALLS=0; - $stmt="select count(*),queue_seconds from vicidial_closer_log where call_date >= '$query_date $SQLtime' and call_date < '$query_date $SQLtimeEND' and campaign_id IN($group_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE') group by queue_seconds;"; + $stmt="select count(*),queue_seconds from vicidial_closer_log where call_date >= '$query_date $SQLtime' and call_date < '$query_date $SQLtimeEND' and campaign_id IN($group_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE') group by queue_seconds;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $reasons_to_print = mysql_num_rows($rslt); diff --git a/agc_2-X/trunk/LANG_www/vicidial_it/AST_VDADstats.php b/agc_2-X/trunk/LANG_www/vicidial_it/AST_VDADstats.php index f31a5bc1..66d134fb 100644 --- a/agc_2-X/trunk/LANG_www/vicidial_it/AST_VDADstats.php +++ b/agc_2-X/trunk/LANG_www/vicidial_it/AST_VDADstats.php @@ -14,6 +14,7 @@ # 80709-0230 - Added time stats to call statuses # 80717-2118 - Added calls/hour out of agent login time in status summary # 80722-2049 - Added Status Category stats +# 81109-2341 - Added Productivity Rating # header ("Content-type: text/html; charset=utf-8"); @@ -208,6 +209,7 @@ else echo "Totale Chiamate Effettuate Per Questa Campagna: $TOTALcalls\n"; echo "Durata Media per Tutte Le Chiamate In Secondi: $average_hold_seconds\n"; + echo "\n"; echo "---------- ABBATTUTE\n"; @@ -298,6 +300,46 @@ echo "Totale Chiamate ABBATTUTE: $DROPcalls $DROPpercent%\n"; echo "Percentuale Di Chiamate ABBATTUTE Su Chiamate Con Risposta: $DROPcalls / $ANSWERcalls $DROPANSWERpercent%\n"; echo "Durata Media Chiamate ABBATTUTE in secondi: $average_hold_seconds\n"; + + + + +$stmt = "select closer_campaigns from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; +$rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/^ | -$/","",$closer_campaigns); + $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); + $closer_campaignsSQL = "'$closer_campaigns'"; +if ($DB > 0) {echo "\n|$closer_campaigns|$closer_campaignsSQL|$stmt|\n";} + +$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($closer_campaignsSQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE');"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$row=mysql_fetch_row($rslt); +$TOTALanswers = ($row[0] + $ANSWERcalls); + + +$stmt = "SELECT sum(wait_sec + talk_sec + dispo_sec) from vicidial_agent_log where campaign_id='" . mysql_real_escape_string($group) . "' and event_time >= '$query_date_BEGIN' and event_time <= '$query_date_END';"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$row=mysql_fetch_row($rslt); +$agent_non_pause_sec = $row[0]; + +if ($agent_non_pause_sec > 0) + { + $AVG_ANSWERagent_non_pause_sec = (($TOTALanswers / $agent_non_pause_sec) * 60); + $AVG_ANSWERagent_non_pause_sec = round($AVG_ANSWERagent_non_pause_sec, 2); + } +else + {$AVG_ANSWERagent_non_pause_sec=0;} +$AVG_ANSWERagent_non_pause_sec = sprintf("%10s", $AVG_ANSWERagent_non_pause_sec); + +echo "Productivity Rating: $AVG_ANSWERagent_non_pause_sec\n"; + + + + echo "\n"; echo "---------- NESSUNA RISPOSTA AUTO-DIAL\n"; diff --git a/agc_2-X/trunk/LANG_www/vicidial_it/AST_agent_performance_detail.php b/agc_2-X/trunk/LANG_www/vicidial_it/AST_agent_performance_detail.php index f936db59..4b68381a 100644 --- a/agc_2-X/trunk/LANG_www/vicidial_it/AST_agent_performance_detail.php +++ b/agc_2-X/trunk/LANG_www/vicidial_it/AST_agent_performance_detail.php @@ -14,6 +14,7 @@ # 81030-0346 - Added pause code stats # 81030-1924 - Added total non-pause and total logged-in time to pause code section # 81108-0716 - fixed user same-name bug +# 81110-0056 - fixed pause code display bug # require("dbconnect.php"); @@ -614,6 +615,8 @@ while ($i < $subs_to_print) $PCpause_sec[$i] = $row[2]; $sub_status[$i] = $row[3]; $PCnon_pause_sec[$i] = $row[4]; + +# echo "$sub_status[$i]|$PCpause_sec[$i]\n"; # if ( (!eregi("-$sub_status[$i]-", $sub_statuses)) and (strlen($sub_status[$i])>0) ) if (!eregi("-$sub_status[$i]-", $sub_statuses)) { @@ -671,7 +674,7 @@ while ($m < $k) $SstatusTXT=''; ### BEGIN loop through each stat line ### $i=0; $status_found=0; - while ($i < $rows_to_print) + while ($i < $subs_to_print) { if ( ($Suser=="$PCuser[$i]") and ($Sstatus=="$sub_status[$i]") ) { @@ -773,7 +776,7 @@ while ($n < $j) $SUMstatusTXT=''; ### BEGIN loop through each stat line ### $i=0; $status_found=0; - while ($i < $rows_to_print) + while ($i < $subs_to_print) { if ($Sstatus=="$sub_status[$i]") { diff --git a/agc_2-X/trunk/LANG_www/vicidial_it/AST_timeonVDADall.php b/agc_2-X/trunk/LANG_www/vicidial_it/AST_timeonVDADall.php index 95a404c8..2c9184b1 100644 --- a/agc_2-X/trunk/LANG_www/vicidial_it/AST_timeonVDADall.php +++ b/agc_2-X/trunk/LANG_www/vicidial_it/AST_timeonVDADall.php @@ -116,7 +116,7 @@ if (!isset($SERVdisplay)) {$SERVdisplay=1;} # 0=no, 1=yes if (!isset($CALLSdisplay)) {$CALLSdisplay=1;} # 0=no, 1=yes if (!isset($PHONEdisplay)) {$PHONEdisplay=0;} # 0=no, 1=yes if (!isset($CUSTPHONEdisplay)) {$CUSTPHONEdisplay=0;} # 0=no, 1=yes -if (!isset($with_inbound)) {$with_inbound='N';} # 0=no, 1=yes +if (!isset($with_inbound)) {$with_inbound='N';} # N=no, Y=yes, O=only if (!isset($PAUSEcodes)) {$PAUSEcodes='N';} # 0=no, 1=yes $ingroup_detail=''; @@ -428,7 +428,7 @@ if (ereg('O',$with_inbound)) $AVGhold_sec_answer_calls = round($AVGhold_sec_answer_calls, 0); if ($agent_non_pause_sec > 0) { - $AVG_ANSWERagent_non_pause_sec = ($agent_non_pause_sec / $answersTODAY); + $AVG_ANSWERagent_non_pause_sec = (($answersTODAY / $agent_non_pause_sec) * 60); $AVG_ANSWERagent_non_pause_sec = round($AVG_ANSWERagent_non_pause_sec, 2); $AVG_ANSWERagent_non_pause_sec = sprintf("%01.2f", $AVG_ANSWERagent_non_pause_sec); } @@ -545,7 +545,7 @@ if (ereg('O',$with_inbound)) $AVGhold_sec_answer_calls = round($AVGhold_sec_answer_calls, 0); if ($agent_non_pause_sec > 0) { - $AVG_ANSWERagent_non_pause_sec = ($agent_non_pause_sec / $answersTODAY); + $AVG_ANSWERagent_non_pause_sec = (($answersTODAY / $agent_non_pause_sec) * 60); $AVG_ANSWERagent_non_pause_sec = round($AVG_ANSWERagent_non_pause_sec, 2); $AVG_ANSWERagent_non_pause_sec = sprintf("%01.2f", $AVG_ANSWERagent_non_pause_sec); }