diff --git a/LANG_www/agc_it/manager_send.php b/LANG_www/agc_it/manager_send.php index 1dedad31..6dd29828 100644 --- a/LANG_www/agc_it/manager_send.php +++ b/LANG_www/agc_it/manager_send.php @@ -791,6 +791,11 @@ if ($ACTION=="RedirectXtraCXNeW") $row=mysql_fetch_row($rslt); $exten = $row[0]; + if ( (ereg("^8300",$extension)) and ($protocol == 'Local') ) + { + $extension = "$extension$user"; + } + $stmtD="UPDATE vicidial_conferences set extension='$protocol/$extension' where server_ip='$server_ip' and conf_exten='$exten' limit 1;"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmtD, $link); diff --git a/LANG_www/agc_it/vdc_db_query.php b/LANG_www/agc_it/vdc_db_query.php index d41b2cf5..cb1215b1 100644 --- a/LANG_www/agc_it/vdc_db_query.php +++ b/LANG_www/agc_it/vdc_db_query.php @@ -1753,7 +1753,7 @@ if ($stage == "end") $CLuniqueid = $row[9]; } - $CLstage = preg_replace("/XFER|-/",'',$CLstage); + $CLstage = preg_replace("/XFER|CLOSER|-/",'',$CLstage); if ($CLstage < 0.25) {$CLstage=0;} $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$VDcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='1',serverid='$queuemetrics_log_id';"; @@ -1828,6 +1828,7 @@ if ($stage == "end") else { $SQLterm = "term_reason='$term_reason'"; + $QL_term=''; if ( (ereg("NONE",$term_reason)) or (ereg("NONE",$VDterm_reason)) or (strlen($VDterm_reason) < 1) ) { @@ -1849,6 +1850,7 @@ if ($stage == "end") else { $SQLterm = "term_reason='AGENT'"; + $QL_term = 'COMPLETEAGENT'; } } @@ -1857,6 +1859,26 @@ if ($stage == "end") if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); $affected_rows = mysql_affected_rows($link); + + if ( (strlen($QL_term) > 0) and ($leaving_threeway > 0) ) + { + $stmt="SELECT count(*) from queue_log where call_id='$MDnextCID' and verb='COMPLETEAGENT' and queue='$VDcampaign_id';"; + $rslt=mysql_query($stmt, $linkB); + if ($DB) {echo "$stmt\n";} + $VAC_cc_ct = mysql_num_rows($rslt); + if ($VAC_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $agent_complete = $row[0]; + } + if ($agent_complete < 1) + { + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$VDcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='1',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + } + } } } diff --git a/LANG_www/agc_it/vicidial.php b/LANG_www/agc_it/vicidial.php index bef9faf4..843a77c4 100644 --- a/LANG_www/agc_it/vicidial.php +++ b/LANG_www/agc_it/vicidial.php @@ -199,10 +199,11 @@ # 81015-0405 - Fixed bug related to hangups on 3way calls # 81016-0703 - Changed leave 3way to allow function at any time transfer-conf is available # 81020-1501 - Fixed bugs in queue_log logging +# 81023-0411 - Added compatibility for dial-in agents using AGI, bug fixes # -$version = '2.0.5-178'; -$build = '81020-1501'; +$version = '2.0.5-179'; +$build = '81023-0411'; require("dbconnect.php"); @@ -1237,6 +1238,11 @@ else $extension = "$dialplan_number$AT$ext_context"; } $SIP_user = "$protocol/$extension"; + $SIP_user_DiaL = "$protocol/$extension"; + if ( (ereg('8300',$dialplan_number)) and (strlen($dialplan_number)<5) and ($protocol == 'Local') ) + { + $SIP_user = "$protocol/$extension$VD_login"; + } $stmt="SELECT asterisk_version from servers where server_ip='$server_ip';"; if ($DB) {echo "|$stmt|\n";} @@ -1405,11 +1411,11 @@ else } ### insert a NUOVO record to the vicidial_manager table to be processed - $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$SIqueryCID','Channel: $SIP_user','Context: $ext_context','Exten: $session_id','Priority: 1','Callerid: $SIqueryCID','','','','','');"; + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$SIqueryCID','Channel: $SIP_user_DiaL','Context: $ext_context','Exten: $session_id','Priority: 1','Callerid: $SIqueryCID','','','','','');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); $affected_rows = mysql_affected_rows($link); - print "\n"; + print "\n"; if ($auto_dial_level > 0) { @@ -2205,15 +2211,15 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} mainxfer_send_redirect('3WAY','','',tempvarattempt); - if (threeway_end == '0') - { - document.vicidial_form.xferchannel.value = ''; - xfercall_send_hangup(); - - document.vicidial_form.callchannel.value = ''; - document.vicidial_form.callserverip.value = ''; - dialedcall_send_hangup(); - } +// if (threeway_end == '0') +// { +// document.vicidial_form.xferchannel.value = ''; +// xfercall_send_hangup(); +// +// document.vicidial_form.callchannel.value = ''; +// document.vicidial_form.callserverip.value = ''; +// dialedcall_send_hangup(); +// } if( document.images ) { document.images['livecall'].src = image_livecall_OFF.src;} } @@ -2266,7 +2272,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} if (taskFromConf == 'YES') {basic_originate_call(manual_string,'NO','YES',dial_conf_exten,'NO',taskFromConf,threeway_cid);} else - {basic_originate_call(manual_string,'NO','NO');} + {basic_originate_call(manual_string,'NO','NO','','','','1');} MD_ring_secondS=0; } @@ -3396,7 +3402,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} if (MDDiaLOverridEform.length > 0) { - basic_originate_call(session_id,'NO','YES',MDDiaLOverridEform,'YES'); + basic_originate_call(session_id,'NO','YES',MDDiaLOverridEform,'YES','','1'); } else { @@ -5617,13 +5623,13 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} { document.vicidial_form.conf_dtmf.value = CalL_XC_a_Dtmf; document.vicidial_form.xfernumber.value = CalL_XC_a_NuMber; - basic_originate_call(CalL_XC_a_NuMber,'NO','YES',session_id,'YES'); + basic_originate_call(CalL_XC_a_NuMber,'NO','YES',session_id,'YES','','1'); } function DtMf_PreSet_b_DiaL() { document.vicidial_form.conf_dtmf.value = CalL_XC_b_Dtmf; document.vicidial_form.xfernumber.value = CalL_XC_b_NuMber; - basic_originate_call(CalL_XC_b_NuMber,'NO','YES',session_id,'YES'); + basic_originate_call(CalL_XC_b_NuMber,'NO','YES',session_id,'YES','','1'); } // ################################################################################ diff --git a/LANG_www/vicidial_it/AST_CLOSERstats.php b/LANG_www/vicidial_it/AST_CLOSERstats.php index e7ccb250..fecaa02b 100644 --- a/LANG_www/vicidial_it/AST_CLOSERstats.php +++ b/LANG_www/vicidial_it/AST_CLOSERstats.php @@ -15,6 +15,7 @@ # 80709-0331 - Added time stats to call statuses # 80722-2149 - Added Status Category stats # 81015-0705 - Added IVR calls count +# 81024-0037 - Added multi-select inbound-groups # require("dbconnect.php"); @@ -26,14 +27,16 @@ if (isset($_GET["group"])) {$group=$_GET["group"];} elseif (isset($_POST["group"])) {$group=$_POST["group"];} if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} -if (isset($_GET["end_date"])) {$end_date=$_GET["end_date"];} - elseif (isset($_POST["end_date"])) {$end_date=$_POST["end_date"];} +if (isset($_GET["end_date"])) {$end_date=$_GET["end_date"];} + elseif (isset($_POST["end_date"])) {$end_date=$_POST["end_date"];} if (isset($_GET["shift"])) {$shift=$_GET["shift"];} elseif (isset($_POST["shift"])) {$shift=$_POST["shift"];} if (isset($_GET["submit"])) {$submit=$_GET["submit"];} - elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} if (isset($_GET["INVIA"])) {$INVIA=$_GET["INVIA"];} - elseif (isset($_POST["INVIA"])) {$INVIA=$_POST["INVIA"];} + elseif (isset($_POST["INVIA"])) {$INVIA=$_POST["INVIA"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} $PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); @@ -84,13 +87,37 @@ $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $groups_to_print = mysql_num_rows($rslt); $i=0; + $LISTgroups[$i]='---NONE---'; + $i++; + $groups_to_print++; while ($i < $groups_to_print) { $row=mysql_fetch_row($rslt); - $groups[$i] =$row[0]; + $LISTgroups[$i] =$row[0]; $i++; } +$i=0; +$group_string='|'; +$group_ct = count($group); +while($i < $group_ct) + { + $group_string .= "$group[$i]|"; + $group_SQL .= "'$group[$i]',"; + $i++; + } +if ( (ereg("--NONE--",$group_string) ) or ($group_ct < 1) ) + { + $group_SQL = "''"; +# $group_SQL = "group_id IN('')"; + } +else + { + $group_SQL = eregi_replace(",$",'',$group_SQL); +# $group_SQL = "group_id IN($group_SQL)"; + } + + $stmt="select vsc_id,vsc_name from vicidial_status_categories;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} @@ -120,33 +147,65 @@ while ($i < $statcats_to_print) \n"; echo "VICIDIAL: Estadísticas de VDAD Closer\n"; +if ($DB > 0) + { + echo "
\n"; + echo "$group_ct|$group_string|$group_SQL\n"; + echo "
\n"; + echo "$shift|$query_date|$end_date\n"; + echo "
\n"; + } + echo "
\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "Date Range:
\n"; echo "\n"; echo " to \n"; -echo "
\n"; +echo "Gruppi Inbound: \n"; +echo "\n"; +echo "\n"; -echo "\n"; +echo "           MODIFICA | REPORT \n"; + +echo "
\n"; + +#echo "\n"; +echo "Shift: \n"; -echo "\n"; -echo "           MODIFICA | REPORT \n"; +echo "   \n"; +echo "
\n"; echo "
\n\n"; echo "
\n\n";
 
 
-if (!$group)
+if ($groups_to_print < 1)
 {
 echo "\n\n";
 echo "PER FAVORE SELEZIONA UN GRUPPO INBOUND E UN INTERVALLO DI TEMPO, POI PREMI INVIA\n";
@@ -178,18 +237,71 @@ $query_date_END = "$end_date $time_END";
 
 
 
-echo "VICIDIAL: Estadísticas de Auto-dial en CLOSER                      $NOW_TIME\n";
+echo "VICIDIAL: Estadísticas de Auto-dial en CLOSER: $group_string          $NOW_TIME\n";
+
+
+
+
+
+
+if ($group_ct > 1)
+	{
+	echo "\n";
+	echo "---------- MULTI-GROUP BREAKDOWN:\n";
+	echo "+----------------------+---------+---------+---------+---------+\n";
+	echo "| IN-GROUP             | CALLS   | DROPS   | DROP %  | IVR     |\n";
+	echo "+----------------------+---------+---------+---------+---------+\n";
+
+	$i=0;
+	while($i < $group_ct)
+		{
+		$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]';";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$row=mysql_fetch_row($rslt);
+
+		$stmt="select count(*) from live_inbound_log where start_time >= '$query_date_BEGIN' and start_time <= '$query_date_END' and comment_a='$group[$i]' and comment_b='START';";
+		$rslt=mysql_query($stmt, $link);
+		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);";
+		$rslt=mysql_query($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$rowy=mysql_fetch_row($rslt);
+
+		$groupDISPLAY =	sprintf("%20s", $group[$i]);
+		$gTOTALcalls =	sprintf("%7s", $row[0]);
+		$gIVRcalls =	sprintf("%7s", $rowx[0]);
+		$gDROPcalls =	sprintf("%7s", $rowy[0]);
+		if ( ($gDROPcalls < 1) or ($gTOTALcalls < 1) )
+			{$gDROPpercent = '0';}
+		else
+			{
+			$gDROPpercent = (($gDROPcalls / $gTOTALcalls) * 100);
+			$gDROPpercent = round($gDROPpercent, 2);
+			}
+		$gDROPpercent =	sprintf("%6s", $gDROPpercent);
+
+		echo "| $groupDISPLAY | $gTOTALcalls | $gDROPcalls | $gDROPpercent% | $gIVRcalls |\n";
+		$i++;
+		}
+
+	echo "+----------------------+---------+---------+---------+---------+\n";
+
+	}
+
 
 echo "\n";
 echo "Intervallo Di Tempo: $query_date_BEGIN to $query_date_END\n\n";
 echo "---------- TOTALI\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='" . mysql_real_escape_string($group) . "';";
