Asterisk-Java

org.asteriskjava.manager.event
Class ManagerEvent

java.lang.Object
  extended by java.util.EventObject
      extended by org.asteriskjava.manager.event.ManagerEvent
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
AbstractAgentEvent, AbstractChannelEvent, AbstractMeetMeEvent, AbstractMonitorEvent, AbstractParkedCallEvent, AbstractQueueMemberEvent, AbstractRtcpEvent, AbstractRtpStatEvent, AgentCallbackLoginEvent, AgentCallbackLogoffEvent, AgentCalledEvent, AgentLoginEvent, AgentLogoffEvent, AgiExecEvent, AlarmClearEvent, AlarmEvent, BridgeEvent, BridgeExecEvent, CdrEvent, ChannelReloadEvent, ChannelUpdateEvent, ConnectEvent, DialEvent, DisconnectEvent, DndStateEvent, DtmfEvent, ExtensionStatusEvent, FaxReceivedEvent, HoldedCallEvent, HoldEvent, JabberEventEvent, JitterBufStatsEvent, LogChannelEvent, MasqueradeEvent, MeetMeEndEvent, MessageWaitingEvent, ModuleLoadReportEvent, MusicOnHoldEvent, NewAccountCodeEvent, NewExtenEvent, PeerStatusEvent, PriEventEvent, ProtocolIdentifierReceivedEvent, QueueEvent, QueueMemberPenaltyEvent, RegistryEvent, ReloadEvent, RenameEvent, ResponseEvent, ShutdownEvent, TransferEvent, UserEvent, VarSetEvent

public abstract class ManagerEvent
extends java.util.EventObject

Abstract base class for all Events that can be received from the Asterisk server.

Events contain data pertaining to an event generated from within the Asterisk core or an extension module.

There is one conrete subclass of ManagerEvent per each supported Asterisk Event.

Version:
$Id: ManagerEvent.java 1351 2009-07-21 21:01:45Z srt $
Author:
srt
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
ManagerEvent(java.lang.Object source)
           
 
Method Summary
protected  void appendPropertyIfNotNull(java.lang.StringBuilder sb, java.lang.String property, java.lang.Object value)
           
 java.util.Date getDateReceived()
          Returns the point in time this event was received from the Asterisk server.
 java.lang.String getFile()
          Returns the name of the file in Asterisk's source code that triggered this event.
 java.lang.String getFunc()
          Returns the name of the C function in Asterisk's source code that triggered this event.
 java.lang.Integer getLine()
          Returns the line number in Asterisk's source code where this event was triggered.
 java.lang.String getPrivilege()
          Returns the AMI authorization class of this event.
 java.lang.Integer getSequenceNumber()
          Returns the sequence numbers of this event.
 java.lang.String getServer()
          Returns the name of the Asterisk server from which this event has been received.
 java.lang.Double getTimestamp()
          Returns the timestamp for this event.
 void setDateReceived(java.util.Date dateReceived)
          Sets the point in time this event was received from the asterisk server.
 void setFile(java.lang.String file)
           
 void setFunc(java.lang.String func)
           
 void setLine(java.lang.Integer line)
           
 void setPrivilege(java.lang.String privilege)
          Sets the AMI authorization class of this event.
 void setSequenceNumber(java.lang.Integer sequenceNumber)
           
 void setServer(java.lang.String server)
          Sets the name of the Asterisk server from which this event has been received.
 void setTimestamp(java.lang.Double timestamp)
          Sets the timestamp for this event.
 java.lang.String 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
 

Constructor Detail

ManagerEvent

public ManagerEvent(java.lang.Object source)
Method Detail

getDateReceived

public java.util.Date getDateReceived()
Returns the point in time this event was received from the Asterisk server.

Pseudo events that are not directly received from the asterisk server (for example ConnectEvent and DisconnectEvent) may return null.


setDateReceived

public void setDateReceived(java.util.Date dateReceived)
Sets the point in time this event was received from the asterisk server.


