diff --git a/UPGRADE b/UPGRADE
index 2b30be1a..e68e76d2 100644
--- a/UPGRADE
+++ b/UPGRADE
@@ -677,6 +677,9 @@ OTHER CHANGES:
fairly detailed and database-intensive report that summarizes several
user-grouped statistics
+154. Added ability to use static audio from dynamic fields in Survey and
+ Answering machine messages when using Cepstral TTS
+
diff --git a/agi/VD_amd.agi b/agi/VD_amd.agi
index 5b507248..94df3340 100644
--- a/agi/VD_amd.agi
+++ b/agi/VD_amd.agi
@@ -40,12 +40,14 @@
# 100903-0041 - Changed lead_id max length to 10 digits
# 101111-1552 - Fixed minor bug in TTS filtering
# 110324-2334 - Logging changes made
+# 110812-1515 - Added static tts file parsing and replacement
#
$script = 'VD_amd.agi';
$A = 1; # set to 1 for AMD output messages mode
$AMD_LOG = 1; # set to 1 for logfile
+$wav='.wav';
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year = ($year + 1900);
@@ -515,6 +517,7 @@ else
@aryA = $sthA->fetchrow_array;
$TTS_voice = $aryA[1];
$TTS_text = $aryA[0];
+ ### BEGIN replace variables with record values ###
$TTS_text =~ s/--A--lead_id--B--/$TTS_lead_id/gi;
$TTS_text =~ s/--A--entry_date--B--/$TTS_entry_date/gi;
$TTS_text =~ s/--A--modify_date--B--/$TTS_modify_date/gi;
@@ -546,6 +549,62 @@ else
$TTS_text =~ s/--A--last_local_call_time--B--/$TTS_last_local_call_time/gi;
$TTS_text =~ s/--A--rank--B--/$TTS_rank/gi;
$TTS_text =~ 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 =~ /--C--/) || ($TTS_text =~ /--D--/) )
+ {
+ $Cdash='--C--';
+ $Ddash='--D--';
+ @static_check = split(/--C--/,$TTS_text);
+ $sc=0;
+ $sr=0;
+ foreach(@static_check)
+ {
+ 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")
+ {
+ $CDstatic = " ";
+ $static_found++;
+ }
+ else
+ {
+ if (-e "/var/lib/asterisk/sounds/$static_check_lc$wav")
+ {
+ $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/$CDmatch/$CDstatic/gi;
+ print STDERR " Static Replacement Found: $CDmatch|$CDstatic\n";
+ $sr++;
+ }
+ }
+ $sc++;
+ }
+ $TTS_text =~ s/--C--|--D--//gi;
+ print STDERR "\nStatic Replacements Found: $sc|$sr\n";
+ }
+ ### END check for --C-- and --D-- tags for static file replacement
+
+ ### filter input for CLI-safe characters
$TTS_text =~ s/[^,\.\<\>\'\/\=\_\-\: 0-9a-zA-Z]//gi;
$TTS_textRAW = $TTS_text;
$TTS_text =~ s/ /\\ /gi;
@@ -555,8 +614,10 @@ else
$TTS_text =~ s/\>/\\>/gi;
$TTS_text =~ s/\//\\\//gi;
$TTS_text =~ s/\'/\\'/gi;
- # $voice = 'Allison-8kHz';
+ # $voice = 'Allison-8kHz'; # override the voice to Allison-8k
print STDERR "\nGenerating: $TTS_text - $TTS_voice\n";
+
+ ### send command to generate cepstral TTS audio file
`$PATHagi/cepstral_generate.pl --debug --voice=$TTS_voice --dialog=$TTS_text >> $CEPLOGfile `;
use Digest::MD5 qw(md5_hex);
diff --git a/agi/agi-VDAD_ALL_outbound.agi b/agi/agi-VDAD_ALL_outbound.agi
index ad46c69b..89d89172 100644
--- a/agi/agi-VDAD_ALL_outbound.agi
+++ b/agi/agi-VDAD_ALL_outbound.agi
@@ -88,6 +88,7 @@
# 110528-2326 - Added CALLMENU survey method
# 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
#
$script = 'agi-VDAD_ALL_outbound.agi';
@@ -100,6 +101,7 @@ $one_mysql_log=0;
$DROP_TIME = 9; ### default number of seconds to wait until you drop a waiting call
$at='@';
$US='_';
+$wav='.wav';
# get date/time
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
@@ -629,6 +631,7 @@ if ($VDACaffected_rows > 0)
@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;
@@ -660,6 +663,62 @@ if ($VDACaffected_rows > 0)
$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)
+ {
+ $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 = " ";
+ $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++;
+ }
+ $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
+
+ ### filter input for CLI-safe characters
$TTS_text[$s] =~ s/[^,\.\<\>\'\/\=\_\-\: 0-9a-zA-Z]//gi;
$TTS_textRAW[$s] = $TTS_text[$s];
$TTS_text[$s] =~ s/ /\\ /gi;
@@ -669,8 +728,10 @@ if ($VDACaffected_rows > 0)
$TTS_text[$s] =~ s/\>/\\>/gi;
$TTS_text[$s] =~ s/\//\\\//gi;
$TTS_text[$s] =~ s/\'/\\'/gi;
- # $voice = 'Allison-8kHz';
+ # $voice = 'Allison-8kHz'; # override the voice to Allison-8k
print STDERR "\nGenerating: $TTS_text[$s] - $TTS_voice\n";
+
+ ### send command to generate cepstral TTS audio file
`$PATHagi/cepstral_generate.pl --debug --voice=$TTS_voice --dialog=$TTS_text[$s] >> $CEPLOGfile $hideCLI`;
use Digest::MD5 qw(md5_hex);
diff --git a/docs/conf_examples/voicemail.conf.sample b/docs/conf_examples/voicemail.conf.sample
index dc48c6a1..2849b716 100644
--- a/docs/conf_examples/voicemail.conf.sample
+++ b/docs/conf_examples/voicemail.conf.sample
@@ -12,6 +12,7 @@ maxsilence=10
silencethreshold=128
maxlogins=3
maxmsg=500
+emailbody=Dear ${VM_NAME}:\n\n\tJust wanted to let you know you were just left a ${VM_DUR} long message (number ${VM_MSGNUM})\nin mailbox ${VM_MAILBOX} from ${VM_CIDNAME} ${VM_CIDNUM}, on ${VM_DATE}, so you might\nwant to check it when you get a chance. Thanks!\n\n\t\t\t\t--PBX\n
[zonemessages]
newzealand=Pacific/Auckland|'vm-received' q 'digits/at' H 'digits/hundred' M 'hours'
diff --git a/install.pl b/install.pl
index 80fc294c..3926a7f9 100644
--- a/install.pl
+++ b/install.pl
@@ -24,6 +24,7 @@
# 100428-0936 - Added DB custom user/pass fields
# 101217-0520 - Added PREPROCESS directory
# 110619-2153 - Added languages install and conf file specify options
+# 110812-1510 - Added tts sound directories creation
#
############################################
@@ -2482,6 +2483,10 @@ if ($WEBONLY < 1)
print "Copying sounds to $PATHsounds...\n";
`cp -fR ./sounds/* $PATHsounds/`;
+ print "Creating sound tts directories...\n";
+ if (!-e "$PATHsounds/tts/") {`mkdir -p $PATHsounds/tts/`;}
+ if (!-e "$PATHsounds/tts_static/") {`mkdir -p $PATHsounds/tts_static/`;}
+
print "Copying ip_relay scripts to $PATHhome...\n";
`cp -fR ./extras/ip_relay $PATHhome/`;
diff --git a/www/agc/vicidial.php b/www/agc/vicidial.php
index ffb21f4d..b481c0f1 100644
--- a/www/agc/vicidial.php
+++ b/www/agc/vicidial.php
@@ -12313,7 +12313,7 @@ function phone_number_format(formatphone) {
document.getElementById("MainTable").style.backgroundColor="";
document.getElementById("MaiNfooter").style.backgroundColor="";
panel_bgcolor='';
- document.getElementById("MainStatuSSpan").style.background = panel_bgcolor;
+ // document.getElementById("MainStatuSSpan").style.background = panel_bgcolor;
HidEGenDerPulldown();
}
@@ -12328,7 +12328,7 @@ function phone_number_format(formatphone) {
document.getElementById("MainTable").style.backgroundColor="";
document.getElementById("MaiNfooter").style.backgroundColor="";
panel_bgcolor='';
- document.getElementById("MainStatuSSpan").style.background = panel_bgcolor;
+ // document.getElementById("MainStatuSSpan").style.background = panel_bgcolor;
HidEGenDerPulldown();
}