+$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);";
 $rslt=mysql_query($stmt, $link);
 if ($DB) {echo "$stmt\n";}
 $row=mysql_fetch_row($rslt);
 
-$stmt="select count(*) from live_inbound_log where start_time >= '$query_date_BEGIN' and start_time <= '$query_date_END' and comment_a='" . mysql_real_escape_string($group) . "' and comment_b='START';";
+$stmt="select count(*) from live_inbound_log where start_time >= '$query_date_BEGIN' and start_time <= '$query_date_END' and comment_a IN($group_SQL) and comment_b='START';";
 $rslt=mysql_query($stmt, $link);
 if ($DB) {echo "$stmt\n";}
 $rowx=mysql_fetch_row($rslt);
@@ -213,7 +325,7 @@ 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='" . mysql_real_escape_string($group) . "' and status='DROP' and (length_in_sec <= 999 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 <= 9999 or length_in_sec is null);";
 $rslt=mysql_query($stmt, $link);
 if ($DB) {echo "$stmt\n";}
 $row=mysql_fetch_row($rslt);
@@ -284,7 +396,7 @@ while ($p < $statuses_to_print)
 echo "\n";
 echo "---------- QUEUE STATS\n";
 
-$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='" . mysql_real_escape_string($group) . "' and (queue_seconds > 0);";
+$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 (queue_seconds > 0);";
 $rslt=mysql_query($stmt, $link);
 if ($DB) {echo "$stmt\n";}
 $row=mysql_fetch_row($rslt);
