File: tts-bofh.agi

package info (click to toggle)
libasterisk-agi-perl 1.08-1.1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 452 kB
  • sloc: perl: 2,883; makefile: 2
file content (28 lines) | stat: -rwxr-xr-x 671 bytes parent folder | download | duplicates (4)
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 picks a random bofh excuse from the fortune database 
# and sends it to Festival (text to speech processor)
#
# This script also requires the Fortune perl module
#
# Written by: James Golovich <james@gnuinter.net>
#



use Asterisk::AGI;
use Fortune;

$AGI = new Asterisk::AGI;

my %input = $AGI->ReadParse();

my $base_filename = '/usr/share/games/fortunes/bofh-excuses';

$ffile = new Fortune ($base_filename);
$ffile->read_header ();
$fortune = '"' . $ffile->get_random_fortune () . '"';
$fortune =~ s/\n/ /g;
$fortune =~ s/BOFH excuse \#(\d*):/Bastard Operator From Hell Excuse Number $1:,., /;

$AGI->exec('Festival', $fortune);