Privet
It’s ok. such script can’t run from console. You must start it from dialplan.
And of course you must place php-agi files into default asterisk agi folder.
In your case it is: /var/lib/asterisk/agi-bin/
Well, i have found something for you, may be this can help:
Look at yours php.ini option: variables_order, it must be variables_order = “EGPCS” if you need to kill error about PATH index. But i think that you have some wrong configurations with phpagi and it can’t use standart variable for command path and trying to use $_ENV.
!/usr/local/bin/php -q
PHP Notice: Use of undefined constant phpagi - assumed ‘phpagi’ in /var/lib/asterisk/ag-bin/SMSSMS.php on line 4
PHP Notice: Use of undefined constant php - assumed ‘php’ in /var/lib/asterisk/ag-bin/SMSSMS.php on line 4
PHP Warning: require(phpagiphp): failed to open stream: No such file or directory in /var/lib/asterisk/ag-bin/SMSSMS.php on line 4
PHP Fatal error: require(): Failed opening required ‘phpagiphp’ (include_path=’.:/usr/share/php’) in /var/lib/asterisk/ag-bin/SMSSMS.php on line 4
I got this error when i hit api using curl in agi asterisk
!/usr/local/bin/php -q
<?php
set_time_limit(0);
require(phpagi.php);
$agi = new AGI();
$agi->answer();
$request_url="http://onextelbulksms.in/shn/api/pushsms.php?usr=alobhasms&key=010Wiuw00NxS6ReGL7lxQbK8o9ktqi&sndr=alobha&ph=8218026279&text=hello team&time=1236299296 (Time In seconds from 1 Jan 1970)rpt=1";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $request_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
curl_close($ch);
?>
I want sound is played only for 30 sec after that call will be hangup , then agi script will be run , but when I call to 1234 sound nplayed continue and and not automaticlly hangup and not even agi script will work . Please help me out