[Asterisk-java-cvs] CVS: asterisk-java/src/java/net/sf/asterisk/fastagi AbstractAGIScript.java,1.6,1
Brought to you by:
srt
From: Stefan R. <sr...@us...> - 2005-03-11 16:18:24
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3378/src/java/net/sf/asterisk/fastagi Modified Files: AbstractAGIScript.java Log Message: Added streamFile() methods Index: AbstractAGIScript.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/AbstractAGIScript.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -p -r1.6 -r1.7 --- AbstractAGIScript.java 11 Mar 2005 14:15:35 -0000 1.6 +++ AbstractAGIScript.java 11 Mar 2005 16:18:13 -0000 1.7 @@ -23,6 +23,7 @@ import net.sf.asterisk.fastagi.command.S import net.sf.asterisk.fastagi.command.SetExtensionCommand; import net.sf.asterisk.fastagi.command.SetPriorityCommand; import net.sf.asterisk.fastagi.command.SetVariableCommand; +import net.sf.asterisk.fastagi.command.StreamFileCommand; import net.sf.asterisk.fastagi.reply.AGIReply; /** @@ -69,6 +70,35 @@ public abstract class AbstractAGIScript } /** + * Plays the given file. + * + * @param file name of the file to play. + */ + protected void streamFile(AGIChannel channel, String file) + throws AGIException + { + channel.sendCommand(new StreamFileCommand(file)); + } + + /** + * Plays the given file and allows the user to escape by pressing one of the + * given digit. + * + * @param file name of the file to play. + * @param escapeDigits a String containing the dtmf digits that allow the + * user to escape. + * @return the dtmf digit pressed or 0x0 if none was pressed. + */ + protected char streamFile(AGIChannel channel, String file, + String escapeDigits) throws AGIException + { + AGIReply reply; + + reply = channel.sendCommand(new StreamFileCommand(file, escapeDigits)); + return reply.getResultCodeAsChar(); + } + + /** * Returns the value of the given channel variable. * * @param name the name of the variable to retrieve. |