net.sf.asterisk.fastagi.command
Class ControlStreamFileCommand

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

public class ControlStreamFileCommand
extends AGICommand

Plays the given file, allowing playback to be interrupted by the given digits, if any, and allows the listner to control the stream.
If offset is provided then the audio will seek to sample offset before play starts.
Returns 0 if playback completes without a digit being pressed, or the ASCII numerical value of the digit if one was pressed, or -1 on error or if the channel was disconnected.
Remember, the file extension must not be included in the filename.
Available since Asterisk 1.2

Since:
0.2
Version:
$Id: ControlStreamFileCommand.java,v 1.2 2005/08/28 13:37:04 srt Exp $
Author:
srt
See Also:
Serialized Form

Constructor Summary
ControlStreamFileCommand(java.lang.String file)
          Creates a new ControlStreamFileCommand, streaming from the beginning.
ControlStreamFileCommand(java.lang.String file, java.lang.String escapeDigits)
          Creates a new ControlStreamFileCommand, streaming from the beginning.
ControlStreamFileCommand(java.lang.String file, java.lang.String escapeDigits, int offset)
          Creates a new ControlStreamFileCommand, streaming from the given offset.
ControlStreamFileCommand(java.lang.String file, java.lang.String escapeDigits, int offset, java.lang.String forwardDigit, java.lang.String rewindDigit, java.lang.String pauseDigit)
          Creates a new ControlStreamFileCommand, streaming from the given offset.
 
Method Summary
 java.lang.String buildCommand()
          Returns a string suitable to be sent to asterisk.
 java.lang.String getEscapeDigits()
          Returns the digits that allow the user to interrupt this command.
 java.lang.String getFile()
          Returns the name of the file to stream.
 java.lang.String getForwardDigit()
          Returns the digit for fast forward.
 int getOffset()
          Returns the offset samples to skip before streaming.
 java.lang.String getPauseDigit()
          Retruns the digit for pause and unpause.
 java.lang.String getRewindDigit()
          Returns the digit for rewind.
 void setControlDigits(java.lang.String forwardDigit, java.lang.String rewindDigit)
          Sets the control digits for fast forward and rewind.
 void setControlDigits(java.lang.String forwardDigit, java.lang.String rewindDigit, java.lang.String pauseDigit)
          Sets the control digits for fast forward, rewind and pause.
 void setEscapeDigits(java.lang.String escapeDigits)
          Sets the digits that allow the user to interrupt this command.
 void setFile(java.lang.String file)
          Sets the name of the file to stream.
 void setOffset(int offset)
          Sets the offset samples to skip before streaming.
 
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

ControlStreamFileCommand

public ControlStreamFileCommand(java.lang.String file)
Creates a new ControlStreamFileCommand, streaming from the beginning. It uses the default digit "#" for forward and "*" for rewind and does not support pausing.

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

ControlStreamFileCommand

public ControlStreamFileCommand(java.lang.String file,
                                java.lang.String escapeDigits)
Creates a new ControlStreamFileCommand, streaming from the beginning. It uses the default digit "#" for forward and "*" for rewind and does not support pausing.

Parameters:
file - the name of the file to stream, must not include extension.
escapeDigits - contains the digits that allow the user to interrupt this command.

ControlStreamFileCommand

public ControlStreamFileCommand(java.lang.String file,
                                java.lang.String escapeDigits,
                                int offset)
Creates a new ControlStreamFileCommand, streaming from the given offset. It uses the default digit "#" for forward and "*" for rewind and does not support pausing.

Parameters:
file - the name of the file to stream, must not include extension.
escapeDigits - contains the digits that allow the user to interrupt this command. Maybe null if you don't want the user to interrupt.
offset - the offset samples to skip before streaming.

ControlStreamFileCommand

public ControlStreamFileCommand(java.lang.String file,
                                java.lang.String escapeDigits,
                                int offset,
                                java.lang.String forwardDigit,
                                java.lang.String rewindDigit,
                                java.lang.String pauseDigit)
Creates a new ControlStreamFileCommand, streaming from the given offset. It uses the default digit "#" for forward and "*" for rewind and does not support pausing.

Parameters:
file - the name of the file to stream, must not include extension.
escapeDigits - contains the digits that allow the user to interrupt this command. Maybe null if you don't want the user to interrupt.
offset - the offset samples to skip before streaming.
forwardDigit - the digit for fast forward.
rewindDigit - the digit for rewind.
pauseDigit - the digit for pause and unpause.
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.

getEscapeDigits

public java.lang.String getEscapeDigits()
Returns the digits that allow the user to interrupt this command.

Returns:
the digits that allow the user to interrupt this command.

setEscapeDigits

public void setEscapeDigits(java.lang.String escapeDigits)
Sets the digits that allow the user to interrupt this command.

Parameters:
escapeDigits - the digits that allow the user to interrupt this command or null for none.

getOffset

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

Returns:
the offset samples to skip before streaming.

setOffset

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

Parameters:
offset - the offset samples to skip before streaming.

getForwardDigit

public java.lang.String getForwardDigit()
Returns the digit for fast forward.

Returns:
the digit for fast forward.

getRewindDigit

public java.lang.String getRewindDigit()
Returns the digit for rewind.

Returns:
the digit for rewind.

getPauseDigit

public java.lang.String getPauseDigit()
Retruns the digit for pause and unpause.

Returns:
the digit for pause and unpause.

setControlDigits

public void setControlDigits(java.lang.String forwardDigit,
                             java.lang.String rewindDigit)
Sets the control digits for fast forward and rewind.

Parameters:
forwardDigit - the digit for fast forward.
rewindDigit - the digit for rewind.

setControlDigits

public void setControlDigits(java.lang.String forwardDigit,
                             java.lang.String rewindDigit,
                             java.lang.String pauseDigit)
Sets the control digits for fast forward, rewind and pause.

Parameters:
forwardDigit - the digit for fast forward.
rewindDigit - the digit for rewind.
pauseDigit - the digit for pause and unpause.

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.