I need help about PHP SCRIPT!

here is my script:hello.php
#!/usr/bin/php -q

<?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! Crying or Very sad (agi-test.agi is already in agi-bin directory, and it is writen by perl,is it the reason???).

please help me!
Thanks so much!

Hi,

Try with give full path of your sound file /var/lib/asterisk/sounds/myhello

Cheers.

[quote=“akpositive”]Hi,

Try with give full path of your sound file /var/lib/asterisk/sounds/myhello

Cheers.[/quote]

I tried but nothing happen! I still don’t here hello.gsm!help me please!

Help me help me please!!!

Not sure if exec is the right way to playback a file, there a stream_file method for this task, you could try it and see what happens.

Also note the following line is wrong:

$agi=answer(); 

Cheers.

Marco Bruni
www.marcobruni.net[