@@ -333,7 +445,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='" . mysql_real_escape_string($group) . "' 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) group by queue_seconds;";
 $rslt=mysql_query($stmt, $link);
 if ($DB) {echo "$stmt\n";}
 $reasons_to_print = mysql_num_rows($rslt);
@@ -396,7 +508,7 @@ echo "+----------------------+------------+\n";
 echo "| HANGUP REASON        | CALLS      |\n";
 echo "+----------------------+------------+\n";
 
-$stmt="select count(*),term_reason from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id='" . mysql_real_escape_string($group) . "' group by term_reason;";
+$stmt="select count(*),term_reason from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id IN($group_SQL) group by term_reason;";
 $rslt=mysql_query($stmt, $link);
 if ($DB) {echo "$stmt\n";}
 $reasons_to_print = mysql_num_rows($rslt);
@@ -438,7 +550,7 @@ echo "+--------+----------------------+----------------------+------------+-----
 
 
 ## get counts and time totals for all statuses in this campaign
-$stmt="select count(*),status,sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id='" . mysql_real_escape_string($group) . "' group by status;";
+$stmt="select count(*),status,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) group by status;";
 $rslt=mysql_query($stmt, $link);
 if ($DB) {echo "$stmt\n";}
 $statuses_to_print = mysql_num_rows($rslt);
