[asterisk-users] Asterisk cant play sounds from AGI

Edwin Quijada listas_quijada at hotmail.com
Thu Jul 10 21:54:33 CDT 2008


Hi! I am a newbie using Asterisk. I am developing an IVR using perl from AGI and Cepstral as voices
The AGI is this

use Asterisk::AGI;
use File::Basename;
use Digest::MD5 qw(md5_hex);
 
 
 $AGI = new Asterisk::AGI;
 %input = $AGI->ReadParse();
 #
$AGI->say_number('9865');
$AGI->say_digits('873746');
 
speak("Hello World....");
 
 
 
sub speak
  {
    $text = $_[0];
 
    my $hash = md5_hex($text);
 
    my $ttsdir = "/var/lib/asterisk/sounds/tts";
    my $cepoptions = "-p audio/sampling-rate=8000,audio/channels=1";
 
    my $wavefile = "$ttsdir/tts-$hash.wav";
 
    unless (-f $wavefile)
      {
        open(fileOUT, ">/var/lib/asterisk/sounds/tts/say-text-$hash.txt");
        print fileOUT "$text";
        close(fileOUT);
 
        my $execf="/opt/swift/bin/swift -f $ttsdir/say-text-$hash.txt -o $wavefile $cepoptions";
        system($execf);
 
        unlink("$ttsdir/say-text-$hash.txt");
      }
    $filename = 'tts/'.basename('tts/'.basename($wavefile,".wav"));
    $AGI->stream_file($filename);
#  unlink("$wavefile");

This function I took from internet where i found it


My problem is that i cant hear anything when play the file sound using  $AGI->stream_file($filename);
I put asterisk in verbose mode but just see that it plays the sound but I cant hear anything.

I thought maybe was the codec but asterisk can play .wav
But this works
$AGI->say_number('9865');


Any help or cluees will be so appreciate~!
Thks!


*-------------------------------------------------------*
*-Edwin Quijada
*-Developer DataBase
*-JQ Microsistemas
*-809-849-8087
* " Si deseas lograr cosas excepcionales debes de hacer cosas fuera de lo comun"
*-------------------------------------------------------*

_________________________________________________________________
Get your fix of news, sports, entertainment and more on MSN Mobile
http://www.msnmobilefix.com/Default.aspx


More information about the asterisk-users mailing list