Added STC(settings-container) and LTT(lead temp table) message playback options for the VD_amd.agi script

git-svn-id: svn://192.168.202.10@3235 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2020-04-25 06:29:14 +00:00
parent 2f86c68068
commit b72ebbc9df
16 changed files with 598 additions and 19 deletions
+83 -4
View File
@@ -61,6 +61,7 @@
# 200102-0823 - Added vmm_daily_limit campaign setting
# 200205-1839 - Fix for list override message
# 200311-0041 - Added amd_agent_route_options feature
# 200424-1839 - Added STC(settings-container) and LTT(lead temp table) message playback options
#
$script = 'VD_amd.agi';
@@ -533,7 +534,7 @@ else
$sthA->finish();
### Grab vmail forward message values from the database
$SQL_group_id=$VD_campaign_id; $SQL_group_id =~ s/_/\\_/gi;
$stmtA = "SELECT am_message_exten,amd_send_to_vmx,waitforsilence_options,survey_recording,campaign_rec_filename,cpd_amd_action,amd_inbound_group,amd_callmenu,cpd_unknown_action,campaign_id,am_message_wildcards,vmm_daily_limit FROM vicidial_campaigns where closer_campaigns LIKE \"% $SQL_group_id %\" order by campaign_id limit 1;";
$stmtA = "SELECT am_message_exten,amd_send_to_vmx,waitforsilence_options,survey_recording,campaign_rec_filename,cpd_amd_action,amd_inbound_group,amd_callmenu,cpd_unknown_action,campaign_id,am_message_wildcards,vmm_daily_limit FROM vicidial_campaigns where closer_campaigns LIKE \"% $SQL_group_id %\" order by active,campaign_id limit 1;";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -767,10 +768,13 @@ else
if ($AGILOG) {$agi_string = "-- VDAD vicidial_lead_call_quota_counts AM update: |$affected_rows|$uniqueid|"; &agi_output;}
}
##### BEGIN Check if prompt uses TTS or DYN, if so, create TTS and set the filename to the generated prompt #####
if ( ($DB_am_message_exten =~ /^TTS/) || ($DB_am_message_exten =~ /^DYN/) )
##### BEGIN Check if prompt uses TTS, STC, LTT or DYN. If so, create TTS and set the filename to the generated prompt #####
if ($DB_am_message_exten =~ /^TTS|^STC|^LTT|^DYN/)
{
$useTTS=0;
$useSTC=0;
$useLTT=0;
# Cepstral Text-To-Speech, vicidial_tts_prompts
if ($DB_am_message_exten =~ /^TTS/)
{
$useTTS++;
@@ -778,6 +782,23 @@ else
$TTS_filename =~s/^TTS//gi;
$TTS_filename =~s/\|.*//gi;
}
# Settings Container entry, vicidial_settings_containers
elsif ($DB_am_message_exten =~ /^STC/)
{
$useSTC++;
$TTS_filename = $DB_am_message_exten;
$TTS_filename =~s/^STC//gi;
$TTS_filename =~s/\|.*//gi;
}
# Lead Temp Table entry, vicidial_lead_messages
elsif ($DB_am_message_exten =~ /^LTT/)
{
$useLTT++;
$TTS_filename = $DB_am_message_exten;
$TTS_filename =~s/^LTT//gi;
$TTS_filename =~s/\|.*//gi;
}
# dynamic filename lookup
else
{
$TTS_filename = $DB_am_message_exten;
@@ -785,7 +806,7 @@ else
$TTS_text = $TTS_filename;
}
if ($AGILOG) {$agi_string = "-- TTS : |$useTTS|$TTS_filename|"; &agi_output;}
if ($AGILOG) {$agi_string = "-- TTS : |$useTTS|$useSTC|$useLTT|$TTS_filename|"; &agi_output;}
$stmtA = "SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner FROM vicidial_list where lead_id='$VD_lead_id';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
@@ -828,6 +849,8 @@ else
}
$sthA->finish();
if ($useTTS > 0)
{
$TTS_voice = 'Allison-8kHz';
$TTS_text = $TTS_filename;
$stmtA = "SELECT tts_text,tts_voice FROM vicidial_tts_prompts where tts_id='$TTS_filename';";
@@ -841,6 +864,54 @@ else
$TTS_text = $aryA[0];
}
$sthA->finish();
}
if ($useSTC > 0)
{
$TTS_text = $TTS_filename;
$stmtA = "SELECT container_entry FROM vicidial_settings_containers where container_id='$TTS_filename';";
$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;
$TTS_text = $aryA[0];
}
$sthA->finish();
}
if ($useLTT > 0)
{
$TTS_text = $TTS_filename;
$stmtA = "SELECT message_entry,call_date FROM vicidial_lead_messages where lead_id='$VD_lead_id' order by call_date desc limit 1;";
$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;
$TTS_text = $aryA[0];
$TTS_call_date = $aryA[1];
}
$sthA->finish();
if ($sthArows > 0)
{
$stmtA = "UPDATE vicidial_lead_messages SET played=(played+1) where lead_id='$VD_lead_id' and call_date='$TTS_call_date' limit 1;";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VLM vicidial_lead_messages update: |$affected_rows|$stmtA|"; &agi_output;}
}
else
{
if ($AGILOG) {$agi_string = "ERROR: VLM no vicidial_lead_messages record found: |$useLTT|$TTS_filename|$VD_lead_id|$callerid|"; &agi_output;}
$dbhA->disconnect();
$AGI->hangup($channel);
exit;
}
}
### BEGIN replace variables with record values ###
$TTS_text =~ s/--A--lead_id--B--/$TTS_lead_id/gi;
@@ -1426,6 +1497,14 @@ else
$affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VDAD vicidial_lead_call_quota_counts AL update: |$affected_rows|$uniqueid|"; &agi_output;}
}
if ($useLTT > 0)
{
$stmtA = "UPDATE vicidial_lead_messages SET played=(played+1) where lead_id='$VD_lead_id' and call_date='$TTS_call_date' limit 1;";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VLM vicidial_lead_messages POST-CALL update: |$affected_rows|$stmtA|"; &agi_output;}
}
}
+17 -1
View File
@@ -140,9 +140,10 @@
# 191017-2039 - Added reset of calls_today_filtered fields
# 200122-0847 - Added CID Groups auto-rotate feature
# 200422-1544 - Added purging of vicidial_security_event_log table after 7 days
# 200425-0218 - Added purging of vicidial_lead_messages after 1 day
#
$build = '200422-1544';
$build = '200425-0218';
$DB=0; # Debug flag
$teodDB=0; # flag to log Timeclock End of Day processes to log file
@@ -1855,6 +1856,21 @@ if ($timeclock_end_of_day_NOW > 0)
##### END vicidial_security_event_log end of day process removing records older than 7 days #####
##### BEGIN vicidial_lead_messages end of day process removing records older than 1 day #####
$stmtA = "DELETE FROM vicidial_lead_messages WHERE call_date < \"$RMSQLdate\";";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows = $sthA->rows;
$event_string = "$sthArows rows deleted from vicidial_lead_messages table";
if (!$Q) {print "$event_string \n";}
if ($teodDB) {&teod_logger;}
$stmtA = "optimize table vicidial_lead_messages;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
##### END vicidial_lead_messages end of day process removing records older than 1 day #####
##### BEGIN usacan_phone_dialcode_fix funciton #####
if ($usacan_phone_dialcode_fix > 0)
{
+11 -1
View File
@@ -4300,6 +4300,16 @@ index (event_time),
index (remote_address)
) ENGINE=MyISAM;
CREATE TABLE vicidial_lead_messages (
lead_id INT(9) UNSIGNED NOT NULL,
call_date DATETIME,
user VARCHAR(20) DEFAULT NULL,
played TINYINT(3) default '0',
message_entry MEDIUMTEXT,
index (lead_id),
index (call_date)
) ENGINE=MyISAM;
ALTER TABLE vicidial_email_list MODIFY message text character set utf8;
@@ -4628,4 +4638,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='1593',db_schema_update_date=NOW(),reload_timestamp=NOW();
UPDATE system_settings SET db_schema_version='1594',db_schema_update_date=NOW(),reload_timestamp=NOW();
+12
View File
@@ -1226,3 +1226,15 @@ index (remote_address)
) ENGINE=MyISAM;
UPDATE system_settings SET db_schema_version='1593',db_schema_update_date=NOW() where db_schema_version < 1593;
CREATE TABLE vicidial_lead_messages (
lead_id INT(9) UNSIGNED NOT NULL,
call_date DATETIME,
user VARCHAR(20) DEFAULT NULL,
played TINYINT(3) default '0',
message_entry MEDIUMTEXT,
index (lead_id),
index (call_date)
) ENGINE=MyISAM;
UPDATE system_settings SET db_schema_version='1594',db_schema_update_date=NOW() where db_schema_version < 1594;
+462
View File
@@ -0,0 +1,462 @@
<?php
# vdc_LTT_generate.php
#
# Copyright (C) 2020 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# This script is designed to generate a list of wav audio files to play and then
# insert a record into the vicidial_lead_messages table
#
# !!! IMPORTANT !!! You must customize this script to your needs!
#
### Example line to put in the campaign WEBFORM field:
# http://127.0.0.1/agc/vdc_LTT_generate.php
#
# CHANGELOG:
# 200424-2013 - First build of script
#
$version = '2.14-1';
$build = '200424-2013';
require_once("dbconnect_mysqli.php");
require_once("functions.php");
$query_string = getenv("QUERY_STRING");
if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];}
elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];}
if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];}
elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];}
if (isset($_GET["vendor_lead_code"])) {$vendor_lead_code=$_GET["vendor_lead_code"];}
elseif (isset($_POST["vendor_lead_code"])) {$vendor_lead_code=$_POST["vendor_lead_code"];}
if (strlen($vendor_lead_code) < 1) {$vendor_lead_code = $vendor_id;}
if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];}
elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];}
if (isset($_GET["gmt_offset_now"])) {$gmt_offset_now=$_GET["gmt_offset_now"];}
elseif (isset($_POST["gmt_offset_now"])) {$gmt_offset_now=$_POST["gmt_offset_now"];}
if (isset($_GET["phone_code"])) {$phone_code=$_GET["phone_code"];}
elseif (isset($_POST["phone_code"])) {$phone_code=$_POST["phone_code"];}
if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];}
elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];}
if (isset($_GET["title"])) {$title=$_GET["title"];}
elseif (isset($_POST["title"])) {$title=$_POST["title"];}
if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];}
elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];}
if (isset($_GET["middle_initial"])) {$middle_initial=$_GET["middle_initial"];}
elseif (isset($_POST["middle_initial"])) {$middle_initial=$_POST["middle_initial"];}
if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];}
elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];}
if (isset($_GET["address1"])) {$address1=$_GET["address1"];}
elseif (isset($_POST["address1"])) {$address1=$_POST["address1"];}
if (isset($_GET["address2"])) {$address2=$_GET["address2"];}
elseif (isset($_POST["address2"])) {$address2=$_POST["address2"];}
if (isset($_GET["address3"])) {$address3=$_GET["address3"];}
elseif (isset($_POST["address3"])) {$address3=$_POST["address3"];}
if (isset($_GET["city"])) {$city=$_GET["city"];}
elseif (isset($_POST["city"])) {$city=$_POST["city"];}
if (isset($_GET["state"])) {$state=$_GET["state"];}
elseif (isset($_POST["state"])) {$state=$_POST["state"];}
if (isset($_GET["province"])) {$province=$_GET["province"];}
elseif (isset($_POST["province"])) {$province=$_POST["province"];}
if (isset($_GET["postal_code"])) {$postal_code=$_GET["postal_code"];}
elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];}
if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];}
elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];}
if (isset($_GET["gender"])) {$gender=$_GET["gender"];}
elseif (isset($_POST["gender"])) {$gender=$_POST["gender"];}
if (isset($_GET["date_of_birth"])) {$date_of_birth=$_GET["date_of_birth"];}
elseif (isset($_POST["date_of_birth"])) {$date_of_birth=$_POST["date_of_birth"];}
if (isset($_GET["alt_phone"])) {$alt_phone=$_GET["alt_phone"];}
elseif (isset($_POST["alt_phone"])) {$alt_phone=$_POST["alt_phone"];}
if (isset($_GET["email"])) {$email=$_GET["email"];}
elseif (isset($_POST["email"])) {$email=$_POST["email"];}
if (isset($_GET["security_phrase"])) {$security_phrase=$_GET["security_phrase"];}
elseif (isset($_POST["security_phrase"])) {$security_phrase=$_POST["security_phrase"];}
if (isset($_GET["comments"])) {$comments=$_GET["comments"];}
elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];}
if (isset($_GET["user"])) {$user=$_GET["user"];}
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
if (isset($_GET["campaign"])) {$campaign=$_GET["campaign"];}
elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];}
if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];}
elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];}
if (isset($_GET["original_phone_login"])) {$original_phone_login=$_GET["original_phone_login"];}
elseif (isset($_POST["original_phone_login"])) {$original_phone_login=$_POST["original_phone_login"];}
if (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];}
elseif (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];}
if (isset($_GET["fronter"])) {$fronter=$_GET["fronter"];}
elseif (isset($_POST["fronter"])) {$fronter=$_POST["fronter"];}
if (isset($_GET["closer"])) {$closer=$_GET["closer"];}
elseif (isset($_POST["closer"])) {$closer=$_POST["closer"];}
if (isset($_GET["group"])) {$group=$_GET["group"];}
elseif (isset($_POST["group"])) {$group=$_POST["group"];}
if (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];}
elseif (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];}
if (isset($_GET["SQLdate"])) {$SQLdate=$_GET["SQLdate"];}
elseif (isset($_POST["SQLdate"])) {$SQLdate=$_POST["SQLdate"];}
if (isset($_GET["epoch"])) {$epoch=$_GET["epoch"];}
elseif (isset($_POST["epoch"])) {$epoch=$_POST["epoch"];}
if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];}
elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];}
if (isset($_GET["customer_zap_channel"])) {$customer_zap_channel=$_GET["customer_zap_channel"];}
elseif (isset($_POST["customer_zap_channel"])) {$customer_zap_channel=$_POST["customer_zap_channel"];}
if (isset($_GET["customer_server_ip"])) {$customer_server_ip=$_GET["customer_server_ip"];}
elseif (isset($_POST["customer_server_ip"])) {$customer_server_ip=$_POST["customer_server_ip"];}
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
if (isset($_GET["SIPexten"])) {$SIPexten=$_GET["SIPexten"];}
elseif (isset($_POST["SIPexten"])) {$SIPexten=$_POST["SIPexten"];}
if (isset($_GET["session_id"])) {$session_id=$_GET["session_id"];}
elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];}
if (isset($_GET["phone"])) {$phone=$_GET["phone"];}
elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];}
if (isset($_GET["parked_by"])) {$parked_by=$_GET["parked_by"];}
elseif (isset($_POST["parked_by"])) {$parked_by=$_POST["parked_by"];}
if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];}
elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];}
if (isset($_GET["dialed_number"])) {$dialed_number=$_GET["dialed_number"];}
elseif (isset($_POST["dialed_number"])) {$dialed_number=$_POST["dialed_number"];}
if (isset($_GET["dialed_label"])) {$dialed_label=$_GET["dialed_label"];}
elseif (isset($_POST["dialed_label"])) {$dialed_label=$_POST["dialed_label"];}
if (isset($_GET["source_id"])) {$source_id=$_GET["source_id"];}
elseif (isset($_POST["source_id"])) {$source_id=$_POST["source_id"];}
if (isset($_GET["rank"])) {$rank=$_GET["rank"];}
elseif (isset($_POST["rank"])) {$rank=$_POST["rank"];}
if (isset($_GET["owner"])) {$owner=$_GET["owner"];}
elseif (isset($_POST["owner"])) {$owner=$_POST["owner"];}
if (isset($_GET["camp_script"])) {$camp_script=$_GET["camp_script"];}
elseif (isset($_POST["camp_script"])) {$camp_script=$_POST["camp_script"];}
if (isset($_GET["in_script"])) {$in_script=$_GET["in_script"];}
elseif (isset($_POST["in_script"])) {$in_script=$_POST["in_script"];}
if (isset($_GET["script_width"])) {$script_width=$_GET["script_width"];}
elseif (isset($_POST["script_width"])) {$script_width=$_POST["script_width"];}
if (isset($_GET["script_height"])) {$script_height=$_GET["script_height"];}
elseif (isset($_POST["script_height"])) {$script_height=$_POST["script_height"];}
if (isset($_GET["fullname"])) {$fullname=$_GET["fullname"];}
elseif (isset($_POST["fullname"])) {$fullname=$_POST["fullname"];}
if (isset($_GET["recording_filename"])) {$recording_filename=$_GET["recording_filename"];}
elseif (isset($_POST["recording_filename"])) {$recording_filename=$_POST["recording_filename"];}
if (isset($_GET["recording_id"])) {$recording_id=$_GET["recording_id"];}
elseif (isset($_POST["recording_id"])) {$recording_id=$_POST["recording_id"];}
if (isset($_GET["user_custom_one"])) {$user_custom_one=$_GET["user_custom_one"];}
elseif (isset($_POST["user_custom_one"])) {$user_custom_one=$_POST["user_custom_one"];}
if (isset($_GET["user_custom_two"])) {$user_custom_two=$_GET["user_custom_two"];}
elseif (isset($_POST["user_custom_two"])) {$user_custom_two=$_POST["user_custom_two"];}
if (isset($_GET["user_custom_three"])) {$user_custom_three=$_GET["user_custom_three"];}
elseif (isset($_POST["user_custom_three"])) {$user_custom_three=$_POST["user_custom_three"];}
if (isset($_GET["user_custom_four"])) {$user_custom_four=$_GET["user_custom_four"];}
elseif (isset($_POST["user_custom_four"])) {$user_custom_four=$_POST["user_custom_four"];}
if (isset($_GET["user_custom_five"])) {$user_custom_five=$_GET["user_custom_five"];}
elseif (isset($_POST["user_custom_five"])) {$user_custom_five=$_POST["user_custom_five"];}
if (isset($_GET["talk_time"])) {$talk_time=$_GET["talk_time"];}
elseif (isset($_POST["talk_time"])) {$talk_time=$_POST["talk_time"];}
if (isset($_GET["talk_time_min"])) {$talk_time_min=$_GET["talk_time_min"];}
elseif (isset($_POST["talk_time_min"])) {$talk_time_min=$_POST["talk_time_min"];}
if (isset($_GET["agent_log_id"])) {$agent_log_id=$_GET["agent_log_id"];}
elseif (isset($_POST["agent_log_id"])) {$agent_log_id=$_POST["agent_log_id"];}
if (isset($_GET["dispo_name"])) {$dispo_name=$_GET["dispo_name"];}
elseif (isset($_POST["dispo_name"])) {$dispo_name=$_POST["dispo_name"];}
if (isset($_GET["event"])) {$event=$_GET["event"];}
elseif (isset($_POST["event"])) {$event=$_POST["event"];}
if (isset($_GET["message"])) {$message=$_GET["message"];}
elseif (isset($_POST["message"])) {$message=$_POST["message"];}
if (isset($_GET["counter"])) {$counter=$_GET["counter"];}
elseif (isset($_POST["counter"])) {$counter=$_POST["counter"];}
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
header ("Content-type: text/html; charset=utf-8");
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache"); // HTTP/1.0
$txt = '.txt';
$StarTtime = date("U");
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$CIDdate = date("mdHis");
$ENTRYdate = date("YmdHis");
$MT[0]='';
if ($non_latin < 1)
{
$user=preg_replace("/[^-_0-9a-zA-Z]/","",$user);
$pass=preg_replace("/[^-_0-9a-zA-Z]/","",$pass);
$length_in_sec = preg_replace("/[^0-9]/","",$length_in_sec);
$phone_code = preg_replace("/[^0-9]/","",$phone_code);
$phone_number = preg_replace("/[^0-9]/","",$phone_number);
$counter = preg_replace("/[^0-9]/","",$counter);
}
else
{
$user = preg_replace("/\'|\"|\\\\|;/","",$user);
$pass = preg_replace("/\'|\"|\\\\|;/","",$pass);
}
$DB=preg_replace("/[^-_0-9a-zA-Z]/","",$DB);
if (strlen($lead_id) < 1)
{
echo "ERROR: invalid lead_id: |$lead_id|\n";
}
else
{
# EXAMPLE SCRIPT:
# Hello, this is a call from ACME Shipping, your order number A1234567 from account 876543 was shipped on December 1st and is insured for $123456.78.
# If you have any questions, please call us back at 3125551212. Goodbye.
#
# VARIABLES:
# address3 = 'ACME Shipping' (company name)
# vendor_lead_code = 'A1234567' (order number)
# owner = '876543' (account number)
# province = '2020-12-01' (shipping date)
# security_phrase = '123456.78' (insured amount)
# alt_phone = '3125551212' (callback phone number)
#
# STATIC PRIMPTS:
# EXship01.wav = 'Hello, this is a call from'
# EXship02.wav = 'your order number'
# EXship03.wav = 'from account'
# EXship04.wav = 'was shipped on'
# EXship05.wav = 'and is insured for'
# EXship06.wav = 'cents. If you have any questions, please call us back at'
# EXship07.wav = 'Goodbye'
#
# TEST URL: http://127.0.0.1/agc/vdc_LTT_generate.php?lead_id=101&user=6666&address3=ACME+Shipping&vendor_lead_code=A1234567&owner=876543&province=2020-12-01&security_phrase=123456.78&alt_phone=3125551212
# SAMPLE WEBFORM URL:
# VARhttp://127.0.0.1/agc/vdc_LTT_generate.php?lead_id=--A--lead_id--B--&user=--A--user--B--&address3=--A--address3--B--&vendor_lead_code=--A--vendor_lead_code--B--&owner=--A--owner--B--&province=--A--province--B--&security_phrase=--A--security_phrase--B--&alt_phone=--A--alt_phone--B--
#
if ($address3 == 'ACME Shipping') {$EXship01a = 'EXshipACME.wav';}
if ($address3 == 'International Parcel Shipping') {$EXship01a = 'EXshipIPS.wav';}
if ($address3 == 'United States Postal Service') {$EXship01a = 'EXshipUSPS.wav';}
$EXship02a = convertWordToSpell($DB,"$vendor_lead_code");
$owner = strtolower($owner);
$EXship03a = convertWordToSpell($DB,"$owner");
$provinceMONTH = date("n", strtotime("$province"));
$provinceDAY = date("j", strtotime("$province"));
$EXship04a = convertNumberToMonth($DB,"$provinceMONTH");
$EXship04b = convertNumberToOrder($DB,"$provinceDAY");
$security_phraseARY = explode('.',$security_phrase);
if ($security_phraseARY[0] == '0') {$EXship05a = 'digits/0.wav|';}
else
{
$EXship05a = convertNumberToNumberSpeak("$security_phraseARY[0]");
$EXship05a = preg_replace("/ | | | /",' ',$EXship05a);
$EXship05a = preg_replace("/^ | $/",'',$EXship05a);
$EXship05a = preg_replace("/ /",'.wav|digits/',$EXship05a);
$EXship05a = "digits/".$EXship05a.".wav|";
}
$EXship05a .= 'digits/dollars.wav|';
if ($security_phraseARY[1] == '0') {$EXship05b = 'digits/0.wav|';}
else
{
$EXship05b = convertNumberToNumberSpeak("$security_phraseARY[1]");
$EXship05b = preg_replace("/ | | | /",' ',$EXship05b);
$EXship05b = preg_replace("/^ | $/",'',$EXship05b);
$EXship05b = preg_replace("/ /",'.wav|digits/',$EXship05b);
$EXship05b = "digits/".$EXship05b.".wav|";
}
$EXship05b .= 'cents.wav|';
$EXship06a = convertWordToSpell($DB,"$alt_phone");
$message_entry = 'EXship01.wav|';
$message_entry .= "$EXship01a|";
$message_entry .= "EXship02.wav|";
$message_entry .= "$EXship02a";
$message_entry .= "EXship03.wav|";
$message_entry .= "$EXship03a";
$message_entry .= "EXship04.wav|";
$message_entry .= "$EXship04a$EXship04b";
$message_entry .= "EXship05.wav|";
$message_entry .= "$EXship05a$EXship05b";
$message_entry .= "EXship06.wav|";
$message_entry .= "$EXship06a";
$message_entry .= "EXship07.wav|";
$message_entry = preg_replace("/\.wav/",'',$message_entry);
print "$message_entry \n";
$stmt="INSERT INTO vicidial_lead_messages (lead_id,call_date,user,message_entry) values('$lead_id',NOW(),'$user','$message_entry');";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$affected_rows = mysqli_affected_rows($link);
}
exit;
### SUBROUTINES ###
function convertWordToSpell($DB,$word)
{
if (strlen($word) < 1)
{
if ($DB > 0) {print "DEBUG ERROR: ($word)";}
return false;
}
$orderARY = str_split($word);
$orderARY_ct = count($orderARY);
if ($DB > 0) {print "DEBUG: ($word $orderARY_ct)";}
$i=0; $spell='';
while($orderARY_ct > $i)
{
if (preg_match('/^[0-9]/',$orderARY[$i])) {$spell .= "digits/".$orderARY[$i].".wav|";}
if (preg_match('/^[a-zA-Z]/',$orderARY[$i]))
{
$orderARY[$i] = strtolower($orderARY[$i]);
$spell .= "letters/".$orderARY[$i].".wav|";
}
if ($orderARY[$i] == '#') {$spell .= "digits/pound.wav|";}
if ($orderARY[$i] == '*') {$spell .= "digits/star.wav|";}
if ($orderARY[$i] == '-') {$spell .= "letters/dash.wav|";}
if ($orderARY[$i] == ' ') {$spell .= "letters/space.wav|";}
if ($orderARY[$i] == '/') {$spell .= "letters/slash.wav|";}
if ($orderARY[$i] == '+') {$spell .= "letters/plus.wav|";}
if ($orderARY[$i] == '!') {$spell .= "letters/exclaimation-point.wav|";}
if ($orderARY[$i] == '=') {$spell .= "letters/equals.wav|";}
if ($orderARY[$i] == '@') {$spell .= "letters/at.wav|";}
if ($orderARY[$i] == '.') {$spell .= "letters/dot.wav|";}
$i++;
}
return $spell;
}
function convertNumberToOrder($DB,$num)
{
if (strlen($num) < 1)
{
if ($DB > 0) {print "DEBUG ERROR: ($num)";}
return false;
}
if ($DB > 0) {print "DEBUG: ($num)";}
$order='';
if ( ($num >= 1) and ($num <= 20) ) {$order .= "digits/h-".$num.".wav|";}
if ( ($num >= 21) and ($num <= 99) )
{
if (substr($num, -1) == '0') {$order .= "digits/h-".$num.".wav|";}
else {$order .= "digits/".substr($num,0,1)."0.wav|digits/h-".substr($num, -1).".wav|";}
}
return $order;
}
function convertNumberToMonth($DB,$num)
{
if (strlen($num) < 1)
{
if ($DB > 0) {print "DEBUG ERROR: ($num)";}
return false;
}
if ($DB > 0) {print "DEBUG: ($num)";}
$file_month='';
if ( ($num >= 1) and ($num <= 12) )
{
$num = ($num -1);
$file_month = "digits/mon-".$num.".wav|";
}
return $file_month;
}
function convertNumberToWord($num = false)
{
$num = str_replace(array(',', ' '), '' , trim($num));
if(! $num)
{
return false;
}
$num = (int) $num;
$words = array();
$list1 = array('', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven',
'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen'
);
$list2 = array('', 'ten', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety', 'hundred');
$list3 = array('', 'thousand', 'million', 'billion', 'trillion', 'quadrillion', 'quintillion', 'sextillion', 'septillion',
'octillion', 'nonillion', 'decillion', 'undecillion', 'duodecillion', 'tredecillion', 'quattuordecillion',
'quindecillion', 'sexdecillion', 'septendecillion', 'octodecillion', 'novemdecillion', 'vigintillion'
);
$num_length = strlen($num);
$levels = (int) (($num_length + 2) / 3);
$max_length = $levels * 3;
$num = substr('00' . $num, -$max_length);
$num_levels = str_split($num, 3);
for ($i = 0; $i < count($num_levels); $i++)
{
$levels--;
$hundreds = (int) ($num_levels[$i] / 100);
$hundreds = ($hundreds ? ' ' . $list1[$hundreds] . ' hundred' . ' ' : '');
$tens = (int) ($num_levels[$i] % 100);
$singles = '';
if ( $tens < 20 )
{
$tens = ($tens ? ' ' . $list1[$tens] . ' ' : '' );
}
else
{
$tens = (int)($tens / 10);
$tens = ' ' . $list2[$tens] . ' ';
$singles = (int) ($num_levels[$i] % 10);
$singles = ' ' . $list1[$singles] . ' ';
}
$words[] = $hundreds . $tens . $singles . ( ( $levels && ( int ) ( $num_levels[$i] ) ) ? ' ' . $list3[$levels] . ' ' : '' );
}
$commas = count($words);
if ($commas > 1)
{
$commas = $commas - 1;
}
return implode(' ', $words);
}
function convertNumberToNumberSpeak($num = false)
{
$num = str_replace(array(',', ' '), '' , trim($num));
if(! $num)
{
return false;
}
$num = (int) $num;
$words = array();
$list1 = array('', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11','12', '13', '14', '15', '16', '17', '18', '19');
$list2 = array('', '10', '20', '30', '40', '50', '60', '70', '80', '90', 'hundred');
$list3 = array('', 'thousand', 'million', 'billion', 'trillion');
$num_length = strlen($num);
$levels = (int) (($num_length + 2) / 3);
$max_length = $levels * 3;
$num = substr('00' . $num, -$max_length);
$num_levels = str_split($num, 3);
for ($i = 0; $i < count($num_levels); $i++)
{
$levels--;
$hundreds = (int) ($num_levels[$i] / 100);
$hundreds = ($hundreds ? ' ' . $list1[$hundreds] . ' hundred' . ' ' : '');
$tens = (int) ($num_levels[$i] % 100);
$singles = '';
if ( $tens < 20 )
{
$tens = ($tens ? ' ' . $list1[$tens] . ' ' : '' );
}
else
{
$tens = (int)($tens / 10);
$tens = ' ' . $list2[$tens] . ' ';
$singles = (int) ($num_levels[$i] % 10);
$singles = ' ' . $list1[$singles] . ' ';
}
$words[] = $hundreds . $tens . $singles . ( ( $levels && ( int ) ( $num_levels[$i] ) ) ? ' ' . $list3[$levels] . ' ' : '' );
}
$commas = count($words);
if ($commas > 1)
{
$commas = $commas - 1;
}
return implode(' ', $words);
}
?>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+2 -2
View File
@@ -1,4 +1,4 @@
# version: 20200409124201
# version: 20200425013001
users-user User ID <QXZ>This field is where you put the users ID number, can be up to 8 digits in length, Must be at least 2 characters in length.</QXZ>
users-pass Password <QXZ>This field is where you put the users password. Must be at least 2 characters in length. A medium strength user password will be at least 10 characters in length, and a strong user password will be at least 20 characters in length and have letters as well as at least one number. It is recommended that you use a longer password if possible, stringing together several unrelated words with no spaces, and a number somewhere in the string. The maximum size of a password is 100 characters.</QXZ>
users-force_change_password Force Change Password <QXZ>If this option is set to Y then the user will be prompted to change their password the next time they log in to the administration webpage. Default is N.</QXZ>
@@ -165,7 +165,7 @@ campaigns-auto_alt_dial Auto Alt-Number Dialing <QXZ>This setting is used to aut
campaigns-dial_timeout Dial Timeout <QXZ>If defined, calls that would normally hang up after the timeout defined in extensions.conf would instead timeout at this amount of seconds if it is less than the extensions.conf timeout. This allows for quickly changing dial timeouts from server to server and limiting the effects to a single campaign. If you are having a lot of Answering Machine or Voicemail calls you may want to try changing this value to between 21-26 and see if results improve.</QXZ>
campaigns-dial_timeout_lead_container Dial Timeout Lead Container <QXZ>This option allows you to select a Settings Container of the DIAL_TIMEOUTS type that will allow you to override the campaign dial timeouts on a per lead basis using a lead field value defined in the container. You can enable manual dialing and auto dialing overrides separately by defining which lead field is to be looked at for a dial timeout key value. If you wanted to use the -comments- lead field for manual dial timeouts, you would define manual_dial_field => comments. If you wanted to use the -comments- lead field for auto dial timeouts, you would define auto_dial_field => comments. after either or both of these are defined, you will need to define the key and value pairs for the dial timeouts. For example, if a key of -A- in the comments field should trigger a 50 second dial timeout override for the lead, you would define A => 50. You can define multiple key and value pairs in the settings container. Lead field names should be in lower case letters only. You must define the Lead Field Name above any Field Values that you define. Field value matching is case sensitive. We recommend not matching to field values that have spaces or special characters in them.</QXZ>
campaigns-campaign_vdad_exten Routing Extension <QXZ>This field allows for a custom outbound routing extension. This allows you to use different call handling methods depending upon how you want to route calls through your outbound campaign. Formerly called Campaign VDAD extension.</QXZ><BR>- <QXZ>8364 - same as 8368</QXZ><BR>- <QXZ>8365 - Will send the call only to an agent on the same server as the call is placed on</QXZ><BR>- <QXZ>8366 - Used for press-1, broadcast and survey campaigns</QXZ><BR>- <QXZ>8367 - Will try to first send the call to an agent on the local server, then it will look on other servers</QXZ><BR>- <QXZ>8368 - DEFAULT - Will send the call to the next available agent no matter what server they are on</QXZ><BR>- <QXZ>8369 - Used for Answering Machine Detection after that, same behavior as 8368</QXZ><BR>- <QXZ>8373 - Used for Answering Machine Detection after that same behavior as 8366</QXZ><BR>- <QXZ>8374 - Used for press-1, broadcast and survey campaigns with Cepstral Text-to-speech</QXZ><BR>- <QXZ>8375 - Used for Answering Machine Detection then press-1, broadcast and survey campaigns with Cepstral Text-to-speech</QXZ>
campaigns-am_message_exten Answering Machine Message <QXZ>This field is for entering the prompt to play when the agent gets an answering machine and clicks on the Answering Machine Message button in the transfer conference frame. You must set this to either an audio file in the audio store or a TTS prompt if TTS is enabled on your system. You can also use lead fields to generate audio filenames using the DYN flag, for instance using DYN--A--user--B-- for agent 1234 would look for a file named 1234.wav in your audio store to play.</QXZ>
campaigns-am_message_exten Answering Machine Message <QXZ>This field is for entering the prompt to play when the agent gets an answering machine and clicks on the Answering Machine Message button in the transfer conference frame. You must set this to either an audio file in the audio store or a TTS prompt if TTS is enabled on your system. You can also use lead fields to generate audio filenames using the DYN flag, for instance using DYN--A--user--B-- for agent 1234 would look for a file named 1234.wav in your audio store to play. If you need more space to build your message with files, you can put them into a Settings Container and the use STC and then the container ID to use that settings container as your answering machine message. Another advanced option is LTT, if you have custom programming on your system to construct answering maching messages on a per-call basis.</QXZ>
campaigns-vmm_daily_limit Voicemail Message Daily Limit <QXZ>This option allows you to limit the number of times a voicemail message plays to a lead for a single day. After the defined limit is reached, the call will be hung up instead of playing a message. If this feature is active then it will be in effect for all calls sent to play a voicemail message, even if an agent manually sends a call to a VM message. The default is 0, for disabled.</QXZ>
campaigns-waitforsilence_options WaitForSilence Options <QXZ>If Wait For Silence is desired on calls that are detected as Answering Machines then this field has those options. There are three settings separated by a comma, the first option is how long to detect silence in milliseconds, the second option is for how many times to detect that before playing the message, the third is the maximum number of seconds to wait before timing out and playing the message. Default is EMPTY for disabled. A standard value for this would be wait for 2 seconds of silence twice: 2000,2,30</QXZ>
campaigns-am_message_wildcards AM Message Wildcards <QXZ>This option, if enabled, allows you to go to the AM Message Wildcard administration page where you can define wildcards that can match data in a default lead field and can play a different message based upon the data in a specific lead. Default is N for disabled.</QXZ>