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 = " "; + $static_found++; + } + else + { + if (-e "/var/lib/asterisk/sounds/$static_check_lc$wav") { - $CDstatic = " "; + $CDstatic = " "; $static_found++; } else { - if (-e "/var/lib/asterisk/sounds/$static_check_lc$wav") + $firsttwo = substr($static_check_lc, 0, 2); + if (-e "/var/lib/asterisk/sounds/tts_static/$firsttwo/$static_check_lc$wav") { - $CDstatic = " "; + $CDstatic = " "; $static_found++; } - else - { - $firsttwo = substr($static_check_lc, 0, 2); - if (-e "/var/lib/asterisk/sounds/tts_static/$firsttwo/$static_check_lc$wav") - { - $CDstatic = " "; - $static_found++; - } - } - } - if ($static_found > 0) - { - $CDmatch = "$Cdash$static_check[$sc]$Ddash"; - $TTS_text[$s] =~ s/$CDmatch/$CDstatic/gi; - print STDERR " Static Replacement Found: $CDmatch|$CDstatic\n"; - $sr++; } } - $sc++; + if ($static_found > 0) + { + $CDmatch = "$Cdash$static_check[$sc]$Ddash"; + $TTS_text[$s] =~ s/$CDmatch/$CDstatic/gi; + print STDERR " Static Replacement Found: $CDmatch|$CDstatic\n"; + $sr++; + } } - $TTS_text[$s] =~ s/--C--|--D--//gi; - print STDERR "\nStatic Replacements Found: $sc|$sr\n"; + $sc++; } - ### END check for --C-- and --D-- tags for static file replacement + $TTS_text[$s] =~ s/--C--|--D--//gi; + print STDERR "\nStatic Replacements Found: $sc|$sr\n"; + } + ### END check for --C-- and --D-- tags for static file replacement + if ($TTS_DYN[$s] < 1) + { ### filter input for CLI-safe characters $TTS_text[$s] =~ s/[^,\.\<\>\'\/\=\_\-\: 0-9a-zA-Z]//gi; $TTS_textRAW[$s] = $TTS_text[$s]; @@ -1231,7 +1257,8 @@ if ($VDACaffected_rows > 0) $TTS_filename_path[$s] = $PATHsounds . "/tts/" . $enc_ftl . "/tts-" . $enc; print STDERR "\nfilename: $TTS_filename_path[$s]\n"; } - $sthA->finish(); + else + {$TTS_filename_path[$s] = $TTS_text[$s];} $s++; } @@ -1253,6 +1280,8 @@ if ($VDACaffected_rows > 0) } } } + ##### END TTS or DYN audio prompt processing, pre-generate Cepstral first and last name as an audio file ##### + $xCLlist_id=0; $called_count=0; @@ -4197,7 +4226,29 @@ sub enter_pin_number $interrupt_digit=''; undef $interrupt_digit; - $interrupt_digit = $AGI->stream_file("$sound","$survey_dtmf_digits"); + if ( $sound ne "") + { + if ($sound =~ /\|/) + { + @sound_array = split(/\|/,$sound); + $w=0; + foreach(@sound_array) + { + if (length($sound_array[$w])>0) + { + if ($interrupt_digit < 2) + { + $interrupt_digit = $AGI->stream_file("$sound_array[$w]","$survey_dtmf_digits"); + } + } + $w++; + } + } + else + {$interrupt_digit = $AGI->stream_file("$sound","$survey_dtmf_digits");} + } + + if ($AGILOG) {$agi_string = "interrupt_digit |$interrupt_digit| timeout |$survey_wait_sec|$survey_wait_msec|"; &agi_output;} diff --git a/extras/MySQL_AST_CREATE_tables.sql b/extras/MySQL_AST_CREATE_tables.sql index 464eb614..cbd1dc6f 100644 --- a/extras/MySQL_AST_CREATE_tables.sql +++ b/extras/MySQL_AST_CREATE_tables.sql @@ -825,11 +825,11 @@ qc_get_record_launch ENUM('NONE','SCRIPT','WEBFORM','QCSCRIPT','QCWEBFORM') defa qc_show_recording ENUM('Y','N') default 'Y', qc_web_form_address VARCHAR(255), qc_script VARCHAR(20), -survey_first_audio_file VARCHAR(50) default 'US_pol_survey_hello', +survey_first_audio_file TEXT, survey_dtmf_digits VARCHAR(16) default '1238', survey_ni_digit VARCHAR(1) default '8', -survey_opt_in_audio_file VARCHAR(50) default 'US_pol_survey_transfer', -survey_ni_audio_file VARCHAR(50) default 'US_thanks_no_contact', +survey_opt_in_audio_file TEXT, +survey_ni_audio_file TEXT, survey_method ENUM('AGENT_XFER','VOICEMAIL','EXTENSION','HANGUP','CAMPREC_60_WAV','CALLMENU','VMAIL_NO_INST') default 'AGENT_XFER', survey_no_response_action ENUM('OPTIN','OPTOUT','DROP') default 'OPTIN', survey_ni_status VARCHAR(6) default 'NI', @@ -855,11 +855,11 @@ default_group_alias VARCHAR(30) default '', vtiger_search_dead ENUM('DISABLED','ASK','RESURRECT') default 'ASK', vtiger_status_call ENUM('Y','N') default 'N', survey_third_digit VARCHAR(1) default '', -survey_third_audio_file VARCHAR(50) default 'US_thanks_no_contact', +survey_third_audio_file TEXT, survey_third_status VARCHAR(6) default 'NI', survey_third_exten VARCHAR(20) default '8300', survey_fourth_digit VARCHAR(1) default '', -survey_fourth_audio_file VARCHAR(50) default 'US_thanks_no_contact', +survey_fourth_audio_file TEXT, survey_fourth_status VARCHAR(6) default 'NI', survey_fourth_exten VARCHAR(20) default '8300', drop_lockout_time VARCHAR(6) default '0', @@ -4570,4 +4570,4 @@ INSERT INTO vicidial_settings_containers(container_id,container_notes,container_ UPDATE system_settings set vdc_agent_api_active='1'; -UPDATE system_settings SET db_schema_version='1581',db_schema_update_date=NOW(),reload_timestamp=NOW(); +UPDATE system_settings SET db_schema_version='1582',db_schema_update_date=NOW(),reload_timestamp=NOW(); diff --git a/extras/upgrade_2.14.sql b/extras/upgrade_2.14.sql index 0b9e10c8..1d77f77f 100644 --- a/extras/upgrade_2.14.sql +++ b/extras/upgrade_2.14.sql @@ -1123,3 +1123,11 @@ ALTER TABLE system_settings ADD enable_first_webform ENUM('0','1') default '1'; ALTER TABLE system_settings ADD recording_buttons VARCHAR(30) default 'START_STOP'; UPDATE system_settings SET db_schema_version='1581',db_schema_update_date=NOW() where db_schema_version < 1581; + +ALTER TABLE vicidial_campaigns MODIFY survey_first_audio_file TEXT; +ALTER TABLE vicidial_campaigns MODIFY survey_opt_in_audio_file TEXT; +ALTER TABLE vicidial_campaigns MODIFY survey_ni_audio_file TEXT; +ALTER TABLE vicidial_campaigns MODIFY survey_third_audio_file TEXT; +ALTER TABLE vicidial_campaigns MODIFY survey_fourth_audio_file TEXT; + +UPDATE system_settings SET db_schema_version='1582',db_schema_update_date=NOW() where db_schema_version < 1582; diff --git a/www/vicidial/admin.php b/www/vicidial/admin.php index 47cbe6d9..0b2644da 100644 --- a/www/vicidial/admin.php +++ b/www/vicidial/admin.php @@ -4595,12 +4595,13 @@ else # 191111-1601 - Added additional user status group setting(status_group_id) # 191113-1751 - Added add_dnc_phone add_fpg_phone API functions # 191114-0923 - Added enable_first_webform and recording_buttons system settings +# 191121-2256 - Extended survey audio file lengths # # make sure you have added a user to the vicidial_users MySQL table with at least user_level 9 to access this page the first time -$admin_version = '2.14-729a'; -$build = '191114-0923'; +$admin_version = '2.14-730a'; +$build = '191121-2256'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -10314,7 +10315,7 @@ if ($ADD==21) $rslt=mysql_to_mysqli($stmt, $link); } - $stmt="INSERT INTO vicidial_campaigns (campaign_id,campaign_name,campaign_description,active,dial_status_a,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,campaign_script,get_call_launch,campaign_changedate,campaign_stats_refresh,list_order_mix,web_form_address_two,start_call_url,dispo_call_url,na_call_url,user_group,web_form_address_three,campaign_script_two) values('$campaign_id','$campaign_name','$campaign_description','$active','NEW','DOWN','$park_ext','$park_file_name','" . mysqli_real_escape_string($link, $web_form_address) . "','$allow_closers','$hopper_level','$auto_dial_level','$next_agent_call','$local_call_time','$voicemail_ext','$script_id','$get_call_launch','$SQLdate','Y','DISABLED','','','','','$user_group','','$campaign_script_two');"; + $stmt="INSERT INTO vicidial_campaigns (campaign_id,campaign_name,campaign_description,active,dial_status_a,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,campaign_script,get_call_launch,campaign_changedate,campaign_stats_refresh,list_order_mix,web_form_address_two,start_call_url,dispo_call_url,na_call_url,user_group,web_form_address_three,campaign_script_two,survey_first_audio_file,survey_ni_audio_file,survey_opt_in_audio_file,survey_third_audio_file,survey_fourth_audio_file) values('$campaign_id','$campaign_name','$campaign_description','$active','NEW','DOWN','$park_ext','$park_file_name','" . mysqli_real_escape_string($link, $web_form_address) . "','$allow_closers','$hopper_level','$auto_dial_level','$next_agent_call','$local_call_time','$voicemail_ext','$script_id','$get_call_launch','$SQLdate','Y','DISABLED','','','','','$user_group','','$campaign_script_two','US_pol_survey_hello','US_thanks_no_contact','US_pol_survey_transfer','US_thanks_no_contact','US_thanks_no_contact');"; $rslt=mysql_to_mysqli($stmt, $link); $stmtA="INSERT INTO vicidial_campaign_stats (campaign_id) values('$campaign_id');"; @@ -14571,13 +14572,15 @@ if ($ADD==41) $survey_wait_sec = '10'; $survey_first_audio_file = 'US_pol_survey_hello'; $survey_method = 'AGENT_XFER'; - $survey_ni_audio_file = ''; + $survey_ni_audio_file = 'US_thanks_no_contact'; $survey_ni_digit = '8'; $survey_ni_status = 'NI'; $survey_no_response_action = 'OPTIN'; $survey_opt_in_audio_file = 'US_pol_survey_transfer'; $survey_response_digit_map = '1-DEMOCRAT|2-REPUBLICAN|3-INDEPENDANT|8-OPTOUT|X-NO RESPONSE|'; $survey_xfer_exten = '8300'; + $survey_third_audio_file = 'US_thanks_no_contact'; + $survey_fourth_audio_file = 'US_thanks_no_contact'; $voicemail_ext = ''; $cpd_amd_action = 'DISABLED'; $cpd_unknown_action = 'DISABLED'; @@ -25624,27 +25627,27 @@ if ($ADD==31) { echo "