getPrivilege

public java.lang.String getPrivilege()
Returns the AMI authorization class of this event.

This is one or more of system, call, log, verbose, command, agent or user. Multiple privileges are separated by comma.

Note: This property is not available from Asterisk 1.0 servers.

Since:
0.2

setPrivilege

public void setPrivilege(java.lang.String privilege)
Sets the AMI authorization class of this event.

Since:
0.2

getTimestamp

public final java.lang.Double getTimestamp()
Returns the timestamp for this event.

The timestamp property is available in Asterisk since 1.4 if enabled in manager.conf by setting timestampevents = yes.

In contains the time the event was generated in seconds since the epoch.

Example: 1159310429.569108

Returns:
the timestamp for this event.
Since:
0.3

setTimestamp

public final void setTimestamp(java.lang.Double timestamp)
Sets the timestamp for this event.

Parameters:
timestamp - the timestamp to set.
Since:
0.3

getServer

public final java.lang.String getServer()
Returns the name of the Asterisk server from which this event has been received.

This property is only available when using to AstManProxy.

Returns:
the name of the Asterisk server from which this event has been received or null when directly connected to an Asterisk server instead of AstManProxy.
Since:
1.0.0

setServer

public final void setServer(java.lang.String server)
Sets the name of the Asterisk server from which this event has been received.

Parameters:
server - the name of the Asterisk server from which this event has been received.
Since:
1.0.0

getFile

public java.lang.String getFile()
Returns the name of the file in Asterisk's source code that triggered this event. For example pbx.c.

This property is only available if debugging for the Manager API has been turned on in Asterisk. This can be done by calling manager debug on on Asterisk's command line interface or by adding debug=on to Asterisk's manager.conf. This feature is availble in Asterisk since 1.6.0.

Returns:
the name of the file in that triggered this event or null if debgging is turned off.
Since:
1.0.0
See Also:
getFunc(), getLine()

setFile

public void setFile(java.lang.String file)

getLine

public java.lang.Integer getLine()
Returns the line number in Asterisk's source code where this event was triggered.

This property is only available if debugging for the Manager API has been turned on in Asterisk. This can be done by calling manager debug on on Asterisk's command line interface or by adding debug=on to Asterisk's manager.conf. This feature is availble in Asterisk since 1.6.0.

Returns:
the line number where this event was triggered or null if debgging is turned off.
Since:
1.0.0
See Also:
getFile(), getFunc()

setLine

public void setLine(java.lang.Integer line)

getFunc

public java.lang.String getFunc()
Returns the name of the C function in Asterisk's source code that triggered this event. For example pbx_builtin_setvar_helper

This property is only available if debugging for the Manager API has been turned on in Asterisk. This can be done by calling manager debug on on Asterisk's command line interface or by adding debug=on to Asterisk's manager.conf. This feature is availble in Asterisk since 1.6.0.

Returns:
the name of the C function that triggered this event or null if debgging is turned off.
Since:
1.0.0
See Also:
getFile(), getLine()

setFunc

public void setFunc(java.lang.String func)

getSequenceNumber

public java.lang.Integer getSequenceNumber()
Returns the sequence numbers of this event. Sequence numbers are only incremented while debugging is enabled.

This property is only available if debugging for the Manager API has been turned on in Asterisk. This can be done by calling manager debug on on Asterisk's command line interface or by adding debug=on to Asterisk's manager.conf. This feature is availble in Asterisk since 1.6.0.

Returns:
the sequence number of this event or null if debgging is turned off.
Since:
1.0.0
See Also:
getFile(), getLine()

setSequenceNumber

public void setSequenceNumber(java.lang.Integer sequenceNumber)

toString

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

appendPropertyIfNotNull

protected void appendPropertyIfNotNull(java.lang.StringBuilder sb,
                                       java.lang.String property,
                                       java.lang.Object value)

Asterisk-Java

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