net.sf.asterisk.fastagi.command
Class RecordFileCommand

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

public class RecordFileCommand
extends AGICommand

Record to a file until a given dtmf digit in the sequence is received.
Returns -1 on hangup or error.
The format will specify what kind of file will be recorded. The timeout is the maximum record time in milliseconds, or -1 for no timeout. Offset samples is optional, and if provided will seek to the offset without exceeding the end of the file. "maxSilence" is the number of seconds of maxSilence allowed before the function returns despite the lack of dtmf digits or reaching timeout.

Version:
$Id: RecordFileCommand.java,v 1.2 2005/03/08 16:48:34 srt Exp $
Author:
srt
See Also:
Serialized Form

Constructor Summary
RecordFileCommand(java.lang.String file, java.lang.String format, java.lang.String escapeDigits, int timeout)
          Creates a new RecordFileCommand.
RecordFileCommand(java.lang.String file, java.lang.String format, java.lang.String escapeDigits, int timeout, int offset, boolean beep, int maxSilence)
          Creates a new RecordFileCommand.
 
Method Summary
 java.lang.String buildCommand()
          Returns a string suitable to be sent to asterisk.
 boolean getBeep()
          Returns true if a beep should be played before recording.
 java.lang.String getEscapeDigits()
          Returns the digits that allow the user to end recording.
 java.lang.String getFile()
          Returns the name of the file to stream.
 java.lang.String getFormat()
          Returns the format of the file to be recorded, for example "wav".
 int getOffset()
          Returns the offset samples to skip.
 int getTimeout()
          Returns the maximum record time in milliseconds.
 void setBeep(boolean beep)
          Set to true to play a beep before recording.
 void setEscapeDigits(java.lang.String escapeDigits)
          Sets the digits that allow the user to end recording.
 void setFile(java.lang.String file)
          Sets the name of the file to stream.
 void setFormat(java.lang.String format)
          Sets the format of the file to be recorded, for example "wav".
 void setOffset(int offset)
          Sets the offset samples to skip.
 void setTimeout(int timeout)
          Sets the maximum record time in milliseconds.
 
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

RecordFileCommand

public RecordFileCommand(java.lang.String file,
                         java.lang.String format,
                         java.lang.String escapeDigits,
                         int timeout)
Creates a new RecordFileCommand.

Parameters:
file - the name of the file to stream, must not include extension.
format - the format of the file to be recorded, for example "wav".
escapeDigits - contains the digits that allow the user to end recording.
timeout - the maximum record time in milliseconds, or -1 for no timeout.

RecordFileCommand

public RecordFileCommand(java.lang.String file,
                         java.lang.String format,
                         java.lang.String escapeDigits,
                         int timeout,
                         int offset,
                         boolean beep,
                         int maxSilence)
Creates a new RecordFileCommand.

Parameters:
file - the name of the file to stream, must not include extension.
format - the format of the file to be recorded, for example "wav".
escapeDigits - contains the digits that allow the user to end recording.
timeout - the maximum record time in milliseconds, or -1 for no timeout.
offset - the offset samples to skip.
beep - true if a beep should be played before recording.
maxSilence - The amount of silence (in seconds) to allow before returning despite the lack of dtmf digits or reaching timeout.
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.

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

getFormat

public java.lang.String getFormat()
Returns the format of the file to be recorded, for example "wav".

Returns:
the format of the file to be recorded, for example "wav".

setFormat

public void setFormat(java.lang.String format)
Sets the format of the file to be recorded, for example "wav".

Parameters:
format - the format of the file to be recorded, for example "wav".

getEscapeDigits

public java.lang.String getEscapeDigits()
Returns the digits that allow the user to end recording.

Returns:
the digits that allow the user to end recording.

setEscapeDigits

public void setEscapeDigits(java.lang.String escapeDigits)
Sets the digits that allow the user to end recording.

Parameters:
escapeDigits - the digits that allow the user to end recording or null for none.

getTimeout

public int getTimeout()
Returns the maximum record time in milliseconds.

Returns:
the maximum record time in milliseconds.

setTimeout

public void setTimeout(int timeout)
Sets the maximum record time in milliseconds.

Parameters:
timeout - the maximum record time in milliseconds, or -1 for no timeout.

getOffset

public int getOffset()
Returns the offset samples to skip.

Returns:
the offset samples to skip.

setOffset

public void setOffset(int offset)
Sets the offset samples to skip.

Parameters:
offset - the offset samples to skip.

getBeep

public boolean getBeep()
Returns true if a beep should be played before recording.

Returns:
true if a beep should be played before recording, false if not.

setBeep

public void setBeep(boolean beep)
Set to true to play a beep before recording.

Parameters:
beep - true if a beep should be played before recording, false if not.

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.