net.sf.asterisk.fastagi.command
Class GetDataCommand

java.lang.Object
  extended by net.sf.asterisk.fastagi.command.AGICommand
      extended by net.sf.asterisk.fastagi.command.GetDataCommand
All Implemented Interfaces:
java.io.Serializable

public class GetDataCommand
extends AGICommand

Stream the given file, and recieve DTMF data. The user may interrupt the streaming by starting to enter digits.
Returns the digits recieved from the channel at the other end.
Input ends when the timeout is reached, the maximum number of digits is read or the user presses #.

Version:
$Id: GetDataCommand.java,v 1.7 2005/11/17 17:41:35 srt Exp $
Author:
srt
See Also:
Serialized Form

Constructor Summary
GetDataCommand(java.lang.String file)
          Creates a new GetDataCommand with default timeout and maxDigits set to 1024.
GetDataCommand(java.lang.String file, long timeout)
          Creates a new GetDataCommand with the given timeout and maxDigits set to 1024.
GetDataCommand(java.lang.String file, long timeout, int maxDigits)
          Creates a new GetDataCommand with the given timeout and maxDigits.
 
Method Summary
 java.lang.String buildCommand()
          Returns a string suitable to be sent to asterisk.
 java.lang.String getFile()
          Returns the name of the file to stream.
 int getMaxDigits()
          Returns the maximum number of digits to read.
 long getTimeout()
          Returns the timeout to wait for data.
 void setFile(java.lang.String file)
          Sets the name of the file to stream.
This attribute is mandatory.
 void setMaxDigits(int maxDigits)
          Sets the maximum number of digits to read.
 void setTimeout(long timeout)
          Sets the timeout to wait for data.
 
Methods inherited from class net.sf.asterisk.fastagi.command.AGICommand
escapeAndQuote, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GetDataCommand

public GetDataCommand(java.lang.String file)
Creates a new GetDataCommand with default timeout and maxDigits set to 1024.

Parameters:
file - the name of the file to stream, must not include extension.

GetDataCommand

public GetDataCommand(java.lang.String file,
                      long timeout)
Creates a new GetDataCommand with the given timeout and maxDigits set to 1024.

Parameters:
file - the name of the file to stream, must not include extension.
timeout - the timeout in milliseconds to wait for data.
0 means standard timeout value, -1 means "ludicrous time" (essentially never times out).

GetDataCommand

public GetDataCommand(java.lang.String file,
                      long timeout,
                      int maxDigits)
               throws java.lang.IllegalArgumentException
Creates a new GetDataCommand with the given timeout and maxDigits.

Parameters:
file - the name of the file to stream, must not include extension.
timeout - the timeout in milliseconds to wait for data.
0 means standard timeout value, -1 means "ludicrous time" (essentially never times out).
maxDigits - the maximum number of digits to read.
Must be in [1..1024].
Throws:
java.lang.IllegalArgumentException - if maxDigits is not in [1..1024]
Method Detail

getFile

public java.lang.String getFile()
Returns the name of the file to stream.

Returns:
the name of the file to stream.

setFile

public void setFile(java.lang.String file)
Sets the name of the file to stream.
This attribute is mandatory.

Parameters:
file - the name of the file to stream, must not include extension.

getTimeout

public long getTimeout()
Returns the timeout to wait for data.

Returns:
the timeout in milliseconds to wait for data.

setTimeout

public void setTimeout(long timeout)
Sets the timeout to wait for data.

Parameters:
timeout - the timeout in milliseconds to wait for data.
0 means standard timeout value, -1 means "ludicrous time" (essentially never times out).

getMaxDigits

public int getMaxDigits()
Returns the maximum number of digits to read.

Returns:
the maximum number of digits to read.

setMaxDigits

public void setMaxDigits(int maxDigits)
                  throws java.lang.IllegalArgumentException
Sets the maximum number of digits to read.

Parameters:
maxDigits - the maximum number of digits to read.
Must be in [1..1024].
Throws:
java.lang.IllegalArgumentException - if maxDigits is not in [1..1024]

buildCommand

public java.lang.String buildCommand()
Description copied from class: AGICommand
Returns a string suitable to be sent to asterisk.

Specified by:
buildCommand in class AGICommand
Returns:
a string suitable to be sent to asterisk.


Copyright © 2004-2005 Stefan Reuter. All Rights Reserved.