<?php
require_once('phpagi.php');
$agi=new $AGI();
$agi=answer();
$agi->exec('Playback','hello'); //hello is a gsm file in Sounds directory.
$agi->verbose("hello done");
?>
here is my context:
[test]
exten=>1,1,wait(1)
exten=>1,2,AGI(hello.php)
exten=>1,3,playback(vm-goodbye)
exten=>1,4,hangup()
after using SIP phone (X-litte) to call, Asterisk CLI display:
–launched AGI script /var/lib/asterisk/agi-bin/hello.php
–<SIP/truonglh-b7bbfca8>AGI script hello.php completed, returning 0.
But I don’t hear anything (my hello.gsm).I don’t know why! please help me!
Ah,if I replace exten=>1,2,AGI(hello.php) by exten=>1,2,AGI(agi-test.agi), everything work as expected! (agi-test.agi is already in agi-bin directory, and it is writen by perl,is it the reason???).
[quote=“heros”]
[test]
exten=>1,1,wait(1)
exten=>1,2,AGI(hello.php)
exten=>1,3,playback(vm-goodbye)
exten=>1,4,hangup()
please help me!
Thanks so much![/quote]
hey hero…In the second line u should have that file hello.php in phpagi folder, So that it can use phpagi.php.
like this
exten=>1,2,AGI(/phpagi-2.14/hello.php)
and u should have the hello sound file in /var/lib/asterisk/sounds.
Once try with it…u may solve ur problem…all d best
go to directory of your file.
Then from console type:
./hello.php
And see results.
You can have different problems - file is not in /var/lib/asterisk/agi-bin/ directory./ Wrong permissions. Not installed all dependencies - I am using mainly perl, and cant say what exactly you have to install, but it is something like php-cli
Of course - if permissions are wrong - you can start script from console, but Asterisk (which could run as different user) could have no permissions to run script.