diff --git a/UPGRADE b/UPGRADE index 2debffd7..2e737893 100644 --- a/UPGRADE +++ b/UPGRADE @@ -458,6 +458,9 @@ OTHER CHANGES: This includes different wording, different sizes and removing the blank space below the recording buttons. +128. Added ability to play multiple audio prompts for outbound survey campaigns + and to use DYN for lead field wildcards defined as audio prompts. + diff --git a/agi/agi-VDAD_ALL_outbound.agi b/agi/agi-VDAD_ALL_outbound.agi index e8875a2a..b25ae44b 100644 --- a/agi/agi-VDAD_ALL_outbound.agi +++ b/agi/agi-VDAD_ALL_outbound.agi @@ -122,6 +122,7 @@ # 190713-1045 - Added Call Quota logging # 190925-1348 - Added campaign SIP Actions processing # 191104-2026 - Added code for Khomp version compatibility +# 191120-2235 - Added DYN multi-prompt survey prompts functionality # $script = 'agi-VDAD_ALL_outbound.agi'; @@ -1014,43 +1015,58 @@ if ($VDACaffected_rows > 0) } - ### pre-generate Cepstral first and last name as an audio file + ##### BEGIN TTS or DYN audio prompt processing, pre-generate Cepstral first and last name as an audio file ##### if ($call_handle_method =~ /SURVEYCAMPCEP/) { $t=0; - if ($survey_first_audio_file =~ /^TTS/) + if ($survey_first_audio_file =~ /^TTS|^DYN/) { $TTS_prompt[$t] = 'survey_first_audio_file'; $TTS_filename[$t] = $survey_first_audio_file; - $TTS_filename[$t]=~s/^TTS//gi; + $TTS_DYN[$t]=0; + if ($survey_first_audio_file =~ /^DYN/) + {$TTS_DYN[$t]++;} + $TTS_filename[$t]=~s/^TTS|^DYN//gi; $t++; } - if ($survey_opt_in_audio_file =~ /^TTS/) + if ($survey_opt_in_audio_file =~ /^TTS|^DYN/) { $TTS_prompt[$t] = 'survey_opt_in_audio_file'; $TTS_filename[$t] = $survey_opt_in_audio_file; - $TTS_filename[$t]=~s/^TTS//gi; + $TTS_DYN[$t]=0; + if ($survey_opt_in_audio_file =~ /^DYN/) + {$TTS_DYN[$t]++;} + $TTS_filename[$t]=~s/^TTS|^DYN//gi; $t++; } - if ($survey_ni_audio_file =~ /^TTS/) + if ($survey_ni_audio_file =~ /^TTS|^DYN/) { $TTS_prompt[$t] = 'survey_ni_audio_file'; $TTS_filename[$t] = $survey_ni_audio_file; - $TTS_filename[$t]=~s/^TTS//gi; + $TTS_DYN[$t]=0; + if ($survey_ni_audio_file =~ /^DYN/) + {$TTS_DYN[$t]++;} + $TTS_filename[$t]=~s/^TTS|^DYN//gi; $t++; } - if ($survey_third_audio_file =~ /^TTS/) + if ($survey_third_audio_file =~ /^TTS|^DYN/) { $TTS_prompt[$t] = 'survey_third_audio_file'; $TTS_filename[$t] = $survey_third_audio_file; - $TTS_filename[$t]=~s/^TTS//gi; + $TTS_DYN[$t]=0; + if ($survey_third_audio_file =~ /^DYN/) + {$TTS_DYN[$t]++;} + $TTS_filename[$t]=~s/^TTS|^DYN//gi; $t++; } - if ($survey_fourth_audio_file =~ /^TTS/) + if ($survey_fourth_audio_file =~ /^TTS|^DYN/) { $TTS_prompt[$t] = 'survey_fourth_audio_file'; $TTS_filename[$t] = $survey_fourth_audio_file; - $TTS_filename[$t]=~s/^TTS//gi; + $TTS_DYN[$t]=0; + if ($survey_fourth_audio_file =~ /^DYN/) + {$TTS_DYN[$t]++;} + $TTS_filename[$t]=~s/^TTS|^DYN//gi; $t++; } @@ -1104,105 +1120,115 @@ if ($VDACaffected_rows > 0) $s=0; while ($s < $t) { - $stmtA = "SELECT tts_text,tts_voice FROM vicidial_tts_prompts where tts_id='$TTS_filename[$s]';"; - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - $dbhP=$dbhA; $mysql_count='01057'; $MEL_aff_rows=$sthArows; &mysql_error_logging; - if ($s < 1) {$hideCLI = '';} - else {$hideCLI = '&';} - if ($sthArows > 0) + if ($TTS_DYN[$s] < 1) { - @aryA = $sthA->fetchrow_array; - $TTS_voice = $aryA[1]; - $TTS_text[$s] = $aryA[0]; - ### BEGIN replace variables with record values ### - $TTS_text[$s] =~ s/--A--lead_id--B--/$TTS_lead_id/gi; - $TTS_text[$s] =~ s/--A--entry_date--B--/$TTS_entry_date/gi; - $TTS_text[$s] =~ s/--A--modify_date--B--/$TTS_modify_date/gi; - $TTS_text[$s] =~ s/--A--status--B--/$TTS_status/gi; - $TTS_text[$s] =~ s/--A--user--B--/$TTS_user/gi; - $TTS_text[$s] =~ s/--A--vendor_lead_code--B--/$TTS_vendor_lead_code/gi; - $TTS_text[$s] =~ s/--A--source_id--B--/$TTS_source_id/gi; - $TTS_text[$s] =~ s/--A--list_id--B--/$TTS_list_id/gi; - $TTS_text[$s] =~ s/--A--phone_number--B--/$TTS_phone_number/gi; - $TTS_text[$s] =~ s/--A--title--B--/$TTS_title/gi; - $TTS_text[$s] =~ s/--A--first_name--B--/$TTS_first_name/gi; - $TTS_text[$s] =~ s/--A--middle_initial--B--/$TTS_middle_initial/gi; - $TTS_text[$s] =~ s/--A--last_name--B--/$TTS_last_name/gi; - $TTS_text[$s] =~ s/--A--address1--B--/$TTS_address1/gi; - $TTS_text[$s] =~ s/--A--address2--B--/$TTS_address2/gi; - $TTS_text[$s] =~ s/--A--address3--B--/$TTS_address3/gi; - $TTS_text[$s] =~ s/--A--city--B--/$TTS_city/gi; - $TTS_text[$s] =~ s/--A--state--B--/$TTS_state/gi; - $TTS_text[$s] =~ s/--A--province--B--/$TTS_province/gi; - $TTS_text[$s] =~ s/--A--postal_code--B--/$TTS_postal_code/gi; - $TTS_text[$s] =~ s/--A--country_code--B--/$TTS_country_code/gi; - $TTS_text[$s] =~ s/--A--gender--B--/$TTS_gender/gi; - $TTS_text[$s] =~ s/--A--date_of_birth--B--/$TTS_date_of_birth/gi; - $TTS_text[$s] =~ s/--A--alt_phone--B--/$TTS_alt_phone/gi; - $TTS_text[$s] =~ s/--A--email--B--/$TTS_email/gi; - $TTS_text[$s] =~ s/--A--security_phrase--B--/$TTS_security_phrase/gi; - $TTS_text[$s] =~ s/--A--comments--B--/$TTS_comments/gi; - $TTS_text[$s] =~ s/--A--called_count--B--/$TTS_called_count/gi; - $TTS_text[$s] =~ s/--A--last_local_call_time--B--/$TTS_last_local_call_time/gi; - $TTS_text[$s] =~ s/--A--rank--B--/$TTS_rank/gi; - $TTS_text[$s] =~ s/--A--owner--B--/$TTS_owner/gi; - ### END replace variables with record values ### - - ### BEGIN check for --C-- and --D-- tags for static file replacement - if ( ($TTS_text[$s] =~ /--C--/) || ($TTS_text[$s] =~ /--D--/) ) + $stmtA = "SELECT tts_text,tts_voice FROM vicidial_tts_prompts where tts_id='$TTS_filename[$s]';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $dbhP=$dbhA; $mysql_count='01057'; $MEL_aff_rows=$sthArows; &mysql_error_logging; + if ($s < 1) {$hideCLI = '';} + else {$hideCLI = '&';} + if ($sthArows > 0) { - $Cdash='--C--'; - $Ddash='--D--'; - @static_check = split(/--C--/,$TTS_text[$s]); - $sc=0; - $sr=0; - foreach(@static_check) + @aryA = $sthA->fetchrow_array; + $TTS_voice = $aryA[1]; + $TTS_text[$s] = $aryA[0]; + } + $sthA->finish(); + } + else + {$TTS_text[$s] = $TTS_filename[$s];} + + ### BEGIN replace variables with record values ### + $TTS_text[$s] =~ s/--A--lead_id--B--/$TTS_lead_id/gi; + $TTS_text[$s] =~ s/--A--entry_date--B--/$TTS_entry_date/gi; + $TTS_text[$s] =~ s/--A--modify_date--B--/$TTS_modify_date/gi; + $TTS_text[$s] =~ s/--A--status--B--/$TTS_status/gi; + $TTS_text[$s] =~ s/--A--user--B--/$TTS_user/gi; + $TTS_text[$s] =~ s/--A--vendor_lead_code--B--/$TTS_vendor_lead_code/gi; + $TTS_text[$s] =~ s/--A--source_id--B--/$TTS_source_id/gi; + $TTS_text[$s] =~ s/--A--list_id--B--/$TTS_list_id/gi; + $TTS_text[$s] =~ s/--A--phone_number--B--/$TTS_phone_number/gi; + $TTS_text[$s] =~ s/--A--title--B--/$TTS_title/gi; + $TTS_text[$s] =~ s/--A--first_name--B--/$TTS_first_name/gi; + $TTS_text[$s] =~ s/--A--middle_initial--B--/$TTS_middle_initial/gi; + $TTS_text[$s] =~ s/--A--last_name--B--/$TTS_last_name/gi; + $TTS_text[$s] =~ s/--A--address1--B--/$TTS_address1/gi; + $TTS_text[$s] =~ s/--A--address2--B--/$TTS_address2/gi; + $TTS_text[$s] =~ s/--A--address3--B--/$TTS_address3/gi; + $TTS_text[$s] =~ s/--A--city--B--/$TTS_city/gi; + $TTS_text[$s] =~ s/--A--state--B--/$TTS_state/gi; + $TTS_text[$s] =~ s/--A--province--B--/$TTS_province/gi; + $TTS_text[$s] =~ s/--A--postal_code--B--/$TTS_postal_code/gi; + $TTS_text[$s] =~ s/--A--country_code--B--/$TTS_country_code/gi; + $TTS_text[$s] =~ s/--A--gender--B--/$TTS_gender/gi; + $TTS_text[$s] =~ s/--A--date_of_birth--B--/$TTS_date_of_birth/gi; + $TTS_text[$s] =~ s/--A--alt_phone--B--/$TTS_alt_phone/gi; + $TTS_text[$s] =~ s/--A--email--B--/$TTS_email/gi; + $TTS_text[$s] =~ s/--A--security_phrase--B--/$TTS_security_phrase/gi; + $TTS_text[$s] =~ s/--A--comments--B--/$TTS_comments/gi; + $TTS_text[$s] =~ s/--A--called_count--B--/$TTS_called_count/gi; + $TTS_text[$s] =~ s/--A--last_local_call_time--B--/$TTS_last_local_call_time/gi; + $TTS_text[$s] =~ s/--A--rank--B--/$TTS_rank/gi; + $TTS_text[$s] =~ s/--A--owner--B--/$TTS_owner/gi; + ### END replace variables with record values ### + + ### BEGIN check for --C-- and --D-- tags for static file replacement + if ( ($TTS_text[$s] =~ /--C--/) || ($TTS_text[$s] =~ /--D--/) ) + { + $Cdash='--C--'; + $Ddash='--D--'; + @static_check = split(/--C--/,$TTS_text[$s]); + $sc=0; + $sr=0; + foreach(@static_check) + { + if ($sc > 0) { - if ($sc > 0) + $static_check[$sc] =~ s/--D-.*//gi; + $static_check_lc = lc($static_check[$sc]); + print STDERR " Checking For Static Replacement: $static_check[$sc]|$static_check_lc$wav\n"; + $static_found=0; + if (-e "/var/lib/asterisk/sounds/tts_static/$static_check_lc$wav") { - $static_check[$sc] =~ s/--D-.*//gi; - $static_check_lc = lc($static_check[$sc]); - print STDERR " Checking For Static Replacement: $static_check[$sc]|$static_check_lc$wav\n"; - $static_found=0; - if (-e "/var/lib/asterisk/sounds/tts_static/$static_check_lc$wav") + $CDstatic = "