<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16414" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=296000116-14032007><FONT face=Arial 
size=2>Pessoal,</FONT></SPAN></DIV>
<DIV><SPAN class=296000116-14032007><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=296000116-14032007><FONT face=Arial size=2>Existe alguma forma 
de resgatar o que foi digitado na URA, e jogar em uma variavel em PHP 
(Agi)???</FONT></SPAN></DIV>
<DIV><SPAN class=296000116-14032007><FONT face=Arial size=2>Alguem conhece algum 
exemplo de sintaxe ou algo do tipo?</FONT></SPAN></DIV>
<DIV><SPAN class=296000116-14032007><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=296000116-14032007><FONT face=Arial size=2>Eu tenho uma rota, e 
dentro dela, ao digitar 5 eu chamo o phpagi.</FONT></SPAN></DIV>
<DIV><SPAN class=296000116-14032007><FONT face=Arial size=2>Dentro do script eu 
executo um SOM, STREAM FILE menu, e apos isso, eu queria receber o que a pessoa 
digitou, jogando em uma variavel em php.</FONT></SPAN></DIV>
<DIV><SPAN class=296000116-14032007><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=296000116-14032007><FONT face=Arial size=2>Colo abaixo o 
script.</FONT></SPAN></DIV>
<DIV><SPAN class=296000116-14032007><FONT face=Arial size=2>#!/usr/bin/php 
-q<BR>&lt;?<BR>//--------------<BR>//usar um depurador mais 
detalhando<BR>ob_implicit_flush(true);<BR>set_time_limit(6);<BR>$in=fopen("php://stdin","r");<BR>$stdlog=fopen("/var/lib/asterisk/agi-bin/log/meu_agi.log","w");</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV><SPAN class=296000116-14032007><FONT face=Arial size=2>$num = 37;<BR>$dig = 
123;<BR>$som = "z6-digite";<BR>$debug = false;<BR>//definir a funcao antes de 
iniciar o ciclo principal<BR>function read(){<BR>&nbsp;&nbsp;&nbsp; global $in, 
$debug, $stdlog;<BR>&nbsp;&nbsp;&nbsp; $input = 
str_replace("\n","",fgets($in,4096));<BR>&nbsp;&nbsp;&nbsp; if ($debug) 
fputs($stdlog,"read: $input\n");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
return $input;<BR>}</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV><SPAN class=296000116-14032007><FONT face=Arial size=2>function 
errlog($line){<BR>&nbsp;&nbsp;&nbsp; global $err;<BR>&nbsp;&nbsp;&nbsp; echo 
"VERBOSE \"$line\"\n";<BR>}</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV><SPAN class=296000116-14032007><FONT face=Arial size=2>function 
write($line){<BR>&nbsp;&nbsp;&nbsp; global $debug, 
$stdlog;<BR>&nbsp;&nbsp;&nbsp; if ($debug) fputs($stdlog,"write: 
$line\n");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo 
$line."\n";<BR>}</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV><SPAN class=296000116-14032007><FONT face=Arial size=2>while 
($env=read()){<BR>&nbsp;&nbsp;&nbsp; $s = split(": 
",$env);<BR>&nbsp;&nbsp;&nbsp; $agi[str_replace("agi_","",$s[(0)])] = 
trim($s[1]);<BR>&nbsp;&nbsp;&nbsp; if (($env == "") || ($env == 
"\n")){<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
break;<BR>&nbsp;&nbsp;&nbsp; }<BR>}</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV><SPAN class=296000116-14032007><FONT face=Arial size=2>//main 
program<BR>echo "VERBOSE \"Aqui vamos nos!\" \n";<BR>read();<BR>errlog("Call 
from ".$agi['channel']." - Chamando o telefone.");<BR>read();<BR>write("STREAM 
FILE $som X");<BR>read();<BR>write("SAY DIGITS $s 
X");<BR>read();<BR>//write("SAY DIGITS $dig X");<BR>//read();<BR>//write("SAY 
NUMBER $num X");<BR>//read();</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV><SPAN class=296000116-14032007><FONT face=Arial 
size=2>fclose($in);<BR>fclose($stdlog);</FONT></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV><SPAN class=296000116-14032007><FONT face=Arial 
size=2>exit;<BR>?&gt;</FONT></SPAN></DIV>
<DIV><SPAN class=296000116-14032007><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=296000116-14032007><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=296000116-14032007><FONT face=Arial 
size=2>Abraco<BR>Marcio</FONT></SPAN></DIV></BODY></HTML>