Asterisk-Java

org.asteriskjava.manager.event
Class PeerStatusEvent

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

public class PeerStatusEvent
extends ManagerEvent

A PeerStatusEvent is triggered when a SIP or IAX client attempts to registrer at this asterisk server.

This event is implemented in channels/chan_iax2.c and channels/chan_sip.c

Version:
$Id: PeerStatusEvent.java 1025 2008-04-06 08:52:04Z srt $
Author:
srt
See Also:
Serialized Form

Field Summary
static java.lang.String STATUS_LAGGED
           
static java.lang.String STATUS_REACHABLE
           
static java.lang.String STATUS_REGISTERED
           
static java.lang.String STATUS_REJECTED
           
static java.lang.String STATUS_UNREACHABLE
           
static java.lang.String STATUS_UNREGISTERED
           
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
PeerStatusEvent(java.lang.Object source)
           
 
Method Summary
 java.lang.String getAddress()
          Returns the IP address of the peer that registered.
 java.lang.String getCause()
          Returns the cause of a rejection or unregistration.
 java.lang.String getChannelType()
          Returns the type of channel that registers, that is "IAX2" for an IAX2 channel or "SIP" for a SIP channel.
 java.lang.String getPeer()
          Returns the name of the peer that registered.
 java.lang.String getPeerStatus()
          Returns the registration state.
 java.lang.Integer getPort()
          Returns the port of the peer that registered.
 java.lang.Integer getTime()
          Returns the ping time of the client if status equals "Reachable" or "Lagged"; if the status equals "Unreachable" it returns how long the last response took (in ms) for IAX peers or -1 for SIP peers.
 void setAddress(java.lang.String address)
           
 void setCause(java.lang.String cause)
          Sets the cause of the rejection or unregistration.
 void setChannelType(java.lang.String channelType)
          Sets the type of channel that registers.
 void setPeer(java.lang.String peer)
          Sets the name of the peer that registered.
 void setPeerStatus(java.lang.String peerStatus)
          Sets the registration state.
 void setPort(java.lang.Integer port)
           
 void setTime(java.lang.Integer time)
           
 
Methods inherited from class org.asteriskjava.manager.event.ManagerEvent
getDateReceived, getPrivilege, getServer, getTimestamp, setDateReceived, setPrivilege, 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

STATUS_REGISTERED

public static final java.lang.String STATUS_REGISTERED
See Also:
Constant Field Values

STATUS_UNREGISTERED

public static final java.lang.String STATUS_UNREGISTERED
See Also:
Constant Field Values

STATUS_REACHABLE

public static final java.lang.String STATUS_REACHABLE
See Also:
Constant Field Values

STATUS_LAGGED

public static final java.lang.String STATUS_LAGGED
See Also:
Constant Field Values

STATUS_UNREACHABLE

public static final java.lang.String STATUS_UNREACHABLE
See Also:
Constant Field Values

STATUS_REJECTED

public static final java.lang.String STATUS_REJECTED
See Also:
Constant Field Values
Constructor Detail

PeerStatusEvent

public PeerStatusEvent(java.lang.Object source)
Parameters:
source -
Method Detail

getChannelType

public java.lang.String getChannelType()
Returns the type of channel that registers, that is "IAX2" for an IAX2 channel or "SIP" for a SIP channel.

Available since Asterisk 1.6.

Returns:
the type of channel that registers.
Since:
1.0.0

setChannelType

public void setChannelType(java.lang.String channelType)
Sets the type of channel that registers.

Parameters:
channelType - the type of channel that registers
Since:
1.0.0

getPeer

public java.lang.String getPeer()
Returns the name of the peer that registered.

The peer name includes the channel type prefix. So if you receive a PeerStatusEvent for a SIP peer defined as "john" in sip.conf this method returns "SIP/john".

Peer names for IAX clients start with "IAX2/", peer names for SIP clients start with "SIP/".

Returns:
the peer's name including the channel type.

setPeer

public void setPeer(java.lang.String peer)
Sets the name of the peer that registered.


getPeerStatus

public java.lang.String getPeerStatus()
Returns the registration state.

This may be one of


setPeerStatus

public void setPeerStatus(java.lang.String peerStatus)
Sets the registration state.


getCause

public java.lang.String getCause()
Returns the cause of a rejection or unregistration.

For IAX peers this is set only if the status equals "Rejected".

For SIP peers this is set if the status equals "Unregistered" and the peer was unregistered due to an expiration. In that case the cause is set to "Expired".

Returns:
the cause of a rejection or unregistration.

setCause

public void setCause(java.lang.String cause)
Sets the cause of the rejection or unregistration.


getTime

public java.lang.Integer getTime()
Returns the ping time of the client if status equals "Reachable" or "Lagged"; if the status equals "Unreachable" it returns how long the last response took (in ms) for IAX peers or -1 for SIP peers.


setTime

public void setTime(java.lang.Integer time)

getAddress

public java.lang.String getAddress()
Returns the IP address of the peer that registered. Only available for SIP channels.

Available since Asterisk 1.6.

Returns:
the IP address of the peer that registered or null if not available.
Since:
1.0.0

setAddress

public void setAddress(java.lang.String address)

getPort

public java.lang.Integer getPort()
Returns the port of the peer that registered. Only available for SIP channels.

Available since Asterisk 1.6.

Returns:
the port of the peer that registered or null if not available.
Since:
1.0.0

setPort

public void setPort(java.lang.Integer port)

Asterisk-Java

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