[Asterisk-java-users] Newbie
Brought to you by:
srt
From: Ines <mou...@ya...> - 2005-10-28 10:14:59
|
Hello, I've got a java class with different methods : - a method which answers the channel - a method which makes a call -a method which plays an audio file ... this is my java class : ---------------------------------------------------- import java.io.IOException; import net.sf.asterisk.fastagi.AGIChannel; import net.sf.asterisk.fastagi.AGIException; import net.sf.asterisk.fastagi.AGIRequest; import net.sf.asterisk.fastagi.BaseAGIScript; import net.sf.asterisk.fastagi.DefaultAGIServer; import net.sf.asterisk.fastagi.command.GetDataCommand; import net.sf.asterisk.fastagi.reply.AGIReply; public class AsteriskApp extends BaseAGIScript { AGIRequest request; AGIChannel channel; public AsteriskApp() { } public void service(AGIRequest request, AGIChannel channel) throws AGIException { .... } public void answerChannel() throws AGIException { answer(); } public void playAndDetect() throws IllegalArgumentException, AGIException { channel.sendCommand(new GetDataCommand("welcom", 1800, 1)); } public void hangupChannel() throws AGIException { hangup(); } public String GetDigit () throws AGIException { String f=null; char dig = waitForDigit(-1); return(f.valueOf(dig)); } ..... } --------------------------------------------------- what i want to do is : different application which calls this class and uses the methods, in different ways -an application which can make a call -an application which answers a call, plays a audio file, wait for digit, ..., hangup ..... for example : ---------------------------------------------------- import java.io.IOException; import net.sf.asterisk.fastagi.AGIChannel; import net.sf.asterisk.fastagi.AGIException; import net.sf.asterisk.fastagi.AGIRequest; import net.sf.asterisk.fastagi.DefaultAGIServer; import net.sf.asterisk.fastagi.command.GetDataCommand; import net.sf.asterisk.manager.AuthenticationFailedException; import net.sf.asterisk.manager.TimeoutException; public class Application { public static void main(String[] args) throws IllegalStateException,IOException, AGIException { AGIRequest request = null; AGIChannel channel= null; new DefaultAGIServer().startup(); AstersiskApp AA = new AsteriskApp(); AA.answerChannel(); AA.playAndDetect(); String digit=t.GetDigit(); A.hangupChannel(); } } ------------------------------------------------------ But this doesn't work, because it will only run what is in the method service(request,channel) has anyone got an idea how to do this ? thanks a lot ines ___________________________________________________________________________ Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger Téléchargez cette version sur http://fr.messenger.yahoo.com |