Re: [Asterisk-java-users] Newbie problem getting started with HelloAGIScript
Brought to you by:
srt
From: Liam O'H. <lia...@gm...> - 2006-02-23 19:27:40
|
> I would recommend getting an IDE if you plan on working in Java for a wh= ile ;-) > > Eclipse & NetBeans are full-featured free ones, while simple free ones l= ike BlueJ also work. Thanks for the good advice. I imagine I'll be using Eclipse. > For commandline, try 'javac HelloAGIScript.java -classpath asterisk-java= .jar' I discovered the solution which, as I suspected, is Java-newbie related as opposed to Asterisk-Java related, however, for the purposes of closing this thread (and in case anyone other java newbie needs this answer) here is the solution : Read the documentation properly, read the source and read what the compiler is telling you!! The whole point of implementing BaseAGIScript instead of AbstractAGIScript is to remove the necessity to pass <channel> as a parameter to the methods. As such, you should remove <channel> as a parameter from the method calls in the example in the tutorial. The point could be made that the tutorial should contain a compilable example, but it's also not unreasonable to assume a certain basic familiarity with Java. So, the HelloAGIScript.java source should read : import net.sf.asterisk.fastagi.AGIChannel; import net.sf.asterisk.fastagi.AGIException; import net.sf.asterisk.fastagi.AGIRequest; import net.sf.asterisk.fastagi.BaseAGIScript; public class HelloAGIScript extends BaseAGIScript { public void service(AGIRequest request, AGIChannel channel) throws AGIException { // Answer the channel... answer(); // ...say hello... streamFile("welcome"); // ...and hangup. hangup(); } } |