Added ability to have outbound auto-dial campaigns drop to an audio prompt or a call menu. Outbound IVR Report added. Added optional logging of call menu caller key presses. Lead ID can now be preserved on calls coming from auto-dial or in-groups that go through call menus and back into an in-group.

git-svn-id: svn://192.168.202.10@1664 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2011-05-26 04:37:51 +00:00
parent 7c48dad999
commit a091519340
16 changed files with 919 additions and 177 deletions
+6
View File
@@ -596,6 +596,12 @@ OTHER CHANGES:
131. Change Dial Level Difference Target to work properly with all RATIO and
ADAPT dial method outbound campaigns.
132. Added ability to have outbound auto-dial campaigns drop to an audio prompt
or a call menu. Outbound IVR Report added. Added optional logging of
call menu caller key presses. Lead ID can now be preserved on calls
coming from auto-dial or in-groups that go through call menus and back
into an in-group.
+21 -5
View File
@@ -14,7 +14,7 @@
# ; - CIDLOOKUP - Lookup CID to find record in whole system
# ; - CIDLOOKUPRL - Restrict lookup to one list
# ; - CIDLOOKUPRC - Restrict lookup to one campaign's lists
# ; - CLOSER - Closer calls from VICIDIAL fronters
# ; - CLOSER - Closer calls from VICIDIAL fronters(and previous in-group calls)
# ; - ANI - ANI received, add record with phone number (based on RBS T1s)
# ; - ANILOOKUP - Lookup ANI to find record in whole system
# ; - ANILOOKUPRL - Restrict lookup to one list
@@ -149,6 +149,7 @@
# 110324-2330 - Added recording of remote agent calls, per in-group and campaign recording settings
# 110325-1409 - Added user recording override settings checking for remote agent recording
# 110505-1620 - Fixed minor voicemail issue
# 110525-1555 - Added CLOSER compatibility with outbound and in-group calls that went through Call Menu
#
$script = 'agi-VDAD_ALL_inbound.agi';
@@ -328,6 +329,9 @@ while(<STDIN>)
}
if ($calleridname =~ /^V\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d|^Y\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d/)
{$callerid = $calleridname;}
if ( ($callerid =~ /\".*\"/) && ( (!$calleridname) or ($calleridname =~ /unknown/) ) )
{
$calleridname = $callerid;
@@ -335,10 +339,13 @@ if ( ($callerid =~ /\".*\"/) && ( (!$calleridname) or ($calleridname =~ /unknown
$calleridname =~ s/\"|\" //gi;
}
$callerid =~ s/\D|\'//gi;
$calleridname =~ s/unknown|\'//gi;
if ( (!$callerid) or ($callerid =~ /unknown/) )
{$callerid = $calleridname;}
if ($callerid !~ /^V\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d|^Y\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d/)
{
$callerid =~ s/\D|\'//gi;
$calleridname =~ s/unknown|\'//gi;
if ( (!$callerid) or ($callerid =~ /unknown/) )
{$callerid = $calleridname;}
}
##### find out if this call is already in the vicidial_log_extended table
$VLEcount=0;
@@ -470,6 +477,15 @@ if ($call_handle_method =~ /^CLOSER/)
$AGI->set_callerid($Jnewcallerid);
if ($AGILOG) {$agi_string = "callerID changed: $Jnewcallerid"; &agi_output;}
}
### allow for outbound auto-dial calls or previous in-group calls passed through call menus
if ($callerid =~ /^V\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d|^Y\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d/)
{
$CIDlead_id = substr($callerid, 10, 10);
$CIDlead_id = ($CIDlead_id + 0);
$VCcallerid = $callerid;
$insert_lead_id = $CIDlead_id;
if ($AGILOG) {$agi_string = "Lead ID found: $insert_lead_id"; &agi_output;}
}
}
if ( ($call_handle_method =~ /^CID/) || ($call_handle_method =~ /^VID/) )
+108 -39
View File
@@ -84,6 +84,7 @@
# 110303-2316 - Added condition that would not allow calls to be sent to agent with ringing inbound call
# 110324-2326 - Added recording of remote agent calls, per in-group and campaign recording settings
# 110325-1410 - Added user recording override settings checking for remote agent recording
# 110525-1530 - Added AUDIO and CALLMENU drop options
#
$script = 'agi-VDAD_ALL_outbound.agi';
@@ -476,7 +477,7 @@ if ($VDACaffected_rows > 0)
$sthA->finish();
### Grab campaign values from the database
$stmtA = "SELECT drop_call_seconds,drop_action,safe_harbor_exten,concurrent_transfers,next_agent_call,voicemail_ext,drop_inbound_group,use_internal_dnc,use_campaign_dnc,cpd_amd_action,am_message_exten,three_way_call_cid,campaign_cid,survey_first_audio_file,survey_opt_in_audio_file,survey_ni_audio_file,survey_third_audio_file,survey_fourth_audio_file,extension_appended_cidname,queue_priority,closer_campaigns,queuemetrics_phone_environment,campaign_recording,campaign_rec_filename FROM vicidial_campaigns where campaign_id = '$VDADcampaign';";
$stmtA = "SELECT drop_call_seconds,drop_action,safe_harbor_exten,concurrent_transfers,next_agent_call,voicemail_ext,drop_inbound_group,use_internal_dnc,use_campaign_dnc,cpd_amd_action,am_message_exten,three_way_call_cid,campaign_cid,survey_first_audio_file,survey_opt_in_audio_file,survey_ni_audio_file,survey_third_audio_file,survey_fourth_audio_file,extension_appended_cidname,queue_priority,closer_campaigns,queuemetrics_phone_environment,campaign_recording,campaign_rec_filename,safe_harbor_audio,safe_harbor_menu_id FROM vicidial_campaigns where campaign_id = '$VDADcampaign';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
@@ -511,6 +512,8 @@ if ($VDACaffected_rows > 0)
$queuemetrics_phone_environment = $aryA[21];
$campaign_recording = $aryA[22];
$campaign_rec_filename = $aryA[23];
$safe_harbor_audio = $aryA[24];
$safe_harbor_menu_id = $aryA[25];
if (length($closer_campaigns) > 2)
{
$closer_campaigns =~ s/^ | -$//gi;
@@ -2427,24 +2430,8 @@ if ($drop_timer > $DROP_TIME)
$CIDdate = "$mon$mday$hour$min$sec";
$tsSQLdate = "$year$mon$mday$hour$min$sec";
$SQLdate = "$year-$mon-$mday $hour:$min:$sec";
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='$callerid',queue='$VDADcampaign',agent='NONE',verb='EXITWITHTIMEOUT',data1='1',serverid='$queuemetrics_log_id';";
$Baffected_rows = $dbhB->do($stmtB);
$dbhP=$dbhB; $stmtA=$stmtB; $mysql_count='01048'; $MEL_aff_rows=$Baffected_rows; &mysql_error_logging;
$stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='$callerid',queue='$VDADcampaign',agent='NONE',verb='CALLSTATUS',data1='DROP',serverid='$queuemetrics_log_id';";
$Baffected_rows = $dbhB->do($stmtB);
$dbhP=$dbhB; $stmtA=$stmtB; $mysql_count='01049'; $MEL_aff_rows=$Baffected_rows; &mysql_error_logging;
$dbhB->disconnect();
}
$Euniqueid=$uniqueid;
$Euniqueid =~ s/\.\d+//gi;
if ($drop_seconds < 1)
{
@@ -2494,39 +2481,118 @@ if ($drop_timer > $DROP_TIME)
$S='*';
$DROPexten = "90009*$drop_inbound_group$S$S$CIDlead_id$S$S$VDADphone$S$fronter$S";
}
if ($drop_action =~ /CALLMENU/)
{
$DROPexten = 's';
$ext_context = $safe_harbor_menu_id;
if (length($ext_context)<1)
{$DROPexten = '';}
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;
$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);
$dbhP=$dbhA; $mysql_count='01050'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
if ($AGILOG) {$agi_string = "-- VDAD vicidial_log update: |$affected_rows|$uniqueid"; &agi_output;}
if ($DBX) {print "CONNECTED TO DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";}
$stmtA = "UPDATE vicidial_list set status='DROP' where lead_id = '$CIDlead_id';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$affected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='01051'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
if ($AGILOG) {$agi_string = "-- VDAD vicidial_list update: |$affected_rows|$CIDlead_id"; &agi_output;}
$stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='$callerid',queue='$VDADcampaign',agent='NONE',verb='EXITWITHTIMEOUT',data1='1',serverid='$queuemetrics_log_id';";
$Baffected_rows = $dbhB->do($stmtB);
$dbhP=$dbhB; $stmtA=$stmtB; $mysql_count='01XXX'; $MEL_aff_rows=$Baffected_rows; &mysql_error_logging;
$stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' order by call_time desc limit 1;";
$affected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='01052'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
if ($AGILOG) {$agi_string = "-- VDAD vac record deleted: |$affected_rows|$VDADcampaign|"; &agi_output;}
$stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='$callerid',queue='$VDADcampaign',agent='NONE',verb='CALLSTATUS',data1='IVRXFR',serverid='$queuemetrics_log_id';";
$Baffected_rows = $dbhB->do($stmtB);
$dbhP=$dbhB; $stmtA=$stmtB; $mysql_count='01XXX'; $MEL_aff_rows=$Baffected_rows; &mysql_error_logging;
$dbhB->disconnect();
}
$stmtA = "UPDATE vicidial_log FORCE INDEX(lead_id) set status='IVRXFR',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds',term_reason='CALLMENUXFER' where lead_id = '$CIDlead_id' and uniqueid LIKE \"$Euniqueid%\";";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$affected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
if ($AGILOG) {$agi_string = "-- VDAD vicidial_log update: |$affected_rows|$uniqueid"; &agi_output;}
$stmtA = "UPDATE vicidial_list set status='IVRXFR' where lead_id = '$CIDlead_id';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$affected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
if ($AGILOG) {$agi_string = "-- VDAD vicidial_list update: |$affected_rows|$CIDlead_id"; &agi_output;}
}
else
{
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='$callerid',queue='$VDADcampaign',agent='NONE',verb='EXITWITHTIMEOUT',data1='1',serverid='$queuemetrics_log_id';";
$Baffected_rows = $dbhB->do($stmtB);
$dbhP=$dbhB; $stmtA=$stmtB; $mysql_count='01048'; $MEL_aff_rows=$Baffected_rows; &mysql_error_logging;
$stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='$callerid',queue='$VDADcampaign',agent='NONE',verb='CALLSTATUS',data1='DROP',serverid='$queuemetrics_log_id';";
$Baffected_rows = $dbhB->do($stmtB);
$dbhP=$dbhB; $stmtA=$stmtB; $mysql_count='01049'; $MEL_aff_rows=$Baffected_rows; &mysql_error_logging;
$dbhB->disconnect();
}
$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);
$dbhP=$dbhA; $mysql_count='01050'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
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);
$dbhP=$dbhA; $mysql_count='01051'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
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);
$dbhP=$dbhA; $mysql_count='01052'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
if ($AGILOG) {$agi_string = "-- VDAD vac record deleted: |$affected_rows|$VDADcampaign|"; &agi_output;}
}
if ($drop_action =~ /AUDIO/)
{
$DROPexten='';
if ($AGILOG) {$agi_string = "playing drop message: $safe_harbor_audio"; &agi_output;}
if (length($safe_harbor_audio) > 0)
{
$AGI->stream_file('sip-silence');
$AGI->stream_file('sip-silence');
if ($safe_harbor_audio =~ /\|/)
{
@safe_harbor_audio_array = split(/\|/,$safe_harbor_audio);
$w=0;
foreach(@safe_harbor_audio_array)
{
if (length($safe_harbor_audio_array[$w])>0)
{
$AGI->stream_file("$safe_harbor_audio_array[$w]");
}
$w++;
}
}
else
{$AGI->stream_file("$safe_harbor_audio");}
}
}
### use STDOUT to send call to proper DROP location
$VHqueryCID = "VH$CIDdate$VDADconf_exten";
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
sleep(1);
if ($AGILOG) {$agi_string = "exiting the VDAD app, transferring call to $DROPexten"; &agi_output;}
if ($AGILOG) {$agi_string = "exiting the VDAD app, transferring call to $DROPexten $ext_context"; &agi_output;}
print "SET CONTEXT $ext_context\n";
checkresult($result);
print "SET EXTENSION $DROPexten\n";
@@ -2536,6 +2602,9 @@ if ($drop_timer > $DROP_TIME)
}
else
{
### use STDOUT to send call to proper DROP location
$VHqueryCID = "VH$CIDdate$VDADconf_exten";
### 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','','','','','','','','','')";
$affected_rows = $dbhA->do($stmtA);
+115 -46
View File
@@ -26,7 +26,7 @@
#exten => 1234,2,AGI(agi-VDAD_inbound_calltime_check.agi,INBOUND-----YES-----START-----24hours-----EXTENSION-----101-----default)
#exten => 1234,3,Hangup
#
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2011 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# changes:
# 80525-0144 - First Build
@@ -37,6 +37,7 @@
# 90621-1130 - Fixed issue when no call time is specified
# 91122-2353 - Added QueueMetrics logging as IVR INFO entries
# 101219-2110 - Added call time overflow
# 110525-1347 - Added compatibility for outbound IVR logging
#
$script = 'agi-VDAD_inbound_calltime_check.agi';
@@ -210,24 +211,50 @@ while(<STDIN>)
if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;}
}
if ( ($callerid =~ /\".*\"/) && ( (!$calleridname) or ($calleridname =~ /unknown/) ) )
$outboundIVR=0;
$ingroupIVR=0;
if ($calleridname =~ /^V\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d|^Y\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d/)
{
$calleridname = $callerid;
$calleridname =~ s/\<\d\d\d\d\d\d\d\d\d\d\>//gi;
$calleridname =~ s/\"|\" //gi;
$callerid = $calleridname;
$stmtA = "SELECT campaign_id,lead_id FROM vicidial_auto_calls where callerid='$callerid';";
$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;
$campaign_id = $aryA[0];
$lead_id = $aryA[1];
}
$sthA->finish();
if ($calleridname =~ /^V\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d/)
{$outboundIVR=1;}
if ($calleridname =~ /^Y\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d/)
{$ingroupIVR=1;}
}
else
{
if ( ($callerid =~ /\".*\"/) && ( (!$calleridname) or ($calleridname =~ /unknown/) ) )
{
$calleridname = $callerid;
$calleridname =~ s/\<\d\d\d\d\d\d\d\d\d\d\>//gi;
$calleridname =~ s/\"|\" //gi;
}
$callerid =~ s/\D|\'//gi;
$calleridname =~ s/unknown|\'//gi;
if ( (!$callerid) or ($callerid =~ /unknown/) )
{$callerid = $calleridname;}
$callerid =~ s/\D|\'//gi;
$calleridname =~ s/unknown|\'//gi;
if ( (!$callerid) or ($callerid =~ /unknown/) )
{$callerid = $calleridname;}
if (length($callerid)>0) {$phone_number = $callerid;}
else {$phone_number = '';}
if (length($calleridname)>0) {$VLcomments = $calleridname;}
else {$VLcomments = '';}
if (length($callerid)>0) {$phone_number = $callerid;}
else {$phone_number = '';}
if (length($calleridname)>0) {$VLcomments = $calleridname;}
else {$VLcomments = '';}
}
if (length($callerid)<8) {$callerid = $parked_by;}
if (length($pin)>0) {$callerid = $pin;}
@@ -378,6 +405,43 @@ if ( ( ($hm < $ct_default_start) || ($hm > $ct_default_stop) ) && ($hm >= $ct_st
{
$VHqueryCID = "VA$CIDdate$hour$min$sec$sec";
if ($outboundIVR > 0)
{
$stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' and campaign_id='$campaign_id' and server_ip='$VARserver_ip' order by call_time desc limit 1;";
$affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- AH VDAC vac record deleted: |$affected_rows|$campaign_id|$callerid|"; &agi_output;}
$stmtA = "INSERT INTO vicidial_outbound_ivr_log (uniqueid,caller_code,event_date,campaign_id,lead_id,menu_id,menu_action) values('$uniqueid','$callerid','$SQLdate','$campaign_id','$lead_id','$context','AFTERHOURSDROP')";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$affected_rowsL = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VOIL insert: |$affected_rowsL|$uniqueid|$callerid|$campaign_id|$lead_id|$context|"; &agi_output;}
}
else
{
$stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' and uniqueid='$uniqueid' and server_ip='$VARserver_ip' order by call_time desc limit 1;";
$affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- AH VDAC vac record deleted: |$affected_rows|$uniqueid|$callerid|"; &agi_output;}
$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;}
$affected_rowsL = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- AH LIL insert: |$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 =~ /EXTENSION|VOICEMAIL|IN_GROUP/)
{
if ($after_hours_action =~ /EXTENSION/)
@@ -410,28 +474,6 @@ if ( ( ($hm < $ct_default_start) || ($hm > $ct_default_stop) ) && ($hm >= $ct_st
checkresult($result);
}
}
$stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' and uniqueid='$uniqueid' and server_ip='$VARserver_ip' order by call_time desc limit 1;";
$affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- AH VDCL vac record deleted: |$affected_rows| $uniqueid|$callerid|"; &agi_output;}
$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;}
$affected_rowsL = $dbhA->do($stmtA);
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 =~ /MESSAGE|HANGUP/)
{
@@ -455,23 +497,47 @@ if ( ( ($hm < $ct_default_start) || ($hm > $ct_default_stop) ) && ($hm >= $ct_st
### insert an IVR record to the vicidial_auto_calls table
if ($log_to_vac =~ /YES/)
if ($outboundIVR > 0)
{
$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_outbound_ivr_log (uniqueid,caller_code,event_date,campaign_id,lead_id,menu_id,menu_action) values('$uniqueid','$callerid','$SQLdate','$campaign_id','$lead_id','$context','')";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$affected_rowsL = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VOIL insert: |$affected_rowsL|$uniqueid|$callerid|$campaign_id|$lead_id|$context|"; &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 = "UPDATE vicidial_auto_calls SET last_update_time='$last_update_time',status='IVR' where callerid='$callerid';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$affected_rowsV = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VAC : |$affected_rowsV|$uniqueid|$callerid|$extension|"; &agi_output;}
if ($AGILOG) {$agi_string = "-- VAC update: |$affected_rowsV|$uniqueid|$callerid|$last_update_time|"; &agi_output;}
}
else
{
if ($log_to_vac =~ /YES/)
{
if ($ingroupIVR > 0)
{
$stmtA = "UPDATE vicidial_auto_calls SET last_update_time='$last_update_time',status='IVR' where callerid='$callerid';";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$affected_rowsV = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VAC update: |$affected_rowsV|$uniqueid|$callerid|$last_update_time|"; &agi_output;}
}
else
{
$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 = "-- VDAC vac record deleted: |$affected_rows| $uniqueid|$callerid|"; &agi_output;}
$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;}
$affected_rowsL = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- LIL : |$affected_rowsL|$uniqueid|$callerid|$extension|"; &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')";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$affected_rowsV = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VAC insert: |$affected_rowsV|$uniqueid|$callerid|$extension|"; &agi_output;}
}
}
$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;}
$affected_rowsL = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- LIL insert: |$affected_rowsL|$uniqueid|$callerid|$extension|"; &agi_output;}
}
### QueueMetrics logging if enabled
if ($enable_queuemetrics_logging > 0)
@@ -481,6 +547,9 @@ if ($enable_queuemetrics_logging > 0)
if ($DBX) {print "CONNECTED TO QueueMetrics DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";}
if ($outboundIVR > 0)
{$uniqueid = $caller_id;}
$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);
+289
View File
@@ -0,0 +1,289 @@
#!/usr/bin/perl
#
# cm.agi version 2.4
#
# Used by Call Menus to log digit presses if enabled in the settings. You should
# not need to manually use this script, it is used by the dialplan builder.
#
# You need to put lines similar to those below in your extensions.conf file:
# ; Below are the parameters needed for the script to be run properly
# ; 1. the in-group to take settings from
# ; 2. digit pressed
# ;
# ;inbound calls check calltime:
#exten => 1,1,AGI(cm.agi,INBOUND-----1)
#exten => 1,2,...
#
# Copyright (C) 2011 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# changes:
# 110525-2100 - First Build
#
$script = 'cm.agi';
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year = ($year + 1900);
$mon++;
if ($mon < 10) {$mon = "0$mon";}
if ($mday < 10) {$mday = "0$mday";}
if ($hour < 10) {$hour = "0$hour";}
if ($min < 10) {$min = "0$min";}
if ($sec < 10) {$sec = "0$sec";}
$now_date_epoch = time();
$now_date = "$year-$mon-$mday $hour:$min:$sec";
# default path to astguiclient configuration file:
$PATHconf = '/etc/astguiclient.conf';
open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n";
@conf = <conf>;
close(conf);
$i=0;
foreach(@conf)
{
$line = $conf[$i];
$line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi;
if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) )
{$PATHhome = $line; $PATHhome =~ s/.*=//gi;}
if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) )
{$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;}
if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) )
{$PATHagi = $line; $PATHagi =~ s/.*=//gi;}
if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) )
{$PATHweb = $line; $PATHweb =~ s/.*=//gi;}
if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) )
{$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;}
if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) )
{$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;}
if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) )
{$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) )
{$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) )
{$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) )
{$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) )
{$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) )
{$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;}
$i++;
}
if (!$VARDB_port) {$VARDB_port='3306';}
if (!$AGILOGfile) {$AGILOGfile = "$PATHlogs/agiout.$year-$mon-$mday";}
use DBI;
use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second
use Asterisk::AGI;
$AGI = new Asterisk::AGI;
$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass")
or die "Couldn't connect to database: " . DBI->errstr;
### Grab Server values from the database
$stmtA = "SELECT agi_output FROM servers where server_ip = '$VARserver_ip';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
if ($sthArows > 0)
{
$AGILOG = '0';
@aryA = $sthA->fetchrow_array;
$DBagi_output = "$aryA[0]";
if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';}
if ($DBagi_output =~ /FILE/) {$AGILOG = '2';}
if ($DBagi_output =~ /BOTH/) {$AGILOG = '3';}
}
$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 ###
if (length($ARGV[0])>1)
{
if ($AGILOG) {$agi_string = "Perl Environment Dump:"; &agi_output;}
$i=0;
while ($#ARGV >= $i)
{
$args = "$args $ARGV[$i]";
if ($AGILOG) {$agi_string = "$i|$ARGV[$i]"; &agi_output;}
$i++;
}
### list of command-line array arguments:
@ARGV_vars = split(/-----/, $ARGV[0]);
$channel_group = $ARGV_vars[0];
$dtmf = $ARGV_vars[1];
}
$|=1;
while(<STDIN>)
{
chomp;
last unless length($_);
if ($AGILOG)
{
if (/^agi_(\w+)\:\s+(.*)$/)
{
$AGI{$1} = $2;
}
}
if (/^agi_context\:\s+(.*)$/) {$context = $1;}
if (/^agi_priority\:\s+(.*)$/) {$priority = $1;}
if (/^agi_uniqueid\:\s+(.*)$/) {$unique_id = $1; $uniqueid = $unique_id;}
if (/^agi_channel\:\s+(.*)$/) {$channel = $1;}
if (/^agi_extension\:\s+(.*)$/) {$extension = $1;}
if (/^agi_type\:\s+(.*)$/) {$type = $1;}
if (/^agi_callerid\:\s+(.*)$/) {$callerid = $1;}
if (/^agi_calleridname\:\s+(.*)$/) {$calleridname = $1;}
}
$outboundIVR=0;
if ($calleridname =~ /^V\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d/)
{
$callerid = $calleridname;
$outboundIVR=1;
$stmtA = "SELECT campaign_id,lead_id FROM vicidial_auto_calls where callerid='$callerid';";
$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;
$campaign_id = $aryA[0];
$lead_id = $aryA[1];
}
$sthA->finish();
}
else
{
if ( ($callerid =~ /\".*\"/) && ( (!$calleridname) or ($calleridname =~ /unknown/) ) )
{
$calleridname = $callerid;
$calleridname =~ s/\<\d\d\d\d\d\d\d\d\d\d\>//gi;
$calleridname =~ s/\"|\" //gi;
}
$callerid =~ s/\D|\'//gi;
$calleridname =~ s/unknown|\'//gi;
if ( (!$callerid) or ($callerid =~ /unknown/) )
{$callerid = $calleridname;}
if (length($callerid)>0) {$phone_number = $callerid;}
else {$phone_number = '';}
if (length($calleridname)>0) {$VLcomments = $calleridname;}
else {$VLcomments = '';}
}
if (length($callerid)<8) {$callerid = $parked_by;}
if (length($pin)>0) {$callerid = $pin;}
foreach $i (sort keys %AGI)
{
if ($AGILOG) {$agi_string = " -- $i = $AGI{$i}"; &agi_output;}
}
if ($AGILOG) {$agi_string = "AGI Variables: |$unique_id|$channel|$extension|$type|$callerid|"; &agi_output;}
if (length($pin) < 1) {$pin=$inbound_number;}
$fronter = $pin;
if ($AGILOG) {$agi_string = "+++++ DTMF LOG STARTED : |$channel_group|$callerid-$pin|$now_date"; &agi_output;}
$VDADphone='';
$VDADphone_code='';
if ($channel =~ /Local/i)
{
if ($AGILOG) {$agi_string = "+++++ VDAD START LOCAL CHANNEL: EXITING- $priority"; &agi_output;}
exit;
}
### insert an IVR record to the vicidial_auto_calls table
if ($outboundIVR > 0)
{
$stmtA = "INSERT INTO vicidial_outbound_ivr_log (uniqueid,caller_code,event_date,campaign_id,lead_id,menu_id,menu_action) values('$uniqueid','$callerid','$now_date','$campaign_id','$lead_id','$context>$dtmf','$dtmf')";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$affected_rowsL = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VOIL insert: |$affected_rowsL|$uniqueid|$callerid|$campaign_id|$lead_id|$context|"; &agi_output;}
}
else
{
$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','$now_date','$channel_group','$dtmf','$context>$dtmf','$priority')";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$affected_rowsL = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- LIL insert: |$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";}
#
# if ($outboundIVR > 0)
# {$uniqueid = $caller_id;}
#
# $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();
$dbhA->disconnect();
exit;
sub agi_output
{
if ($AGILOG >=2)
{
### open the log file for writing ###
open(Lout, ">>$AGILOGfile")
|| 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='';
}
+52
View File
@@ -30,6 +30,7 @@
# 100328-1008 - Added --months CLI option
# 110218-1200 - Added notes and search log archiving
# 110430-1442 - Added queue-log and closer-log options, changed quiet to --quiet flag
# 110525-1040 - Added vicidial_outbound_ivr_log archiving
#
### begin parsing run-time options ###
@@ -630,6 +631,57 @@ if (!$T)
}
##### vicidial_outbound_ivr_log
$stmtA = "SELECT count(*) from vicidial_outbound_ivr_log;";
$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;
$vicidial_outbound_ivr_log_count = $aryA[0];
}
$sthA->finish();
$stmtA = "SELECT count(*) from vicidial_outbound_ivr_log_archive;";
$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;
$vicidial_outbound_ivr_log_archive_count = $aryA[0];
}
$sthA->finish();
if (!$Q) {print "\nProcessing vicidial_outbound_ivr_log table... ($vicidial_outbound_ivr_log_count|$vicidial_outbound_ivr_log_archive_count)\n";}
$stmtA = "INSERT IGNORE INTO vicidial_outbound_ivr_log_archive SELECT * from vicidial_outbound_ivr_log;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows = $sthA->rows;
if (!$Q) {print "$sthArows rows inserted into vicidial_outbound_ivr_log_archive table \n";}
$rv = $sthA->err();
if (!$rv)
{
$stmtA = "DELETE FROM vicidial_outbound_ivr_log WHERE event_date < '$del_time';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows = $sthA->rows;
if (!$Q) {print "$sthArows rows deleted from vicidial_outbound_ivr_log table \n";}
$stmtA = "optimize table vicidial_outbound_ivr_log;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$stmtA = "optimize table vicidial_outbound_ivr_log_archive;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
}
#$dbhA->disconnect();
#print "$del_time\n\n";
+38 -18
View File
@@ -60,6 +60,7 @@
# 101107-2257 - Added cross-server phone dialplan extensions
# 101214-1507 - Changed list auto-reset to work with inactive lists
# 110512-2112 - Added vicidial_campaign_stats_debug to table cleaning
# 110525-2334 - Added cm.agi optional logging to call menus
#
$DB=0; # Debug flag
@@ -1631,7 +1632,7 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
##### BEGIN Generate the Call Menu entries #####
$stmtA = "SELECT menu_id,menu_name,menu_prompt,menu_timeout,menu_timeout_prompt,menu_invalid_prompt,menu_repeat,menu_time_check,call_time_id,track_in_vdac,custom_dialplan_entry,tracking_group FROM vicidial_call_menu order by menu_id;";
$stmtA = "SELECT menu_id,menu_name,menu_prompt,menu_timeout,menu_timeout_prompt,menu_invalid_prompt,menu_repeat,menu_time_check,call_time_id,track_in_vdac,custom_dialplan_entry,tracking_group,dtmf_log FROM vicidial_call_menu order by menu_id;";
# print "$stmtA\n";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -1640,18 +1641,19 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
while ($sthArows > $i)
{
@aryA = $sthA->fetchrow_array;
$menu_id[$i] = "$aryA[0]";
$menu_name[$i] = "$aryA[1]";
$menu_prompt[$i] = "$aryA[2]";
$menu_timeout[$i] = "$aryA[3]";
$menu_timeout_prompt[$i] = "$aryA[4]";
$menu_invalid_prompt[$i] = "$aryA[5]";
$menu_repeat[$i] = "$aryA[6]";
$menu_time_check[$i] = "$aryA[7]";
$call_time_id[$i] = "$aryA[8]";
$track_in_vdac[$i] = "$aryA[9]";
$custom_dialplan_entry[$i]= "$aryA[10]";
$tracking_group[$i] = "$aryA[11]";
$menu_id[$i] = $aryA[0];
$menu_name[$i] = $aryA[1];
$menu_prompt[$i] = $aryA[2];
$menu_timeout[$i] = $aryA[3];
$menu_timeout_prompt[$i] = $aryA[4];
$menu_invalid_prompt[$i] = $aryA[5];
$menu_repeat[$i] = $aryA[6];
$menu_time_check[$i] = $aryA[7];
$call_time_id[$i] = $aryA[8];
$track_in_vdac[$i] = $aryA[9];
$custom_dialplan_entry[$i]= $aryA[10];
$tracking_group[$i] = $aryA[11];
$dtmf_log[$i] = $aryA[12];
if ($track_in_vdac[$i] > 0)
{$track_in_vdac[$i] = 'YES'}
@@ -1683,11 +1685,11 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
while ($sthArowsJ > $j)
{
@aryA = $sthA->fetchrow_array;
$option_value[$j] = "$aryA[0]";
$option_description[$j] = "$aryA[1]";
$option_route[$j] = "$aryA[2]";
$option_route_value[$j] = "$aryA[3]";
$option_route_value_context[$j] = "$aryA[4]";
$option_value[$j] = $aryA[0];
$option_description[$j] = $aryA[1];
$option_route[$j] = $aryA[2];
$option_route_value[$j] = $aryA[3];
$option_route_value_context[$j] = $aryA[4];
if ($option_value[$j] =~ /STAR/) {$option_value[$j] = '*';}
if ($option_value[$j] =~ /HASH/) {$option_value[$j] = '#';}
$j++;
@@ -1787,14 +1789,20 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
}
if ($option_route[$j] =~ /AGI/)
{
if ($dtmf_log[$i] > 0)
{$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(cm.agi,$tracking_group[$i]-----$option_value[$j])\n"; $PRI++;}
$call_menu_line .= "exten => $option_value[$j],$PRI,AGI($option_route_value[$j])\n";
}
if ($option_route[$j] =~ /CALLMENU/)
{
if ($dtmf_log[$i] > 0)
{$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(cm.agi,$tracking_group[$i]-----$option_value[$j])\n"; $PRI++;}
$call_menu_line .= "exten => $option_value[$j],$PRI,Goto($option_route_value[$j],s,1)\n";
}
if ($option_route[$j] =~ /DID/)
{
if ($dtmf_log[$i] > 0)
{$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(cm.agi,$tracking_group[$i]-----$option_value[$j])\n"; $PRI++;}
$call_menu_line .= "exten => $option_value[$j],$PRI,Goto(trunkinbound,$option_route_value[$j],1)\n";
}
if ($option_route[$j] =~ /INGROUP/)
@@ -1810,15 +1818,21 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
$IGvid_confirm_filename = $IGoption_route_value_context[7];
$IGvid_validate_digits = $IGoption_route_value_context[8];
if ($dtmf_log[$i] > 0)
{$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(cm.agi,$tracking_group[$i]-----$option_value[$j])\n"; $PRI++;}
$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(agi-VDAD_ALL_inbound.agi,$IGhandle_method-----$IGsearch_method-----$option_route_value[$j]-----$menu_id[$i]--------------------$IGlist_id-----$IGphone_code-----$IGcampaign_id---------------$IGvid_enter_filename-----$IGvid_id_number_filename-----$IGvid_confirm_filename-----$IGvid_validate_digits)\n";
}
if ($option_route[$j] =~ /EXTENSION/)
{
if ($dtmf_log[$i] > 0)
{$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(cm.agi,$tracking_group[$i]-----$option_value[$j])\n"; $PRI++;}
if (length($option_route_value_context[$j])>0) {$option_route_value_context[$j] = "$option_route_value_context[$j],";}
$call_menu_line .= "exten => $option_value[$j],$PRI,Goto($option_route_value_context[$j]$option_route_value[$j],1)\n";
}
if ($option_route[$j] =~ /VOICEMAIL/)
{
if ($dtmf_log[$i] > 0)
{$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(cm.agi,$tracking_group[$i]-----$option_value[$j])\n"; $PRI++;}
$call_menu_line .= "exten => $option_value[$j],$PRI,Goto(default,85026666666666$option_route_value[$j],1)\n";
}
if ($option_route[$j] =~ /HANGUP/)
@@ -1847,10 +1861,14 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
}
$call_menu_line .= "$hangup_prompt_ext";
if ($dtmf_log[$i] > 0)
{$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(cm.agi,$tracking_group[$i]-----$option_value[$j])\n"; $PRI++;}
$call_menu_line .= "exten => $option_value[$j],n,Hangup\n";
}
else
{
if ($dtmf_log[$i] > 0)
{$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(cm.agi,$tracking_group[$i]-----$option_value[$j])\n"; $PRI++;}
$call_menu_line .= "exten => $option_value[$j],$PRI,Hangup\n";
}
}
@@ -1877,6 +1895,8 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
$d = leading_zero($4);
$DIALstring = "$a$S$b$S$c$S$d$S";
}
if ($dtmf_log[$i] > 0)
{$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(cm.agi,$tracking_group[$i]-----$option_value[$j])\n"; $PRI++;}
$call_menu_line .= "exten => $option_value[$j],$PRI,Goto(default,$DIALstring$Pdialplan,1)\n";
}
$sthA->finish();
+2 -1
View File
@@ -100,6 +100,7 @@
# 110224-1859 - Added compatibility with QM phone environment logging
# 110303-1710 - Added clearing of ring_callerid when vicidial_auto_calls deleted
# 110513-1745 - Added double-check for dial level difference target, and dial level and avail-only-tally features
# 110525-1940 - Allow for auto-dial IVR transfers
#
@@ -1358,7 +1359,7 @@ while($one_day_interval > 0)
if ( ( ($dialtime_log >= $call_timeout) || ($dialtime_catch >= $call_timeout) || ($CLstatus =~ /BUSY|DISCONNECT|XFER|CLOSER/) ) && ($PARKchannel < 1) )
{
if ($CLcall_type !~ /IN/)
if ( ($CLcall_type !~ /IN/) && ($CLstatus !~ /IVR/) )
{
if ($CLstatus !~ /XFER|CLOSER/)
{
+1
View File
@@ -57,3 +57,4 @@ ALTNUM - Agent manual Dial Alternate number dialing, number dialed before final
DISPO - Agent in disposition screen when they closed their web browser wiithout selecting dispisition
WAITTO - Wait time option call termination on inbound call
PDROP - Pre-routing dropped call, call hung up the instant the Answer signal is received
IVRXFR - Outbound drop to Call Menu
+22 -4
View File
@@ -656,7 +656,7 @@ alt_number_dialing ENUM('Y','N') default 'N',
scheduled_callbacks ENUM('Y','N') default 'N',
lead_filter_id VARCHAR(10) default 'NONE',
drop_call_seconds TINYINT(3) default '5',
drop_action ENUM('HANGUP','MESSAGE','VOICEMAIL','IN_GROUP') default 'MESSAGE',
drop_action ENUM('HANGUP','MESSAGE','VOICEMAIL','IN_GROUP','AUDIO','CALLMENU') default 'AUDIO',
safe_harbor_exten VARCHAR(20) default '8307',
display_dialable_count ENUM('Y','N') default 'Y',
wrapup_seconds SMALLINT(3) UNSIGNED default '0',
@@ -805,7 +805,9 @@ custom_3way_button_transfer VARCHAR(30) default 'DISABLED',
available_only_tally_threshold ENUM('DISABLED','LOGGED-IN_AGENTS','NON-PAUSED_AGENTS','WAITING_AGENTS') default 'DISABLED',
available_only_tally_threshold_agents SMALLINT(5) UNSIGNED default '0',
dial_level_threshold ENUM('DISABLED','LOGGED-IN_AGENTS','NON-PAUSED_AGENTS','WAITING_AGENTS') default 'DISABLED',
dial_level_threshold_agents SMALLINT(5) UNSIGNED default '0'
dial_level_threshold_agents SMALLINT(5) UNSIGNED default '0',
safe_harbor_audio VARCHAR(100) default 'buzz',
safe_harbor_menu_id VARCHAR(50) default ''
);
CREATE TABLE vicidial_lists (
@@ -1817,7 +1819,8 @@ menu_time_check ENUM('0','1') default '0',
call_time_id VARCHAR(20) default '',
track_in_vdac ENUM('0','1') default '1',
custom_dialplan_entry TEXT,
tracking_group VARCHAR(20) default 'CALLMENU'
tracking_group VARCHAR(20) default 'CALLMENU',
dtmf_log ENUM('0','1') default '0'
);
CREATE TABLE vicidial_call_menu_options (
@@ -2325,6 +2328,19 @@ index (campaign_id),
unique index campserver (campaign_id, server_ip)
);
CREATE TABLE vicidial_outbound_ivr_log (
uniqueid VARCHAR(50) NOT NULL,
caller_code VARCHAR(30) NOT NULL,
event_date DATETIME,
campaign_id VARCHAR(20) default '',
lead_id INT(9) UNSIGNED,
menu_id VARCHAR(50) default '',
menu_action VARCHAR(50) default '',
index (event_date),
index (lead_id),
index (campaign_id),
unique index campserver (event_date, lead_id, menu_id)
);
ALTER TABLE vicidial_campaign_server_stats ENGINE=MEMORY;
@@ -2477,7 +2493,9 @@ ALTER TABLE vicidial_lead_search_log_archive MODIFY search_log_id INT(9) UNSIGNE
CREATE TABLE vicidial_closer_log_archive LIKE vicidial_closer_log;
ALTER TABLE vicidial_closer_log_archive MODIFY closecallid INT(9) UNSIGNED NOT NULL;
UPDATE system_settings SET db_schema_version='1275',db_schema_update_date=NOW();
CREATE TABLE vicidial_outbound_ivr_log_archive LIKE vicidial_outbound_ivr_log;
UPDATE system_settings SET db_schema_version='1276',db_schema_update_date=NOW();
GRANT RELOAD ON *.* TO cron@'%';
GRANT RELOAD ON *.* TO cron@localhost;
+25
View File
@@ -776,3 +776,28 @@ unique index campserver (campaign_id, server_ip)
);
UPDATE system_settings SET db_schema_version='1275',db_schema_update_date=NOW();
ALTER TABLE vicidial_campaigns MODIFY drop_action ENUM('HANGUP','MESSAGE','VOICEMAIL','IN_GROUP','AUDIO','CALLMENU') default 'AUDIO';
ALTER TABLE vicidial_campaigns ADD safe_harbor_audio VARCHAR(100) default 'buzz';
ALTER TABLE vicidial_campaigns ADD safe_harbor_menu_id VARCHAR(50) default '';
CREATE TABLE vicidial_outbound_ivr_log (
uniqueid VARCHAR(50) NOT NULL,
caller_code VARCHAR(30) NOT NULL,
event_date DATETIME,
campaign_id VARCHAR(20) default '',
lead_id INT(9) UNSIGNED,
menu_id VARCHAR(50) default '',
menu_action VARCHAR(50) default '',
index (event_date),
index (lead_id),
index (campaign_id),
unique index campserver (event_date, lead_id, menu_id)
);
CREATE TABLE vicidial_outbound_ivr_log_archive LIKE vicidial_outbound_ivr_log;
ALTER TABLE vicidial_call_menu ADD dtmf_log ENUM('0','1') default '0';
UPDATE system_settings SET db_schema_version='1276',db_schema_update_date=NOW() where db_schema_version < 1276;
@@ -581,6 +581,14 @@ Campaign Debug Page||
Bulk Phone Insert Page||
Send a Call With Custom CID Page||
Speech Voice Lab Page||
Safe Harbor Audio||
This is the audio prompt file that is played if the Drop Action is set to AUDIO. Default is buzz||
Safe Harbor Call Menu||
This is the call menu that a call is sent to if the Drop Action is set to CALLMENU||
Log Key Press||
This option if enabled will log the DTMF key press by the caller in this Call Menu. Default is 0 for disabled||
No DTMF Logging||
DTMF Logging Enabled||
admin_campaign_multi_alt.php
+127 -39
View File
@@ -1,7 +1,7 @@
<?php
# AST_IVRstats.php
#
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2011 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGES
# 81026-2026 - First build
@@ -16,6 +16,7 @@
# 100712-1324 - Added system setting slave server option
# 100802-2347 - Added User Group Allowed Reports option validation
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
# 110525-1907 - Added support for outbound log analysis
#
require("dbconnect.php");
@@ -31,6 +32,8 @@ if (isset($_GET["end_date"])) {$end_date=$_GET["end_date"];}
elseif (isset($_POST["end_date"])) {$end_date=$_POST["end_date"];}
if (isset($_GET["shift"])) {$shift=$_GET["shift"];}
elseif (isset($_POST["shift"])) {$shift=$_POST["shift"];}
if (isset($_GET["type"])) {$type=$_GET["type"];}
elseif (isset($_POST["type"])) {$type=$_POST["type"];}
if (isset($_GET["submit"])) {$submit=$_GET["submit"];}
elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];}
if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];}
@@ -42,8 +45,12 @@ $PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
if (strlen($shift)<2) {$shift='ALL';}
if (strlen($type)<2) {$type='inbound';}
$report_name = 'Inbound IVR Report';
if ($type == 'inbound')
{$report_name = 'Inbound IVR Report';}
else
{$report_name = 'Outbound IVR Report';}
$db_source = 'M';
#############################################
@@ -106,6 +113,16 @@ $row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
$LOGallowed_campaignsSQL='';
$whereLOGallowed_campaignsSQL='';
if ( (!eregi("-ALL",$LOGallowed_campaigns)) )
{
$rawLOGallowed_campaignsSQL = preg_replace("/ -/",'',$LOGallowed_campaigns);
$rawLOGallowed_campaignsSQL = preg_replace("/ /","','",$rawLOGallowed_campaignsSQL);
$LOGallowed_campaignsSQL = "and campaign_id IN('$rawLOGallowed_campaignsSQL')";
$whereLOGallowed_campaignsSQL = "where campaign_id IN('$rawLOGallowed_campaignsSQL')";
}
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL REPORTS/",$LOGallowed_reports)) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
@@ -121,11 +138,16 @@ if (!isset($group)) {$group = '';}
if (!isset($query_date)) {$query_date = "$NOW_DATE 00:00:00";}
if (!isset($end_date)) {$end_date = "$NOW_DATE 23:23:59";}
$stmt="select group_id,group_name from vicidial_inbound_groups order by group_id;";
if ($type == 'inbound')
{$stmt="select group_id,group_name from vicidial_inbound_groups order by group_id;";}
else
{$stmt="select campaign_id,campaign_name from vicidial_campaigns order by campaign_id $whereLOGallowed_campaignsSQL;";}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$groups_to_print = mysql_num_rows($rslt);
$i=0;
if ($type == 'inbound')
{
$LISTgroups[$i]='CALLMENU';
$LISTgroups_names[$i]='IVR';
$i++;
@@ -134,6 +156,7 @@ $i=0;
$LISTgroups_names[$i]='Dynamic Application';
$i++;
$groups_to_print++;
}
while ($i < $groups_to_print)
{
$row=mysql_fetch_row($rslt);
@@ -262,6 +285,7 @@ if ($DB > 0)
echo "<FORM ACTION=\"$PHP_SELF\" METHOD=GET name=vicidial_report id=vicidial_report>\n";
echo "<TABLE BORDER=0><TR><TD VALIGN=TOP>\n";
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
echo "<INPUT TYPE=HIDDEN NAME=type VALUE=\"$type\">\n";
echo "Date Range:<BR>\n";
echo "<INPUT TYPE=hidden NAME=query_date ID=query_date VALUE=\"$query_date\">\n";
@@ -302,25 +326,51 @@ echo " &nbsp; <INPUT TYPE=TEXT NAME=end_date_T SIZE=9 MAXLENGTH=8 VALUE=\"$end_d
echo "</TD><TD ROWSPAN=2 VALIGN=TOP>\n";
echo "Inbound Groups: \n";
echo "</TD><TD ROWSPAN=2 VALIGN=TOP>\n";
echo "<SELECT SIZE=5 NAME=group[] multiple>\n";
$o=0;
while ($groups_to_print > $o)
if ($type == 'inbound')
{
if (ereg("\|$LISTgroups[$o]\|",$group_string))
{echo "<option selected value=\"$LISTgroups[$o]\">$LISTgroups[$o] - $LISTgroups_names[$o]</option>\n";}
else
{echo "<option value=\"$LISTgroups[$o]\">$LISTgroups[$o] - $LISTgroups_names[$o]</option>\n";}
$o++;
echo "Inbound Groups: \n";
echo "</TD><TD ROWSPAN=2 VALIGN=TOP>\n";
echo "<SELECT SIZE=5 NAME=group[] multiple>\n";
$o=0;
while ($groups_to_print > $o)
{
if (ereg("\|$LISTgroups[$o]\|",$group_string))
{echo "<option selected value=\"$LISTgroups[$o]\">$LISTgroups[$o] - $LISTgroups_names[$o]</option>\n";}
else
{echo "<option value=\"$LISTgroups[$o]\">$LISTgroups[$o] - $LISTgroups_names[$o]</option>\n";}
$o++;
}
echo "</SELECT>\n";
echo "</TD><TD ROWSPAN=2 VALIGN=TOP>\n";
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ";
echo "<a href=\"./admin.php?ADD=3111&group_id=$group[0]\">MODIFY</a> | ";
echo "<a href=\"./admin.php?ADD=999999\">REPORTS</a> | ";
echo "<a href=\"./AST_CLOSERstats.php?query_date=$query_date&end_date=$end_date&shift=$shift$groupQS\">CLOSER REPORT</a> \n";
echo "</FONT>\n";
}
else
{
echo "Campaigns: \n";
echo "</TD><TD ROWSPAN=2 VALIGN=TOP>\n";
echo "<SELECT SIZE=5 NAME=group[] multiple>\n";
$o=0;
while ($groups_to_print > $o)
{
if (ereg("\|$LISTgroups[$o]\|",$group_string))
{echo "<option selected value=\"$LISTgroups[$o]\">$LISTgroups[$o] - $LISTgroups_names[$o]</option>\n";}
else
{echo "<option value=\"$LISTgroups[$o]\">$LISTgroups[$o] - $LISTgroups_names[$o]</option>\n";}
$o++;
}
echo "</SELECT>\n";
echo "</TD><TD ROWSPAN=2 VALIGN=TOP>\n";
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ";
echo "<a href=\"./admin.php?ADD=31&campaign_id=$group[0]\">MODIFY</a> | ";
echo "<a href=\"./admin.php?ADD=999999\">REPORTS</a> | ";
echo "<a href=\"./AST_VDADstats.php?query_date=$query_date&end_date=$end_date&shift=$shift$groupQS\">OUTBOUND REPORT</a> \n";
echo "</FONT>\n";
}
echo "</SELECT>\n";
echo "</TD><TD ROWSPAN=2 VALIGN=TOP>\n";
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ";
echo "<a href=\"./admin.php?ADD=3111&group_id=$group[0]\">MODIFY</a> | ";
echo "<a href=\"./admin.php?ADD=999999\">REPORTS</a> | ";
echo "<a href=\"./AST_CLOSERstats.php?query_date=$query_date&end_date=$end_date&shift=$shift$groupQS\">CLOSER REPORT</a> \n";
echo "</FONT>\n";
echo "</TD></TR>\n";
echo "<TR><TD>\n";
@@ -383,7 +433,14 @@ else
$totFLOWtotal_time=0;
##### Grab all records for the IVR for the specified time period
$stmt="select uniqueid,extension,start_time,comment_a,comment_b,comment_d,UNIX_TIMESTAMP(start_time),phone_ext from live_inbound_log where start_time >= '$query_date_BEGIN' and start_time <= '$query_date_END' and comment_a IN($group_SQL) order by uniqueid,start_time;";
if ($type == 'inbound')
{
$stmt="select uniqueid,extension,start_time,comment_a,comment_b,comment_d,UNIX_TIMESTAMP(start_time),phone_ext from live_inbound_log where start_time >= '$query_date_BEGIN' and start_time <= '$query_date_END' and comment_a IN($group_SQL) order by uniqueid,start_time;";
}
else
{
$stmt="select uniqueid,caller_code,event_date,campaign_id,menu_id,menu_action,UNIX_TIMESTAMP(event_date),caller_code from vicidial_outbound_ivr_log where event_date >= '$query_date_BEGIN' and event_date <= '$query_date_END' and campaign_id IN($group_SQL) order by uniqueid,event_date,menu_action desc;";
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$logs_to_print = mysql_num_rows($rslt);
@@ -538,21 +595,24 @@ else
$FLOWunique_calls_list[$s] = preg_replace("/,$/","",$FLOWunique_calls_list[$s]);
##### Grab all records for the IVR for the specified time period
$stmt="select status,length_in_sec from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and uniqueid IN($FLOWunique_calls_list[$s]);";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$vcl_statuses_to_print = mysql_num_rows($rslt);
$w=0;
while ($w < $vcl_statuses_to_print)
if ($type == 'inbound')
{
$row=mysql_fetch_row($rslt);
$vcl_statuses[$w] = $row[0];
if ( (ereg("DROP",$vcl_statuses[$w])) or (ereg("XDROP",$vcl_statuses[$w])) )
{$FLOWdrop[$s]++;}
$FLOWclose_time[$s] = ($FLOWclose_time[$s] + $row[1]);
$FLOWtotal[$s]++;
$w++;
##### Grab all records for the IVR for the specified time period
$stmt="select status,length_in_sec from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and uniqueid IN($FLOWunique_calls_list[$s]);";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$vcl_statuses_to_print = mysql_num_rows($rslt);
$w=0;
while ($w < $vcl_statuses_to_print)
{
$row=mysql_fetch_row($rslt);
$vcl_statuses[$w] = $row[0];
if ( (ereg("DROP",$vcl_statuses[$w])) or (ereg("XDROP",$vcl_statuses[$w])) )
{$FLOWdrop[$s]++;}
$FLOWclose_time[$s] = ($FLOWclose_time[$s] + $row[1]);
$FLOWtotal[$s]++;
$w++;
}
}
if ( ($FLOWtotal[$s] > 0) and ($FLOWdrop[$s] > 0) )
{
@@ -621,7 +681,14 @@ else
$h=0;
while ($i <= 96)
{
$stmt="select count(*) from live_inbound_log where start_time >= '$query_date $h:00:00' and start_time <= '$query_date $h:14:59' and comment_a IN($group_SQL) and comment_b='START';";
if ($type == 'inbound')
{
$stmt="select count(*) from live_inbound_log where start_time >= '$query_date $h:00:00' and start_time <= '$query_date $h:14:59' and comment_a IN($group_SQL) and comment_b='START';";
}
else
{
$stmt="select count(*) from vicidial_outbound_ivr_log where event_date >= '$query_date $h:00:00' and event_date <= '$query_date $h:14:59' and campaign_id IN($group_SQL) and menu_action='';";
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
@@ -631,7 +698,14 @@ else
$i++;
$stmt="select count(*) from live_inbound_log where start_time >= '$query_date $h:15:00' and start_time <= '$query_date $h:29:59' and comment_a IN($group_SQL) and comment_b='START';";
if ($type == 'inbound')
{
$stmt="select count(*) from live_inbound_log where start_time >= '$query_date $h:15:00' and start_time <= '$query_date $h:29:59' and comment_a IN($group_SQL) and comment_b='START';";
}
else
{
$stmt="select count(*) from vicidial_outbound_ivr_log where event_date >= '$query_date $h:15:00' and event_date <= '$query_date $h:29:59' and campaign_id IN($group_SQL) and menu_action='';";
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
@@ -640,7 +714,14 @@ else
if ($hour_count[$i] > 0) {$last_full_record = $i;}
$i++;
$stmt="select count(*) from live_inbound_log where start_time >= '$query_date $h:30:00' and start_time <= '$query_date $h:44:59' and comment_a IN($group_SQL) and comment_b='START';";
if ($type == 'inbound')
{
$stmt="select count(*) from live_inbound_log where start_time >= '$query_date $h:30:00' and start_time <= '$query_date $h:44:59' and comment_a IN($group_SQL) and comment_b='START';";
}
else
{
$stmt="select count(*) from vicidial_outbound_ivr_log where event_date >= '$query_date $h:30:00' and event_date <= '$query_date $h:44:59' and campaign_id IN($group_SQL) and menu_action='';";
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
@@ -649,7 +730,14 @@ else
if ($hour_count[$i] > 0) {$last_full_record = $i;}
$i++;
$stmt="select count(*) from live_inbound_log where start_time >= '$query_date $h:45:00' and start_time <= '$query_date $h:59:59' and comment_a IN($group_SQL) and comment_b='START';";
if ($type == 'inbound')
{
$stmt="select count(*) from live_inbound_log where start_time >= '$query_date $h:45:00' and start_time <= '$query_date $h:59:59' and comment_a IN($group_SQL) and comment_b='START';";
}
else
{
$stmt="select count(*) from vicidial_outbound_ivr_log where event_date >= '$query_date $h:45:00' and event_date <= '$query_date $h:59:59' and campaign_id IN($group_SQL) and menu_action='';";
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
+61 -12
View File
File diff suppressed because one or more lines are too long
+12 -12
View File
@@ -622,21 +622,21 @@ if ( ($ADD==3111) or ($ADD==4111) or ($ADD==5111) )
}
$stmt="select menu_id,menu_name from vicidial_call_menu order by menu_id limit 10000;";
$rslt=mysql_query($stmt, $link);
$menus_to_print = mysql_num_rows($rslt);
$call_menu_list='';
$i=0;
while ($i < $menus_to_print)
{
$row=mysql_fetch_row($rslt);
$call_menu_list .= "<option value=\"$row[0]\">$row[0] - $row[1]</option>";
$i++;
}
### select list contents generation for dynamic route displays in call menu and in-group screens
if ( ($ADD==3511) or ($ADD==2511) or ($ADD==2611) or ($ADD==4511) or ($ADD==5511) or ($ADD==3111) or ($ADD==2111) or ($ADD==2011) or ($ADD==4111) or ($ADD==5111) )
{
$stmt="select menu_id,menu_name from vicidial_call_menu order by menu_id;";
$rslt=mysql_query($stmt, $link);
$menus_to_print = mysql_num_rows($rslt);
$call_menu_list='';
$i=0;
while ($i < $menus_to_print)
{
$row=mysql_fetch_row($rslt);
$call_menu_list .= "<option value=\"$row[0]\">$row[0] - $row[1]</option>";
$i++;
}
$stmt="select did_pattern,did_description,did_route from vicidial_inbound_dids where did_active='Y' order by did_pattern;";
$rslt=mysql_query($stmt, $link);
$dids_to_print = mysql_num_rows($rslt);
+32 -1
View File
@@ -43,6 +43,7 @@
# 110212-2041 - Added compatibility with definable scheduled callback statuses
# 110215-1411 - Added display of call notes to log records
# 110215-1717 - Changed empty lead_id behavior to be add-a-lead functionality
# 110525-1827 - Added ivr log records display
#
require("dbconnect.php");
@@ -1145,6 +1146,37 @@ else
echo "<BR><BR>\n";
echo "<B>IVR LOGS FOR THIS LEAD:</B>\n";
echo "<TABLE width=750 cellspacing=1 cellpadding=1>\n";
echo "<tr><td><font size=1># </td><td align=left><font size=2> CAMPAIGN</td><td><font size=2>DATE/TIME </td><td align=left><font size=2>CALL MENU </td><td align=left><font size=2> &nbsp; ACTION</td></tr>\n";
$stmt="select campaign_id,event_date,menu_id,menu_action from vicidial_outbound_ivr_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by uniqueid,event_date,menu_action desc limit 500;";
$rslt=mysql_query($stmt, $link);
$logs_to_print = mysql_num_rows($rslt);
if ($DB) {echo "$logs_to_print|$stmt|\n";}
$u=0;
while ($logs_to_print > $u)
{
$row=mysql_fetch_row($rslt);
if (eregi("1$|3$|5$|7$|9$", $u))
{$bgcolor='bgcolor="#B9CBFD"';}
else
{$bgcolor='bgcolor="#9BB9FB"';}
$u++;
echo "<tr $bgcolor>";
echo "<td><font size=1>$u</td>";
echo "<td align=left><font size=2> $row[0] </td>";
echo "<td align=left><font size=1> $row[1] </td>\n";
echo "<td align=left><font size=2> $row[2] </td>\n";
echo "<td align=left><font size=2> $row[3] &nbsp;</td>\n";
echo "</tr>\n";
}
echo "</TABLE><BR><BR>\n";
echo "<B>RECORDINGS FOR THIS LEAD:</B>\n";
echo "<TABLE width=750 cellspacing=1 cellpadding=1>\n";
echo "<tr><td><font size=1># </td><td align=left><font size=2> LEAD</td><td><font size=2>DATE/TIME </td><td align=left><font size=2>SECONDS </td><td align=left><font size=2> &nbsp; RECID</td><td align=center><font size=2>FILENAME</td><td align=left><font size=2>LOCATION</td><td align=left><font size=2>TSR</td></tr>\n";
@@ -1214,7 +1246,6 @@ else
}
echo "</TABLE><BR><BR>\n";