getConferenceMembers()
{
synchronized (conferenceMembersSyncRoot)
{
return unmodifiableConferenceMembers;
}
}
/**
* Returns the currently used security settings of this CallPeer.
*
* @return the CallPeerSecurityStatusEvent that contains the
* current security settings.
*/
public CallPeerSecurityStatusEvent getCurrentSecuritySettings()
{
return lastSecurityEvent;
}
/**
* Returns the protocol provider that this peer belongs to.
*
* @return a reference to the ProtocolProviderService that this peer
* belongs to.
*/
public abstract U getProtocolProvider();
/**
* Returns an object representing the current state of that peer.
*
* @return a CallPeerState instance representing the peer's state.
*/
public CallPeerState getState()
{
return state;
}
/**
* Determines whether this call peer is currently a conference focus.
*
* @return true if this peer is a conference focus and
* false otherwise.
*/
public boolean isConferenceFocus()
{
return conferenceFocus;
}
/**
* Determines whether the audio stream (if any) being sent to this peer is
* mute.
*
* The default implementation returns false.
*
*
* @return true if an audio stream is being sent to this peer and
* it is currently mute; false, otherwise
*/
public boolean isMute()
{
return isMute;
}
/**
* Implements
* CallPeer#removeCallPeerConferenceListener(
* CallPeerConferenceListener).
*
* @param listener the CallPeerConferenceListener to remove
*/
public void removeCallPeerConferenceListener(
CallPeerConferenceListener listener)
{
if (listener != null)
synchronized (callPeerConferenceListeners)
{
callPeerConferenceListeners.remove(listener);
}
}
/**
* Unregisters the specified listener.
*
* @param listener the listener to unregister.
*/
public void removeCallPeerListener(CallPeerListener listener)
{
if (listener == null)
return;
synchronized(callPeerListeners)
{
callPeerListeners.remove(listener);
}
}
/**
* Unregisters the specified listener.
*
* @param listener the listener to unregister.
*/
public void removeCallPeerSecurityListener(
CallPeerSecurityListener listener)
{
if (listener == null)
return;
synchronized(callPeerSecurityListeners)
{
callPeerSecurityListeners.remove(listener);
}
}
/**
* Removes a specific ConferenceMember from the list of
* ConferenceMembers reported by this peer through
* {@link #getConferenceMembers()} and {@link #getConferenceMemberCount()}
* if it is contained and fires
* CallPeerConferenceEvent#CONFERENCE_MEMBER_REMOVED to
* the currently registered CallPeerConferenceListeners.
*
* @param conferenceMember a ConferenceMember to be removed from
* the list of ConferenceMember reported by this peer. If the
* specified ConferenceMember is no contained in the list, no event
* is fired.
*/
public void removeConferenceMember(ConferenceMember conferenceMember)
{
if (conferenceMember != null)
{
synchronized (conferenceMembersSyncRoot)
{
if (conferenceMembers.contains(conferenceMember))
{
List newConferenceMembers
= new ArrayList(conferenceMembers);
if (newConferenceMembers.remove(conferenceMember))
{
conferenceMembers = newConferenceMembers;
unmodifiableConferenceMembers
= Collections.unmodifiableList(conferenceMembers);
}
else
return;
}
else
return;
}
fireCallPeerConferenceEvent(
new CallPeerConferenceEvent(
this,
CallPeerConferenceEvent.CONFERENCE_MEMBER_REMOVED,
conferenceMember));
}
}
/**
* Specifies whether this peer is a conference focus.
*
* @param conferenceFocus true if this peer is to become a
* conference focus and false otherwise.
*/
public void setConferenceFocus(boolean conferenceFocus)
{
if (this.conferenceFocus != conferenceFocus)
{
this.conferenceFocus = conferenceFocus;
fireCallPeerConferenceEvent(
new CallPeerConferenceEvent(
this,
CallPeerConferenceEvent.CONFERENCE_FOCUS_CHANGED));
}
}
/**
* Sets the mute property for this call peer.
*
* @param newMuteValue the new value of the mute property for this call peer
*/
public void setMute(boolean newMuteValue)
{
this.isMute = newMuteValue;
firePropertyChange(MUTE_PROPERTY_NAME, isMute, newMuteValue);
}
/**
* Causes this CallPeer to enter the specified state. The method also sets
* the currentStateStartDate field and fires a CallPeerChangeEvent.
*
* @param newState the state this call peer should enter.
*/
public void setState(CallPeerState newState)
{
setState(newState, null);
}
/**
* Causes this CallPeer to enter the specified state. The method also sets
* the currentStateStartDate field and fires a CallPeerChangeEvent.
*
* @param newState the state this call peer should enter.
* @param reason a string that could be set to contain a human readable
* explanation for the transition (particularly handy when moving into a
* FAILED state).
*/
public void setState(CallPeerState newState, String reason)
{
setState(newState, reason, -1);
}
/**
* Causes this CallPeer to enter the specified state. The method also sets
* the currentStateStartDate field and fires a CallPeerChangeEvent.
*
* @param newState the state this call peer should enter.
* @param reason a string that could be set to contain a human readable
* explanation for the transition (particularly handy when moving into a
* FAILED state).
* @param reasonCode the code for the reason of the state change.
*/
public void setState(CallPeerState newState, String reason, int reasonCode)
{
CallPeerState oldState = getState();
if(oldState == newState)
return;
this.state = newState;
if (CallPeerState.CONNECTED.equals(newState)
&& !CallPeerState.isOnHold(oldState))
{
callDurationStartTime = System.currentTimeMillis();
}
fireCallPeerChangeEvent(
CallPeerChangeEvent.CALL_PEER_STATE_CHANGE,
oldState,
newState,
reason,
reasonCode);
}
/**
* Returns a string representation of the peer in the form of
*
* Display Name <address>;status=CallPeerStatus
*
* @return a string representation of the peer and its state.
*/
@Override
public String toString()
{
return getDisplayName() + " <" + getAddress()
+ ">;status=" + getState().getStateString();
}
}