@@ -460,8 +572,11 @@ while ($i < $statuses_to_print)
 		}
 
 	$TOTALcalls =	($TOTALcalls + $row[0]);
-	$STATUSrate =	($STATUScount / ($TOTALsec / 3600) );
-		$STATUSrate =	sprintf("%.2f", $STATUSrate);
+	if ( ($STATUScount < 1) or ($TOTALsec < 1) )
+		{$STATUSrate = 0;}
+	else
+		{$STATUSrate =	($STATUScount / ($TOTALsec / 3600) );}
+	$STATUSrate =	sprintf("%.2f", $STATUSrate);
 
 	$STATUShours_H =	($row[2] / 3600);
 	$STATUShours_H_int = round($STATUShours_H, 2);
@@ -526,8 +641,11 @@ if ($TOTALcalls < 1)
 	}
 else
 	{
-	$TOTALrate =	($TOTALcalls / ($TOTALsec / 3600) );
-		$TOTALrate =	sprintf("%.2f", $TOTALrate);
+	if ( ($TOTALcalls < 1) or ($TOTALsec < 1) )
+		{$TOTALrate = 0;}
+	else
+		{$TOTALrate =	($TOTALcalls / ($TOTALsec / 3600) );}
+	$TOTALrate =	sprintf("%.2f", $TOTALrate);
 
 	$TOTALhours_H =	($TOTALsec / 3600);
 	$TOTALhours_H_int = round($TOTALhours_H, 2);
@@ -614,7 +732,7 @@ echo "+--------------------------+------------+----------+--------+\n";
 echo "| AGENT                    | CALLS      | TEMPO M   | MEDIA M |\n";
 echo "+--------------------------+------------+----------+--------+\n";
 
-$stmt="select vicidial_closer_log.user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from vicidial_closer_log,vicidial_users where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id='" . mysql_real_escape_string($group) . "' and vicidial_closer_log.user is not null and length_in_sec is not null and length_in_sec > 0 and vicidial_closer_log.user=vicidial_users.user group by vicidial_closer_log.user;";
+$stmt="select vicidial_closer_log.user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from vicidial_closer_log,vicidial_users where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id IN($group_SQL) and vicidial_closer_log.user is not null and length_in_sec is not null and length_in_sec > 0 and vicidial_closer_log.user=vicidial_users.user group by vicidial_closer_log.user;";
 $rslt=mysql_query($stmt, $link);
 if ($DB) {echo "$stmt\n";}
 $users_to_print = mysql_num_rows($rslt);
@@ -704,14 +822,14 @@ $i=0;
 $h=0;
 while ($i <= 96)
 	{
-	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id IN($group_SQL);";
 	$rslt=mysql_query($stmt, $link);
 	if ($DB) {echo "$stmt\n";}
 	$row=mysql_fetch_row($rslt);
 	$hour_count[$i] = $row[0];
 	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
 	if ($hour_count[$i] > 0) {$last_full_record = $i;}
-	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id IN($group_SQL) and status IN('DROP','XDROP');";
 	$rslt=mysql_query($stmt, $link);
 	if ($DB) {echo "$stmt\n";}
 	$row=mysql_fetch_row($rslt);
@@ -719,42 +837,42 @@ while ($i <= 96)
 	$i++;
 
 
-	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='$group';";
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id IN($group_SQL);";
 	$rslt=mysql_query($stmt, $link);
 	if ($DB) {echo "$stmt\n";}
 	$row=mysql_fetch_row($rslt);
 	$hour_count[$i] = $row[0];
 	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
 	if ($hour_count[$i] > 0) {$last_full_record = $i;}
-	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id IN($group_SQL) and status IN('DROP','XDROP');";
 	$rslt=mysql_query($stmt, $link);
 	if ($DB) {echo "$stmt\n";}
 	$row=mysql_fetch_row($rslt);
 	$drop_count[$i] = $row[0];
 	$i++;
 
-	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id IN($group_SQL);";
 	$rslt=mysql_query($stmt, $link);
 	if ($DB) {echo "$stmt\n";}
 	$row=mysql_fetch_row($rslt);
 	$hour_count[$i] = $row[0];
 	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
 	if ($hour_count[$i] > 0) {$last_full_record = $i;}
-	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id IN($group_SQL) and status IN('DROP','XDROP');";
 	$rslt=mysql_query($stmt, $link);
 	if ($DB) {echo "$stmt\n";}
 	$row=mysql_fetch_row($rslt);
 	$drop_count[$i] = $row[0];
 	$i++;
 
-	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id IN($group_SQL);";
 	$rslt=mysql_query($stmt, $link);
 	if ($DB) {echo "$stmt\n";}
 	$row=mysql_fetch_row($rslt);
 	$hour_count[$i] = $row[0];
 	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
 	if ($hour_count[$i] > 0) {$last_full_record = $i;}
-	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id IN($group_SQL) and status IN('DROP','XDROP');";
 	$rslt=mysql_query($stmt, $link);
 	if ($DB) {echo "$stmt\n";}
 	$row=mysql_fetch_row($rslt);
@@ -904,4 +1022,4 @@ echo "\nRun Time: $RUNtime seconds\n";
 ?>
 
- \ No newline at end of file + diff --git a/LANG_www/vicidial_it/admin_search_lead.php b/LANG_www/vicidial_it/admin_search_lead.php index 966026ec..7f08c8c1 100644 --- a/LANG_www/vicidial_it/admin_search_lead.php +++ b/LANG_www/vicidial_it/admin_search_lead.php @@ -224,7 +224,7 @@ else {$bgcolor='bgcolor="#9BB9FB"';} echo "\n"; echo "$o\n"; - echo "$row[0]\n"; + echo "$row[0]\n"; echo "$row[3]\n"; echo "$row[5]\n"; echo "$row[4]\n"; diff --git a/bin/AST_VDremote_agents.pl b/bin/AST_VDremote_agents.pl index 20a83cd0..f613adfa 100644 --- a/bin/AST_VDremote_agents.pl +++ b/bin/AST_VDremote_agents.pl @@ -36,6 +36,7 @@ # 70417-1346 - Fixed bug that would add unneeded simulated agent lines # 80128-0105 - Fixed calls_today bug # 81007-1746 - Added debugX output for count statements and changed to if from while +# 81026-1246 - Added better logging of calls and fixed the DROP bug # ### begin parsing run-time options ### @@ -257,11 +258,54 @@ while($one_day_interval > 0) $calls_today++; $sthA->finish(); - $stmtA = "UPDATE vicidial_live_agents set status='INCALL', last_call_time='$SQLdate',comments='REMOTE',calls_today='$calls_today' where server_ip='$server_ip' and status IN('QUEUE') and extension LIKE \"R/%\";"; - $affected_rows = $dbhA->do($stmtA); + @QHlive_agent_id=@MT; + @QHlead_id=@MT; + @QHuniqueid=@MT; + @QHuser=@MT; + @QHcall_type=@MT; + ##### grab number of calls today in this campaign and increment + $stmtA = "SELECT vla.live_agent_id,vla.lead_id,vla.uniqueid,vla.user,vac.call_type FROM vicidial_live_agents vla,vicidial_auto_calls vac where vla.server_ip='$server_ip' and vla.status IN('QUEUE') and vla.extension LIKE \"R/%\" and vla.uniqueid=vac.uniqueid and vla.channel=vac.channel;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $vla_qh_ct=$sthA->rows; + $w=0; + while ($vla_qh_ct > $w) + { + @aryA = $sthA->fetchrow_array; + $QHlive_agent_id[$w] = "$aryA[0]"; + $QHlead_id[$w] = "$aryA[1]"; + $QHuniqueid[$w] = "$aryA[2]"; + $QHuser[$w] = "$aryA[3]"; + $QHcall_type[$w] = "$aryA[4]"; + $w++; + } + $sthA->finish(); - $event_string = "| QUEUEd call listing vla UPDATEd $affected_rows"; - &event_logger; + $w=0; + while ($vla_qh_ct > $w) + { + $stmtA = "UPDATE vicidial_live_agents set status='INCALL', last_call_time='$SQLdate',comments='REMOTE',calls_today='$calls_today' 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]';"; + $Baffected_rows = $dbhA->do($stmtB); + + if ($QHcall_type[$w] =~ /IN/) + { + $stmtC = "UPDATE vicidial_closer_log set status='XFER',user='$QHuser[$w]',comments='REMOTE' where lead_id='$QHlead_id[$w]' order by call_date desc limit 1;"; + $Caffected_rows = $dbhA->do($stmtC); + } + else + { + $stmtC = "UPDATE vicidial_log set status='XFER',user='$QHuser[$w]',comments='REMOTE' where uniqueid='$QHuniqueid[$w]';"; + $Caffected_rows = $dbhA->do($stmtC); + } + + $event_string = "| QUEUEd listing UPDATEd |$Aaffected_rows|$Baffected_rows|$Caffected_rows| |$QHlive_agent_id[$w]|$QHlead_id[$w]|$QHuniqueid[$w]|$QHuser[$w]|$QHcall_type[$w]|"; + &event_logger; + + $w++; + } #@psoutput = `/bin/ps -f --no-headers -A`; @psoutput = `/bin/ps -o "%p %a" --no-headers -A`; diff --git a/bin/FastAGI_log.pl b/bin/FastAGI_log.pl index 40955733..5fbd4333 100644 --- a/bin/FastAGI_log.pl +++ b/bin/FastAGI_log.pl @@ -42,6 +42,7 @@ # 80830-0035 - Added auto alt dialing for EXTERNAL leads for each lead # 80909-0843 - Added support for campaign-speccific DNC lists # 81021-0306 - Added Local channel logging support and while-to-if changes +# 81026-1247 - Changed to allow for better remote agent calling # @@ -742,7 +743,7 @@ sub process_request { if ($calleridname !~ /^Y\d\d\d\d/) { ########## FIND AND UPDATE vicidial_log ########## - $stmtA = "SELECT start_epoch,status,user,term_reason FROM vicidial_log FORCE INDEX(lead_id) where lead_id = '$VD_lead_id' and uniqueid LIKE \"$Euniqueid%\" limit 1;"; + $stmtA = "SELECT start_epoch,status,user,term_reason,comments FROM vicidial_log FORCE INDEX(lead_id) where lead_id = '$VD_lead_id' and uniqueid LIKE \"$Euniqueid%\" limit 1;"; if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; @@ -754,6 +755,7 @@ sub process_request { $VD_status = "$aryA[1]"; $VD_user = "$aryA[2]"; $VD_term_reason = "$aryA[3]"; + $VD_comments = "$aryA[4]"; $epc_countCUSTDATA++; } $sthA->finish(); @@ -775,7 +777,7 @@ sub process_request { if ($Rsec < 10) {$Rsec = "0$Rsec";} $RSQLdate = "$Ryear-$Rmon-$Rmday $Rhour:$Rmin:$Rsec"; - $stmtA = "SELECT start_epoch,status,closecallid,user,term_reason,length_in_sec,queue_seconds FROM vicidial_closer_log where lead_id = '$VD_lead_id' and call_date > \"$RSQLdate\" order by call_date desc limit 1;"; + $stmtA = "SELECT start_epoch,status,closecallid,user,term_reason,length_in_sec,queue_seconds,comments FROM vicidial_closer_log where lead_id = '$VD_lead_id' and call_date > \"$RSQLdate\" order by call_date desc limit 1;"; if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; @@ -792,6 +794,7 @@ sub process_request { $VD_term_reason = "$aryA[4]"; $VD_length_in_sec = "$aryA[5]"; $VD_queue_seconds = "$aryA[6]"; + $VD_comments = "$aryA[7]"; $epc_countCUSTDATA++; } $sthA->finish(); @@ -805,7 +808,7 @@ sub process_request { $VD_seconds = ($now_date_epoch - $VD_start_epoch); $SQL_status=''; - if ($VD_status =~ /^NA$|^NEW$|^QUEUE$|^XFER$/) + if ( ($VD_status =~ /^NA$|^NEW$|^QUEUE$|^XFER$/) && ($VD_comments !~ /REMOTE/) ) { if ( ($VD_term_reason !~ /AGENT|CALLER|QUEUETIMEOUT/) && ( ($VD_user =~ /VDAD|VDCL/) || (length($VD_user) < 1) ) ) {$VDLSQL_term_reason = "term_reason='ABANDON',";} @@ -847,7 +850,7 @@ sub process_request { } else { - if ($VD_status =~ /^DONE$|^INCALL$|^XFER$/) + if ($VD_status =~ /^DONE$|^INCALL$|^XFER$/) {$VDCLSQL_update = "term_reason='CALLER',";} else { diff --git a/www/vicidial/admin_search_lead.php b/www/vicidial/admin_search_lead.php index b1b6dc91..3acb463c 100644 --- a/www/vicidial/admin_search_lead.php +++ b/www/vicidial/admin_search_lead.php @@ -224,7 +224,7 @@ else {$bgcolor='bgcolor="#9BB9FB"';} echo "\n"; echo "$o\n"; - echo "$row[0]\n"; + echo "$row[0]\n"; echo "$row[3]\n"; echo "$row[5]\n"; echo "$row[4]\n";