[asterisk-users] AGI doesn't execute PHP5 script

Stefan-Michael. Guenther (in-put GbR) asterisk at in-put.de
Tue Aug 8 02:55:10 MST 2006


Hi,

I'm trying to start a PHP5 script via the AGI Interface.
The asterisk version is Asterisk 1.2.5-BRIstuffed-0.3.0-PRE-1k and I followed 
the instructions on

http://www.voip-info.org/tiki-print.php?page=Asterisk+AGI+php

The problem is, as you can see from the output in the CLI, that Asterisk 
claims that it executes the script, but nothing happens. It doesn't create 
the file /tmp/asterisk and it doesn't send an email.
When I execute the script manually on the command line, it is execute without 
an error, the file is there and the email, too.

######################################################
;extensions.conf
;
[guenther]
exten => 111,1,Answer()
exten => 111,2,AGI(test.php)
exten => 111,3,Hangup

######################################################
ls -l /var/lib/asterisk/agi-bin/test.php

-rwxr-xr-x 1 asterisk root  340 Aug  8 10:07 test.php

######################################################

cat /var/lib/asterisk/agi-bin/test.php
#! /usr/bin/php5

<?php
ob_implicit_flush(false);
set_time_limit(6);
error_reporting(0);
system("touch /tmp/asterisk");
$header="From: Asterisk <Asterisk at localhost>\nX-OTRS-Queue:Misc\n";
$subject="Anruf vom SysAdmin";
mail("otrs at localhost",$subject,"Testemail","From: Asterisk 
<Asterisk at localhost>");
?>

######################################################
asterisk*CLI> dial 111 at guenther
    -- Executing Answer("OSS/dsp", "") in new stack
 << Console call has been answered >>
    -- Executing AGI("OSS/dsp", "test.php") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/test.php
AGI Tx >> agi_request: test.php
AGI Tx >> agi_channel: OSS/dsp
AGI Tx >> agi_language: en
AGI Tx >> agi_type: Console
AGI Tx >> agi_uniqueid: asterisk-6958-1155024459.47
AGI Tx >> agi_callerid: unknown
AGI Tx >> agi_calleridname: unknown
AGI Tx >> agi_callingpres: 0
AGI Tx >> agi_callingani2: 0
AGI Tx >> agi_callington: 0
AGI Tx >> agi_callingtns: 0
AGI Tx >> agi_dnid: unknown
AGI Tx >> agi_rdnis: unknown
AGI Tx >> agi_context: guenther
AGI Tx >> agi_extension: 111
AGI Tx >> agi_priority: 2
AGI Tx >> agi_enhanced: 0.0
AGI Tx >> agi_accountcode:
AGI Tx >> LI>
    -- AGI Script test.php completed, returning 0
    -- Executing Hangup("OSS/dsp", "") in new stack
 << Hangup on console >>

######################################################
When I use a shell script instead of the PHP script, everything works as 
expected, the file /tmp/asterisk is created:

cat /var/lib/asterisk/agi-bin/test.sh
#! /bin/bash

echo "1" > /tmp/asterisk

######################################################

Obviously, PHP5 is the problem, but what's wrong with it?

Thanks for your help,

Stefan
-- 

********************************************
in-put GbR - Das Linux-Systemhaus
Stefan-Michael Guenther
Moltkestrasse 49     D-76133 Karlsruhe
Tel./Fax : +49 (0)721 / 83044 - 98/93
http://www.in-put.de
********************************************
     Schulungen  Installationen  
         Beratung   Support
      Voice-over-IP-Loesungen
********************************************

-- 

********************************************
in-put GbR - Das Linux-Systemhaus
Stefan-Michael Guenther
Moltkestrasse 49     D-76133 Karlsruhe
Tel./Fax : +49 (0)721 / 83044 - 98/93
http://www.in-put.de
********************************************
     Schulungen  Installationen  
         Beratung   Support
      Voice over IP - Lösungen
********************************************



More information about the asterisk-users mailing list