[asterisk-users] AGI PHP Issues (Not new to Asterisk but new to AGI)
Chris Blunt
chris.blunt at entropy-it.com
Wed Nov 29 07:38:16 MST 2006
Sorry to bother you all with what is probably a simple question.
I am attempting my first go at a simple AGI application using PHP (Getting
Asterisk to SAY PHONETIC ABC). I have dabbled with PHP but I am by no means
a professional standard developer.
My script seems to execute ok, and I can see asterisk playing the sounds but
my phone goes from ringing to busy, and I don't hear the phontics.
Below are the relevant bit from my PHP, Console, and extensions.conf.
I would be most grateful if someone could show me the way.
Thanks in advance:
Chris
Asterisk ver: 1.2.10
PHP:
#!/usr/local/php/bin/php -q
<?php
$stdin = fopen('php://stdin', 'r');
$stdout = fopen('php://stdout', 'w');
$stdlog = fopen('/var/log/asterisk/my_agi.log', 'w');
while (!feof($stdin)) {
$temp = fgets($stdin);
$temp = str_replace("\n","",$temp);
$s = explode(":",$temp);
$agivar[$s[0]] = trim($s[1]);
if (($temp == "") || ($temp == "\n")) {
break;
}
}
fputs($stdout,"SAY PHONETIC \"abc\" \"#\" \n");
fflush($stdout);
$msg = fgets($stdin,1024);
fputs($stdlog,$msg . "\n");
?>
Extensions.conf:
exten => 4343,1,Answer
exten => 4343,2,AGI(example.php)
exten => 4343,3,Busy
AGI Debug:
AGI Rx << SAY PHONETIC "abc" "#"
-- Playing 'phonetic/a_p' (language 'en')
-- Playing 'phonetic/b_p' (language 'en')
-- Playing 'phonetic/c_p' (language 'en')
-- AGI Script example.php completed, returning 0
-- Executing Busy("SIP/4321-081b9498", "") in new stack
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20061129/432dc065/attachment.htm
More information about the asterisk-users
mailing list