Asterisk-Java

org.asteriskjava.fastagi.command
Class StreamFileCommand

java.lang.Object
  extended by org.asteriskjava.fastagi.command.AbstractAgiCommand
      extended by org.asteriskjava.fastagi.command.StreamFileCommand
All Implemented Interfaces:
java.io.Serializable, AgiCommand

public class StreamFileCommand
extends AbstractAgiCommand

Plays the given file, allowing playback to be interrupted by the given digits, if any.

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, filename follows the same conventions and uses the same file path as dialplan applications like Playback or Background. The file extension must not be included in the filename.

Version:
$Id: StreamFileCommand.java 1064 2008-06-03 17:27:52Z msmith $
Author:
srt
See Also:
Serialized Form

Constructor Summary
StreamFileCommand(java.lang.String file)
          Creates a new StreamFileCommand, streaming from the beginning.
StreamFileCommand(java.lang.String file, java.lang.String escapeDigits)
          Creates a new StreamFileCommand, streaming from the beginning.
StreamFileCommand(java.lang.String file, java.lang.String escapeDigits, int offset)
          Creates a new StreamFileCommand, 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.
 int getOffset()
          Returns the offset samples to skip before streaming.
 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 org.asteriskjava.fastagi.command.AbstractAgiCommand
escapeAndQuote, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StreamFileCommand

public StreamFileCommand(java.lang.String file)
Creates a new StreamFileCommand, streaming from the beginning.

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

StreamFileCommand

public StreamFileCommand(java.lang.String file,
                         java.lang.String escapeDigits)
Creates a new StreamFileCommand, streaming from the beginning.

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.

StreamFileCommand

public StreamFileCommand(java.lang.String file,
                         java.lang.String escapeDigits,
                         int offset)
Creates a new StreamFileCommand, streaming from the given offset.

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.
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.

buildCommand

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

Specified by:
buildCommand in interface AgiCommand
Specified by:
buildCommand in class AbstractAgiCommand
Returns:
a string suitable to be sent to asterisk.

Asterisk-Java

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