/* * Jitsi, the OpenSource Java VoIP and Instant Messaging client. * * Distributable under LGPL license. * See terms of license at gnu.org. */ package net.java.sip.communicator.impl.protocol.mock; import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.event.*; import net.java.sip.communicator.util.*; /** * @author Damian Minkov * @author Lubomir Marinov */ public class MockCall extends AbstractCall implements CallPeerListener { /** * The Logger used by the MockCall class and its instances * for logging output. */ private static final Logger logger = Logger.getLogger(MockCall.class); /** * Constructs a new MockCall. * * @param sourceProvider Provider */ public MockCall(MockProvider sourceProvider) { super(sourceProvider); } /** * Adds callPeer to the list of peers in this call. * If the call peer is already included in the call, the method has * no effect. * * @param callPeer the new CallPeer */ public void addCallPeer(MockCallPeer callPeer) { if (!doAddCallPeer(callPeer)) return; callPeer.addCallPeerListener(this); if (logger.isInfoEnabled()) logger.info("Will fire peer added"); fireCallPeerEvent( callPeer, CallPeerEvent.CALL_PEER_ADDED); } /** * Removes callPeer from the list of peers in this * call. The method has no effect if there was no such peer in the * call. * * @param callPeer the CallPeer leaving the call; */ public void removeCallPeer(MockCallPeer callPeer) { if (!doRemoveCallPeer(callPeer)) return; callPeer.removeCallPeerListener(this); fireCallPeerEvent( callPeer, CallPeerEvent.CALL_PEER_REMOVED); if(getCallPeerCount() == 0) setCallState(CallState.CALL_ENDED); } public void peerStateChanged(CallPeerChangeEvent evt) { CallPeerState newValue = (CallPeerState) evt.getNewValue(); if ((newValue == CallPeerState.DISCONNECTED) || (newValue == CallPeerState.FAILED)) { removeCallPeer((MockCallPeer) evt.getSourceCallPeer()); } else if ((newValue == CallPeerState.CONNECTED) && getCallState().equals(CallState.CALL_INITIALIZATION)) { setCallState(CallState.CALL_IN_PROGRESS); } } public void peerDisplayNameChanged(CallPeerChangeEvent evt) { } public void peerAddressChanged(CallPeerChangeEvent evt) { } public void peerImageChanged(CallPeerChangeEvent evt) { } public void peerTransportAddressChanged(CallPeerChangeEvent evt) { } /** * Gets the indicator which determines whether the local peer represented by * this Call is acting as a conference focus and thus should send * the "isfocus" parameter in the Contact headers of its outgoing * SIP signaling. * * @return true if the local peer represented by this Call * is acting as a conference focus; otherwise, false */ @Override public boolean isConferenceFocus() { return false; } /** * Adds a specific SoundLevelListener to the list of * listeners interested in and notified about changes in local sound level * related information. * @param l the SoundLevelListener to add */ @Override public void addLocalUserSoundLevelListener(SoundLevelListener l) { } /** * Removes a specific SoundLevelListener of the list of * listeners interested in and notified about changes in local sound level * related information. * @param l the SoundLevelListener to remove */ @Override public void removeLocalUserSoundLevelListener(SoundLevelListener l) { } }