Added QueueMetrics Socket-send function for custom queue_log record sending

git-svn-id: svn://192.168.202.10@1879 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2012-11-21 02:19:31 +00:00
parent c5152a8ea9
commit ba316d527a
13 changed files with 379 additions and 32 deletions
+20 -3
View File
@@ -111,10 +111,11 @@
# 110626-2320 - Added qm_extension
# 120810-0030 - Added external_recording
# 120831-1458 - Added vicidial_dial_log outbound call logging
# 121120-0848 - Added QM socket-send functionality
#
$version = '2.6-58';
$build = '120831-1458';
$version = '2.6-59';
$build = '121120-0848';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=119;
$one_mysql_log=0;
@@ -646,7 +647,7 @@ if ($ACTION=="Hangup")
{
#############################################
##### START QUEUEMETRICS LOGGING LOOKUP #####
$stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_pe_phone_append FROM system_settings;";
$stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_pe_phone_append,queuemetrics_socket,queuemetrics_socket_url FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02014',$user,$server_ip,$session_name,$one_mysql_log);}
if ($format=='debug') {echo "\n<!-- $rowx[0]|$stmt -->";}
@@ -662,6 +663,8 @@ if ($ACTION=="Hangup")
$queuemetrics_pass = $row[4];
$queuemetrics_log_id = $row[5];
$queuemetrics_pe_phone_append = $row[6];
$queuemetrics_socket = $row[7];
$queuemetrics_socket_url = $row[8];
$i++;
}
##### END QUEUEMETRICS LOGGING LOOKUP #####
@@ -737,6 +740,7 @@ if ($ACTION=="Hangup")
{$secondS = ($StarTtime - $time_id);}
$data4SQL='';
$data4SS='';
$stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$log_campaign' and queuemetrics_phone_environment!='';";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02116',$user,$server_ip,$session_name,$one_mysql_log);}
@@ -749,6 +753,7 @@ if ($ACTION=="Hangup")
if ( ($queuemetrics_pe_phone_append > 0) and (strlen($row[0])>0) )
{$pe_append = "-$qm_extension";}
$data4SQL = ",data4='$row[0]$pe_append'";
$data4SS = "&data4=$row[0]$pe_append";
}
if ($format=='debug') {echo "\n<!-- $caller_complete|$stmt -->";}
@@ -757,6 +762,18 @@ if ($ACTION=="Hangup")
if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02019',$user,$server_ip,$session_name,$one_mysql_log);}
$affected_rows = mysql_affected_rows($linkB);
if ($format=='debug') {echo "\n<!-- $affected_rows|$stmt -->";}
if ( ($queuemetrics_socket == 'CONNECT_COMPLETE') and (strlen($queuemetrics_socket_url) > 10) )
{
$socket_send_data_begin='?';
$socket_send_data = "time_id=$StarTtime&call_id=$CalLCID&queue=$CLcampaign_id&agent=Agent/$user&verb=COMPLETEAGENT&data1=$CLstage&data2=$secondS&data3=$CLqueue_position$data4SS";
if (preg_match("/\?/",$queuemetrics_socket_url))
{$socket_send_data_begin='&';}
### send queue_log data to the queuemetrics_socket_url ###
if ($DB > 0) {echo "$queuemetrics_socket_url$socket_send_data_begin$socket_send_data<BR>\n";}
$SCUfile = file("$queuemetrics_socket_url$socket_send_data_begin$socket_send_data");
if ($DB > 0) {echo "$SCUfile[0]<BR>\n";}
}
}
}
}