On 1/11/07, <b class="gmail_sendername">Eric ManxPower Wieling</b> <<a href="mailto:eric@fnords.org">eric@fnords.org</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;">
Steve Edwards wrote:<br>> On Thu, 11 Jan 2007, Yuan LIU wrote:<br>><br>>> AGI doesn't see the name "var"; all it sees is an array @ARGV (or<br>>> whatever in the respective language). As the documentation says,
<br>>> values are passed like command line arguments.<br>><br>> But, in the interest of "more maintainable code," you can pass the<br>> option name and use "getopt_long()" in "C" or whatever language you use.
<br>> For example,<br>><br>> agi(block-ani,--ani=555555555,--dnis=8005551212,--debug,--verbose)<br>><br>> vs<br>><br>> agi(block-ani|555555555|8005551212|y|y)<br><br>AGI() does not support more than 1 parameter to AGIs.
<br><br></blockquote></div><br># cat extensions.conf<br clear="all"><font size="1">exten => 8899,1,Read(my_var|sound-file|5|||15)<br>exten => 8899,2,AGI(/usr/share/asterisk/bin/firstagi.php|${my_var}|123|321|111|222)
</font><br><br># cat firstagi.php<br><font size="1">$my_var=$argv[1];<br>fwrite(STDOUT,"exec sayalpha $my_var \n");<br>fflush(STDOUT);<br>$my_var=$argv[2];<br>fwrite(STDOUT,"exec sayalpha $my_var \n");
<br>fflush(STDOUT);<br>$my_var=$argv[3];<br>fwrite(STDOUT,"exec sayalpha $my_var \n");<br>fflush(STDOUT);<br>$my_var=$argv[4];<br>fwrite(STDOUT,"exec sayalpha $my_var \n");<br>fflush(STDOUT);<br>$my_var=$argv[5];
<br>fwrite(STDOUT,"exec sayalpha $my_var \n");<br>fflush(STDOUT);</font><br><br>Results in console:<font size="1"><br>-- AGI Script Executing Application: (sayalpha) Options: (98765) // Result of READ<br> -- AGI Script Executing Application: (sayalpha) Options: (123) // Other parameters
<br> -- AGI Script Executing Application: (sayalpha) Options: (321)<br> -- AGI Script Executing Application: (sayalpha) Options: (111)<br> -- AGI Script Executing Application: (sayalpha) Options: (222)</font><br>
<br><br>AGI receives more than 1 parameter.<br><br>-- <br>Ralph Liebessohn<br>ICQ: 74835911<br>Skype: liebessohn