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 124e718863
commit 57bdd4e2d8
13 changed files with 379 additions and 32 deletions
+21 -5
View File
@@ -1,18 +1,20 @@
#!/usr/bin/perl
#
# AST_send_URL.pl version 2.4
# AST_send_URL.pl version 2.6
#
# DESCRIPTION:
# This script is spawned for remote agents when the Start Call URL is set in the
# campaign or in-group that the call came from when sent to the remote agent.
# This script is also used for the Add-Lead-URL feature in In-groups.
# This script is also used for the Add-Lead-URL feature in In-groups and for
# QM socket-send.
#
# Copyright (C) 2011 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2012 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGES
# 100622-0929 - First Build
# 100929-0918 - Added function variable and new Add Lead URL function
# 110731-0127 - Added call_id variable and logging
# 121120-0925 - Added QM socket-send functionality
#
$|++;
@@ -53,7 +55,8 @@ if (scalar @ARGV) {
'function=s' => \$function,
'debug!' => \$DB,
'debugX!' => \$DBX,
'fulllog!' => \$FULL_LOG);
'fulllog!' => \$FULL_LOG,
'compat_url=s' => \$compat_url);
$DB = 1 if ($DBX);
if ($DB)
@@ -70,6 +73,7 @@ if (scalar @ARGV) {
print " alt_dial: $alt_dial\n" if ($alt_dial);
print " call_id: $call_id\n" if ($call_id);
print " function: $function\n" if ($function);
print " compat_url: $compat_url\n" if ($compat_url);
print "\n";
}
if ($CLOhelp)
@@ -86,9 +90,11 @@ if (scalar @ARGV) {
print " [--uniqueid] = uniqueid of the call\n";
print " [--alt_dial] = label of the phone number dialed\n";
print " [--call_id] = call_id or caller_code of the call\n";
print " [--compat_url] = full compatible URL to send\n";
print " [--function] = which function is to be run, default is REMOTE_AGENT_START_CALL_URL\n";
print " *REMOTE_AGENT_START_CALL_URL - performs a Start Call URL get for Remote Agent Calls\n";
print " *INGROUP_ADD_LEAD_URL - performs an Add Lead URL get for In-Groups when a lead is added\n";
print " *QM_SOCKET_SEND - performs a queue_log socket send url function\n";
print "\n";
print "You may prefix an option with 'no' to disable it.\n";
print " ie. --noSYSLOG or --noFULLLOG\n";
@@ -205,7 +211,17 @@ if (length($lead_id) > 0)
$VAR_did_description = '';
$VAR_closecallid = '';
if ($function =~ /INGROUP_ADD_LEAD_URL/)
if ($function =~ /QM_SOCKET_SEND/)
{
##### BEGIN QM socket-send URL function #####
$compat_url =~ s/ /+/gi;
$compat_url =~ s/&/\\&/gi;
$parse_url = $compat_url;
$url_function = 'qm_socket';
##### END QM socket-send URL function #####
}
elsif ($function =~ /INGROUP_ADD_LEAD_URL/)
{
##### BEGIN Add Lead URL function #####
$stmtA = "SELECT list_id,phone_code,vendor_lead_code FROM vicidial_list where lead_id='$lead_id';";
+35 -3
View File
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# FastAGI_log.pl version 2.4
# FastAGI_log.pl version 2.6
#
# Experimental Deamon using perl Net::Server that runs as FastAGI to reduce load
# replaces the following AGI scripts:
@@ -25,7 +25,7 @@
# exten => h,1,DeadAGI(agi://127.0.0.1:4577/call_log--HVcauses--PRI-----NODEBUG-----${HANGUPCAUSE}-----${DIALSTATUS}-----${DIALEDTIME}-----${ANSWEREDTIME})
#
#
# Copyright (C) 2011 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2012 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGELOG:
# 61010-1007 - First test build
@@ -61,6 +61,7 @@
# 110224-1854 - Added compatibility with QM phone environment logging
# 110304-0005 - Small changes for CPD and on-hook agent features
# 110324-2336 - Changes to CPD logging of calls and addition of the PDROP status
# 121120-0922 - Added QM socket-send functionality
#
# defaults for PreFork
@@ -1003,7 +1004,7 @@ sub process_request
#############################################
##### START QUEUEMETRICS LOGGING LOOKUP #####
$stmtA = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;";
$stmtA = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_socket,queuemetrics_socket_url FROM system_settings;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
@@ -1016,6 +1017,8 @@ sub process_request
$queuemetrics_login= $aryA[3];
$queuemetrics_pass = $aryA[4];
$queuemetrics_log_id = $aryA[5];
$queuemetrics_socket = $aryA[6];
$queuemetrics_socket_url = $aryA[7];
}
$sthA->finish();
##### END QUEUEMETRICS LOGGING LOOKUP #####
@@ -1097,6 +1100,35 @@ sub process_request
{
$stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='$VD_callerid',queue='$VD_campaign_id',agent='$VD_agent',verb='COMPLETECALLER',data1='$VD_stage',data2='$VD_call_length',data3='$queue_position',serverid='$queuemetrics_log_id',data4='$data_four';";
$Baffected_rows = $dbhB->do($stmtB);
if ( ($queuemetrics_socket =~ /CONNECT_COMPLETE/) and (length($queuemetrics_socket_url) > 10) )
{
$socket_send_data_begin='?';
$socket_send_data = "time_id=$secX&call_id=$VD_callerid&queue=$VD_campaign_id&agent=$VD_agent&verb=COMPLETECALLER&data1=$VD_stage&data2=$VD_call_length&data3=$queue_position&data4=$data_four";
if ($queuemetrics_socket_url =~ /\?/)
{$socket_send_data_begin='&';}
### send queue_log data to the queuemetrics_socket_url ###
$compat_url = "$queuemetrics_socket_url$socket_send_data_begin$socket_send_data";
$compat_url =~ s/ /+/gi;
$compat_url =~ s/&/\\&/gi;
$launch = $PATHhome . "/AST_send_URL.pl";
$launch .= " --SYSLOG" if ($SYSLOG);
$launch .= " --lead_id=" . $VD_lead_id;
$launch .= " --phone_number=" . $VD_phone_number;
$launch .= " --user=" . $VD_agent;
$launch .= " --call_type=X";
$launch .= " --campaign=" . $VD_campaign_id;
$launch .= " --uniqueid=" . $uniqueid;
$launch .= " --call_id=" . $VD_callerid;
$launch .= " --alt_dial=UNKNOWN";
$launch .= " --function=QM_SOCKET_SEND";
$launch .= " --compat_url=" . $compat_url;
system($launch . ' &');
if ($AGILOG) {$agi_string = "$launch|"; &agi_output;}
}
}
if ($AGILOG) {$agi_string = "|$stmtB|"; &agi_output;}