Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8200/src/java/net/sf/asterisk/fastagi
Modified Files:
AbstractAGIScript.java
Log Message:
added waitForDigit method
Index: AbstractAGIScript.java
===================================================================
RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/AbstractAGIScript.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -p -r1.10 -r1.11
--- AbstractAGIScript.java 6 Apr 2005 16:51:47 -0000 1.10
+++ AbstractAGIScript.java 1 Jul 2005 16:36:30 -0000 1.11
@@ -35,6 +35,7 @@ import net.sf.asterisk.fastagi.command.S
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.command.WaitForDigitCommand;
import net.sf.asterisk.fastagi.reply.AGIReply;
/**
@@ -339,16 +340,16 @@ public abstract class AbstractAGIScript
}
/**
- * Says the given character string, returning early if any of
- * the given DTMF number are received on the channel.
+ * Says the given character string, returning early if any of the given DTMF
+ * number are received on the channel.
*
* @param text the text to say.
* @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 sayAlpha(AGIChannel channel, String text,
- String escapeDigits) throws AGIException
+ protected char sayAlpha(AGIChannel channel, String text, String escapeDigits)
+ throws AGIException
{
AGIReply reply;
@@ -361,23 +362,22 @@ public abstract class AbstractAGIScript
*
* @param time the time to say in seconds since 00:00:00 on January 1, 1970.
*/
- protected void sayTime(AGIChannel channel, long time)
- throws AGIException
+ protected void sayTime(AGIChannel channel, long time) throws AGIException
{
channel.sendCommand(new SayTimeCommand(time));
}
/**
- * Says the given time, returning early if any of
- * the given DTMF number are received on the channel.
+ * Says the given time, returning early if any of the given DTMF number are
+ * received on the channel.
*
* @param time the time to say in seconds since 00:00:00 on January 1, 1970.
* @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 sayTime(AGIChannel channel, long time,
- String escapeDigits) throws AGIException
+ protected char sayTime(AGIChannel channel, long time, String escapeDigits)
+ throws AGIException
{
AGIReply reply;
@@ -416,4 +416,20 @@ public abstract class AbstractAGIScript
{
channel.sendCommand(new SetVariableCommand(name, value));
}
+
+ /**
+ * Waits up to 'timeout' milliseconds to receive a DTMF digit.
+ *
+ * @param timeout timeout the milliseconds to wait for the channel to
+ * receive a DTMF digit, -1 will wait forever.
+ * @return the DTMF digit pressed or 0x0 if none was pressed.
+ */
+ protected char waitForDigit(AGIChannel channel, int timeout)
+ throws AGIException
+ {
+ AGIReply reply;
+
+ reply = channel.sendCommand(new WaitForDigitCommand(timeout));
+ return reply.getResultCodeAsChar();
+ }
}
|