Asterisk-Java

org.asteriskjava.fastagi.internal
Class AgiReplyImpl

java.lang.Object
  extended by org.asteriskjava.fastagi.internal.AgiReplyImpl
All Implemented Interfaces:
java.io.Serializable, AgiReply

public class AgiReplyImpl
extends java.lang.Object
implements AgiReply

Default implementation of the AgiReply interface.

Version:
$Id: AgiReplyImpl.java 1271 2009-03-21 03:41:24Z srt $
Author:
srt
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.asteriskjava.fastagi.reply.AgiReply
SC_DEAD_CHANNEL, SC_INVALID_COMMAND_SYNTAX, SC_INVALID_OR_UNKNOWN_COMMAND, SC_SUCCESS
 
Method Summary
 java.lang.String getAttribute(java.lang.String name)
          Returns an additional attribute contained in the reply.
protected  java.util.Map<java.lang.String,java.lang.String> getAttributes()
           
 java.lang.String getExtra()
          Returns the text in parenthesis contained in this reply.
 java.lang.String getFirstLine()
          Returns the first line of the raw reply.
 java.util.List<java.lang.String> getLines()
          Returns a List containing the lines of the raw reply.
 java.lang.String getResult()
          Returns the result, that is the part directly following the "result=" string.
 int getResultCode()
          Returns the return code (the result as int).
 char getResultCodeAsChar()
          Returns the return code as character.
 int getStatus()
          Returns the status code.
 java.lang.String getSynopsis()
          Returns the synopsis of the command sent if Asterisk expected a different syntax (getStatus() == SC_INVALID_COMMAND_SYNTAX).
 java.lang.String getUsage()
          Returns the usage of the command sent if Asterisk expected a different syntax (getStatus() == SC_INVALID_COMMAND_SYNTAX).
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getFirstLine

public java.lang.String getFirstLine()
Description copied from interface: AgiReply
Returns the first line of the raw reply.

Specified by:
getFirstLine in interface AgiReply
Returns:
the first line of the raw reply.

getLines

public java.util.List<java.lang.String> getLines()
Description copied from interface: AgiReply
Returns a List containing the lines of the raw reply.

Specified by:
getLines in interface AgiReply
Returns:
a List containing the lines of the raw reply.

getResultCode

public int getResultCode()
Description copied from interface: AgiReply
Returns the return code (the result as int).

Specified by:
getResultCode in interface AgiReply
Returns:
the return code or -1 if the result is not an int.

getResultCodeAsChar

public char getResultCodeAsChar()
Description copied from interface: AgiReply
Returns the return code as character.

Specified by:
getResultCodeAsChar in interface AgiReply
Returns:
the return code as character.

getResult

public java.lang.String getResult()
Description copied from interface: AgiReply
Returns the result, that is the part directly following the "result=" string.

Specified by:
getResult in interface AgiReply
Returns:
the result.

getStatus

public int getStatus()
Description copied from interface: AgiReply
Returns the status code.

Supported status codes are:

Specified by:
getStatus in interface AgiReply
Returns:
the status code.
See Also:
AgiReply.SC_SUCCESS, AgiReply.SC_INVALID_OR_UNKNOWN_COMMAND, AgiReply.SC_DEAD_CHANNEL, AgiReply.SC_INVALID_COMMAND_SYNTAX

getAttribute

public java.lang.String getAttribute(java.lang.String name)
Description copied from interface: AgiReply
Returns an additional attribute contained in the reply.

For example the reply to the StreamFileCommand contains an additional endpos attribute indicating the frame where the playback was stopped. This can be retrieved by calling getAttribute("endpos") on the corresponding reply.

Specified by:
getAttribute in interface AgiReply
Parameters:
name - the name of the attribute to retrieve. The name is case insensitive.
Returns:
the value of the attribute or null if it is not set.

getAttributes

protected java.util.Map<java.lang.String,java.lang.String> getAttributes()

getExtra

public java.lang.String getExtra()
Description copied from interface: AgiReply
Returns the text in parenthesis contained in this reply.

The meaning of this property depends on the command sent. Sometimes it contains a flag like "timeout" or "hangup" or - in case of the GetVariableCommand - the value of the variable.

Specified by:
getExtra in interface AgiReply
Returns:
the text in the parenthesis or null if not set.

getSynopsis

public java.lang.String getSynopsis()
Description copied from interface: AgiReply
Returns the synopsis of the command sent if Asterisk expected a different syntax (getStatus() == SC_INVALID_COMMAND_SYNTAX).

Specified by:
getSynopsis in interface AgiReply
Returns:
the synopsis of the command sent, null if there were no syntax errors.

getUsage

public java.lang.String getUsage()
Returns the usage of the command sent if Asterisk expected a different syntax (getStatus() == SC_INVALID_COMMAND_SYNTAX).

Specified by:
getUsage in interface AgiReply
Returns:
the usage of the command sent, null if there were no syntax errors.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Asterisk-Java

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