Passing in a file name to cepstral perl script
Posted: Tue Dec 26, 2006 4:53 pm
I have cepstral working fine when I just pass in a string but now have the perl script below and call it from the extensions file. I know the file is there as part of my perl script
writes the file name to a temp file and I can look there then view the file which has data. It
appears that it even gets converted to a .wav file but for some reason, that file doesn't
play from the dialplan and I'm not sure why.
Please help!
Thanks.
exten => 811,9,AGI(cepstral_text.pl| ${TMPTEXTFILE})
AGI(
#!/usr/bin/perl
use Asterisk::AGI;
use File::Basename;
require Data::UUID;
$AGI = new Asterisk::AGI;
my $ug = new Data::UUID;
my $timestamp = gmtime;
my %input = $AGI->ReadParse();
my ($file_to_read)=@ARGV;
my $hash = $ug->create_str;
my $sounddir = "/var/lib/asterisk/sounds/tts";
my $wavefile = "$sounddir/"."tts-$hash.wav";
my $t2wp= "/opt/swift/bin/";
open(fileOUT, ">/tmp"."/does_it_work.txt");
print fileOUT "$file_to_read";
close(fileOUT);
my $execf=$t2wp."swift -f $sounddir/$file_to_read -p audio/channels=1,cst/f0_shift=.8,speech/rate=190,audio/sampling-rate=8000,audio/deadair=2 -o $wavefile";
system($execf);
unlink($sounddir."/$file_to_read");
$AGI->stream_file('tts/'.basename($wavefile,".wav"));
writes the file name to a temp file and I can look there then view the file which has data. It
appears that it even gets converted to a .wav file but for some reason, that file doesn't
play from the dialplan and I'm not sure why.
Please help!
Thanks.
exten => 811,9,AGI(cepstral_text.pl| ${TMPTEXTFILE})
AGI(
#!/usr/bin/perl
use Asterisk::AGI;
use File::Basename;
require Data::UUID;
$AGI = new Asterisk::AGI;
my $ug = new Data::UUID;
my $timestamp = gmtime;
my %input = $AGI->ReadParse();
my ($file_to_read)=@ARGV;
my $hash = $ug->create_str;
my $sounddir = "/var/lib/asterisk/sounds/tts";
my $wavefile = "$sounddir/"."tts-$hash.wav";
my $t2wp= "/opt/swift/bin/";
open(fileOUT, ">/tmp"."/does_it_work.txt");
print fileOUT "$file_to_read";
close(fileOUT);
my $execf=$t2wp."swift -f $sounddir/$file_to_read -p audio/channels=1,cst/f0_shift=.8,speech/rate=190,audio/sampling-rate=8000,audio/deadair=2 -o $wavefile";
system($execf);
unlink($sounddir."/$file_to_read");
$AGI->stream_file('tts/'.basename($wavefile,".wav"));