Added survey_recording option for outbound survey campaigns

git-svn-id: svn://192.168.202.10@1716 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2011-08-30 03:25:22 +00:00
parent 0b2a8da229
commit 414c5150c3
5 changed files with 82 additions and 9 deletions
+57 -2
View File
@@ -89,6 +89,7 @@
# 110626-2342 - Added queuemetrics_pe_phone_append
# 110723-2330 - Set CID to customer phone number and caller code when transferring to CALLMENU
# 110812-1514 - Added static tts file parsing and replacement
# 110829-2324 - Added survey_recording option
#
$script = 'agi-VDAD_ALL_outbound.agi';
@@ -482,7 +483,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,safe_harbor_audio,safe_harbor_menu_id 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,survey_recording 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;
@@ -519,6 +520,7 @@ if ($VDACaffected_rows > 0)
$campaign_rec_filename = $aryA[23];
$safe_harbor_audio = $aryA[24];
$safe_harbor_menu_id = $aryA[25];
$survey_recording = $aryA[26];
if (length($closer_campaigns) > 2)
{
$closer_campaigns =~ s/^ | -$//gi;
@@ -529,6 +531,59 @@ if ($VDACaffected_rows > 0)
}
$sthA->finish();
### start recording if survey recording is enabled
if ( ($call_handle_method =~ /SURVEY/) && ($survey_recording =~ /Y/) )
{
$stmtA = "SELECT vendor_lead_code FROM vicidial_list where lead_id='$CIDlead_id';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$vendor_lead_code = $aryA[0];
}
$sthA->finish();
# get date/time
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year = ($year + 1900);
$Tyear = ($year - 2000);
$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";
$recdate = "$year$mon$mday-$hour$min$sec";
$tinydate = "$Tyear$mon$mday$hour$min$sec";
$campaign_rec_filename =~ s/CAMPAIGN/$VDADcampaign/gi;
$campaign_rec_filename =~ s/CUSTPHONE/$VDADphone/gi;
$campaign_rec_filename =~ s/FULLDATE/$recdate/gi;
$campaign_rec_filename =~ s/TINYDATE/$tinydate/gi;
$campaign_rec_filename =~ s/EPOCH/$now_date_epoch/gi;
$campaign_rec_filename =~ s/AGENT/VDAD/gi;
$campaign_rec_filename =~ s/VENDORLEADCODE/$vendor_lead_code/gi;
$campaign_rec_filename =~ s/LEADID/$CIDlead_id/gi;
$campaign_rec_filename =~ s/\"|\'//gi;
$campaign_rec_filename =~ s/ //gi;
$AGI->exec("Monitor wav|/var/spool/asterisk/monitor/MIX/$campaign_rec_filename");
### insert record into recording_log table ###
$stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,length_in_sec,filename,lead_id,user,location,vicidial_id) values('$channel','$VARserver_ip','$VDADphone','$now_date','$now_date_epoch','0','$campaign_rec_filename','$CIDlead_id','VDAD','$campaign_rec_filename','$uniqueid');";
$SRaffected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging;
if ($AGILOG) {$agi_string = "-- SURVEY RECORDING STARTED : |$SRaffected_rows|$campaign_rec_filename|$stmtA|"; &agi_output;}
}
### pre-generate Cepstral first and last name as an audio file
if ($call_handle_method =~ /SURVEYCAMPCEP/)
{
@@ -2769,7 +2824,7 @@ sub enter_pin_number
while ( ($digit_loop_counter < $digits_to_collect) )
{
$digit = chr($AGI->wait_for_digit('10000')); # wait 10 seconds for input or until the pound key is pressed
if ($digit =~ /\d/)
if ( ($digit =~ /\d/) && ($survey_dtmf_digits =~ /$digit/) )
{
$totalDTMF = "$totalDTMF$digit";
if ($AGILOG) {$agi_string = "digit |$digit| TotalDTMF |$totalDTMF|"; &agi_output;}
+3 -2
View File
@@ -820,7 +820,8 @@ disable_dispo_screen ENUM('DISPO_ENABLED','DISPO_DISABLED','DISPO_SELECT_DISABLE
disable_dispo_status VARCHAR(6) default '',
screen_labels VARCHAR(20) default '--SYSTEM-SETTINGS--',
status_display_fields VARCHAR(30) default 'CALLID',
na_call_url TEXT
na_call_url TEXT,
survey_recording ENUM('Y','N') default 'N'
);
CREATE TABLE vicidial_lists (
@@ -2635,7 +2636,7 @@ CREATE TABLE vicidial_log_noanswer_archive LIKE vicidial_log_noanswer;
CREATE TABLE vicidial_did_agent_log_archive LIKE vicidial_did_agent_log;
CREATE UNIQUE INDEX vdala on vicidial_did_agent_log_archive (uniqueid,call_date,did_route);
UPDATE system_settings SET db_schema_version='1293',db_schema_update_date=NOW();
UPDATE system_settings SET db_schema_version='1294',db_schema_update_date=NOW();
GRANT RELOAD ON *.* TO cron@'%';
GRANT RELOAD ON *.* TO cron@localhost;
+4
View File
@@ -1002,3 +1002,7 @@ CREATE UNIQUE INDEX vdala on vicidial_did_agent_log_archive (uniqueid,call_date,
ALTER TABLE system_settings ADD did_agent_log ENUM('Y','N') default 'N';
UPDATE system_settings SET db_schema_version='1293',db_schema_update_date=NOW() where db_schema_version < 1293;
ALTER TABLE vicidial_campaigns ADD survey_recording ENUM('Y','N') default 'N';
UPDATE system_settings SET db_schema_version='1294',db_schema_update_date=NOW() where db_schema_version < 1294;
@@ -700,6 +700,8 @@ Here is a list of the available variables||
DID Agent Log||
This option will log the inbound DID calls along with an in-group and user ID, if applicable, to a separate table. Default is N||
TIMEOUT will allow you to set what happens to the call when it times out with no input from the caller. INVALID will allow you to set what happens when the caller enters an invalid option. INVALID_2ND and 3RD can only be active if INVALID is not used, it will wait until the second or third invalid entry by the caller before it executes the option||
Survey Recording||
If enabled, this will start recording when the call is answered. Only recommended if the method is not set to transfer to an agent. Default is N for disabled||
lead_report_export.php
+16 -5
View File
File diff suppressed because one or more lines are too long