On 1/10/07, <b class="gmail_sendername">Yuan LIU</b> <<a href="mailto:yliu11@hotmail.com">yliu11@hotmail.com</a>> wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Then there must be an error somewhere. The variable READ() in Asterisk<br>should be usable. Should be able to use SayDigits() to play it back - or no<br>value is read.<br><br>Yuan Liu</blockquote><div><br> Hi Yuan and Anton,
<br><br></div>Let's put here all AGI for test:<br><br></div>#!/usr/bin/php -q<br><?php<br>ob_implicit_flush(false);<br>error_reporting(0);<br>$stdin = fopen( 'php://stdin', 'r' );<br><br>if (!defined('STDIN'))
<br>{<br> define('STDIN',fopen('php://stdin','r'));<br>}<br>if (!defined('STDOUT'))<br>{<br> define('STDOUT',fopen('php://stdout','r'));<br>}<br>if (!defined('STDERR'))
<br>{<br> define('STERR',fopen('php://stderr','r'));<br>}<br><br>while(!feof($stdin))<br>{<br> $temp=trim(fgets(STDIN,4096));<br> if (($temp=="") || ($temp="\n"))
<br> {<br> break;<br> }<br> $s=split(":",$temp);<br> $nome=str_subst("agi_","",$s[0]);<br> $agi[$nome]=trim($s[1]);<br>}<br><br>foreach($agi as $chave=>$valor)
<br>{<br> fwrite(STDERR,"--$chave=$valor\n");<br> fflush(STDERR);<br>}<br>$my_var="123";<br>fflush(STDERR);<br>fwrite(STDERR,"Just testing\"\"\n");<br>fflush(STDERR);<br>
fwrite(STDOUT,"exec read my_var|//usr/share/asterisk/sounds/please-wait-connect-oncall-eng|5|||15 \n");<br>fwrite(STDOUT,"exec saydigits ${my_var} \n");<br>fflush(STDOUT);<br><br>$conn=odbc_connect('MSSQL', 'asterisk', '123456');
<br>$query = odbc_exec($conn, "INSERT INTO usuario(nome) VALUES('$my_var')");<br>?><br><br>If I not startup $my_var="123"; Saydigits receives a NULL as options. And so nothing was inserted into db.
<br>I tried to use WAIT FOR DIGIT but it makes no sense, asterisk passed through it directly like <span id="_user_Joel@digitalparadise.net" style="color: rgb(0, 104, 28);">Joel Lansden <Joel AT digitalparadise DOT net>
<span style="color: rgb(0, 0, 0);">reported on 9/14/06.</span></span><br>Is there another function or way to test it or I must try in another asterisk box?<br><br>-- <br>Ralph Liebessohn<br>ICQ: 74835911<br>Skype: liebessohn