Installing phpagi 2.x

I’am using Debian/4, Apache/2.2.3, PHP 5.2.5-0.dotdeb.2 and Asterisk/1.4.13

Download agi-php 2.x files from http://phpagi.sourceforge.net/

Adjust agi script files location set in asterisk.conf (a simple reload won’t do the job, so restart Asterisk afterwards)

[directories]
astagidir => /var/lib/asterisk/agi-bin

Create a context in the dialplan for your agi scripts in extention.conf
[agi]
exten => 800,1,Verbose(1|AGI)
exten => 800,n,agi(dtmf.php)
exten => 800,n,Hangup()

and include it in your incoming context with
include => agi

Before you can use the examples eg. dtmf.php a few adjustments are needed:

1. Scripts must be executable: chmod 755 dtmf.php

2. All php files are run by Asterisk, as if started from the console, so test that by actually running it from the console.

I had to edit dtmf.php to make a few changes:
Change the interpreter location from
#!/usr/local/bin/php -q
to
#!/usr/bin/php5 -q

Change the php include path to let the script find the file phpagi.php with
ini_set( "include_path", "/your_folder_to_phpagi.php/" );

Install speech engine
I followed the installation guide available at www.voip-info.org.

apt-get install festival
Comment out ;exit 0

Possible errors and solutions

Error message:
Failed to execute ‘/var/lib/asterisk/agi-bin/dtmf.php’: No such file or directory

Solutions:
Either check your astagidir in asterisk.conf
or make the dtmf.php executable with chmod 755
or check the line “#!/usr/bin/php5 -q”

Error message:
WARNING[26320]: file.c:563 ast_openstream_full: File /var/spool/asterisk/tmp//text2wav_ace75969fc9b3a79aef4da4291ca0646 does not exist in any format.
Solution:
Festival is not started or installed (Remember the exit 0; ?)

ADDENDUM:

http://jroliva.wordpress.com/2008/10/26/howto-consulta-de-stocks-usando-asterisk-phpagi-y-mysql/

Update 07/12/2011:

The Festival installation guide at www.voip-info.org has been moved to http://www.voip-info.org/wiki/view/Asterisk+festival+installation

June 26th, 2008 - Posted in asterisk, voIP | | 2 Comments

Installing spanish voices for festival speech synthesis system

On this blog I found the packages to install spanish voices for Festival. No apt-getting but *.deb files, learn how to install these…

June 26th, 2008 - Posted in asterisk, voIP | | 0 Comments