Asterisk-Java

org.asteriskjava.manager.event
Class AgiExecEvent

java.lang.Object
  extended by java.util.EventObject
      extended by org.asteriskjava.manager.event.ManagerEvent
          extended by org.asteriskjava.manager.event.AgiExecEvent
All Implemented Interfaces:
java.io.Serializable

public class AgiExecEvent
extends ManagerEvent

AgiExecEvents are triggered when an AGI command is executed. For each command two events are triggered: one before excution ("Start") and one after execution ("End").

The following sub events are reported:

It is implemented in res/res_agi.c.

Available since Asterisk 1.6

Since:
1.0.0
Version:
$Id: AgiExecEvent.java 959 2008-02-02 23:56:59Z srt $
Author:
srt
See Also:
Serialized Form

Field Summary
static java.lang.String SUB_EVENT_END
          Execution of an AGI command has finished.
static java.lang.String SUB_EVENT_START
          Execution of an AGI command has started.
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
AgiExecEvent(java.lang.Object source)
          Creates a new AgiExecEvent.
 
Method Summary
 java.lang.String getChannel()
          Returns the name of the channel this event occurred on.
 java.lang.String getCommand()
          Returns the AGI command.
 java.lang.String getCommandId()
          Returns the command id.
 java.lang.String getResult()
          Returns the result as a string.
 java.lang.Integer getResultCode()
          Returns the result code.
 java.lang.String getSubEvent()
          Returns the sub event type.
 boolean isEnd()
          Checks is this an end sub event.
 boolean isStart()
          Checks is this a start sub event.
 void setChannel(java.lang.String channel)
          Sets the name of the channel this event occurred on.
 void setCommand(java.lang.String command)
          Sets the AGI command.
 void setCommandId(java.lang.String commandId)
          Sets the command id.
 void setResult(java.lang.String result)
          Sets the string respresentation of the result.
 void setResultCode(java.lang.Integer resultCode)
          Sets the result code.
 void setSubEvent(java.lang.String subEvent)
          Sets the sub event type.
 
Methods inherited from class org.asteriskjava.manager.event.ManagerEvent
appendPropertyIfNotNull, getDateReceived, getFile, getFunc, getLine, getPrivilege, getSequenceNumber, getServer, getTimestamp, setDateReceived, setFile, setFunc, setLine, setPrivilege, setSequenceNumber, setServer, setTimestamp, toString
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SUB_EVENT_START

public static final java.lang.String SUB_EVENT_START
Execution of an AGI command has started.

See Also:
Constant Field Values

SUB_EVENT_END

public static final java.lang.String SUB_EVENT_END
Execution of an AGI command has finished.

See Also:
Constant Field Values
Constructor Detail

AgiExecEvent

public AgiExecEvent(java.lang.Object source)
Creates a new AgiExecEvent.

Parameters:
source -
Method Detail

getChannel

public java.lang.String getChannel()
Returns the name of the channel this event occurred on.

Returns:
the name of the channel this event occurred on.

setChannel

public void setChannel(java.lang.String channel)
Sets the name of the channel this event occurred on.

Parameters:
channel - the name of the channel this event occurred on.

getSubEvent

public java.lang.String getSubEvent()
Returns the sub event type. This is either "Start" or "End".

Returns:
the sub event type.
See Also:
SUB_EVENT_START, SUB_EVENT_END

setSubEvent

public void setSubEvent(java.lang.String subEvent)
Sets the sub event type.

Parameters:
subEvent - the sub event type.

getCommandId

public java.lang.String getCommandId()
Returns the command id. The command is a random number generated by Asterisk that allows matching the "End" sub event with the corresponding "Start" sub event.

Returns:
the command id.

setCommandId

public void setCommandId(java.lang.String commandId)
Sets the command id.

Parameters:
commandId - the command id.

getCommand

public java.lang.String getCommand()
Returns the AGI command.

Returns:
the AGI command.

setCommand

public void setCommand(java.lang.String command)
Sets the AGI command.

Parameters:
command - the AGI command.

getResultCode

public java.lang.Integer getResultCode()
Returns the result code.

Returns:
the result code.

setResultCode

public void setResultCode(java.lang.Integer resultCode)
Sets the result code.

Parameters:
resultCode - the result code.

getResult

public java.lang.String getResult()
Returns the result as a string.

They correspond to the numeric values returned by getResultCode(). Usually you will want to stick with the numeric values.

Possible values are:

Returns:
a string respresentation of the result.

setResult

public void setResult(java.lang.String result)
Sets the string respresentation of the result.

Parameters:
result - a string respresentation of the result.

isStart

public boolean isStart()
Checks is this a start sub event.

Returns:
true if this is a "Start" sub event, false otherwise.

isEnd

public boolean isEnd()
Checks is this an end sub event.

Returns:
true if this is an "End" sub event, false otherwise.

Asterisk-Java

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