Hi all,
Firstly, apologies for the very basic nature of this question. Although a
developer of many years, my exposure to Java has been extremely limited. I
have many years IVR experience and I have been using Asterisk at home for
the last year. As such, if I can be helped over this initial hurdle I
believe I'll be able to stand on my own.
I have Sun's j2sdk1.4.2_09 on Centos 4 and am having difficulties getting
HelloAGIScript compiled.
After much Googling I discovered that I needed to set my CLASSPATH. I set i=
t
to the java bin path and the directory containing asterisk-java.jar. This
reduced the number of errors but I am unable to get beyond the next problem=
.
As per the tutorial I changed AbstractAGIScript to BaseAGIScript (
HelloAGIScript.java attached at end of post).
The compile command in the tutorial is "javac -cp asterisk-java.jar
HelloAGIScript.java" but, from my reading of the javac documentation at
java.sun.com the -c and -p options don't appear to be valid options.
The compile command I'm using is "javac -sourcepath asterisk-java.jar
HelloAGIScript.java" and I'm getting the following errors:
HelloAGIScript.java:12: answer() in
net.sf.asterisk.fastagi.BaseAGIScriptcannot be applied to (
net.sf.asterisk.fastagi.AGIChannel)
answer(channel);
^
HelloAGIScript.java:15: cannot resolve symbol
symbol : method streamFile (net.sf.asterisk.fastagi.AGIChannel,
java.lang.String)
location: class HelloAGIScript
streamFile(channel, "welcome");
^
HelloAGIScript.java:18: hangup() in
net.sf.asterisk.fastagi.BaseAGIScriptcannot be applied to (
net.sf.asterisk.fastagi.AGIChannel)
hangup(channel);
I do realise that this is more of a Java beginner's question than an
Asterisk-Java question so I'd be most grateful for any assistance. Any and
all suggestions and/or URLs would be great.
Regards,
Liam
HelloAGIScript.java
----------------------------
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(channel);
// ...say hello...
streamFile(channel, "welcome");
// ...and hangup.
hangup(channel);
}
}
|