namespace AsterNET.Manager.Event
{
///
/// 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
///
public class PeerStatusEvent : ManagerEvent
{
private string channelType;
private string peer;
private string peerStatus;
private string cause;
private int time;
public PeerStatusEvent(ManagerConnection source)
: base(source)
{
}
///
/// Channel type
/// "SIP",
/// "IAX2
///
public string ChannelType
{
get { return channelType; }
set { this.channelType = value; }
}
///
/// Returns the name of the peer that registered. The peer's name starts with "IAX2/" if it is an
/// IAX client or "SIP/" if it is a SIP client. It is followed by the username that is used for
/// registration.
///
/// Sets the name of the peer that registered.
public string Peer
{
get { return peer; }
set { this.peer = value; }
}
/// Returns the registration state.
/// This may be one of
///
/// - Registered
/// - Unregistered
/// - Reachable
/// - Lagged
/// - Unreachable
/// - Rejected (IAX only)
///
///
/// Sets the registration state.
public string PeerStatus
{
get { return peerStatus; }
set { this.peerStatus = value; }
}
///
/// 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".
///
/// Sets the cause of the rejection or unregistration.
public string Cause
{
get { return cause; }
set { this.cause = value; }
}
///
/// 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.
///
public int Time
{
get { return time; }
set { this.time = value; }
}
}
}