[Asterisk-java-cvs] CVS: asterisk-java/src/java/net/sf/asterisk/fastagi AbstractAGIScript.java,1.11,
Brought to you by:
srt
From: Stefan R. <sr...@us...> - 2005-07-14 19:27:07
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22559/src/java/net/sf/asterisk/fastagi Modified Files: AbstractAGIScript.java Log Message: added getData(...) methods Index: AbstractAGIScript.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/AbstractAGIScript.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -p -r1.11 -r1.12 --- AbstractAGIScript.java 1 Jul 2005 16:36:30 -0000 1.11 +++ AbstractAGIScript.java 14 Jul 2005 19:26:57 -0000 1.12 @@ -19,6 +19,7 @@ package net.sf.asterisk.fastagi; import net.sf.asterisk.fastagi.command.AnswerCommand; import net.sf.asterisk.fastagi.command.ChannelStatusCommand; import net.sf.asterisk.fastagi.command.ExecCommand; +import net.sf.asterisk.fastagi.command.GetDataCommand; import net.sf.asterisk.fastagi.command.GetVariableCommand; import net.sf.asterisk.fastagi.command.HangupCommand; import net.sf.asterisk.fastagi.command.SayAlphaCommand; @@ -142,6 +143,64 @@ public abstract class AbstractAGIScript } /** + * Plays the given file and waits for the user to enter DTMF digits until he + * presses '#'. + * + * @param file the name of the file to play + * @return a String containing the DTMF the user entered + */ + protected String getData(AGIChannel channel, String file) + throws AGIException + { + AGIReply reply; + + reply = channel.sendCommand(new GetDataCommand(file)); + return reply.getResult(); + } + + /** + * Plays the given file and waits for the user to enter DTMF digits until he + * presses '#' or the timeout occurs. + * + * @param file the name of the file to play + * @param timeout the timeout to wait for user input.<br> + * 0 means standard timeout value, -1 means "ludicrous time" + * (essentially never times out). + * @return a String containing the DTMF the user entered + */ + protected String getData(AGIChannel channel, String file, int timeout) + throws AGIException + { + AGIReply reply; + + reply = channel.sendCommand(new GetDataCommand(file, timeout)); + return reply.getResult(); + } + + /** + * Plays the given file and waits for the user to enter DTMF digits until he + * presses '#' or the timeout occurs or the maximum number of digits has + * been entered. + * + * @param file the name of the file to play + * @param timeout the timeout to wait for user input.<br> + * 0 means standard timeout value, -1 means "ludicrous time" + * (essentially never times out). + * @param maxDigits the maximum number of digits the user is allowed to + * enter + * @return a String containing the DTMF the user entered + */ + protected String getData(AGIChannel channel, String file, int timeout, + int maxDigits) throws AGIException + { + AGIReply reply; + + reply = channel + .sendCommand(new GetDataCommand(file, timeout, maxDigits)); + return reply.getResult(); + } + + /** * Executes the given command. * * @param application the name of the application to execute, for example |