On 1/10/07, <b class="gmail_sendername">Yuan LIU</b> &lt;<a href="mailto:yliu11@hotmail.com">yliu11@hotmail.com</a>&gt; 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.&nbsp;&nbsp;The variable READ() in Asterisk<br>should be usable.&nbsp;&nbsp;Should be able to use SayDigits() to play it back - or no<br>value is read.<br><br>Yuan Liu</blockquote><div><br>&nbsp;Hi Yuan and Anton,
<br><br></div>Let&#39;s put here all AGI for test:<br><br></div>#!/usr/bin/php -q<br>&lt;?php<br>ob_implicit_flush(false);<br>error_reporting(0);<br>$stdin = fopen( &#39;php://stdin&#39;, &#39;r&#39; );<br><br>if (!defined(&#39;STDIN&#39;))
<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; define(&#39;STDIN&#39;,fopen(&#39;php://stdin&#39;,&#39;r&#39;));<br>}<br>if (!defined(&#39;STDOUT&#39;))<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; define(&#39;STDOUT&#39;,fopen(&#39;php://stdout&#39;,&#39;r&#39;));<br>}<br>if (!defined(&#39;STDERR&#39;))
<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; define(&#39;STERR&#39;,fopen(&#39;php://stderr&#39;,&#39;r&#39;));<br>}<br><br>while(!feof($stdin))<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $temp=trim(fgets(STDIN,4096));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (($temp==&quot;&quot;) || ($temp=&quot;\n&quot;))
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $s=split(&quot;:&quot;,$temp);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $nome=str_subst(&quot;agi_&quot;,&quot;&quot;,$s[0]);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $agi[$nome]=trim($s[1]);<br>}<br><br>foreach($agi as $chave=&gt;$valor)
<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fwrite(STDERR,&quot;--$chave=$valor\n&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fflush(STDERR);<br>}<br>$my_var=&quot;123&quot;;<br>fflush(STDERR);<br>fwrite(STDERR,&quot;Just testing\&quot;\&quot;\n&quot;);<br>fflush(STDERR);<br>
fwrite(STDOUT,&quot;exec read my_var|//usr/share/asterisk/sounds/please-wait-connect-oncall-eng|5|||15 \n&quot;);<br>fwrite(STDOUT,&quot;exec saydigits ${my_var} \n&quot;);<br>fflush(STDOUT);<br><br>$conn=odbc_connect(&#39;MSSQL&#39;, &#39;asterisk&#39;, &#39;123456&#39;);
<br>$query = odbc_exec($conn, &quot;INSERT INTO usuario(nome) VALUES(&#39;$my_var&#39;)&quot;);<br>?&gt;<br><br>If I not startup $my_var=&quot;123&quot;; 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&nbsp;&lt;Joel AT digitalparadise DOT net&gt; 
<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