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

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

astagidir => /var/lib/asterisk/agi-bin

Create a context in the dialplan for your agi scripts in extention.conf
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
#!/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

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

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.
Festival is not started or installed (Remember the exit 0; ?)


Update 07/12/2011:

The Festival installation guide at has been moved to

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

Using Asterisk PBX with Apache Proxy module

For the fun of it I wanted to try AJAM to view real time call progress data wrapped in a nice prototype.js driven GUI.

“If you want to integrate CGI’s, databases, PHP, etc. you will likely need to use a more traditional web server like Apache and link in your Asterisk micro HTTP server with something like this:
ProxyPass /asterisk http://localhost:8088/asterisk

Ok, by using this ProxyPass thingy, I´am able to use my own PHP scripts, yeah babe that´s what I want :)

FYI: I’am using Debian/4, Apache/2.2.3 and Asterisk/1.4.13

First you need to activate proxing in Apache by creating the following softlinks:
cd /etc/apache2/mods-enabled
ln -s ../mods-available/proxy.conf proxy.conf
ln -s ../mods-available/proxy.load proxy.load
ln -s ../mods-available/proxy_http.load proxy_http.load
ln -s ../mods-available/proxy_connect.load proxy_connect.load

The second step is to add the ProxyPass to your httpd.conf or vhost file:
<VirtualHost *:80>
ProxyPass /proxy http://localhost:8088/asterisk
ProxyPassReverse /proxy http://localhost:8088/asterisk

And finally reload apache with
/etc/init.d/apache2 reload

You should now be able to make requests to which will be forwarded to http://localhost:8088/asterisk/static/ajamdemo.html

And it will look something like this:
Asterisk AJAM demo example

April 8th, 2008 - Posted in voIP | | 1 Comments