diff --git a/www/agc/manager_send.php b/www/agc/manager_send.php index 590bd8d5..4f66771e 100644 --- a/www/agc/manager_send.php +++ b/www/agc/manager_send.php @@ -76,6 +76,7 @@ # 80707-2325 - Added vicidial_id to recording_log for tracking of vicidial or closer log to recording # 80915-1755 - Rewrote leave-3way functions for external calling # 81011-1404 - Fixed bugs in leave3way when transferring a manual dial call +# 81020-1459 - Fixed bugs in queue_log logging # require("dbconnect.php"); @@ -184,8 +185,8 @@ if (!isset($ACTION)) {$ACTION="Originate";} if (!isset($format)) {$format="alert";} if (!isset($ext_priority)) {$ext_priority="1";} -$version = '2.0.5-33'; -$build = '81011-1404'; +$version = '2.0.5-34'; +$build = '81020-1459'; $StarTtime = date("U"); $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); @@ -417,12 +418,12 @@ $rslt=mysql_query($stmt, $link); $row=''; $rowx=''; $channel_live=1; if ( (strlen($channel)<3) or (strlen($queryCID)<15) ) - { + { $channel_live=0; echo "Channel $channel is not valid or queryCID $queryCID is not valid, Hangup command not inserted\n"; - } + } else - { + { if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} # $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; @@ -441,39 +442,143 @@ $rslt=mysql_query($stmt, $link); # echo "Channel $channel is not live on $call_server_ip, Hangup command not inserted\n"; # } # } - if ( ($auto_dial_level > 0) and (strlen($CalLCID)>2) and (strlen($exten)>2) and ($secondS > 4)) - { + if ( ($auto_dial_level > 0) and (strlen($CalLCID)>2) and (strlen($exten)>2) and ($secondS > 0)) + { $stmt="SELECT count(*) FROM vicidial_auto_calls where channel='$channel' and callerid='$CalLCID';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); $rowx=mysql_fetch_row($rslt); if ($rowx[0]==0) - { - echo "Call $CalLCID $channel is not live on $call_server_ip, Checking Live Channel...\n"; + { + echo "Call $CalLCID $channel is not live on $call_server_ip, Checking Live Channel...\n"; $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel' and extension LIKE \"%$exten\";"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); if ($row[0]==0) - { - $channel_live=0; - echo "Channel $channel is not live on $call_server_ip, Hangup command not inserted $rowx[0]\n$stmt\n"; - } + { + $channel_live=0; + echo "Channel $channel is not live on $call_server_ip, Hangup command not inserted $rowx[0]\n$stmt\n"; + } else - { - echo "$stmt\n"; + { + echo "$stmt\n"; + } } - } - } + } + if ($channel_live==1) - { - $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Hangup','$queryCID','Channel: $channel','','','','','','','','','');"; - if ($format=='debug') {echo "\n";} - $rslt=mysql_query($stmt, $link); - echo "Hangup command sent for Channel $channel on $call_server_ip\n"; + { + if ( (strlen($CalLCID)>15) and ($secondS > 0)) + { + $stmt="SELECT count(*) FROM vicidial_auto_calls where callerid='$CalLCID';"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($format=='debug') {echo "\n";} + if ($rowx[0] > 0) + { + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + if ($format=='debug') {echo "\n";} + $qm_conf_ct = mysql_num_rows($rslt); + $i=0; + while ($i < $qm_conf_ct) + { + $row=mysql_fetch_row($rslt); + $enable_queuemetrics_logging = $row[0]; + $queuemetrics_server_ip = $row[1]; + $queuemetrics_dbname = $row[2]; + $queuemetrics_login = $row[3]; + $queuemetrics_pass = $row[4]; + $queuemetrics_log_id = $row[5]; + $i++; + } + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); + mysql_select_db("$queuemetrics_dbname", $linkB); + + $stmt="SELECT count(*) from queue_log where call_id='$CalLCID' and verb='CONNECT';"; + $rslt=mysql_query($stmt, $linkB); + $VAC_cn_ct = mysql_num_rows($rslt); + if ($VAC_cn_ct > 0) + { + $row=mysql_fetch_row($rslt); + $caller_connect = $row[0]; + } + if ($format=='debug') {echo "\n";} + if ($caller_connect > 0) + { + ### grab call lead information needed for QM logging + $stmt="SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,callerid,uniqueid from vicidial_auto_calls where callerid='$CalLCID' order by call_time limit 1;"; + $rslt=mysql_query($stmt, $link); + $VAC_qm_ct = mysql_num_rows($rslt); + if ($VAC_qm_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_call_id = $row[0]; + $CLlead_id = $row[1]; + $CLphone_number = $row[2]; + $CLstatus = $row[3]; + $CLcampaign_id = $row[4]; + $CLphone_code = $row[5]; + $CLalt_dial = $row[6]; + $CLstage = $row[7]; + $CLcallerid = $row[8]; + $CLuniqueid = $row[9]; + } + if ($format=='debug') {echo "\n";} + + $CLstage = preg_replace("/.*-/",'',$CLstage); + if (strlen($CLstage) < 1) {$CLstage=0;} + + $stmt="SELECT count(*) from queue_log where call_id='$CalLCID' and verb='COMPLETECALLER' and queue='$CLcampaign_id';"; + $rslt=mysql_query($stmt, $linkB); + $VAC_cc_ct = mysql_num_rows($rslt); + if ($VAC_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $caller_complete = $row[0]; + } + if ($format=='debug') {echo "\n";} + + if ($caller_complete < 1) + { + $time_id=0; + $stmt="SELECT time_id from queue_log where call_id='$CalLCID' and verb='ENTERQUEUE' and queue='$CLcampaign_id';"; + $rslt=mysql_query($stmt, $linkB); + $VAC_eq_ct = mysql_num_rows($rslt); + if ($VAC_eq_ct > 0) + { + $row=mysql_fetch_row($rslt); + $time_id = $row[0]; + } + $StarTtime = date("U"); + if ($time_id > 100000) + {$secondS = ($StarTtime - $time_id);} + + if ($format=='debug') {echo "\n";} + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$CLcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$secondS',data3='1',serverid='$queuemetrics_log_id';"; + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + if ($format=='debug') {echo "\n";} + } + } + } + } + } + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Hangup','$queryCID','Channel: $channel','','','','','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + echo "Hangup command sent for Channel $channel on $call_server_ip\n"; + } } - } } diff --git a/www/agc/vdc_db_query.php b/www/agc/vdc_db_query.php index d4d2e634..7ff74683 100644 --- a/www/agc/vdc_db_query.php +++ b/www/agc/vdc_db_query.php @@ -166,10 +166,11 @@ # 80909-1710 - Added support for campaign-specific DNC lists # 81010-1048 - Added support for hangup of all channels except for agent channel after attempting a 3way call # 81011-1404 - Fixed bugs in leave3way when transferring a manual dial call +# 81020-1459 - Fixed bugs in queue_log logging # -$version = '2.0.5-84'; -$build = '81011-1404'; +$version = '2.0.5-85'; +$build = '81020-1459'; require("dbconnect.php"); @@ -1665,7 +1666,7 @@ if ($stage == "end") if ($enable_queuemetrics_logging > 0) { ### grab call lead information needed for QM logging - $stmt="SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,callerid,uniqueid from vicidial_auto_calls where lead_id='$lead_id' order by call_time desc limit 1;"; + $stmt="SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,callerid,uniqueid from vicidial_auto_calls where lead_id='$lead_id' order by call_time limit 1;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $VAC_qm_ct = mysql_num_rows($rslt); @@ -1687,7 +1688,7 @@ if ($stage == "end") $CLstage = preg_replace("/.*-/",'',$CLstage); if (strlen($CLstage) < 1) {$CLstage=0;} - $stmt="SELECT count(*) from queue_log where call_id='$MDnextCID' and verb='COMPLETECALLER';"; + $stmt="SELECT count(*) from queue_log where call_id='$MDnextCID' and verb='COMPLETECALLER' and queue='$VDcampaign_id';"; $rslt=mysql_query($stmt, $linkB); if ($DB) {echo "$stmt\n";} $VAC_cc_ct = mysql_num_rows($rslt); @@ -1699,11 +1700,6 @@ if ($stage == "end") if ($caller_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); - $term_reason='AGENT'; } else @@ -2663,11 +2659,7 @@ if ($ACTION == 'updateDISPO') if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); - $stmt="UPDATE vicidial_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by uniqueid desc limit 1;"; - if ($format=='debug') {echo "\n";} - $rslt=mysql_query($stmt, $link); - - $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; + $stmt = "select count(*) from vicidial_inbound_groups where group_id='$stage';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); @@ -2677,6 +2669,12 @@ if ($ACTION == 'updateDISPO') if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); } + else + { + $stmt="UPDATE vicidial_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by uniqueid desc limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + } if ( ($use_internal_dnc=='Y') and ($dispo_choice=='DNC') ) { @@ -2790,7 +2788,10 @@ if ($ACTION == 'updateDISPO') $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); mysql_select_db("$queuemetrics_dbname", $linkB); - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$campaign',agent='Agent/$user',verb='CALLSTATUS',data1='$dispo_choice',serverid='$queuemetrics_log_id';"; + if (strlen($stage) < 2) + {$stage = $campaign;} + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$stage',agent='Agent/$user',verb='CALLSTATUS',data1='$dispo_choice',serverid='$queuemetrics_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); $affected_rows = mysql_affected_rows($linkB); diff --git a/www/agc/vicidial.php b/www/agc/vicidial.php index bb4cd8a2..868f22b7 100644 --- a/www/agc/vicidial.php +++ b/www/agc/vicidial.php @@ -198,10 +198,11 @@ # 81013-1644 - Fixed bug in leave 3way for manual dial fronters # 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 # -$version = '2.0.5-176'; -$build = '81016-0703'; +$version = '2.0.5-178'; +$build = '81020-1501'; require("dbconnect.php"); @@ -273,7 +274,7 @@ $random = (rand(1000000, 9999999) + 10000000); ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format FROM system_settings;"; +$stmt = "SELECT use_non_latin,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,webroot_writable FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); @@ -285,6 +286,8 @@ while ($i < $qm_conf_ct) $vdc_header_date_format = $row[1]; $vdc_customer_date_format = $row[2]; $vdc_header_phone_format = $row[3]; + $WeBRooTWritablE = $row[4]; + $i++; } ##### END SETTINGS LOOKUP ##### @@ -4864,6 +4867,10 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} // Send Hangup command for customer call connected to the conference now to Manager function dialedcall_send_hangup(dispowindow,hotkeysused,altdispo) { + if (VDCL_group_id.length > 1) + {var group = VDCL_group_id;} + else + {var group = campaign;} var form_cust_channel = document.vicidial_form.callchannel.value; var form_cust_serverip = document.vicidial_form.callserverip.value; var customer_channel = lastcustchannel; @@ -4904,7 +4911,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var queryCID = "HLvdcW" + epoch_sec + user_abb; var hangupvalue = customer_channel; // alert(auto_dial_level + "|" + CalLCID + "|" + customer_server_ip + "|" + hangupvalue + "|" + VD_live_call_secondS); - custhangup_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=Hangup&format=text&user=" + user + "&pass=" + pass + "&channel=" + hangupvalue + "&call_server_ip=" + customer_server_ip + "&queryCID=" + queryCID + "&auto_dial_level=" + auto_dial_level + "&CalLCID=" + CalLCID + "&secondS=" + VD_live_call_secondS + "&exten=" + session_id; + custhangup_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=Hangup&format=text&user=" + user + "&pass=" + pass + "&channel=" + hangupvalue + "&call_server_ip=" + customer_server_ip + "&queryCID=" + queryCID + "&auto_dial_level=" + auto_dial_level + "&CalLCID=" + CalLCID + "&secondS=" + VD_live_call_secondS + "&exten=" + session_id + "campaign" + group; xmlhttp.open('POST', 'manager_send.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp.send(custhangup_query); @@ -5389,6 +5396,10 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} // Update vicidial_list lead record with disposition selection function DispoSelect_submit() { + if (VDCL_group_id.length > 1) + {var group = VDCL_group_id;} + else + {var group = campaign;} leaving_threeway=0; document.vicidial_form.callchannel.value = ''; document.vicidial_form.callserverip.value = ''; @@ -5429,7 +5440,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} } if (xmlhttp) { - DSupdate_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=updateDISPO&format=text&user=" + user + "&pass=" + pass + "&dispo_choice=" + DispoChoice + "&lead_id=" + document.vicidial_form.lead_id.value + "&campaign=" + campaign + "&auto_dial_level=" + auto_dial_level + "&agent_log_id=" + agent_log_id + "&CallBackDatETimE=" + CallBackDatETimE + "&list_id=" + document.vicidial_form.list_id.value + "&recipient=" + CallBackrecipient + "&use_internal_dnc=" + use_internal_dnc + "&use_campaign_dnc=" + use_campaign_dnc + "&MDnextCID=" + LasTCID + "&comments=" + CallBackCommenTs; + DSupdate_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=updateDISPO&format=text&user=" + user + "&pass=" + pass + "&dispo_choice=" + DispoChoice + "&lead_id=" + document.vicidial_form.lead_id.value + "&campaign=" + campaign + "&auto_dial_level=" + auto_dial_level + "&agent_log_id=" + agent_log_id + "&CallBackDatETimE=" + CallBackDatETimE + "&list_id=" + document.vicidial_form.list_id.value + "&recipient=" + CallBackrecipient + "&use_internal_dnc=" + use_internal_dnc + "&use_campaign_dnc=" + use_campaign_dnc + "&MDnextCID=" + LasTCID + "&stage=" + group + "&comments=" + CallBackCommenTs; xmlhttp.open('POST', 'vdc_db_query.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp.send(DSupdate_query); diff --git a/www/vicidial/AST_VDADstats.php b/www/vicidial/AST_VDADstats.php index 10c08651..194c83d7 100644 --- a/www/vicidial/AST_VDADstats.php +++ b/www/vicidial/AST_VDADstats.php @@ -417,7 +417,7 @@ while ($i < $statuses_to_print) } $r++; } - + if ($AGENTsec < 1) {$AGENTsec=1;} $TOTALcalls = ($TOTALcalls + $row[0]); $STATUSrate = ($STATUScount / ($TOTALsec / 3600) ); $STATUSrate = sprintf("%.2f", $STATUSrate);