<?php
$agi->saynumber("1234"); // speaks the number 1234
$agi->saydigits("1234"); // speaks the digits 1, 2, 3 and 4.
$agi->saytime(); // speaks the current time.
$agi->text2wav("These are some words eh?"); // speaks the phrase "These are some words eh?" using Festival.
$agi->play("welcome"); // plays a file on the current channel.
/*
Plays the prompt "say-something", then records up to 10000 milliseconds of audio to the file "somefile.gsm"
*/
$agi->recordfile("somefile","gsm",10000,"say-something");
?>
[quote=“mbruni”]You need to create the agi object, so just after the line “<?php” add:
require("phpagi.php");
$agi=new AGI();
Also check you have the file phpagi.php in /var/lib/asterisk/agi-bin.
Regards.
Marco Bruni[/quote]
Now the file is like this:
[ul]
#!/opt/lampp/bin/php
<?php
require(“phpagi.php”);
$agi=new AGI();
$agi->saynumber(“1234”); // speaks the number 1234
$agi->saydigits(“1234”); // speaks the digits 1, 2, 3 and 4.
$agi->saytime(); // speaks the current time.
$agi->text2wav("These are some words eh?"); // speaks the phrase "These are some words eh?" using Festival.
$agi->play("welcome"); // plays a file on the current channel.
/*
Plays the prompt "say-something", then records up to 10000 milliseconds of audio to the file "somefile.gsm"
*/
$agi->recordfile("somefile","gsm",10000,"say-something");
?>
[/ul]
Output:
– Executing [3016@default:1] Answer(“SIP/1200-b6c0a098”, “”) in new stack
– Executing [3016@default:2] AGI(“SIP/1200-b6c0a098”, “saynumber.agi”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/saynumber.agi
– AGI Script saynumber.agi completed, returning 0 == Auto fallthrough, channel ‘SIP/1200-b6c0a098’ status is 'UNKNOWN’
asterisk*CLI>
the commands you are using are not vallid you should use these commands
#!/opt/lampp/bin/php
<?php
require("phpagi.php");
$agi=new AGI();
$agi->say_number("1234"); // speaks the number 1234
$agi->say_digits("1234"); // speaks the digits 1, 2, 3 and 4.
$agi->say_time(); // speaks the current time.
$agi->text2wav("These are some words eh?"); // speaks the phrase "These are some words eh?" using Festival.
$agi->stream_file('welcome');// plays a file on the current channel.
see this page
[asterisk.drunkcoder.com/agi.cgi](http://asterisk.drunkcoder.com/agi.cgi)
and set file permissions to cmod 744 /var/lib/asterisk/agi-bin
for phpmanager to connect to the asterisk manager and make some custom settings for text2wave make a file phpagi.conf in /etc/asterisk
you can find a sample of that file in de doc folder when you unpack phpagi
[quote=“sander4000”]Just unpack in /var/lib/asterisk/agi-bin
and set file permissions to cmod 744 /var/lib/asterisk/agi-bin
for phpmanager to connect to the asterisk manager and make some custom settings for text2wave make a file phpagi.conf in /etc/asterisk
you can find a sample of that file in de doc folder when you unpack phpagi[/quote]
[asmanager]
server=localhost ; server to connect to
port=5038 ; default manager port username=phpagi ; username for login secret=myphpagisecret ; password for login
Do I need to put the username and secret from [asmanger] into manager.conf ?
(or there is no connection between the 2 ?)