logging fixes and queue_log fixes

AST_VDauto_dial.pl fix for deleting vicidial_auto_calls entries

git-svn-id: svn://192.168.202.10@979 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2008-10-20 08:06:16 +00:00
parent 3bdb598013
commit 21276c1ac1
15 changed files with 683 additions and 381 deletions
+155 -16
View File
@@ -23,8 +23,10 @@
# #
# changes: # changes:
# 80930-0226 - first build # 80930-0226 - first build
# 81015-1702 - added filter stats
# #
$filter_stats = 1;
$script = 'VDL_CID_lookup.agi'; $script = 'VDL_CID_lookup.agi';
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
@@ -38,6 +40,7 @@ if ($sec < 10) {$sec = "0$sec";}
$now_date_epoch = time(); $now_date_epoch = time();
$now_date = "$year-$mon-$mday $hour:$min:$sec"; $now_date = "$year-$mon-$mday $hour:$min:$sec";
$SQLdate = "$year-$mon-$mday $hour:$min:$sec";
# default path to astguiclient configuration file: # default path to astguiclient configuration file:
$PATHconf = '/etc/astguiclient.conf'; $PATHconf = '/etc/astguiclient.conf';
@@ -199,24 +202,160 @@ $callerid =~ s/\"//gi;
### find out if phone number exists in the vicidial_list table
$stmtA = "SELECT count(*) FROM vicidial_list where phone_number = '$callerid' and list_id NOT IN('99999');";
$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;
$VDL_count = "$aryA[0]";
}
$sthA->finish();
if ($VDL_count < 1)
if ($filter_stats > 0)
{ {
$priority = ($priority + 3); ### find out if phone number exists in the vicidial_list table
if ($AGILOG) {$agi_string = "-- cid_lookup finish: |$priority|$callerid"; &agi_output;} $stmtA = "SELECT count(*) FROM vicidial_list where phone_number = '$callerid';";
print "SET PRIORITY $priority\n"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
checkresult($result); $sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$VDL_count = "$aryA[0]";
}
$sthA->finish();
if ($VDL_count < 1)
{
$priority = ($priority + 3);
$stmtA = "INSERT INTO live_inbound_log (uniqueid,channel,server_ip,caller_id,extension,start_time,comment_a,comment_b) values('$uniqueid','$channel','$VARserver_ip','$callerid','$extension','$SQLdate','INBOUND_IVR_FILTER','NOT_FOUND')";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- cid_lookup finish: : |$affected_rows|$callerid|$priority|NOT_FOUND|"; &agi_output;}
print "SET PRIORITY $priority\n";
checkresult($result);
$dbhA->disconnect();
exit;
}
else ################# LEAD IN SYSTEM, FILTER FURTHER #########################
{
$stmtA = "SELECT count(*) FROM vicidial_list where phone_number = '$callerid' and status IN('A1','A2','A3','A4','SALE');";
$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;
$sales_count = "$aryA[0]";
}
$sthA->finish();
if ($sales_count > 0)
{
$priority = ($priority + 3);
$stmtA = "INSERT INTO live_inbound_log (uniqueid,channel,server_ip,caller_id,extension,start_time,comment_a,comment_b,comment_c) values('$uniqueid','$channel','$VARserver_ip','$callerid','$extension','$SQLdate','INBOUND_IVR_FILTER','EXISTING','SALE')";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- cid_lookup finish: : |$affected_rows|$callerid|$priority|EXISTING|SALE|"; &agi_output;}
print "SET PRIORITY $priority\n";
checkresult($result);
$dbhA->disconnect();
exit;
}
$stmtA = "SELECT count(*) FROM vicidial_list where phone_number = '$callerid' and status IN('DNC');";
$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;
$dnc_count = "$aryA[0]";
}
$sthA->finish();
if ($dnc_count > 0)
{
$priority = ($priority + 3);
$stmtA = "INSERT INTO live_inbound_log (uniqueid,channel,server_ip,caller_id,extension,start_time,comment_a,comment_b,comment_c) values('$uniqueid','$channel','$VARserver_ip','$callerid','$extension','$SQLdate','INBOUND_IVR_FILTER','EXISTING','DNC')";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- cid_lookup finish: : |$affected_rows|$callerid|$priority|EXISTING|DNC|"; &agi_output;}
print "SET PRIORITY $priority\n";
checkresult($result);
$dbhA->disconnect();
exit;
}
$stmtA = "SELECT count(*) FROM vicidial_list where phone_number = '$callerid' and list_id NOT IN('999999');";
$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;
$archive_count = "$aryA[0]";
}
$sthA->finish();
if ($archive_count < 1)
{
$priority = ($priority + 3);
$stmtA = "INSERT INTO live_inbound_log (uniqueid,channel,server_ip,caller_id,extension,start_time,comment_a,comment_b,comment_c) values('$uniqueid','$channel','$VARserver_ip','$callerid','$extension','$SQLdate','INBOUND_IVR_FILTER','EXISTING','ARCHIVE')";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- cid_lookup finish: : |$affected_rows|$callerid|$priority|EXISTING|ARCHIVE|"; &agi_output;}
print "SET PRIORITY $priority\n";
checkresult($result);
$dbhA->disconnect();
exit;
}
$stmtA = "INSERT INTO live_inbound_log (uniqueid,channel,server_ip,caller_id,extension,start_time,comment_a,comment_b,comment_c) values('$uniqueid','$channel','$VARserver_ip','$callerid','$extension','$SQLdate','INBOUND_IVR_FILTER','CLEAN','TO_AGENT')";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- cid_lookup finish: : |$affected_rows|$callerid|$priority|EXISTING|CLEAN|"; &agi_output;}
exit;
}
}
else
{
### find out if phone number exists in the vicidial_list table
$stmtA = "SELECT count(*) FROM vicidial_list where phone_number = '$callerid' and list_id NOT IN('999999');";
$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;
$VDL_count = "$aryA[0]";
}
$sthA->finish();
if ($VDL_count < 1)
{
$priority = ($priority + 3);
if ($AGILOG) {$agi_string = "-- cid_lookup finish: |$priority|$callerid"; &agi_output;}
print "SET PRIORITY $priority\n";
checkresult($result);
}
} }
$dbhA->disconnect(); $dbhA->disconnect();
+86 -32
View File
@@ -84,6 +84,7 @@
# 80918-0505 - Added place in line and estimated time on hold # 80918-0505 - Added place in line and estimated time on hold
# 81002-1120 - Added processing for DID forwarded calls # 81002-1120 - Added processing for DID forwarded calls
# 81011-1019 - Added option for press 1 to leave voicemail if wait time > hold-time-option-seconds # 81011-1019 - Added option for press 1 to leave voicemail if wait time > hold-time-option-seconds
# 81020-0237 - Added term_reason logging for all possible exits of the script
# #
$script = 'agi-VDAD_ALL_inbound.agi'; $script = 'agi-VDAD_ALL_inbound.agi';
@@ -536,7 +537,7 @@ if ($call_handle_method =~ /LOOKUP/)
} }
$cbc=0; $cbc=0;
$stmtA= "SELECT lead_id from vicidial_list where phone_number='$phone_number' $listSQL order by last_local_call_time limit 1;"; $stmtA= "SELECT lead_id from vicidial_list where phone_number='$phone_number' $listSQL order by last_local_call_time desc limit 1;";
if ($AGILOG) {$agi_string = "VDAD vicidial_list search |$phone_number|$stmtA|"; &agi_output;} if ($AGILOG) {$agi_string = "VDAD vicidial_list search |$phone_number|$stmtA|"; &agi_output;}
$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;
@@ -692,6 +693,7 @@ if ( ($hm < $ct_default_start) || ($hm > $ct_default_stop) )
if ($after_hours_action =~ /MESSAGE/) if ($after_hours_action =~ /MESSAGE/)
{ {
$AGI->stream_file('sip-silence'); $AGI->stream_file('sip-silence');
$AGI->stream_file('sip-silence');
$AGI->stream_file("$after_hours_message_filename"); $AGI->stream_file("$after_hours_message_filename");
sleep(1); sleep(1);
@@ -1149,13 +1151,6 @@ if ($agent_search_method =~ /^SO|^LO/)
if ($no_delay_call_route !~ /Y/i) if ($no_delay_call_route !~ /Y/i)
{usleep(1*500*1000);} {usleep(1*500*1000);}
print "SET CONTEXT $ext_context\n";
checkresult($result);
print "SET EXTENSION $VDADconf_exten\n";
checkresult($result);
print "SET PRIORITY 1\n";
checkresult($result);
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year = ($year + 1900); $year = ($year + 1900);
$mon++; $mon++;
@@ -1169,6 +1164,13 @@ if ($agent_search_method =~ /^SO|^LO/)
$affected_rows = $dbhA->do($stmtA); $affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$insert_lead_id|$insert_close_id|\n|$stmtA|"; &agi_output;} if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$insert_lead_id|$insert_close_id|\n|$stmtA|"; &agi_output;}
print "SET CONTEXT $ext_context\n";
checkresult($result);
print "SET EXTENSION $VDADconf_exten\n";
checkresult($result);
print "SET PRIORITY 1\n";
checkresult($result);
$dbhA->disconnect(); $dbhA->disconnect();
$now_date_epoch = time(); $now_date_epoch = time();
@@ -1439,13 +1441,6 @@ if ($agent_search_method =~ /^LO|^LB/)
if ($no_delay_call_route !~ /Y/i) if ($no_delay_call_route !~ /Y/i)
{usleep(1*500*1000);} {usleep(1*500*1000);}
print "SET CONTEXT $ext_context\n";
checkresult($result);
print "SET EXTENSION $VDADremDIALstr\n";
checkresult($result);
print "SET PRIORITY 1\n";
checkresult($result);
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year = ($year + 1900); $year = ($year + 1900);
$mon++; $mon++;
@@ -1459,6 +1454,13 @@ if ($agent_search_method =~ /^LO|^LB/)
$affected_rows = $dbhA->do($stmtA); $affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$insert_lead_id|\n|$stmtA|"; &agi_output;} if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$insert_lead_id|\n|$stmtA|"; &agi_output;}
print "SET CONTEXT $ext_context\n";
checkresult($result);
print "SET EXTENSION $VDADremDIALstr\n";
checkresult($result);
print "SET PRIORITY 1\n";
checkresult($result);
$dbhA->disconnect(); $dbhA->disconnect();
$now_date_epoch = time(); $now_date_epoch = time();
@@ -1535,14 +1537,6 @@ if ($hold_recall_xfer_group !~ /NONE/)
sleep(1); sleep(1);
} }
if ($AGILOG) {$agi_string = "exiting the VDAD app, transferring call to $DROPexten"; &agi_output;}
print "SET CONTEXT $ext_context\n";
checkresult($result);
print "SET EXTENSION $DROPexten\n";
checkresult($result);
print "SET PRIORITY 1\n";
checkresult($result);
$stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' and server_ip='$VARserver_ip' order by call_time desc limit 1;"; $stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' and server_ip='$VARserver_ip' order by call_time desc limit 1;";
$affected_rows = $dbhA->do($stmtA); $affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VDCL vac record deleted: |$affected_rows| $VDADcampaign|"; &agi_output;} if ($AGILOG) {$agi_string = "-- VDCL vac record deleted: |$affected_rows| $VDADcampaign|"; &agi_output;}
@@ -1557,6 +1551,27 @@ if ($hold_recall_xfer_group !~ /NONE/)
$affected_rows = $dbhA->do($stmtA); $affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VDCL vl update: |$affected_rows|$insert_lead_id|\n|$stmtA|"; &agi_output;} if ($AGILOG) {$agi_string = "-- VDCL vl update: |$affected_rows|$insert_lead_id|\n|$stmtA|"; &agi_output;}
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 DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";}
$stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='$YqueryCID',queue='$channel_group',agent='NONE',verb='TRANSFER',data1='$DROPexten',data2='$ext_context',data3='1',data4='1',serverid='$queuemetrics_log_id';";
$Baffected_rows = $dbhB->do($stmtB);
$dbhB->disconnect();
}
if ($AGILOG) {$agi_string = "exiting the VDAD app, transferring call to $DROPexten"; &agi_output;}
print "SET CONTEXT $ext_context\n";
checkresult($result);
print "SET EXTENSION $DROPexten\n";
checkresult($result);
print "SET PRIORITY 1\n";
checkresult($result);
$dbhA->disconnect(); $dbhA->disconnect();
exit; exit;
@@ -1776,6 +1791,7 @@ if ( ($hold_time_option !~ /NONE/ ) && ( $holdtime_estimate_sec_diff > $hold_tim
{ {
$wait_in_queue=0; # exits wait loop $wait_in_queue=0; # exits wait loop
$DROPexten = ''; $DROPexten = '';
$exitwithkey=0;
if ($hold_time_option =~ /EXTENSION/) if ($hold_time_option =~ /EXTENSION/)
{ {
if (length($hold_time_option_exten)>0) if (length($hold_time_option_exten)>0)
@@ -1810,6 +1826,26 @@ if ($hold_time_option =~ /PRESS_VMAIL/)
{ {
$DROPexten = "$voicemail_dump_exten$hold_time_option_voicemail"; $DROPexten = "$voicemail_dump_exten$hold_time_option_voicemail";
$HT_status='QVMAIL'; $HT_status='QVMAIL';
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 DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";}
$place=0;
if ($rec_countWAIT > 0) {$place = $rec_countWAIT;}
if ($rec_countWAITrem > 0) {$place = $rec_countWAITrem;}
$place++;
$stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='$YqueryCID',queue='$channel_group',agent='NONE',verb='EXITWITHKEY',data1='1',data2='$place',serverid='$queuemetrics_log_id';";
$Baffected_rows = $dbhB->do($stmtB);
$exitwithkey++;
$dbhB->disconnect();
}
} }
else else
{ {
@@ -1881,14 +1917,6 @@ if ($wait_in_queue < 1)
sleep(1); sleep(1);
} }
if ($AGILOG) {$agi_string = "exiting the VDAD app, transferring call to $DROPexten"; &agi_output;}
print "SET CONTEXT $ext_context\n";
checkresult($result);
print "SET EXTENSION $DROPexten\n";
checkresult($result);
print "SET PRIORITY 1\n";
checkresult($result);
$stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' and server_ip='$VARserver_ip' order by call_time desc limit 1;"; $stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' and server_ip='$VARserver_ip' order by call_time desc limit 1;";
$affected_rows = $dbhA->do($stmtA); $affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VDCL vac record deleted: |$affected_rows| $VDADcampaign|"; &agi_output;} if ($AGILOG) {$agi_string = "-- VDCL vac record deleted: |$affected_rows| $VDADcampaign|"; &agi_output;}
@@ -1904,6 +1932,27 @@ if ($wait_in_queue < 1)
$affected_rows = $dbhA->do($stmtA); $affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VDCL vl update: |$affected_rows|$insert_lead_id|\n|$stmtA|"; &agi_output;} if ($AGILOG) {$agi_string = "-- VDCL vl update: |$affected_rows|$insert_lead_id|\n|$stmtA|"; &agi_output;}
if ( ($enable_queuemetrics_logging > 0) && ($exitwithkey < 1) )
{
$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 DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";}
$stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='$YqueryCID',queue='$channel_group',agent='NONE',verb='TRANSFER',data1='$DROPexten',data2='$ext_context',data3='$drop_seconds',data4='$drop_seconds',serverid='$queuemetrics_log_id';";
$Baffected_rows = $dbhB->do($stmtB);
$dbhB->disconnect();
}
if ($AGILOG) {$agi_string = "exiting the VDAD app, transferring call to $DROPexten"; &agi_output;}
print "SET CONTEXT $ext_context\n";
checkresult($result);
print "SET EXTENSION $DROPexten\n";
checkresult($result);
print "SET PRIORITY 1\n";
checkresult($result);
$dbhA->disconnect(); $dbhA->disconnect();
exit; exit;
@@ -1984,7 +2033,12 @@ if ($enable_queuemetrics_logging > 0)
if ($DBX) {print "CONNECTED TO DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";} if ($DBX) {print "CONNECTED TO DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";}
$stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='$YqueryCID',queue='$channel_group',agent='NONE',verb='EXITWITHTIMEOUT',data1='1',serverid='$queuemetrics_log_id';"; $place=0;
if ($rec_countWAIT > 0) {$place = $rec_countWAIT;}
if ($rec_countWAITrem > 0) {$place = $rec_countWAITrem;}
$place++;
$stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='$YqueryCID',queue='$channel_group',agent='NONE',verb='EXITWITHTIMEOUT',data1='$place',serverid='$queuemetrics_log_id';";
$Baffected_rows = $dbhB->do($stmtB); $Baffected_rows = $dbhB->do($stmtB);
$dbhB->disconnect(); $dbhB->disconnect();
+37 -20
View File
@@ -55,6 +55,7 @@
# 80527-2329 - Added SURVEYCAMP ability to pull settings from database # 80527-2329 - Added SURVEYCAMP ability to pull settings from database
# 80831-0353 - Added logging of alt_dial field # 80831-0353 - Added logging of alt_dial field
# 80909-0603 - Added campaign-specific dnc option for outbound survey # 80909-0603 - Added campaign-specific dnc option for outbound survey
# 81020-0235 - Fixed Drop hangup bug and other small bugs
# #
$script = 'agi-VDAD_ALL_outbound.agi'; $script = 'agi-VDAD_ALL_outbound.agi';
@@ -466,9 +467,9 @@ if ($affected_rows > 0)
##### PLAY REMINDER MESSAGE ##### ##### PLAY REMINDER MESSAGE #####
if ($call_handle_method =~ /REMIND/) if ($call_handle_method =~ /REMIND/)
{ {
$stmtA = "UPDATE vicidial_auto_calls set last_update_time='$FDtsSQLdate' where callerid='$callerid' order by call_time desc limit 1;"; $stmtA = "UPDATE vicidial_auto_calls set last_update_time='$FDtsSQLdate',stage='REMIND-0' where callerid='$callerid' order by call_time desc limit 1;";
$affected_rows = $dbhA->do($stmtA); $affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VDAC posttime record: |$affected_rows|$FDtsSQLdate|$callerid|"; &agi_output;} if ($AGILOG) {$agi_string = "-- VDAC posttime record: |$affected_rows|$FDtsSQLdate|$callerid|REMIND|"; &agi_output;}
$AGI->stream_file("$survey_first_audio_file"); $AGI->stream_file("$survey_first_audio_file");
} }
@@ -483,9 +484,9 @@ if ($call_handle_method =~ /SURVEY/)
{ {
$AGI->stream_file('sip-silence'); $AGI->stream_file('sip-silence');
$stmtA = "UPDATE vicidial_auto_calls set last_update_time='$FDtsSQLdate' where callerid='$callerid' order by call_time desc limit 1;"; $stmtA = "UPDATE vicidial_auto_calls set last_update_time='$FDtsSQLdate',stage='SURVEY-0' where callerid='$callerid' order by call_time desc limit 1;";
$affected_rows = $dbhA->do($stmtA); $affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VDAC posttime record: |$affected_rows|$FDtsSQLdate|$callerid|"; &agi_output;} if ($AGILOG) {$agi_string = "-- VDAC posttime record: |$affected_rows|$FDtsSQLdate|$callerid|SURVEY|"; &agi_output;}
### check to see if the SURVEY settings should be pulled from the campaign settings in the database ### check to see if the SURVEY settings should be pulled from the campaign settings in the database
if ($call_handle_method =~ /SURVEYCAMP/) if ($call_handle_method =~ /SURVEYCAMP/)
@@ -675,6 +676,10 @@ if ($call_handle_method =~ /SURVEY/)
if (length($DROPexten) > 0) if (length($DROPexten) > 0)
{ {
$stmtA = "UPDATE vicidial_auto_calls set status='XFER',stage='XFER-0' where callerid='$callerid' order by call_time desc limit 1;";
$affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VDAC XFER status: |$affected_rows|$FDtsSQLdate|$callerid|"; &agi_output;}
if ($AGILOG) {$agi_string = "exiting the VDAD SURVEY app, transferring call to $DROPexten"; &agi_output;} if ($AGILOG) {$agi_string = "exiting the VDAD SURVEY app, transferring call to $DROPexten"; &agi_output;}
print "SET CONTEXT $ext_context\n"; print "SET CONTEXT $ext_context\n";
checkresult($result); checkresult($result);
@@ -756,6 +761,14 @@ if ($call_handle_method =~ /SURVEY/)
&agi_output; &agi_output;
} }
$stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' order by call_time desc limit 1;";
$affected_rows = $dbhA->do($stmtA);
if ($AGILOG)
{
$agi_string = "-- VDAD vac record deleted: |$affected_rows|$VDADcampaign|";
&agi_output;
}
$AGI->hangup(); $AGI->hangup();
exit; exit;
@@ -1241,6 +1254,23 @@ if ($drop_action =~ /IN_GROUP/)
} }
$Euniqueid=$uniqueid;
$Euniqueid =~ s/\.\d+//gi;
$stmtA = "UPDATE vicidial_log FORCE INDEX(lead_id) set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds',term_reason='QUEUETIMEOUT' where lead_id = '$CIDlead_id' and uniqueid LIKE \"$Euniqueid%\";";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VDAD vicidial_log update: |$affected_rows|$uniqueid"; &agi_output;}
$stmtA = "UPDATE vicidial_list set status='DROP' where lead_id = '$CIDlead_id';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VDAD vicidial_list update: |$affected_rows|$CIDlead_id"; &agi_output;}
$stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' order by call_time desc limit 1;";
$affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VDAD vac record deleted: |$affected_rows|$VDADcampaign|"; &agi_output;}
### use STDOUT to send call to proper DROP location ### use STDOUT to send call to proper DROP location
$VHqueryCID = "VH$CIDdate$VDADconf_exten"; $VHqueryCID = "VH$CIDdate$VDADconf_exten";
@@ -1264,24 +1294,11 @@ if ($drop_action =~ /IN_GROUP/)
### insert a NEW record to the vicidial_manager table to be processed ### insert a NEW record to the vicidial_manager table to be processed
$stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$VARserver_ip','','Hangup','$VHqueryCID','Channel: $channel','','','','','','','','','')"; $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$VARserver_ip','','Hangup','$VHqueryCID','Channel: $channel','','','','','','','','','')";
$affected_rows = $dbhA->do($stmtA); $affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VDCL call_hungup timout: |$VHqueryCID|$VDADconf_exten|$channel|insert to vicidial_manager"; &agi_output;} if ($AGILOG) {$agi_string = "-- VDCL call_hungup timout: |$CIDlead_id|$VHqueryCID|$VDADconf_exten|$channel|insert to vicidial_manager"; &agi_output;}
$AGI->hangup();
} }
$stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' order by call_time desc limit 1;";
$affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VDAD vac record deleted: |$affected_rows|$VDADcampaign|"; &agi_output;}
$Euniqueid=$uniqueid;
$Euniqueid =~ s/\.\d+//gi;
$stmtA = "UPDATE vicidial_log FORCE INDEX(lead_id) set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds',term_reason='QUEUETIMEOUT' where lead_id = '$CIDlead_id' and uniqueid LIKE \"$Euniqueid%\";";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VDAD vicidial_log update: |$affected_rows|$uniqueid"; &agi_output;}
$stmtA = "UPDATE vicidial_list set status='DROP' where lead_id = '$CIDlead_id';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VDAD vicidial_list update: |$affected_rows|$CIDlead_id"; &agi_output;}
} }
+21 -6
View File
@@ -13,10 +13,13 @@
# ; 2. whether to log the call into the vicidial_auto_calls table: # ; 2. whether to log the call into the vicidial_auto_calls table:
# ; - YES - insert the call as status IVR # ; - YES - insert the call as status IVR
# ; - NO - do not insert call into vac table # ; - NO - do not insert call into vac table
# # ; 3. note to put in the comment_b field when record inserted into the
# ; live_inbound_log table, no spaces in this field, use underscore '_'
# ; default if not populated is NONE
# ;
# ;inbound calls check calltime: # ;inbound calls check calltime:
#exten => 1234,1,Answer ; Answer the line #exten => 1234,1,Answer ; Answer the line
#exten => 1234,2,AGI(agi-VDAD_inbound_calltime_check.agi,INBOUND-----YES) #exten => 1234,2,AGI(agi-VDAD_inbound_calltime_check.agi,INBOUND-----YES-----START)
#exten => 1234,3,Hangup #exten => 1234,3,Hangup
# #
# Copyright (C) 2008 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2 # Copyright (C) 2008 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
@@ -24,6 +27,8 @@
# changes: # changes:
# 80525-0144 - First Build # 80525-0144 - First Build
# 81015-0305 - Added drop logging # 81015-0305 - Added drop logging
# 81015-2009 - Added more logging and NOTE option
# 81017-0238 - Fixed duplication bug for vac in multi-entry dialplans
# #
$script = 'agi-VDAD_inbound_calltime_check.agi'; $script = 'agi-VDAD_inbound_calltime_check.agi';
@@ -147,6 +152,8 @@ if (length($ARGV[0])>1)
$channel_group = $ARGV_vars[0]; $channel_group = $ARGV_vars[0];
$log_to_vac = $ARGV_vars[1]; $log_to_vac = $ARGV_vars[1];
$note = $ARGV_vars[2];
if (length($note)<1) {$note = 'NONE';}
} }
$|=1; $|=1;
@@ -162,6 +169,8 @@ while(<STDIN>)
} }
} }
if (/^agi_context\:\s+(.*)$/) {$context = $1;}
if (/^agi_priority\:\s+(.*)$/) {$priority = $1;}
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;}
@@ -302,7 +311,8 @@ if ( ($ct_day_start > 0) || ($ct_day_stop > 0) )
$ct_default_stop = $ct_day_stop; $ct_default_stop = $ct_day_stop;
} }
$AGI->stream_file('beep'); $AGI->stream_file('sip-silence');
$AGI->stream_file('sip-silence');
@@ -330,7 +340,8 @@ if ( ($hm < $ct_default_start) || ($hm > $ct_default_stop) )
if (length($DROPexten)>0) if (length($DROPexten)>0)
{ ### if DROP extension is defined then send the dropped call there instead of hangup { ### if DROP extension is defined then send the dropped call there instead of hangup
$AGI->stream_file('ding'); # stop music-on-hold process $AGI->stream_file('sip-silence'); # stop music-on-hold process
$AGI->stream_file('sip-silence'); # stop music-on-hold process
sleep(1); sleep(1);
@@ -347,7 +358,7 @@ if ( ($hm < $ct_default_start) || ($hm > $ct_default_stop) )
$affected_rows = $dbhA->do($stmtA); $affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VDCL vac record deleted: |$affected_rows| $uniqueid|$callerid|"; &agi_output;} if ($AGILOG) {$agi_string = "-- VDCL vac record deleted: |$affected_rows| $uniqueid|$callerid|"; &agi_output;}
$stmtA = "INSERT INTO live_inbound_log (uniqueid,channel,server_ip,caller_id,extension,start_time,comment_a,comment_b,comment_c) values('$uniqueid','$channel','$VARserver_ip','$callerid','$extension','$SQLdate','$channel_group','$phone_number','AFTERHOURSDROP')"; $stmtA = "INSERT INTO live_inbound_log (uniqueid,channel,server_ip,caller_id,extension,phone_ext,start_time,comment_a,comment_b,comment_c,comment_d,comment_e) values('$uniqueid','$channel','$VARserver_ip','$callerid','$extension','$phone_number','$SQLdate','$channel_group','$note','AFTERHOURSDROP','$context','$priority')";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$affected_rowsL = $dbhA->do($stmtA); $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;}
@@ -384,13 +395,17 @@ if ( ($hm < $ct_default_start) || ($hm > $ct_default_stop) )
### insert an IVR record to the vicidial_auto_calls table ### insert an IVR record to the vicidial_auto_calls table
if ($log_to_vac == 'YES') if ($log_to_vac == 'YES')
{ {
$stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' and uniqueid='$uniqueid' and server_ip='$VARserver_ip';";
$affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VDCL vac record deleted: |$affected_rows| $uniqueid|$callerid|"; &agi_output;}
$stmtA = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,lead_id,status,uniqueid,callerid,channel,phone_code,phone_number,call_time,call_type,stage,queue_priority,last_update_time) values('$VARserver_ip','$channel_group','0','IVR','$uniqueid','$callerid','$channel','$phone_code','$phone_number','$SQLdate','IN','IVR-0','$queue_priority','$last_update_time')"; $stmtA = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,lead_id,status,uniqueid,callerid,channel,phone_code,phone_number,call_time,call_type,stage,queue_priority,last_update_time) values('$VARserver_ip','$channel_group','0','IVR','$uniqueid','$callerid','$channel','$phone_code','$phone_number','$SQLdate','IN','IVR-0','$queue_priority','$last_update_time')";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$affected_rowsV = $dbhA->do($stmtA); $affected_rowsV = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VAC : |$affected_rowsV|$uniqueid|$callerid|$extension|"; &agi_output;} if ($AGILOG) {$agi_string = "-- VAC : |$affected_rowsV|$uniqueid|$callerid|$extension|"; &agi_output;}
} }
$stmtA = "INSERT INTO live_inbound_log (uniqueid,channel,server_ip,caller_id,extension,start_time,comment_a,comment_b) values('$uniqueid','$channel','$VARserver_ip','$callerid','$extension','$SQLdate','$channel_group','$phone_number')"; $stmtA = "INSERT INTO live_inbound_log (uniqueid,channel,server_ip,caller_id,extension,phone_ext,start_time,comment_a,comment_b,comment_d,comment_e) values('$uniqueid','$channel','$VARserver_ip','$callerid','$extension','$phone_number','$SQLdate','$channel_group','$note','$context','$priority')";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$affected_rowsL = $dbhA->do($stmtA); $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;}
+327 -286
View File
@@ -70,6 +70,8 @@
# 80713-0624 - Added vicidial_list_last_local_call_time field # 80713-0624 - Added vicidial_list_last_local_call_time field
# 80829-2359 - Added extended alt dial and dnc checkon all alt dial hopper insertions # 80829-2359 - Added extended alt dial and dnc checkon all alt dial hopper insertions
# 80909-0845 - Added support for campaign-specific DNC lists # 80909-0845 - Added support for campaign-specific DNC lists
# 81013-2216 - Fixed improper deletion of auto_calls records
# 81020-0125 - Bug fixes from changes to auto_calls deletion changes
# #
@@ -951,13 +953,13 @@ while($one_day_interval > 0)
{ {
if (length($KLserver_ip[$kill_vac]) > 7) if (length($KLserver_ip[$kill_vac]) > 7)
{ {
$end_epoch=0; $CLuniqueid=''; $end_epoch=0; $CLuniqueid=''; $start_epoch=0;
$KLcalleridCHECK[$kill_vac]=$KLcallerid[$kill_vac]; $KLcalleridCHECK[$kill_vac]=$KLcallerid[$kill_vac];
$KLcalleridCHECK[$kill_vac] =~ s/\W//gi; $KLcalleridCHECK[$kill_vac] =~ s/\W//gi;
if ( (length($KLcalleridCHECK[$kill_vac]) > 17) && ($KLcalleridCHECK[$kill_vac] =~ /\d\d\d\d\d\d\d\d\d\d\d\d\d\d/) ) if ( (length($KLcalleridCHECK[$kill_vac]) > 17) && ($KLcalleridCHECK[$kill_vac] =~ /\d\d\d\d\d\d\d\d\d\d\d\d\d\d/) )
{ {
$stmtA = "SELECT end_epoch,uniqueid FROM call_log where caller_code='$KLcallerid[$kill_vac]' and server_ip='$KLserver_ip[$kill_vac]' order by end_epoch, start_time desc limit 1;"; $stmtA = "SELECT end_epoch,uniqueid,start_epoch FROM call_log where caller_code='$KLcallerid[$kill_vac]' and server_ip='$KLserver_ip[$kill_vac]' order by end_epoch, start_time desc limit 1;";
$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;
@@ -968,6 +970,7 @@ while($one_day_interval > 0)
@aryA = $sthA->fetchrow_array; @aryA = $sthA->fetchrow_array;
$end_epoch = "$aryA[0]"; $end_epoch = "$aryA[0]";
$CLuniqueid = "$aryA[1]"; $CLuniqueid = "$aryA[1]";
$start_epoch = "$aryA[2]";
$rec_count++; $rec_count++;
} }
$sthA->finish(); $sthA->finish();
@@ -975,7 +978,7 @@ while($one_day_interval > 0)
if ( (length($KLuniqueid[$kill_vac]) > 11) && (length($CLuniqueid) < 12) ) if ( (length($KLuniqueid[$kill_vac]) > 11) && (length($CLuniqueid) < 12) )
{ {
$stmtA = "SELECT end_epoch,uniqueid FROM call_log where uniqueid='$KLuniqueid[$kill_vac]' and server_ip='$KLserver_ip[$kill_vac]' order by end_epoch, start_time desc limit 1;"; $stmtA = "SELECT end_epoch,uniqueid,start_epoch FROM call_log where uniqueid='$KLuniqueid[$kill_vac]' and server_ip='$KLserver_ip[$kill_vac]' order by end_epoch, start_time desc limit 1;";
$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;
@@ -986,308 +989,173 @@ while($one_day_interval > 0)
@aryA = $sthA->fetchrow_array; @aryA = $sthA->fetchrow_array;
$end_epoch = "$aryA[0]"; $end_epoch = "$aryA[0]";
$CLuniqueid = "$aryA[1]"; $CLuniqueid = "$aryA[1]";
$start_epoch = "$aryA[2]";
$rec_count++; $rec_count++;
} }
$sthA->finish(); $sthA->finish();
} }
if ($end_epoch > 1000)
$CLlead_id=''; $auto_call_id=''; $CLstatus=''; $CLcampaign_id=''; $CLphone_number=''; $CLphone_code='';
$stmtA = "SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,call_type FROM vicidial_auto_calls where callerid='$KLcallerid[$kill_vac]'";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$rec_count=0;
$rec_countCUSTDATA=0;
while ($sthArows > $rec_count)
{ {
$CLlead_id=''; $auto_call_id=''; $CLstatus=''; $CLcampaign_id=''; $CLphone_number=''; $CLphone_code=''; @aryA = $sthA->fetchrow_array;
$auto_call_id = "$aryA[0]";
$CLlead_id = "$aryA[1]";
$CLphone_number = "$aryA[2]";
$CLstatus = "$aryA[3]";
$CLcampaign_id = "$aryA[4]";
$CLphone_code = "$aryA[5]";
$CLalt_dial = "$aryA[6]";
$CLstage = "$aryA[7]";
$CLcall_type = "$aryA[8]";
$rec_count++;
}
$sthA->finish();
$stmtA = "SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage FROM vicidial_auto_calls where callerid='$KLcallerid[$kill_vac]'"; if ($CLcall_type =~ /IN/)
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; {
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $stmtA = "SELECT drop_call_seconds FROM vicidial_inbound_groups where group_id='$CLcampaign_id';";
$sthArows=$sthA->rows; $timeout_leeway = 30;
$rec_count=0; }
$rec_countCUSTDATA=0; else
while ($sthArows > $rec_count) {
$stmtA = "SELECT dial_timeout,drop_call_seconds FROM vicidial_campaigns where campaign_id='$CLcampaign_id';";
$timeout_leeway = 7;
}
$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;
$CLdial_timeout = "$aryA[0]";
$CLdrop_call_seconds = "$aryA[1]";
}
$sthA->finish();
$dialtime_log = ($end_epoch - $start_epoch);
$dialtime_catch = ($now_date_epoch - ($start_epoch + $timeout_leeway));
if ($dialtime_catch > 100000) {$dialtime_catch=0;}
$call_timeout = ($CLdial_timeout + $CLdrop_call_seconds);
if ($CLstage =~ /SURVEY|REMIND/) {$call_timeout = ($call_timeout + 120);}
if ( ($dialtime_log >= $call_timeout) || ($dialtime_catch >= $call_timeout) || ($CLstatus =~ /BUSY|DISCONNECT|XFER|CLOSER/) )
{
if ($CLcall_type !~ /IN/)
{ {
@aryA = $sthA->fetchrow_array; if ($CLstatus !~ /XFER|CLOSER/)
$auto_call_id = "$aryA[0]";
$CLlead_id = "$aryA[1]";
$CLphone_number = "$aryA[2]";
$CLstatus = "$aryA[3]";
$CLcampaign_id = "$aryA[4]";
$CLphone_code = "$aryA[5]";
$CLalt_dial = "$aryA[6]";
$CLstage = "$aryA[7]";
$rec_count++;
}
$sthA->finish();
$stmtA = "DELETE from vicidial_auto_calls where auto_call_id='$auto_call_id'";
$affected_rows = $dbhA->do($stmtA);
$event_string = "| dead call vac deleted|$auto_call_id|$CLlead_id|$KLcallerid[$kill_vac]|$end_epoch|$affected_rows|$KLchannel[$kill_vac]|";
&event_logger;
if ($CLstatus !~ /XFER|CLOSER/)
{
$CLstage =~ s/LIVE|-//gi;
if ($CLstage < 0.25) {$CLstage=1;}
if ($CLstatus =~ /BUSY/) {$CLnew_status = 'B';}
else
{ {
if ($CLstatus =~ /DISCONNECT/) {$CLnew_status = 'DC';} $stmtA = "DELETE from vicidial_auto_calls where auto_call_id='$auto_call_id'";
else {$CLnew_status = 'NA';}
}
if ($CLstatus =~ /LIVE/) {$CLnew_status = 'DROP';}
else
{
$end_epoch = ($now_date_epoch + 1);
$stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed,length_in_sec,end_epoch,alt_dial) values('$CLuniqueid','$CLlead_id','$CLcampaign_id','$SQLdate','$now_date_epoch','$CLnew_status','$CLphone_code','$CLphone_number','VDAD','N','$CLstage','$end_epoch','$CLalt_dial')";
if($M){print STDERR "\n|$stmtA|\n";}
$affected_rows = $dbhA->do($stmtA); $affected_rows = $dbhA->do($stmtA);
$event_string = "| dead NA call added to log $CLuniqueid|$CLlead_id|$CLphone_number|$CLstatus|$CLnew_status|$affected_rows|"; $event_string = "| dead call vac deleted|$auto_call_id|$CLlead_id|$KLcallerid[$kill_vac]|$end_epoch|$affected_rows|$KLchannel[$kill_vac]|$CLcall_type|$CLdial_timeout|$CLdrop_call_seconds|$call_timeout|$dialtime_log|$dialtime_catch|";
&event_logger; &event_logger;
} $CLstage =~ s/LIVE|-//gi;
if ($CLstage < 0.25) {$CLstage=1;}
if ($CLlead_id > 0) if ($CLstatus =~ /BUSY/) {$CLnew_status = 'B';}
{ else
$stmtA = "UPDATE vicidial_list set status='$CLnew_status' where lead_id='$CLlead_id'"; {
if ($CLstatus =~ /DISCONNECT/) {$CLnew_status = 'DC';}
else {$CLnew_status = 'NA';}
}
if ($CLstatus =~ /LIVE/) {$CLnew_status = 'DROP';}
else
{
$end_epoch = ($now_date_epoch + 1);
$stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed,length_in_sec,end_epoch,alt_dial) values('$CLuniqueid','$CLlead_id','$CLcampaign_id','$SQLdate','$now_date_epoch','$CLnew_status','$CLphone_code','$CLphone_number','VDAD','N','$CLstage','$end_epoch','$CLalt_dial')";
if($M){print STDERR "\n|$stmtA|\n";}
$affected_rows = $dbhA->do($stmtA);
$event_string = "| dead NA call added to log $CLuniqueid|$CLlead_id|$CLphone_number|$CLstatus|$CLnew_status|$affected_rows|";
&event_logger;
}
if ($CLlead_id > 0)
{
$stmtA = "UPDATE vicidial_list set status='$CLnew_status' where lead_id='$CLlead_id'";
$affected_rows = $dbhA->do($stmtA);
$event_string = "| dead call vac lead marked $CLnew_status|$CLlead_id|$CLphone_number|$CLstatus|";
&event_logger;
}
$stmtA = "UPDATE vicidial_live_agents set status='PAUSED',random_id='10' where callerid='$KLcallerid[$kill_vac]';";
$affected_rows = $dbhA->do($stmtA); $affected_rows = $dbhA->do($stmtA);
$event_string = "| dead call vac lead marked $CLnew_status|$CLlead_id|$CLphone_number|$CLstatus|"; $event_string = "| dead call vla agent PAUSED $affected_rows|$CLlead_id|$CLphone_number|$CLstatus|";
&event_logger; &event_logger;
}
$stmtA = "UPDATE vicidial_live_agents set status='PAUSED',random_id='10' where callerid='$KLcallerid[$kill_vac]';"; if ( ($enable_queuemetrics_logging > 0) && ($CLstatus =~ /LIVE/) )
$affected_rows = $dbhA->do($stmtA);
$event_string = "| dead call vla agent PAUSED $affected_rows|$CLlead_id|$CLphone_number|$CLstatus|";
&event_logger;
if ( ($enable_queuemetrics_logging > 0) && ($CLstatus =~ /LIVE/) )
{
$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 DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";}
$stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='$KLcallerid[$kill_vac]',queue='$CLcampaign_id',agent='NONE',verb='ABANDON',data1='1',data2='1',data3='$CLstage',serverid='$queuemetrics_log_id';";
$Baffected_rows = $dbhB->do($stmtB);
$dbhB->disconnect();
}
##### BEGIN AUTO ALT PHONE DIAL SECTION #####
### check to see if campaign has alt_dial enabled
$VD_auto_alt_dial = 'NONE';
$VD_auto_alt_dial_statuses='';
$stmtA="SELECT auto_alt_dial,auto_alt_dial_statuses,use_internal_dnc,use_campaign_dnc FROM vicidial_campaigns where campaign_id='$CLcampaign_id';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$epc_countCAMPDATA=0;
while ($sthArows > $epc_countCAMPDATA)
{
@aryA = $sthA->fetchrow_array;
$VD_auto_alt_dial = "$aryA[0]";
$VD_auto_alt_dial_statuses = "$aryA[1]";
$VD_use_internal_dnc = "$aryA[2]";
$VD_use_campaign_dnc = "$aryA[3]";
$epc_countCAMPDATA++;
}
$sthA->finish();
if ( ($VD_auto_alt_dial_statuses =~ / $CLnew_status /) && ($CLlead_id > 0) )
{
if ( ($VD_auto_alt_dial =~ /ALT_ONLY|ALT_AND_ADDR3|ALT_AND_EXTENDED/) && ($CLalt_dial =~ /NONE|MAIN/) )
{ {
$alt_dial_skip=0; $dbhB = DBI->connect("DBI:mysql:$queuemetrics_dbname:$queuemetrics_server_ip:3306", "$queuemetrics_login", "$queuemetrics_pass")
$VD_alt_phone=''; or die "Couldn't connect to database: " . DBI->errstr;
$stmtA="SELECT alt_phone,gmt_offset_now,state,list_id FROM vicidial_list where lead_id='$CLlead_id';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} if ($DBX) {print "CONNECTED TO DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='$KLcallerid[$kill_vac]',queue='$CLcampaign_id',agent='NONE',verb='ABANDON',data1='1',data2='1',data3='$CLstage',serverid='$queuemetrics_log_id';";
$sthArows=$sthA->rows; $Baffected_rows = $dbhB->do($stmtB);
$epc_countCAMPDATA=0;
while ($sthArows > $epc_countCAMPDATA) $dbhB->disconnect();
{
@aryA = $sthA->fetchrow_array;
$VD_alt_phone = "$aryA[0]";
$VD_alt_phone =~ s/\D//gi;
$VD_gmt_offset_now = "$aryA[1]";
$VD_state = "$aryA[2]";
$VD_list_id = "$aryA[3]";
$epc_countCAMPDATA++;
}
$sthA->finish();
if (length($VD_alt_phone)>5)
{
if ($VD_use_internal_dnc =~ /Y/)
{
$stmtA="SELECT count(*) FROM vicidial_dnc where phone_number='$VD_alt_phone';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$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;
$VD_alt_dnc_count = "$aryA[0]";
}
$sthA->finish();
}
else {$VD_alt_dnc_count=0;}
if ($VD_use_campaign_dnc =~ /Y/)
{
$stmtA="SELECT count(*) FROM vicidial_campaign_dnc where phone_number='$VD_alt_phone' and campaign_id='$VD_campaign_id';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$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;
$VD_alt_dnc_count = ($VD_alt_dnc_count + $aryA[0]);
}
$sthA->finish();
}
if ($VD_alt_dnc_count < 1)
{
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$CLlead_id',campaign_id='$CLcampaign_id',status='READY',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='ALT',user='',priority='25';";
$affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VDH record inserted: |$affected_rows| |$stmtA|"; &agi_output;}
}
else
{$alt_dial_skip=1;}
}
else
{$alt_dial_skip=1;}
if ($alt_dial_skip > 0)
{$CLalt_dial='ALT';}
} }
if ( ( ($VD_auto_alt_dial =~ /ADDR3_ONLY/) && ($CLalt_dial =~ /NONE|MAIN/) ) || ( ($VD_auto_alt_dial =~ /ALT_AND_ADDR3/) && ($CLalt_dial =~ /ALT/) ) )
{
$addr3_dial_skip=0;
$VD_address3='';
$stmtA="SELECT address3,gmt_offset_now,state,list_id FROM vicidial_list where lead_id='$CLlead_id';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$epc_countCAMPDATA=0;
while ($sthArows > $epc_countCAMPDATA)
{
@aryA = $sthA->fetchrow_array;
$VD_address3 = "$aryA[0]";
$VD_address3 =~ s/\D//gi;
$VD_gmt_offset_now = "$aryA[1]";
$VD_state = "$aryA[2]";
$VD_list_id = "$aryA[3]";
$epc_countCAMPDATA++;
}
$sthA->finish();
if (length($VD_address3)>5)
{
if ($VD_use_internal_dnc =~ /Y/)
{
$stmtA="SELECT count(*) FROM vicidial_dnc where phone_number='$VD_address3';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$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;
$VD_alt_dnc_count = "$aryA[0]";
}
$sthA->finish();
}
else {$VD_alt_dnc_count=0;}
if ($VD_use_campaign_dnc =~ /Y/)
{
$stmtA="SELECT count(*) FROM vicidial_campaign_dnc where phone_number='$VD_address3' and campaign_id='$VD_campaign_id';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$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;
$VD_alt_dnc_count = ($VD_alt_dnc_count + $aryA[0]);
}
$sthA->finish();
}
if ($VD_alt_dnc_count < 1)
{
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$CLlead_id',campaign_id='$CLcampaign_id',status='READY',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='ADDR3',user='',priority='20';";
$affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VDH record inserted: |$affected_rows| |$stmtA|"; &agi_output;}
}
else
{$addr3_dial_skip=1;}
}
else
{$addr3_dial_skip=1;}
if ($addr3_dial_skip > 0)
{$CLalt_dial='ADDR3';}
}
if ( ( ($VD_auto_alt_dial =~ /EXTENDED_ONLY/) && ($CLalt_dial =~ /NONE|MAIN/) ) || ( ($VD_auto_alt_dial =~ /ALT_AND_EXTENDED/) && ($CLalt_dial =~ /ALT/) ) || ( ($VD_auto_alt_dial =~ /ADDR3_AND_EXTENDED|ALT_AND_ADDR3_AND_EXTENDED/) && ($CLalt_dial =~ /ADDR3/) ) || ( ($VD_auto_alt_dial =~ /EXTENDED/) && ($CLalt_dial =~ /^X/) && ($CLalt_dial !~ /XLAST/) ) )
{
if ($CLalt_dial =~ /ADDR3/) {$Xlast=0;}
else
{$Xlast = $CLalt_dial;}
$Xlast =~ s/\D//gi;
if (length($Xlast)<1)
{$Xlast=0;}
$VD_altdialx='';
$stmtA="SELECT gmt_offset_now,state,list_id FROM vicidial_list where lead_id='$CLlead_id';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$epc_countCAMPDATA=0;
while ($sthArows > $epc_countCAMPDATA)
{
@aryA = $sthA->fetchrow_array;
$VD_gmt_offset_now = "$aryA[1]";
$VD_state = "$aryA[2]";
$VD_list_id = "$aryA[3]";
$epc_countCAMPDATA++;
}
$sthA->finish();
$alt_dial_phones_count=0;
$stmtA="SELECT count(*) FROM vicidial_list_alt_phones where lead_id='$CLlead_id';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$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;
$alt_dial_phones_count = "$aryA[0]";
}
$sthA->finish();
while ( ($alt_dial_phones_count > 0) && ($alt_dial_phones_count > $Xlast) ) ##### BEGIN AUTO ALT PHONE DIAL SECTION #####
### check to see if campaign has alt_dial enabled
$VD_auto_alt_dial = 'NONE';
$VD_auto_alt_dial_statuses='';
$stmtA="SELECT auto_alt_dial,auto_alt_dial_statuses,use_internal_dnc,use_campaign_dnc FROM vicidial_campaigns where campaign_id='$CLcampaign_id';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$epc_countCAMPDATA=0;
while ($sthArows > $epc_countCAMPDATA)
{
@aryA = $sthA->fetchrow_array;
$VD_auto_alt_dial = "$aryA[0]";
$VD_auto_alt_dial_statuses = "$aryA[1]";
$VD_use_internal_dnc = "$aryA[2]";
$VD_use_campaign_dnc = "$aryA[3]";
$epc_countCAMPDATA++;
}
$sthA->finish();
if ( ($VD_auto_alt_dial_statuses =~ / $CLnew_status /) && ($CLlead_id > 0) )
{
if ( ($VD_auto_alt_dial =~ /ALT_ONLY|ALT_AND_ADDR3|ALT_AND_EXTENDED/) && ($CLalt_dial =~ /NONE|MAIN/) )
{ {
$Xlast++; $alt_dial_skip=0;
$stmtA="SELECT alt_phone_id,phone_number,active FROM vicidial_list_alt_phones where lead_id='$CLlead_id' and alt_phone_count='$Xlast';"; $VD_alt_phone='';
$stmtA="SELECT alt_phone,gmt_offset_now,state,list_id FROM vicidial_list where lead_id='$CLlead_id';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$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 ($sthArows > 0) $epc_countCAMPDATA=0;
while ($sthArows > $epc_countCAMPDATA)
{ {
@aryA = $sthA->fetchrow_array; @aryA = $sthA->fetchrow_array;
$VD_altdial_id = "$aryA[0]"; $VD_alt_phone = "$aryA[0]";
$VD_altdial_phone = "$aryA[1]"; $VD_alt_phone =~ s/\D//gi;
$VD_altdial_active = "$aryA[2]"; $VD_gmt_offset_now = "$aryA[1]";
$VD_state = "$aryA[2]";
$VD_list_id = "$aryA[3]";
$epc_countCAMPDATA++;
} }
else
{$Xlast=9999999999;}
$sthA->finish(); $sthA->finish();
if (length($VD_alt_phone)>5)
if ($VD_altdial_active =~ /Y/)
{ {
if ($VD_use_internal_dnc =~ /Y/) if ($VD_use_internal_dnc =~ /Y/)
{ {
$stmtA="SELECT count(*) FROM vicidial_dnc where phone_number='$VD_altdial_phone';"; $stmtA="SELECT count(*) FROM vicidial_dnc where phone_number='$VD_alt_phone';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$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;
@@ -1302,7 +1170,7 @@ while($one_day_interval > 0)
else {$VD_alt_dnc_count=0;} else {$VD_alt_dnc_count=0;}
if ($VD_use_campaign_dnc =~ /Y/) if ($VD_use_campaign_dnc =~ /Y/)
{ {
$stmtA="SELECT count(*) FROM vicidial_campaign_dnc where phone_number='$VD_altdial_phone' and campaign_id='$VD_campaign_id';"; $stmtA="SELECT count(*) FROM vicidial_campaign_dnc where phone_number='$VD_alt_phone' and campaign_id='$VD_campaign_id';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$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;
@@ -1316,28 +1184,201 @@ while($one_day_interval > 0)
} }
if ($VD_alt_dnc_count < 1) if ($VD_alt_dnc_count < 1)
{ {
if ($alt_dial_phones_count == $Xlast) $stmtA = "INSERT INTO vicidial_hopper SET lead_id='$CLlead_id',campaign_id='$CLcampaign_id',status='READY',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='ALT',user='',priority='25';";
{$Xlast = 'LAST';}
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$CLlead_id',campaign_id='$CLcampaign_id',status='READY',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='X$Xlast',user='',priority='15';";
$affected_rows = $dbhA->do($stmtA); $affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VDH record inserted: |$affected_rows| |$stmtA|X$Xlast|$VD_altdial_id|"; &agi_output;} if ($AGILOG) {$agi_string = "-- VDH record inserted: |$affected_rows| |$stmtA|"; &agi_output;}
$Xlast=9999999999;
} }
else else
{if ($AGILOG) {$agi_string = "-- VDH alt dial is DNC|X$Xlast|$VD_altdial_phone|"; &agi_output;}} {$alt_dial_skip=1;}
}
else
{$alt_dial_skip=1;}
if ($alt_dial_skip > 0)
{$CLalt_dial='ALT';}
}
if ( ( ($VD_auto_alt_dial =~ /ADDR3_ONLY/) && ($CLalt_dial =~ /NONE|MAIN/) ) || ( ($VD_auto_alt_dial =~ /ALT_AND_ADDR3/) && ($CLalt_dial =~ /ALT/) ) )
{
$addr3_dial_skip=0;
$VD_address3='';
$stmtA="SELECT address3,gmt_offset_now,state,list_id FROM vicidial_list where lead_id='$CLlead_id';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$epc_countCAMPDATA=0;
while ($sthArows > $epc_countCAMPDATA)
{
@aryA = $sthA->fetchrow_array;
$VD_address3 = "$aryA[0]";
$VD_address3 =~ s/\D//gi;
$VD_gmt_offset_now = "$aryA[1]";
$VD_state = "$aryA[2]";
$VD_list_id = "$aryA[3]";
$epc_countCAMPDATA++;
}
$sthA->finish();
if (length($VD_address3)>5)
{
if ($VD_use_internal_dnc =~ /Y/)
{
$stmtA="SELECT count(*) FROM vicidial_dnc where phone_number='$VD_address3';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$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;
$VD_alt_dnc_count = "$aryA[0]";
}
$sthA->finish();
}
else {$VD_alt_dnc_count=0;}
if ($VD_use_campaign_dnc =~ /Y/)
{
$stmtA="SELECT count(*) FROM vicidial_campaign_dnc where phone_number='$VD_address3' and campaign_id='$VD_campaign_id';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$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;
$VD_alt_dnc_count = ($VD_alt_dnc_count + $aryA[0]);
}
$sthA->finish();
}
if ($VD_alt_dnc_count < 1)
{
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$CLlead_id',campaign_id='$CLcampaign_id',status='READY',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='ADDR3',user='',priority='20';";
$affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VDH record inserted: |$affected_rows| |$stmtA|"; &agi_output;}
}
else
{$addr3_dial_skip=1;}
}
else
{$addr3_dial_skip=1;}
if ($addr3_dial_skip > 0)
{$CLalt_dial='ADDR3';}
}
if ( ( ($VD_auto_alt_dial =~ /EXTENDED_ONLY/) && ($CLalt_dial =~ /NONE|MAIN/) ) || ( ($VD_auto_alt_dial =~ /ALT_AND_EXTENDED/) && ($CLalt_dial =~ /ALT/) ) || ( ($VD_auto_alt_dial =~ /ADDR3_AND_EXTENDED|ALT_AND_ADDR3_AND_EXTENDED/) && ($CLalt_dial =~ /ADDR3/) ) || ( ($VD_auto_alt_dial =~ /EXTENDED/) && ($CLalt_dial =~ /^X/) && ($CLalt_dial !~ /XLAST/) ) )
{
if ($CLalt_dial =~ /ADDR3/) {$Xlast=0;}
else
{$Xlast = $CLalt_dial;}
$Xlast =~ s/\D//gi;
if (length($Xlast)<1)
{$Xlast=0;}
$VD_altdialx='';
$stmtA="SELECT gmt_offset_now,state,list_id FROM vicidial_list where lead_id='$CLlead_id';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$epc_countCAMPDATA=0;
while ($sthArows > $epc_countCAMPDATA)
{
@aryA = $sthA->fetchrow_array;
$VD_gmt_offset_now = "$aryA[1]";
$VD_state = "$aryA[2]";
$VD_list_id = "$aryA[3]";
$epc_countCAMPDATA++;
}
$sthA->finish();
$alt_dial_phones_count=0;
$stmtA="SELECT count(*) FROM vicidial_list_alt_phones where lead_id='$CLlead_id';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$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;
$alt_dial_phones_count = "$aryA[0]";
}
$sthA->finish();
while ( ($alt_dial_phones_count > 0) && ($alt_dial_phones_count > $Xlast) )
{
$Xlast++;
$stmtA="SELECT alt_phone_id,phone_number,active FROM vicidial_list_alt_phones where lead_id='$CLlead_id' and alt_phone_count='$Xlast';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$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;
$VD_altdial_id = "$aryA[0]";
$VD_altdial_phone = "$aryA[1]";
$VD_altdial_active = "$aryA[2]";
}
else
{$Xlast=9999999999;}
$sthA->finish();
if ($VD_altdial_active =~ /Y/)
{
if ($VD_use_internal_dnc =~ /Y/)
{
$stmtA="SELECT count(*) FROM vicidial_dnc where phone_number='$VD_altdial_phone';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$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;
$VD_alt_dnc_count = "$aryA[0]";
}
$sthA->finish();
}
else {$VD_alt_dnc_count=0;}
if ($VD_use_campaign_dnc =~ /Y/)
{
$stmtA="SELECT count(*) FROM vicidial_campaign_dnc where phone_number='$VD_altdial_phone' and campaign_id='$VD_campaign_id';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$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;
$VD_alt_dnc_count = ($VD_alt_dnc_count + $aryA[0]);
}
$sthA->finish();
}
if ($VD_alt_dnc_count < 1)
{
if ($alt_dial_phones_count == $Xlast)
{$Xlast = 'LAST';}
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$CLlead_id',campaign_id='$CLcampaign_id',status='READY',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='X$Xlast',user='',priority='15';";
$affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VDH record inserted: |$affected_rows| |$stmtA|X$Xlast|$VD_altdial_id|"; &agi_output;}
$Xlast=9999999999;
}
else
{if ($AGILOG) {$agi_string = "-- VDH alt dial is DNC|X$Xlast|$VD_altdial_phone|"; &agi_output;}}
}
} }
} }
} }
##### END AUTO ALT PHONE DIAL SECTION #####
}
else
{
$event_string = "| dead call vac XFERd do nothing|$CLlead_id|$CLphone_number|$CLstatus|";
&event_logger;
} }
##### END AUTO ALT PHONE DIAL SECTION #####
} }
else else
{ {
$event_string = "| dead call vac XFERd do nothing|$CLlead_id|$CLphone_number|$CLstatus|"; $event_string = "| dead call vac INBOUND do nothing|$CLlead_id|$CLphone_number|$CLstatus|";
&event_logger; &event_logger;
} }
} }
+12 -1
View File
@@ -469,7 +469,7 @@ while($one_day_interval > 0)
} }
$sthA->finish(); $sthA->finish();
$stmtA = "INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,campaign_id,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,channel,uniqueid,callerid,user_level,comments) values('$DBremote_user[$h]','$server_ip','$DBremote_conf_exten[$h]','R/$DBremote_user[$h]','READY','$DBremote_campaign[$h]','$DBremote_random[$h]','$SQLdate','$tsSQLdate','$SQLdate','$DBremote_closer[$h]','','','','$DBuser_level[$h]','REMOTE');"; $stmtA = "INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,campaign_id,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,channel,uniqueid,callerid,user_level,comments) values('$DBremote_user[$h]','$server_ip','$DBremote_conf_exten[$h]','R/$DBremote_user[$h]','READY','$DBremote_campaign[$h]','$DBremote_random[$h]','$SQLdate','$FDtsSQLdate','$SQLdate','$DBremote_closer[$h]','','','','$DBuser_level[$h]','REMOTE');";
$affected_rows = $dbhA->do($stmtA); $affected_rows = $dbhA->do($stmtA);
if ($DBX) {print STDERR "$DBremote_user[$h] NEW INSERT\n";} if ($DBX) {print STDERR "$DBremote_user[$h] NEW INSERT\n";}
if ($TESTrun > 0) if ($TESTrun > 0)
@@ -769,6 +769,17 @@ $now_date = "$year-$mon-$mday $hour:$min:$sec";
$SQLdate = "$year-$mon-$mday $hour:$min:$sec"; $SQLdate = "$year-$mon-$mday $hour:$min:$sec";
$filedate = "$year-$mon-$mday"; $filedate = "$year-$mon-$mday";
$FDtarget = ($secX + 10);
($Fsec,$Fmin,$Fhour,$Fmday,$Fmon,$Fyear,$Fwday,$Fyday,$Fisdst) = localtime($FDtarget);
$Fyear = ($Fyear + 1900);
$Fmon++;
if ($Fmon < 10) {$Fmon = "0$Fmon";}
if ($Fmday < 10) {$Fmday = "0$Fmday";}
if ($Fhour < 10) {$Fhour = "0$Fhour";}
if ($Fmin < 10) {$Fmin = "0$Fmin";}
if ($Fsec < 10) {$Fsec = "0$Fsec";}
$FDtsSQLdate = "$Fyear$Fmon$Fmday$Fhour$Fmin$Fsec";
$BDtarget = ($secX - 10); $BDtarget = ($secX - 10);
($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget); ($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget);
$Byear = ($Byear + 1900); $Byear = ($Byear + 1900);
+2 -2
View File
@@ -820,11 +820,11 @@ sub process_request {
{$VDCLSQL_update = "term_reason='CALLER',";} {$VDCLSQL_update = "term_reason='CALLER',";}
else else
{ {
if ( ($VD_term_reason !~ /AGENT|CALLER|QUEUETIMEOUT/) && ( ($VD_user =~ /VDAD|VDCL/) || (length($VD_user) < 1) ) ) if ( ($VD_term_reason !~ /AGENT|CALLER|QUEUETIMEOUT|AFTERHOURS|HOLDRECALLXFER|HOLDTIME/) && ( ($VD_user =~ /VDAD|VDCL/) || (length($VD_user) < 1) ) )
{$VDCLSQL_term_reason = "term_reason='ABANDON',";} {$VDCLSQL_term_reason = "term_reason='ABANDON',";}
else else
{ {
if ($VD_term_reason !~ /AGENT|CALLER|QUEUETIMEOUT/) if ($VD_term_reason !~ /AGENT|CALLER|QUEUETIMEOUT|AFTERHOURS|HOLDRECALLXFER|HOLDTIME/)
{$VDCLSQL_term_reason = "term_reason='CALLER',";} {$VDCLSQL_term_reason = "term_reason='CALLER',";}
else else
{$VDCLSQL_term_reason = '';} {$VDCLSQL_term_reason = '';}
+2 -1
View File
@@ -6,6 +6,7 @@ The agi-VDAD_inbound_calltime_check.agi script does a check for the calltime sch
A log of the calls going into this agi-VDAD_inbound_calltime_check.agi script is also inserted into the live_inbound_log table. A log of the calls going into this agi-VDAD_inbound_calltime_check.agi script is also inserted into the live_inbound_log table.
The agi-VDAD_inbound_calltime_check.agi script can also be used to log the progression of a call through an IVR if you place it at major points in your IVR dialplan. The third field that you can define allows you to set a note or comment that is placed into the database when the call goes through that step.
The example below shows how to do a very simple IVR before sending to a queue asking if the caller wants English, Spanish, French or German language service. The example below shows how to do a very simple IVR before sending to a queue asking if the caller wants English, Spanish, French or German language service.
@@ -34,7 +35,7 @@ exten => 7275551111,1,Goto(TEST_IN,s,1)
[TEST_IN] [TEST_IN]
exten => s,1,AGI(agi-VDAD_inbound_calltime_check.agi,TEST_IN-----YES) exten => s,1,AGI(agi-VDAD_inbound_calltime_check.agi,TEST_IN-----YES-----START)
exten => s,2,Background(test_in_menu) exten => s,2,Background(test_in_menu)
exten => s,n,WaitExten(10) exten => s,n,WaitExten(10)
exten => s,n,Background(test_in_menu) exten => s,n,Background(test_in_menu)
+4 -1
View File
@@ -156,6 +156,8 @@ call actions before going to agent - used by agi-VDAD_ALL_inbound/outbound scrip
ENTERQUEUE(url|callerid) ENTERQUEUE(url|callerid)
CONNECT(holdtime) CONNECT(holdtime)
EXITWITHTIMEOUT(position) EXITWITHTIMEOUT(position)
EXITWITHKEY(key|position)
TRANSFER(extension|context|holdtime|calltime)
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)
@@ -167,7 +169,8 @@ call actions after going to agent - used by vicidial.php, vdc_db_query.php and F
not used in vicidial - not used in vicidial -
TRANSFER(extension,context) EXITEMPTY(position|origposition|waittime)
AGENTDUMP
+4 -4
View File
@@ -266,9 +266,9 @@ vi /usr/local/lib/php.ini
cd /usr/local cd /usr/local
wget http://bart.eaccelerator.net/source/0.9.5/eaccelerator-0.9.5.zip wget http://bart.eaccelerator.net/source/0.9.5.3/eaccelerator-0.9.5.3.zip
unzip eaccelerator-0.9.5.zip unzip eaccelerator-0.9.5.3.zip
cd eaccelerator-0.9.5 cd eaccelerator-0.9.5.3
export PHP_PREFIX="/usr/local" export PHP_PREFIX="/usr/local"
$PHP_PREFIX/bin/phpize $PHP_PREFIX/bin/phpize
./configure --enable-eaccelerator=shared --with-php-config=$PHP_PREFIX/bin/php-config ./configure --enable-eaccelerator=shared --with-php-config=$PHP_PREFIX/bin/php-config
@@ -279,7 +279,7 @@ vi /usr/local/lib/php.ini
Add the following lines to the dynamic extensions section of php.ini: Add the following lines to the dynamic extensions section of php.ini:
(you may need to change the extension location depending on your install of php) (you may need to change the extension location depending on your install of php)
zend_extension="../../../usr/local/eaccelerator-0.9.5/modules/eaccelerator.so" zend_extension="../../../usr/local/eaccelerator-0.9.5.3/modules/eaccelerator.so"
eaccelerator.shm_size="48" eaccelerator.shm_size="48"
eaccelerator.cache_dir="/tmp/eaccelerator" eaccelerator.cache_dir="/tmp/eaccelerator"
eaccelerator.enable="1" eaccelerator.enable="1"
+1 -1
View File
@@ -973,7 +973,7 @@ with the following patch:
- patch -p1 ./codecs/gsm/Makefile 1.2-gsm-gcc4.2.patch - patch -p1 ./codecs/gsm/Makefile 1.2-gsm-gcc4.2.patch
*OPTIONAL*(1.2.14 thru 1.2.30.2) rewrite of waitforsilence *OPTIONAL*(1.2.14 thru 1.2.30.2) rewrite of waitforsilence
- wget http://www.eflo.net/files/app_waitforsilence.c - wget http://downloads.vicidial.com/asterisk-patches/app_waitforsilence.c
- mv -f app_waitforsilence.c apps/app_waitforsilence.c - mv -f app_waitforsilence.c apps/app_waitforsilence.c
*OPTIONAL* shorter enter and leave sounds for meetme *OPTIONAL* shorter enter and leave sounds for meetme
+11 -7
View File
@@ -1333,13 +1333,13 @@ if ($stage == "end")
$four_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-4,date("i"),date("s"),date("m"),date("d"),date("Y"))); $four_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-4,date("i"),date("s"),date("m"),date("d"),date("Y")));
##### look for the start epoch in the vicidial_closer_log table ##### look for the start epoch in the vicidial_closer_log table
$stmt="SELECT start_epoch,term_reason,closecallid FROM vicidial_closer_log where phone_number='$phone_number' and lead_id='$lead_id' and user='$user' and call_date > \"$four_hours_ago\" order by closecallid desc limit 1;"; $stmt="SELECT start_epoch,term_reason,closecallid,campaign_id FROM vicidial_closer_log where phone_number='$phone_number' and lead_id='$lead_id' and user='$user' and call_date > \"$four_hours_ago\" order by closecallid desc limit 1;";
$VDIDselect = "VDCL_LID $lead_id $phone_number $user $four_hours_ago"; $VDIDselect = "VDCL_LID $lead_id $phone_number $user $four_hours_ago";
} }
else else
{ {
##### look for the start epoch in the vicidial_log table ##### look for the start epoch in the vicidial_log table
$stmt="SELECT start_epoch,term_reason,uniqueid FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id' order by call_date desc limit 1;"; $stmt="SELECT start_epoch,term_reason,uniqueid,campaign_id FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id' order by call_date desc limit 1;";
$VDIDselect = "VDL_UIDLID $uniqueid $lead_id"; $VDIDselect = "VDL_UIDLID $uniqueid $lead_id";
} }
$rslt=mysql_query($stmt, $link); $rslt=mysql_query($stmt, $link);
@@ -1351,6 +1351,7 @@ if ($stage == "end")
$start_epoch = $row[0]; $start_epoch = $row[0];
$VDterm_reason = $row[1]; $VDterm_reason = $row[1];
$VDvicidial_id = $row[2]; $VDvicidial_id = $row[2];
$VDcampaign_id = $row[3];
$length_in_sec = ($StarTtime - $start_epoch); $length_in_sec = ($StarTtime - $start_epoch);
} }
else else
@@ -1365,7 +1366,7 @@ if ($stage == "end")
fclose($fp); fclose($fp);
##### start epoch in the vicidial_log table, couldn't find one in vicidial_closer_log ##### start epoch in the vicidial_log table, couldn't find one in vicidial_closer_log
$stmt="SELECT start_epoch,term_reason FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id' order by call_date desc limit 1;"; $stmt="SELECT start_epoch,term_reason,campaign_id FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id' order by call_date desc limit 1;";
$rslt=mysql_query($stmt, $link); $rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";} if ($DB) {echo "$stmt\n";}
$VM_mancall_ct = mysql_num_rows($rslt); $VM_mancall_ct = mysql_num_rows($rslt);
@@ -1374,6 +1375,7 @@ if ($stage == "end")
$row=mysql_fetch_row($rslt); $row=mysql_fetch_row($rslt);
$start_epoch = $row[0]; $start_epoch = $row[0];
$VDterm_reason = $row[1]; $VDterm_reason = $row[1];
$VDcampaign_id = $row[2];
$length_in_sec = ($StarTtime - $start_epoch); $length_in_sec = ($StarTtime - $start_epoch);
} }
else else
@@ -1384,6 +1386,8 @@ if ($stage == "end")
} }
else {$length_in_sec = ($StarTtime - $start_epoch);} else {$length_in_sec = ($StarTtime - $start_epoch);}
if (strlen($VDcampaign_id)<1) {$VDcampaign_id = $campaign;}
$four_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-4,date("i"),date("s"),date("m"),date("d"),date("Y"))); $four_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-4,date("i"),date("s"),date("m"),date("d"),date("Y")));
if ($VLA_inOUT == 'INBOUND') if ($VLA_inOUT == 'INBOUND')
@@ -1695,7 +1699,7 @@ if ($stage == "end")
if ($caller_complete < 1) if ($caller_complete < 1)
{ {
$stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$campaign',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='1',serverid='$queuemetrics_log_id';"; $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";} if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $linkB); $rslt=mysql_query($stmt, $linkB);
$affected_rows = mysql_affected_rows($linkB); $affected_rows = mysql_affected_rows($linkB);
@@ -1710,7 +1714,7 @@ if ($stage == "end")
} }
### delete call record from vicidial_auto_calls ### delete call record from vicidial_auto_calls
$stmt = "DELETE from vicidial_auto_calls where lead_id='$lead_id' and campaign_id='$campaign' and uniqueid='$uniqueid';"; $stmt = "DELETE from vicidial_auto_calls where lead_id='$lead_id' and campaign_id='$VDcampaign_id' and uniqueid='$uniqueid';";
if ($DB) {echo "$stmt\n";} if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link); $rslt=mysql_query($stmt, $link);
@@ -1756,14 +1760,14 @@ if ($stage == "end")
$CLstage = preg_replace("/XFER|-/",'',$CLstage); $CLstage = preg_replace("/XFER|-/",'',$CLstage);
if ($CLstage < 0.25) {$CLstage=0;} if ($CLstage < 0.25) {$CLstage=0;}
$stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$campaign',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='1',serverid='$queuemetrics_log_id';"; $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";} if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $linkB); $rslt=mysql_query($stmt, $linkB);
$affected_rows = mysql_affected_rows($linkB); $affected_rows = mysql_affected_rows($linkB);
} }
# $stmt = "DELETE from vicidial_auto_calls lead_id='$lead_id' and campaign_id='$campaign' and uniqueid='$uniqueid';"; # $stmt = "DELETE from vicidial_auto_calls lead_id='$lead_id' and campaign_id='$campaign' and uniqueid='$uniqueid';";
$stmt = "DELETE from vicidial_auto_calls lead_id='$lead_id' and campaign_id='$campaign' and callerid LIKE \"M%\";"; $stmt = "DELETE from vicidial_auto_calls lead_id='$lead_id' and campaign_id='$VDcampaign_id' and callerid LIKE \"M%\";";
if ($DB) {echo "$stmt\n";} if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link); $rslt=mysql_query($stmt, $link);
+5 -4
View File
@@ -197,10 +197,11 @@
# 81012-1729 - Added INBOUND_MAN dial method to allow manual list dialing and inbound calls # 81012-1729 - Added INBOUND_MAN dial method to allow manual list dialing and inbound calls
# 81013-1644 - Fixed bug in leave 3way for manual dial fronters # 81013-1644 - Fixed bug in leave 3way for manual dial fronters
# 81015-0405 - Fixed bug related to hangups on 3way calls # 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
# #
$version = '2.0.5-175'; $version = '2.0.5-176';
$build = '81015-0405'; $build = '81016-0703';
require("dbconnect.php"); require("dbconnect.php");
@@ -5158,7 +5159,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
document.vicidial_form.xferchannel.value = ""; document.vicidial_form.xferchannel.value = "";
lastxferchannel=''; lastxferchannel='';
document.getElementById("Leave3WayCall").innerHTML ="<IMG SRC=\"./images/vdc_XB_leave3waycall_OFF.gif\" border=0 alt=\"LEAVE 3-WAY CALL\">"; // document.getElementById("Leave3WayCall").innerHTML ="<IMG SRC=\"./images/vdc_XB_leave3waycall_OFF.gif\" border=0 alt=\"LEAVE 3-WAY CALL\">";
document.getElementById("DialWithCustomer").innerHTML ="<a href=\"#\" onclick=\"SendManualDial('YES');return false;\"><IMG SRC=\"./images/vdc_XB_dialwithcustomer.gif\" border=0 alt=\"Dial With Customer\"></a>"; document.getElementById("DialWithCustomer").innerHTML ="<a href=\"#\" onclick=\"SendManualDial('YES');return false;\"><IMG SRC=\"./images/vdc_XB_dialwithcustomer.gif\" border=0 alt=\"Dial With Customer\"></a>";
@@ -7354,7 +7355,7 @@ Your Status: <span id="AgentStatusStatus"></span> <BR>Calls Dialing: <span id="A
<IMG SRC="./images/vdc_XB_number.gif" border=0 alt="Number to call"> <input type=text size=15 name=xfernumber maxlength=25 class="cust_form"> &nbsp; <IMG SRC="./images/vdc_XB_number.gif" border=0 alt="Number to call"> <input type=text size=15 name=xfernumber maxlength=25 class="cust_form"> &nbsp;
<input type=hidden name=xferuniqueid> <input type=hidden name=xferuniqueid>
<input type=checkbox name=xferoverride size=1 value="0"><font class="body_tiny"> DIAL OVERRIDE</font> &nbsp; <input type=checkbox name=xferoverride size=1 value="0"><font class="body_tiny"> DIAL OVERRIDE</font> &nbsp;
<span STYLE="background-color: #CCCCCC" id="Leave3WayCall"><IMG SRC="./images/vdc_XB_leave3waycall_OFF.gif" border=0 alt="LEAVE 3-WAY CALL"></span> <span STYLE="background-color: #CCCCCC" id="Leave3WayCall"><a href="#" onclick="leave_3way_call('FIRST');return false;"><IMG SRC="./images/vdc_XB_leave3waycall.gif" border=0 alt="LEAVE 3-WAY CALL"></a></span>
<span STYLE="background-color: #CCCCCC" id="DialBlindTransfer"><IMG SRC="./images/vdc_XB_blindtransfer_OFF.gif" border=0 alt="Dial Blind Transfer"></span> <span STYLE="background-color: #CCCCCC" id="DialBlindTransfer"><IMG SRC="./images/vdc_XB_blindtransfer_OFF.gif" border=0 alt="Dial Blind Transfer"></span>
<a href="#" onclick="DtMf_PreSet_a();return false;"><font class="body_tiny">D1</font></a> <a href="#" onclick="DtMf_PreSet_a();return false;"><font class="body_tiny">D1</font></a>
<a href="#" onclick="DtMf_PreSet_b();return false;"><font class="body_tiny">D2</font></a> <a href="#" onclick="DtMf_PreSet_b();return false;"><font class="body_tiny">D2</font></a>
+8
View File
@@ -14,6 +14,7 @@
# 80430-1920 - Added Customer hangup cause stats # 80430-1920 - Added Customer hangup cause stats
# 80709-0331 - Added time stats to call statuses # 80709-0331 - Added time stats to call statuses
# 80722-2149 - Added Status Category stats # 80722-2149 - Added Status Category stats
# 81015-0705 - Added IVR calls count
# #
require("dbconnect.php"); require("dbconnect.php");
@@ -188,7 +189,13 @@ $rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";} if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt); $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';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$rowx=mysql_fetch_row($rslt);
$TOTALcalls = sprintf("%10s", $row[0]); $TOTALcalls = sprintf("%10s", $row[0]);
$IVRcalls = sprintf("%10s", $rowx[0]);
$TOTALsec = $row[1]; $TOTALsec = $row[1];
if ( ($row[0] < 1) or ($TOTALsec < 1) ) if ( ($row[0] < 1) or ($TOTALsec < 1) )
{$average_call_seconds = ' 0';} {$average_call_seconds = ' 0';}
@@ -201,6 +208,7 @@ else
echo "Total calls taken in to this In-Group: $TOTALcalls\n"; echo "Total calls taken in to this In-Group: $TOTALcalls\n";
echo "Average Call Length for all Calls: $average_call_seconds seconds\n"; echo "Average Call Length for all Calls: $average_call_seconds seconds\n";
echo "Calls taken into the IVR for this In-Group: $IVRcalls\n";
echo "\n"; echo "\n";
echo "---------- DROPS\n"; echo "---------- DROPS\n";
+8
View File
@@ -11,6 +11,7 @@
# - Added required user/pass to gain access to this page # - Added required user/pass to gain access to this page
# 61114-2004 - Changed to display CLOSER and DEFAULT, added trunk shortage # 61114-2004 - Changed to display CLOSER and DEFAULT, added trunk shortage
# 80422-0305 - Added phone login to display, lower font size to 2 # 80422-0305 - Added phone login to display, lower font size to 2
# 81013-2227 - Fixed Remote Agent display bug
# #
header ("Content-type: text/html; charset=utf-8"); header ("Content-type: text/html; charset=utf-8");
@@ -176,6 +177,13 @@ $talking_to_print = mysql_num_rows($rslt);
while ($i < $talking_to_print) while ($i < $talking_to_print)
{ {
$phone[$i]=' '; $phone[$i]=' ';
if (eregi("R/",$Sextension[$i]))
{
$protocol = 'EXTERNAL';
$dialplan = eregi_replace('R/',"",$Sextension[$i]);
$dialplan = eregi_replace("\@.*",'',$dialplan);
$exten = "dialplan_number='$dialplan'";
}
if (eregi("Local/",$Sextension[$i])) if (eregi("Local/",$Sextension[$i]))
{ {
$protocol = 'EXTERNAL'; $protocol = 'EXTERNAL';