Re: [Asterisk-java-users] Newbie
Brought to you by:
srt
From: Stefan R. <sr...@re...> - 2005-10-28 10:54:51
|
If you want to originate a new call you must use the Manager API (see the tutorial for an example). FastAGI can only handle existing calls that are handed over to your Java application. =3DStefan > 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=3Dnull; > char dig =3D 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 =3D null; > AGIChannel channel=3D null; > > new DefaultAGIServer().startup(); > AstersiskApp AA =3D new AsteriskApp(); > AA.answerChannel(); > AA.playAndDetect(); > String digit=3Dt.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! Messen= ger > T=E9l=E9chargez cette version sur http://fr.messenger.yahoo.com > > > ------------------------------------------------------- > This SF.Net email is sponsored by the JBoss Inc. > Get Certified Today * Register for a JBoss Training Course > Free Certification Exam for All Training Attendees Through End of 2005 > Visit http://www.jboss.com/services/certification for more information > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > |