1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
#!/usr/bin/perl
#
# AGI Example that reads through a file one line at a time and sends it to
# Festival
#
# Written by: James Golovich <james@gnuinter.net>
#
use Asterisk::AGI;
$AGI = new Asterisk::AGI;
my %input = $AGI->ReadParse();
my $filename = $ARGV[0];
open(TEXT, "<$filename") || die "Cannot open $filename: $!\n";
while ($string = <TEXT>) {
chop($string);
# remove any quotes (") because they will screw up the string being passed to festival
$string =~ s/\"/ /g;
if ($string) {
$return = $AGI->exec('Festival', "\"$string\"");
}
}
close(TEXT);
|