<div dir="ltr"><i>**When you say 'doesn't work' do you mean 'doesn't do what I want' or 'does not execute?'</i><br><br>I mean I do all steps in Mr. Nir presentation documents and not works.<br>
<br>Here is my php code:<br><br>#!/usr/bin/php -q<br><?php<br>error_reporting(E_ALL);<br>ob_implicit_flush(false);<br>set_time_limit(6);<br>$stdin = fopen('php://stdin', 'r');<br>$stdlog = fopen('agi_log.log', 'w');<br>
$debug = false;<br>/* Read input from Asterisk and output via $astOutput */<br>function astRead()<br>{<br> global $stdin, $debug, $stdlog;<br> $astOutput = str_replace("\n", "", fgets($stdin, 4096));<br>
if ($debug) fputs($stdlog, "read: $input\n");<br> return $astOutput;<br>}<br>/* Write AGI command to Asterisk */<br>function astWrite($agiCommand)<br>{<br> global $debug, $stdlog;<br> if ($debug) fputs($stdlog, "write: $agiCommand\n");<br>
<br> echo $agiCommand."\n";<br>}<br>/* Handling execution input from Asterisk */<br>while (!feof($stdin))<br>{<br>$temp = fgets($stdin);<br>$temp = str_replace("\n","",$temp);<br>$s = explode(":",$temp);<br>
$agivar[$s[0]] = trim($s[1]);<br>if ($temp == "")<br>{<br>break;<br>}<br>}<br>/* Operational Code starts here */<br><br>astWrite("STREAM FILE demo-congrats #");<br>astRead();<br>/* Say the number 123456 */<br>
astWrite("SAY NUMBER 123456 #");<br>astRead();<br><br>/* Finalization of AGI script and clean-ups */<br>fclose ($stdin);<br>fclose ($stdlog);<br>exit(0);<br><br>and have wrote in extension_custom.conf:<br><br>[from-internal-custom]<br>
include => testAGI<br><br>[testAGI]<br>exten => 147,1,Answer <br>exten => 147,2,AGI(testAGI.php) <br>exten => 147,3,Hangup<br><br><br>147 is my extension.<br>operators can call a number via their extension(each extension may use for one or more users?)<br>
<br>I register extension 147 in my client softphone and call a number. what happen after that?<br><br><div class="gmail_quote">On Wed, Jan 16, 2013 at 11:19 AM, Steve Edwards <span dir="ltr"><<a href="mailto:asterisk.org@sedwards.com" target="_blank">asterisk.org@sedwards.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Wed, 16 Jan 2013, Muhammad wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I wrote some php code to working with AGI, but it dosen't work.<br>
</blockquote>
<br></div>
When you say 'doesn't work' do you mean 'doesn't do what I want' or 'does not execute?'<br>
<br>
If you enable AGI debugging, what does the Asterisk console log look like?<br>
<br>
Did you use an established PHP library or 'roll your own?'<br>
<br>
A good way to test an AGI is to create a text file containing all the cruft (the AGI 'environment') Asterisk sends to the AGI along with the expected responses. Then you can execute your AGI completely external from Asterisk with a shell command line like:<br>
<br>
/var/lib/asterisk/agi-bin/my-<u></u>firs-agi <example environment<span class="HOEnZb"><font color="#888888"><br>
<br>
-- <br>
Thanks in advance,<br>
------------------------------<u></u>------------------------------<u></u>-------------<br>
Steve Edwards <a href="mailto:sedwards@sedwards.com" target="_blank">sedwards@sedwards.com</a> Voice: <a href="https://2.177.142.31/_AMI/tidy.php?exten=147&number=%2B17604683867" class="telified" title="Use as phone number" style="color:#777796;background-color:#ffffdf">+1-760-468-3867</a> PST<br>
Newline Fax: <a href="https://2.177.142.31/_AMI/tidy.php?exten=147&number=%2B17607313000" class="telified" title="Use as phone number" style="color:#777796;background-color:#ffffdf">+1-760-731-3000</a></font></span><div class="HOEnZb">
<div class="h5"><br>
<br>
--<br>
______________________________<u></u>______________________________<u></u>_________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>
New to Asterisk? Join us for a live introductory webinar every Thurs:<br>
<a href="http://www.asterisk.org/hello" target="_blank">http://www.asterisk.org/hello</a><br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
<a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/<u></u>mailman/listinfo/asterisk-<u></u>users</a><br>
</div></div></blockquote></div><br></div>