Added queue_log DID and IVR logging entries for QueueMetrics

git-svn-id: svn://192.168.202.10@1262 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2009-11-23 04:56:33 +00:00
parent 8eecb587e9
commit 5236ce5911
7 changed files with 213 additions and 102 deletions
+2
View File
@@ -272,6 +272,8 @@ NOTE: Upgrading from 1.1.12-3 to 2.0.1 is at the bottom
make sure you use the STEP 1 audio mixing script in your crontab with make sure you use the STEP 1 audio mixing script in your crontab with
the "--MIX" option so that these recordings are stored properly the "--MIX" option so that these recordings are stored properly
67. Added queue_log DID and IVR logging entries for QueueMetrics
+88 -47
View File
@@ -19,6 +19,7 @@
# 90214-0217 - Added 'default' did option, to send all non-matching calls to, enforced did_active setting # 90214-0217 - Added 'default' did option, to send all non-matching calls to, enforced did_active setting
# 90507-1145 - Added CALLMENU option # 90507-1145 - Added CALLMENU option
# 90825-2252 - Changed PHONE to route using dialplan number # 90825-2252 - Changed PHONE to route using dialplan number
# 91122-0743 - Added QueueMetrics logging as DID INFO entries
# #
$script = 'agi-DID_route.agi'; $script = 'agi-DID_route.agi';
@@ -103,40 +104,60 @@ $stmtA = "SELECT agi_output,local_gmt FROM servers where server_ip = '$VARserver
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows; $sthArows=$sthA->rows;
$rec_count=0; if ($sthArows > 0)
while ($sthArows > $rec_count)
{ {
$AGILOG = '0'; $AGILOG = '0';
@aryA = $sthA->fetchrow_array; @aryA = $sthA->fetchrow_array;
$DBagi_output = "$aryA[0]"; $DBagi_output = "$aryA[0]";
$local_gmt = "$aryA[1]"; $local_gmt = "$aryA[1]";
if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';} if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';}
if ($DBagi_output =~ /FILE/) {$AGILOG = '2';} if ($DBagi_output =~ /FILE/) {$AGILOG = '2';}
if ($DBagi_output =~ /BOTH/) {$AGILOG = '3';} if ($DBagi_output =~ /BOTH/) {$AGILOG = '3';}
$rec_count++;
} }
$sthA->finish(); $sthA->finish();
#############################################
##### START QUEUEMETRICS LOGGING LOOKUP #####
$stmtA = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_eq_prepend FROM system_settings;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$enable_queuemetrics_logging = $aryA[0];
$queuemetrics_server_ip = $aryA[1];
$queuemetrics_dbname = $aryA[2];
$queuemetrics_login= $aryA[3];
$queuemetrics_pass = $aryA[4];
$queuemetrics_log_id = $aryA[5];
$queuemetrics_eq_prepend = $aryA[6];
}
$sthA->finish();
##### END QUEUEMETRICS LOGGING LOOKUP #####
###########################################
$|=1; $|=1;
while(<STDIN>) while(<STDIN>)
{ {
chomp; chomp;
last unless length($_); last unless length($_);
if ($AGILOG) if ($AGILOG)
{
if (/^agi_(\w+)\:\s+(.*)$/)
{ {
if (/^agi_(\w+)\:\s+(.*)$/)
{
$AGI{$1} = $2; $AGI{$1} = $2;
}
} }
}
if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;} if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;}
if (/^agi_channel\:\s+(.*)$/) {$channel = $1;} if (/^agi_channel\:\s+(.*)$/) {$channel = $1;}
if (/^agi_extension\:\s+(.*)$/) {$extension = $1;} if (/^agi_extension\:\s+(.*)$/) {$extension = $1;}
if (/^agi_type\:\s+(.*)$/) {$type = $1;} if (/^agi_type\:\s+(.*)$/) {$type = $1;}
if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;} if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;}
if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;} if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;}
} }
if ( ($callerid =~ /\".*\"/) && ( (!$calleridname) or ($calleridname =~ /unknown/) ) ) if ( ($callerid =~ /\".*\"/) && ( (!$calleridname) or ($calleridname =~ /unknown/) ) )
@@ -146,8 +167,8 @@ if ( ($callerid =~ /\".*\"/) && ( (!$calleridname) or ($calleridname =~ /unknown
$calleridname =~ s/\"|\" //gi; $calleridname =~ s/\"|\" //gi;
} }
$callerid =~ s/\D//gi; $callerid =~ s/\D//gi;
$calleridname =~ s/unknown//gi; $calleridname =~ s/unknown//gi;
if ( (!$callerid) or ($callerid =~ /unknown/) ) if ( (!$callerid) or ($callerid =~ /unknown/) )
{$callerid = $calleridname;} {$callerid = $calleridname;}
@@ -315,6 +336,20 @@ if ($did_route =~ /AGENT/)
} }
### QueueMetrics logging if enabled
if ( ($did_route =~ /EXTEN|CALLMENU/) && ($enable_queuemetrics_logging > 0) )
{
$dbhB = DBI->connect("DBI:mysql:$queuemetrics_dbname:$queuemetrics_server_ip:3306", "$queuemetrics_login", "$queuemetrics_pass")
or die "Couldn't connect to database: " . DBI->errstr;
if ($DBX) {print "CONNECTED TO QueueMetrics DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";}
$stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='$uniqueid',queue='NONE',agent='NONE',verb='INFO',data1='DID',data2='$extension',serverid='$queuemetrics_log_id';";
$Baffected_rows = $dbhB->do($stmtB);
$dbhB->disconnect();
}
### Route call to an extension on the system ### Route call to an extension on the system
if ($did_route =~ /EXTEN/) if ($did_route =~ /EXTEN/)
{ {
@@ -354,60 +389,66 @@ if ($did_route =~ /CALLMENU/)
######### SUBROUTINES ################# ######### SUBROUTINES #################
sub checkresult sub checkresult
{ {
$pass=0; $fail=0; $pass=0; $fail=0;
my ($res) = @_; my ($res) = @_;
my $retval; my $retval;
$tests++; $tests++;
chomp $res; chomp $res;
if ($res =~ /^200/) { if ($res =~ /^200/)
{
$res =~ /result=(-?\d+)/; $res =~ /result=(-?\d+)/;
if (!length($1)) { if (!length($1))
{
# print STDERR "FAIL ($res)\n"; # print STDERR "FAIL ($res)\n";
$fail++; $fail++;
} else { }
else
{
# print STDERR "PASS ($1)\n"; # print STDERR "PASS ($1)\n";
$pass++; $pass++;
} }
} else { }
else
{
# print STDERR "FAIL (unexpected result '$res')\n"; # print STDERR "FAIL (unexpected result '$res')\n";
$fail++; $fail++;
}
} }
}
sub leading_zero($) sub leading_zero($)
{ {
$_ = $_[0]; $_ = $_[0];
s/^(\d)$/0$1/; s/^(\d)$/0$1/;
s/^(\d\d)$/0$1/; s/^(\d\d)$/0$1/;
return $_; return $_;
} # End of the leading_zero() routine. } # End of the leading_zero() routine.
sub agi_output sub agi_output
{
if ($AGILOG >=2)
{ {
### open the log file for writing ### if ($AGILOG >=2)
open(Lout, ">>$AGILOGfile") {
|| die "Can't open $AGILOGfile: $!\n"; ### open the log file for writing ###
print Lout "$now_date|$script|$agi_string\n"; open(Lout, ">>$AGILOGfile")
close(Lout); || die "Can't open $AGILOGfile: $!\n";
print Lout "$now_date|$script|$agi_string\n";
close(Lout);
}
### send to STDERR writing ###
if ( ($AGILOG == '1') || ($AGILOG == '3') )
{print STDERR "$now_date|$script|$agi_string\n";}
$agi_string='';
} }
### send to STDERR writing ###
if ( ($AGILOG == '1') || ($AGILOG == '3') )
{print STDERR "$now_date|$script|$agi_string\n";}
$agi_string='';
}
sub did_output sub did_output
{
if ($AGILOG >=2)
{ {
### open the log file for writing ### if ($AGILOG >=2)
open(Dout, ">>$DIDLOGfile") {
|| die "Can't open $DIDLOGfile: $!\n"; ### open the log file for writing ###
print Dout "$did_string\n"; open(Dout, ">>$DIDLOGfile")
close(Dout); || die "Can't open $DIDLOGfile: $!\n";
print Dout "$did_string\n";
close(Dout);
}
$did_string='';
} }
$did_string='';
}
+28 -19
View File
@@ -103,6 +103,7 @@
# 90808-0307 - Added longest_wait_time as agent routing option # 90808-0307 - Added longest_wait_time as agent routing option
# 91004-0959 - Fix for queue_log consultative transfers # 91004-0959 - Fix for queue_log consultative transfers
# 91105-1258 - Added CallerIDnumber change on Drop when sending call out # 91105-1258 - Added CallerIDnumber change on Drop when sending call out
# 91122-2352 - Added queue_log IVR and DID entry linking
# #
$script = 'agi-VDAD_ALL_inbound.agi'; $script = 'agi-VDAD_ALL_inbound.agi';
@@ -1101,25 +1102,23 @@ $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows; $sthArows=$sthA->rows;
$dbhP=$dbhA; $mysql_count='02026'; $MEL_aff_rows=$sthArows; &mysql_error_logging; $dbhP=$dbhA; $mysql_count='02026'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
$rec_count=0; if ($sthArows > 0)
while ($sthArows > $rec_count)
{ {
@aryA = $sthA->fetchrow_array; @aryA = $sthA->fetchrow_array;
$enable_queuemetrics_logging = "$aryA[0]"; $enable_queuemetrics_logging = $aryA[0];
$queuemetrics_server_ip = "$aryA[1]"; $queuemetrics_server_ip = $aryA[1];
$queuemetrics_dbname = "$aryA[2]"; $queuemetrics_dbname = $aryA[2];
$queuemetrics_login= "$aryA[3]"; $queuemetrics_login= $aryA[3];
$queuemetrics_pass = "$aryA[4]"; $queuemetrics_pass = $aryA[4];
$queuemetrics_log_id = "$aryA[5]"; $queuemetrics_log_id = $aryA[5];
$queuemetrics_eq_prepend = "$aryA[6]"; $queuemetrics_eq_prepend = $aryA[6];
$rec_count++;
} }
$sthA->finish(); $sthA->finish();
##### END QUEUEMETRICS LOGGING LOOKUP ##### ##### END QUEUEMETRICS LOGGING LOOKUP #####
########################################### ###########################################
if ($enable_queuemetrics_logging > 0) if ($enable_queuemetrics_logging > 0)
{ {
$data2 = "$phone_number"; $data2 = "$phone_number";
if ( (length($queuemetrics_eq_prepend) > 0) && ($queuemetrics_eq_prepend !~ /NONE/) ) if ( (length($queuemetrics_eq_prepend) > 0) && ($queuemetrics_eq_prepend !~ /NONE/) )
{ {
@@ -1131,11 +1130,11 @@ if ($enable_queuemetrics_logging > 0)
$rec_count=0; $rec_count=0;
while ($sthArows > $rec_count) while ($sthArows > $rec_count)
{ {
$DASH='-'; $DASH='-';
@aryA = $sthA->fetchrow_array; @aryA = $sthA->fetchrow_array;
$QMprepend = "$aryA[0]"; $QMprepend = "$aryA[0]";
$rec_count++; $rec_count++;
$data2 = "$QMprepend$DASH$phone_number"; $data2 = "$QMprepend$DASH$phone_number";
} }
$sthA->finish(); $sthA->finish();
} }
@@ -1148,7 +1147,6 @@ if ($enable_queuemetrics_logging > 0)
$stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='$YqueryCID',queue='$channel_group',agent='NONE',verb='ENTERQUEUE',data2='$data2',serverid='$queuemetrics_log_id';"; $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='$YqueryCID',queue='$channel_group',agent='NONE',verb='ENTERQUEUE',data2='$data2',serverid='$queuemetrics_log_id';";
$Baffected_rows = $dbhB->do($stmtB); $Baffected_rows = $dbhB->do($stmtB);
$dbhP=$dbhB; $stmtA=$stmtB; $mysql_count='02028'; $MEL_aff_rows=$Baffected_rows; &mysql_error_logging; $dbhP=$dbhB; $stmtA=$stmtB; $mysql_count='02028'; $MEL_aff_rows=$Baffected_rows; &mysql_error_logging;
$dbhB->disconnect();
} }
@@ -1163,6 +1161,7 @@ $stmtA = "select auto_call_id from vicidial_auto_calls where uniqueid='$uniqueid
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows; $sthArows=$sthA->rows;
if ($AGILOG) {$agi_string = "$sthArows|$stmtA|"; &agi_output;}
$dbhP=$dbhA; $mysql_count='02029'; $MEL_aff_rows=$sthArows; &mysql_error_logging; $dbhP=$dbhA; $mysql_count='02029'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
if ($sthArows > 0) if ($sthArows > 0)
{ {
@@ -1171,8 +1170,8 @@ if ($sthArows > 0)
### UPDATE existing record to LIVE in the vicidial_auto_calls table ### UPDATE existing record to LIVE in the vicidial_auto_calls table
$stmtA = "UPDATE vicidial_auto_calls SET campaign_id='$channel_group',status='LIVE',lead_id='$insert_lead_id',callerid='$callerid',channel='$channel',phone_code='$phone_code',phone_number='$phone_number',call_time='$SQLdate',call_type='IN',stage='LIVE-0',queue_priority='$queue_priority' $adSQL WHERE auto_call_id='$auto_call_id';"; $stmtA = "UPDATE vicidial_auto_calls SET campaign_id='$channel_group',status='LIVE',lead_id='$insert_lead_id',callerid='$callerid',channel='$channel',phone_code='$phone_code',phone_number='$phone_number',call_time='$SQLdate',call_type='IN',stage='LIVE-0',queue_priority='$queue_priority' $adSQL WHERE auto_call_id='$auto_call_id';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$Uaffected_rows = $dbhA->do($stmtA); $Uaffected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "$Uaffected_rows|$stmtA|"; &agi_output;}
$dbhP=$dbhA; $mysql_count='02029'; $MEL_aff_rows=$Uaffected_rows; &mysql_error_logging; $dbhP=$dbhA; $mysql_count='02029'; $MEL_aff_rows=$Uaffected_rows; &mysql_error_logging;
} }
$sthA->finish(); $sthA->finish();
@@ -1197,6 +1196,16 @@ if ($Uaffected_rows < 1)
$sthA->finish(); $sthA->finish();
} }
if ($enable_queuemetrics_logging > 0)
{
$QL_last_day = ($now_date_epoch - 86400);
$stmtB = "UPDATE queue_log SET call_id='$YqueryCID' where time_id > '$QL_last_day' and call_id='$uniqueid' and queue='NONE' and agent='NONE' and verb='INFO' and data1 IN('DID','IVR');";
$Baffected_rows = $dbhB->do($stmtB);
if ($AGILOG) {$agi_string = "$Baffected_rows|$stmtB|"; &agi_output;}
$dbhP=$dbhB; $stmtA=$stmtB; $mysql_count='02XXX'; $MEL_aff_rows=$Baffected_rows; &mysql_error_logging;
$dbhB->disconnect();
}
$stmtA = "INSERT INTO vicidial_closer_log SET lead_id='$insert_lead_id', campaign_id='$channel_group', call_date='$SQLdate', start_epoch='$now_date_epoch', status='QUEUE', phone_code='$phone_code', phone_number='$phone_number', user='VDCL', processed='N', xfercallid='$insert_xfer_id', uniqueid='$uniqueid' $adSQL;"; $stmtA = "INSERT INTO vicidial_closer_log SET lead_id='$insert_lead_id', campaign_id='$channel_group', call_date='$SQLdate', start_epoch='$now_date_epoch', status='QUEUE', phone_code='$phone_code', phone_number='$phone_number', user='VDCL', processed='N', xfercallid='$insert_xfer_id', uniqueid='$uniqueid' $adSQL;";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$affected_rows = $dbhA->do($stmtA); $affected_rows = $dbhA->do($stmtA);
@@ -35,6 +35,7 @@
# 81017-0238 - Fixed duplication bug for vac in multi-entry dialplans # 81017-0238 - Fixed duplication bug for vac in multi-entry dialplans
# 90504-1555 - Added call time scheme override # 90504-1555 - Added call time scheme override
# 90621-1130 - Fixed issue when no call time is specified # 90621-1130 - Fixed issue when no call time is specified
# 91122-2353 - Added QueueMetrics logging as IVR INFO entries
# #
$script = 'agi-VDAD_inbound_calltime_check.agi'; $script = 'agi-VDAD_inbound_calltime_check.agi';
@@ -127,8 +128,7 @@ $stmtA = "SELECT agi_output FROM servers where server_ip = '$VARserver_ip';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows; $sthArows=$sthA->rows;
$rec_count=0; if ($sthArows > 0)
while ($sthArows > $rec_count)
{ {
$AGILOG = '0'; $AGILOG = '0';
@aryA = $sthA->fetchrow_array; @aryA = $sthA->fetchrow_array;
@@ -136,10 +136,30 @@ while ($sthArows > $rec_count)
if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';} if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';}
if ($DBagi_output =~ /FILE/) {$AGILOG = '2';} if ($DBagi_output =~ /FILE/) {$AGILOG = '2';}
if ($DBagi_output =~ /BOTH/) {$AGILOG = '3';} if ($DBagi_output =~ /BOTH/) {$AGILOG = '3';}
$rec_count++;
} }
$sthA->finish(); $sthA->finish();
#############################################
##### START QUEUEMETRICS LOGGING LOOKUP #####
$stmtA = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_eq_prepend FROM system_settings;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$enable_queuemetrics_logging = $aryA[0];
$queuemetrics_server_ip = $aryA[1];
$queuemetrics_dbname = $aryA[2];
$queuemetrics_login= $aryA[3];
$queuemetrics_pass = $aryA[4];
$queuemetrics_log_id = $aryA[5];
$queuemetrics_eq_prepend = $aryA[6];
}
$sthA->finish();
##### END QUEUEMETRICS LOGGING LOOKUP #####
###########################################
### begin parsing run-time options ### ### begin parsing run-time options ###
if (length($ARGV[0])>1) if (length($ARGV[0])>1)
@@ -243,13 +263,12 @@ $sthArows=$sthA->rows;
while ($sthArows > $cbc) while ($sthArows > $cbc)
{ {
@aryA = $sthA->fetchrow_array; @aryA = $sthA->fetchrow_array;
$DBvoicemail_dump_exten = $aryA[0];
$DBvoicemail_dump_exten = "$aryA[0]"; $DBext_context = $aryA[1];
$DBext_context = "$aryA[1]"; $DBanswer_transfer_agent = $aryA[2];
$DBanswer_transfer_agent = "$aryA[2]"; $DBSERVER_GMT = $aryA[3];
$DBSERVER_GMT = "$aryA[3]"; $DBasterisk_version = $aryA[4];
$DBasterisk_version = "$aryA[4]"; $DBmax_vicidial_trunks = $aryA[5];
$DBmax_vicidial_trunks = "$aryA[5]";
if ($DBvoicemail_dump_exten) {$voicemail_dump_exten = $DBvoicemail_dump_exten;} if ($DBvoicemail_dump_exten) {$voicemail_dump_exten = $DBvoicemail_dump_exten;}
if ($DBext_context) {$ext_context = $DBext_context;} if ($DBext_context) {$ext_context = $DBext_context;}
if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;}
@@ -271,28 +290,27 @@ if (length($channel_group) > 1)
while ($sthArows > $cbc) while ($sthArows > $cbc)
{ {
@aryA = $sthA->fetchrow_array; @aryA = $sthA->fetchrow_array;
$call_time_id = $aryA[0];
$call_time_id = "$aryA[0]"; $after_hours_action = $aryA[1];
$after_hours_action = "$aryA[1]"; $after_hours_message_filename = $aryA[2];
$after_hours_message_filename = "$aryA[2]"; $after_hours_exten = $aryA[3];
$after_hours_exten = "$aryA[3]"; $after_hours_voicemail = $aryA[4];
$after_hours_voicemail = "$aryA[4]"; $welcome_message_filename = $aryA[5];
$welcome_message_filename = "$aryA[5]"; $moh_context = $aryA[6];
$moh_context = "$aryA[6]"; $onhold_prompt_filename = $aryA[7];
$onhold_prompt_filename = "$aryA[7]"; $prompt_interval = $aryA[8];
$prompt_interval = "$aryA[8]"; $agent_alert_exten = $aryA[9];
$agent_alert_exten = "$aryA[9]"; $agent_alert_delay = $aryA[10];
$agent_alert_delay = "$aryA[10]"; $drop_call_seconds = $aryA[11];
$drop_call_seconds = "$aryA[11]";
$DROP_TIME = $drop_call_seconds; $DROP_TIME = $drop_call_seconds;
$drop_action = "$aryA[12]"; $drop_action = $aryA[12];
$drop_exten = "$aryA[13]"; $drop_exten = $aryA[13];
$CAMP_callorder = "$aryA[14]"; $CAMP_callorder = $aryA[14];
$VDADvoicemail_ext = "$aryA[15]"; $VDADvoicemail_ext = $aryA[15];
$VDADvoicemail_ext =~ s/\D//gi; $VDADvoicemail_ext =~ s/\D//gi;
$queue_priority = "$aryA[16]"; $queue_priority = $aryA[16];
$drop_inbound_group = "$aryA[17]"; $drop_inbound_group = $aryA[17];
$afterhours_xfer_group = "$aryA[18]"; $afterhours_xfer_group = $aryA[18];
$cbc++; $cbc++;
} }
$sthA->finish(); $sthA->finish();
@@ -335,10 +353,10 @@ $sthArows=$sthA->rows;
if ($sthArows > 0) if ($sthArows > 0)
{ {
@aryA = $sthA->fetchrow_array; @aryA = $sthA->fetchrow_array;
$ct_default_start = "$aryA[0]"; $ct_default_start = $aryA[0];
$ct_default_stop = "$aryA[1]"; $ct_default_stop = $aryA[1];
$ct_day_start = "$aryA[2]"; $ct_day_start = $aryA[2];
$ct_day_stop = "$aryA[3]"; $ct_day_stop = $aryA[3];
$sthA->finish(); $sthA->finish();
if ( ($ct_day_start > 0) || ($ct_day_stop > 0) ) if ( ($ct_day_start > 0) || ($ct_day_stop > 0) )
@@ -400,6 +418,20 @@ if ( ($hm < $ct_default_start) || ($hm > $ct_default_stop) )
$affected_rowsL = $dbhA->do($stmtA); $affected_rowsL = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- AH LIL : |$affected_rowsL|$uniqueid|$callerid|$extension|"; &agi_output;} if ($AGILOG) {$agi_string = "-- AH LIL : |$affected_rowsL|$uniqueid|$callerid|$extension|"; &agi_output;}
### QueueMetrics logging if enabled
if ($enable_queuemetrics_logging > 0)
{
$dbhB = DBI->connect("DBI:mysql:$queuemetrics_dbname:$queuemetrics_server_ip:3306", "$queuemetrics_login", "$queuemetrics_pass")
or die "Couldn't connect to database: " . DBI->errstr;
if ($DBX) {print "CONNECTED TO QueueMetrics DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";}
$stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='$uniqueid',queue='NONE',agent='NONE',verb='INFO',data1='IVR',data2='$context',serverid='$queuemetrics_log_id';";
if ($AGILOG) {$agi_string = "|$stmtB|"; &agi_output;}
$Baffected_rows = $dbhB->do($stmtB);
$dbhB->disconnect();
}
if ($after_hours_action =~ /HANGUP/) if ($after_hours_action =~ /HANGUP/)
{ {
### insert a NEW record to the vicidial_manager table to hangup the channel ### insert a NEW record to the vicidial_manager table to hangup the channel
@@ -447,6 +479,21 @@ $affected_rowsL = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- LIL : |$affected_rowsL|$uniqueid|$callerid|$extension|"; &agi_output;} if ($AGILOG) {$agi_string = "-- LIL : |$affected_rowsL|$uniqueid|$callerid|$extension|"; &agi_output;}
### QueueMetrics logging if enabled
if ($enable_queuemetrics_logging > 0)
{
$dbhB = DBI->connect("DBI:mysql:$queuemetrics_dbname:$queuemetrics_server_ip:3306", "$queuemetrics_login", "$queuemetrics_pass")
or die "Couldn't connect to database: " . DBI->errstr;
if ($DBX) {print "CONNECTED TO QueueMetrics DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";}
$stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='$uniqueid',queue='NONE',agent='NONE',verb='INFO',data1='IVR',data2='$context',serverid='$queuemetrics_log_id';";
if ($AGILOG) {$agi_string = "|$stmtB|"; &agi_output;}
$Baffected_rows = $dbhB->do($stmtB);
$dbhB->disconnect();
}
$sthA->finish(); $sthA->finish();
$dbhA->disconnect(); $dbhA->disconnect();
+1
View File
@@ -433,6 +433,7 @@ PHASE 6: ADDING CRONTAB ENTRIES FOR ASTGUICLIENT/VICIDIAL SCRIPTS
50 0 * * * /usr/share/astguiclient/AST_cleanup_agent_log.pl --last-24hours 50 0 * * * /usr/share/astguiclient/AST_cleanup_agent_log.pl --last-24hours
## uncomment below if using QueueMetrics ## uncomment below if using QueueMetrics
#*/5 * * * * /usr/share/astguiclient/AST_cleanup_agent_log.pl --only-qm-live-call-check #*/5 * * * * /usr/share/astguiclient/AST_cleanup_agent_log.pl --only-qm-live-call-check
#1 1 * * * /usr/share/astguiclient/Vtiger_optimize_all_tables.pl --quiet
### updater for VICIDIAL hopper ### updater for VICIDIAL hopper
* * * * * /usr/share/astguiclient/AST_VDhopper.pl -q * * * * * /usr/share/astguiclient/AST_VDhopper.pl -q
+12 -2
View File
@@ -1,6 +1,6 @@
VICIDIAL and QueueMetrics VICIDIAL and QueueMetrics
queue_log logging was added to VICIDIAL outbound auto calling as an option in the 2.0.3 release tree. queue_log logging was added to VICIDIAL outbound auto calling as an option in the 2.0.3 release, and for inbound in the 2.0.4 release.
This document goes over the features and needed changes made to VICIDIAL to enable it to insert activity records into the queue_log and other tables in MySQL that QueueMetrics uses for it's statistical analysis and reports. This document should not be taken as a HOWTO for proper installation steps to get QueueMetrics working. This document goes over the features and needed changes made to VICIDIAL to enable it to insert activity records into the queue_log and other tables in MySQL that QueueMetrics uses for it's statistical analysis and reports. This document should not be taken as a HOWTO for proper installation steps to get QueueMetrics working.
@@ -15,11 +15,20 @@ Another very important issue to note is that just like with VICIDIAL on multi-se
To be able to view stats for inbound and outbound calls properly you need to add each one individually in QueueMetrics "queues" and properly set whether each one is inbound or outbound. After that you can create a combined queue-alias with all of the campaigns and in-groups in it and it will tell you correctly the number of inbound and outbound calls. To be able to view stats for inbound and outbound calls properly you need to add each one individually in QueueMetrics "queues" and properly set whether each one is inbound or outbound. After that you can create a combined queue-alias with all of the campaigns and in-groups in it and it will tell you correctly the number of inbound and outbound calls.
As of 2008-10-30, several validation and correction functions were added to the AST_cleanup_agent_log.pl script that is supposed to run every hour. These functions should clean up any queue_log errors that appear and cause QueueMetrics to display incorrect call totals. As of 2008-10-30, several validation and correction functions were added to the AST_cleanup_agent_log.pl script that is supposed to run every hour. These functions should clean up any queue_log errors that appear and cause QueueMetrics to display incorrect call totals.
As of 2009-05-30, live montoring and playback of archived recordings through the QueueMetrics interface was added. To use this you must have the audio.server, audio.liveserver and default.audioRpcServer variables set properly in the configuration.properties file as specified toward the bottom of this document. The live monitoring asks for an extension to send the call to, this is an extension dialed on the active voicemail server as defined in the system settings. If there is no active voicemail defined then the live monitor will place the call to the extension on the server that the agent is on. As of 2009-05-30, live montoring and playback of archived recordings through the QueueMetrics interface was added. To use this you must have the audio.server, audio.liveserver and default.audioRpcServer variables set properly in the configuration.properties file as specified toward the bottom of this document. The live monitoring asks for an extension to send the call to, this is an extension dialed on the active voicemail server as defined in the system settings. If there is no active voicemail defined then the live monitor will place the call to the extension on the server that the agent is on.
As of 2009-11-23, DID and IVR logging through QueueMetrics queue_log is now part of the code. DID entries for the queue will be counted only for calls that actually enter the queue or are sent to an agent through a ViciDial in-group. For IVR entries, only the last Call Menu will be counted in the QueueMetrics reports.
Entries you should have in your crontab on one server:
### fix the vicidial_agent_log once every hour and the full day run at night
33 * * * * /usr/share/astguiclient/AST_cleanup_agent_log.pl
50 0 * * * /usr/share/astguiclient/AST_cleanup_agent_log.pl --last-24hours
*/5 * * * * /usr/share/astguiclient/AST_cleanup_agent_log.pl --only-qm-live-call-check
1 1 * * * /usr/share/astguiclient/Vtiger_optimize_all_tables.pl --quiet
Here is a short summary of the needed steps to install QueueMetrics on your system: Here is a short summary of the needed steps to install QueueMetrics on your system:
@@ -186,6 +195,7 @@ call actions before going to agent - used by agi-VDAD_ALL_inbound/outbound scrip
EXITWITHTIMEOUT(position) EXITWITHTIMEOUT(position)
EXITWITHKEY(key|position) EXITWITHKEY(key|position)
TRANSFER(extension|context|holdtime|calltime) TRANSFER(extension|context|holdtime|calltime)
INFO([IVR or DID]|[context or DID])
call actions before going to agent - used by AST_VDauto_dial.pl call actions before going to agent - used by AST_VDauto_dial.pl
ABANDON(position|origposition|waittime) ABANDON(position|origposition|waittime)
@@ -203,7 +213,7 @@ not used in vicidial -
data1: call termination codes, TBD data1: call termination codes, DID, IVR context
data2: callerID or number called(sometimes prepended by DNIS) [3101-9015556189] data2: callerID or number called(sometimes prepended by DNIS) [3101-9015556189]
NOTE: the queuemetrics_eq_prepend field allows you to specify what NOTE: the queuemetrics_eq_prepend field allows you to specify what
+1
View File
@@ -2384,6 +2384,7 @@ SUBPHASE 6.5: setting up astguiclient scripts for continuous running
50 0 * * * /usr/share/astguiclient/AST_cleanup_agent_log.pl --last-24hours 50 0 * * * /usr/share/astguiclient/AST_cleanup_agent_log.pl --last-24hours
## uncomment below if using QueueMetrics ## uncomment below if using QueueMetrics
#*/5 * * * * /usr/share/astguiclient/AST_cleanup_agent_log.pl --only-qm-live-call-check #*/5 * * * * /usr/share/astguiclient/AST_cleanup_agent_log.pl --only-qm-live-call-check
#1 1 * * * /usr/share/astguiclient/Vtiger_optimize_all_tables.pl --quiet
### updater for VICIDIAL hopper ### updater for VICIDIAL hopper
* * * * * /usr/share/astguiclient/AST_VDhopper.pl -q * * * * * /usr/share/astguiclient/AST_VDhopper.pl -q