<!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> </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> </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> </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><?<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> </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> global $in,
$debug, $stdlog;<BR> $input =
str_replace("\n","",fgets($in,4096));<BR> if ($debug)
fputs($stdlog,"read: $input\n");<BR>
return $input;<BR>}</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=296000116-14032007><FONT face=Arial size=2>function
errlog($line){<BR> global $err;<BR> echo
"VERBOSE \"$line\"\n";<BR>}</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=296000116-14032007><FONT face=Arial size=2>function
write($line){<BR> global $debug,
$stdlog;<BR> if ($debug) fputs($stdlog,"write:
$line\n");<BR> echo
$line."\n";<BR>}</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=296000116-14032007><FONT face=Arial size=2>while
($env=read()){<BR> $s = split(":
",$env);<BR> $agi[str_replace("agi_","",$s[(0)])] =
trim($s[1]);<BR> if (($env == "") || ($env ==
"\n")){<BR>
break;<BR> }<BR>}</FONT></SPAN></DIV>
<DIV> </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> </DIV>
<DIV><SPAN class=296000116-14032007><FONT face=Arial
size=2>fclose($in);<BR>fclose($stdlog);</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=296000116-14032007><FONT face=Arial
size=2>exit;<BR>?></FONT></SPAN></DIV>
<DIV><SPAN class=296000116-14032007><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=296000116-14032007><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=296000116-14032007><FONT face=Arial
size=2>Abraco<BR>Marcio</FONT></SPAN></DIV></BODY></HTML>