From c7224e22ea71e4b3ddf181a9da6b429413386552 Mon Sep 17 00:00:00 2001 From: mattf Date: Mon, 10 Oct 2011 20:20:27 +0000 Subject: [PATCH] Changed survey audio files to allow for multiple files with pipe delimiter small fix for remote agent inbound routing git-svn-id: svn://192.168.202.10@1739 3d104415-ff17-0410-8863-d5cf3c621b8a --- agi/agi-VDAD_ALL_outbound.agi | 83 ++++++++++++++++++++++++++++-- bin/AST_VDremote_agents.pl | 4 +- extras/MySQL_AST_CREATE_tables.sql | 5 +- extras/upgrade_2.4.sql | 4 ++ www/vicidial/admin.php | 10 ++-- 5 files changed, 92 insertions(+), 14 deletions(-) diff --git a/agi/agi-VDAD_ALL_outbound.agi b/agi/agi-VDAD_ALL_outbound.agi index 1c320059..a005ea23 100644 --- a/agi/agi-VDAD_ALL_outbound.agi +++ b/agi/agi-VDAD_ALL_outbound.agi @@ -954,7 +954,24 @@ if ($call_handle_method =~ /REMIND/) $dbhP=$dbhA; $mysql_count='01013'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; if ($AGILOG) {$agi_string = "-- VDAC posttime record: |$affected_rows|$FDtsSQLdate|$callerid|REMIND|"; &agi_output;} - $AGI->stream_file("$survey_first_audio_file"); + if ( $survey_first_audio_file ne "") + { + if ($survey_first_audio_file =~ /\|/) + { + @survey_first_audio_file_array = split(/\|/,$survey_first_audio_file); + $w=0; + foreach(@survey_first_audio_file_array) + { + if (length($survey_first_audio_file_array[$w])>0) + { + $AGI->stream_file("$survey_first_audio_file_array[$w]"); + } + $w++; + } + } + else + {$AGI->stream_file("$survey_first_audio_file");} + } } @@ -1061,7 +1078,21 @@ if ($call_handle_method =~ /SURVEY/) { if ( $survey_ni_audio_file ne "") { - $AGI->stream_file($survey_ni_audio_file); + if ($survey_ni_audio_file =~ /\|/) + { + @survey_ni_audio_file_array = split(/\|/,$survey_ni_audio_file); + $w=0; + foreach(@survey_ni_audio_file_array) + { + if (length($survey_ni_audio_file_array[$w])>0) + { + $AGI->stream_file("$survey_ni_audio_file_array[$w]"); + } + $w++; + } + } + else + {$AGI->stream_file("$survey_ni_audio_file");} } $stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' order by call_time desc limit 1;"; @@ -1132,7 +1163,21 @@ if ($call_handle_method =~ /SURVEY/) { if ( $survey_third_audio_file ne "") { - $AGI->stream_file($survey_third_audio_file); + if ($survey_third_audio_file =~ /\|/) + { + @survey_third_audio_file_array = split(/\|/,$survey_third_audio_file); + $w=0; + foreach(@survey_third_audio_file_array) + { + if (length($survey_third_audio_file_array[$w])>0) + { + $AGI->stream_file("$survey_third_audio_file_array[$w]"); + } + $w++; + } + } + else + {$AGI->stream_file("$survey_third_audio_file");} } $stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' order by call_time desc limit 1;"; @@ -1215,7 +1260,21 @@ if ($call_handle_method =~ /SURVEY/) { if ( $survey_fourth_audio_file ne "") { - $AGI->stream_file($survey_fourth_audio_file); + if ($survey_fourth_audio_file =~ /\|/) + { + @survey_fourth_audio_file_array = split(/\|/,$survey_fourth_audio_file); + $w=0; + foreach(@survey_fourth_audio_file_array) + { + if (length($survey_fourth_audio_file_array[$w])>0) + { + $AGI->stream_file("$survey_fourth_audio_file_array[$w]"); + } + $w++; + } + } + else + {$AGI->stream_file("$survey_fourth_audio_file");} } $stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' order by call_time desc limit 1;"; @@ -1314,7 +1373,21 @@ if ($call_handle_method =~ /SURVEY/) if ( $survey_opt_in_audio_file ne "") { - $AGI->stream_file($survey_opt_in_audio_file); + if ($survey_opt_in_audio_file =~ /\|/) + { + @survey_opt_in_audio_file_array = split(/\|/,$survey_opt_in_audio_file); + $w=0; + foreach(@survey_opt_in_audio_file_array) + { + if (length($survey_opt_in_audio_file_array[$w])>0) + { + $AGI->stream_file("$survey_opt_in_audio_file_array[$w]"); + } + $w++; + } + } + else + {$AGI->stream_file("$survey_opt_in_audio_file");} } if ($survey_method =~ /VOICEMAIL|EXTENSION|HANGUP|CALLMENU/) diff --git a/bin/AST_VDremote_agents.pl b/bin/AST_VDremote_agents.pl index 9b746e17..e8d16bdd 100644 --- a/bin/AST_VDremote_agents.pl +++ b/bin/AST_VDremote_agents.pl @@ -325,10 +325,10 @@ while($one_day_interval > 0) $stmtC = "UPDATE vicidial_closer_log set status='XFER',user='$QHuser[$w]',comments='REMOTE' where lead_id='$QHlead_id[$w]' and uniqueid='$QHuniqueid[$w]' and campaign_id='$QHcampaign_id[$w]' limit 1;"; $Caffected_rows = $dbhA->do($stmtC); - $stmtD = "UPDATE vicidial_live_inbound_agents set calls_today=(calls_today + 1),last_call_time='$SQLdate' where user='$QHuser[$w]' and group_id='$QHcampaign_id[$w]';"; + $stmtD = "INSERT IGNORE INTO vicidial_live_inbound_agents SET calls_today='1',last_call_time='$SQLdate' where user='$QHuser[$w]' and group_id='$QHcampaign_id[$w]' ON DUPLICATE KEY UPDATE calls_today=(calls_today + 1),last_call_time='$SQLdate';"; $Daffected_rows = $dbhA->do($stmtD); - $stmtE = "UPDATE vicidial_inbound_group_agents set calls_today=(calls_today + 1) where user='$QHuser[$w]' and group_id='$QHcampaign_id[$w]';"; + $stmtE = "INSERT IGNORE INTO vicidial_inbound_group_agents set calls_today=1 where user='$QHuser[$w]' and group_id='$QHcampaign_id[$w]' ON DUPLICATE KEY UPDATE calls_today=(calls_today + 1);"; $Eaffected_rows = $dbhA->do($stmtE); $stmtG = "SELECT start_call_url FROM vicidial_inbound_groups where group_id='$QHcampaign_id[$w]';"; diff --git a/extras/MySQL_AST_CREATE_tables.sql b/extras/MySQL_AST_CREATE_tables.sql index 33af187c..420cfa0e 100644 --- a/extras/MySQL_AST_CREATE_tables.sql +++ b/extras/MySQL_AST_CREATE_tables.sql @@ -1540,7 +1540,8 @@ group_weight TINYINT(1) default '0', calls_today SMALLINT(5) UNSIGNED default '0', group_web_vars VARCHAR(255) default '', index (group_id), -index (user) +index (user), +unique index viga_user_group_id (user, group_id) ); CREATE TABLE vicidial_live_inbound_agents ( @@ -2679,7 +2680,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='1302',db_schema_update_date=NOW(); +UPDATE system_settings SET db_schema_version='1303',db_schema_update_date=NOW(); GRANT RELOAD ON *.* TO cron@'%'; GRANT RELOAD ON *.* TO cron@localhost; diff --git a/extras/upgrade_2.4.sql b/extras/upgrade_2.4.sql index b9d6099d..b0d15ec8 100644 --- a/extras/upgrade_2.4.sql +++ b/extras/upgrade_2.4.sql @@ -1095,3 +1095,7 @@ ALTER TABLE system_settings ADD expanded_list_stats ENUM('0','1') default '1'; ALTER TABLE vicidial_shifts ADD report_option ENUM('Y','N') default 'N'; UPDATE system_settings SET db_schema_version='1302',db_schema_update_date=NOW() where db_schema_version < 1302; + +CREATE UNIQUE INDEX viga_user_group_id on vicidial_inbound_group_agents (user, group_id); + +UPDATE system_settings SET db_schema_version='1303',db_schema_update_date=NOW() where db_schema_version < 1303; diff --git a/www/vicidial/admin.php b/www/vicidial/admin.php index fcf78b7a..361653e3 100644 --- a/www/vicidial/admin.php +++ b/www/vicidial/admin.php @@ -2200,9 +2200,6 @@ if ($non_latin < 1) $alias_id = ereg_replace("[^-_0-9a-zA-Z]","",$alias_id); $shift_id = ereg_replace("[^-_0-9a-zA-Z]","",$shift_id); $qc_shift_id = ereg_replace("[^-_0-9a-zA-Z]","",$qc_shift_id); - $survey_first_audio_file = ereg_replace("[^-_0-9a-zA-Z]","",$survey_first_audio_file); - $survey_opt_in_audio_file = ereg_replace("[^-_0-9a-zA-Z]","",$survey_opt_in_audio_file); - $survey_ni_audio_file = ereg_replace("[^-_0-9a-zA-Z]","",$survey_ni_audio_file); $survey_method = ereg_replace("[^-_0-9a-zA-Z]","",$survey_method); $alter_custphone_override = ereg_replace("[^-_0-9a-zA-Z]","",$alter_custphone_override); $manual_dial_filter = ereg_replace("[^-_0-9a-zA-Z]","",$manual_dial_filter); @@ -2232,8 +2229,6 @@ if ($non_latin < 1) $group_alias_id = ereg_replace("[^-_0-9a-zA-Z]","",$group_alias_id); $default_group_alias = ereg_replace("[^-_0-9a-zA-Z]","",$default_group_alias); $vtiger_search_dead = ereg_replace("[^-_0-9a-zA-Z]","",$vtiger_search_dead); - $survey_third_audio_file = ereg_replace("[^-_0-9a-zA-Z]","",$survey_third_audio_file); - $survey_fourth_audio_file = ereg_replace("[^-_0-9a-zA-Z]","",$survey_fourth_audio_file); $menu_id = ereg_replace("[^-_0-9a-zA-Z]","",$menu_id); $source_menu = ereg_replace("[^-_0-9a-zA-Z]","",$source_menu); $call_time_id = ereg_replace("[^-_0-9a-zA-Z]","",$call_time_id); @@ -2355,6 +2350,11 @@ if ($non_latin < 1) $alt_log_dbname = ereg_replace("[^-\/\|\._0-9a-zA-Z]","",$alt_log_dbname); $alt_log_login = ereg_replace("[^-\/\|\._0-9a-zA-Z]","",$alt_log_login); $alt_log_pass = ereg_replace("[^-\/\|\._0-9a-zA-Z]","",$alt_log_pass); + $survey_first_audio_file = ereg_replace("[^-\/\|\._0-9a-zA-Z]","",$survey_first_audio_file); + $survey_opt_in_audio_file = ereg_replace("[^-\/\|\._0-9a-zA-Z]","",$survey_opt_in_audio_file); + $survey_ni_audio_file = ereg_replace("[^-\/\|\._0-9a-zA-Z]","",$survey_ni_audio_file); + $survey_third_audio_file = ereg_replace("[^-\/\|\._0-9a-zA-Z]","",$survey_third_audio_file); + $survey_fourth_audio_file = ereg_replace("[^-\/\|\._0-9a-zA-Z]","",$survey_fourth_audio_file); ### ALPHA-NUMERIC and underscore and dash and comma $logins_list = ereg_replace("[^-\,\_0-9a-zA-Z]","",$logins_list);