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 Responses to ' Installing phpagi 2.x '

Subscribe to comments with RSS or TrackBack to ' Installing phpagi 2.x '.

  1. Taiwo said,

    on September 17th, 2008 at 10:30 am

    Nice tutorial, I read up phpAgi and its cool features and decided to install it, I downloaded phpAgi into the /var/lib/asterisk/agi-bin/ folder and extracted it in there. I copied the files from phpagi.2.x folder into the upper folder(/var/lib/asterisk/agi-bin/) which I also included in php.ini include path, but each time i run the agi i get extension “dtmf.php” not present. this is the same error i get while running it outside asterisk

  2. Ali Khan said,

    on July 13th, 2011 at 12:31 pm

    Its a very nice guide and helped me solve my problem as well.
    You can also check this link as for further help in installing phpagi 2.x
    http://www.techstates.com/installing-phpagi-2/

Leave a reply