[Asterisk-Users] First AGI help..
I am trying to write my first AGI script.. I cant seem to get it to work.. I am trying PHP in preference (I know this is frowned upon) but I can't get it to work with perl either.. I guess I just don't understand it correctly.. All I am trying to do is get the script to make a call using Dial so that I can get an idea of how it works.. My experience is really only in PHP based websites so this is a whole new ball game for me.. Thanks for any help.. and any samples (even offlist) would be greatly appreciated.. I have setup in extensions.conf like this for testing.. exten = 7000,1,agi(test1.php) exten = 7001,1,agi(test2.pl) test1.php script.. ?php // From Kapjod's sample.. ob_implicit_flush(true); set_time_limit(0); $err = fopen(php://stderr,w); $in = fopen(php://stdin,r); $out = fopen(php://stdout,w); //This works.. fputs($out, Verbose \Calling phone\n); // This doesn't fputs($out, exec(Dial(sip/2012)\n); fclose($in); fclose($out); fclose($err); ? test2.pl script.. #!/usr/bin/perl # taken from a sample file.. $|=1; while(STDIN) { chomp; last unless length($_); if (/^agi_(\w+)\:\s+(.*)$/) { $AGI{$1} = $2; } } #This works.. print STDOUT AGI Environment Dump:\n; foreach $i (sort keys %AGI) { print STDOUT Verbose \-- $i = $AGI{$i}\\n; } # This does not start a call.. print STDOUT exec(Dial(sip/2012)\n) ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [Asterisk-Users] First AGI help..
Hi ?php // From Kapjod's sample.. ob_implicit_flush(true); set_time_limit(0); $err = fopen(php://stderr,w); $in = fopen(php://stdin,r); $out = fopen(php://stdout,w); //This works.. fputs($out, Verbose \Calling phone\n); // This doesn't fputs($out, exec(Dial(sip/2012)\n); fclose($in); fclose($out); fclose($err); ? You'll find its to do with your syntax - show agi exec produces Usage: EXEC application options Executes application with given options. Returns whatever the application returns, or -2 on failure to find application ie use spaces not (. Paul ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [Asterisk-Users] First AGI help..
Paul Liew wrote: Hi ?php // From Kapjod's sample.. ob_implicit_flush(true); set_time_limit(0); $err = fopen(php://stderr,w); $in = fopen(php://stdin,r); $out = fopen(php://stdout,w); //This works.. fputs($out, Verbose \Calling phone\n); // This doesn't fputs($out, exec(Dial(sip/2012)\n); fclose($in); fclose($out); fclose($err); ? You'll find its to do with your syntax - show agi exec produces Usage: EXEC application options Executes application with given options. Returns whatever the application returns, or -2 on failure to find application ie use spaces not (. Paul ___ Thanks Paul.. I was trying to glue bits from other scripts together and I guess I misinterpreted the syntax from the other scripts.. So thats working now I can try more interesting things and hopefully get somewhere in learning AGI.. Thanks again.. Later.. ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users