Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.protocol.mock
Class MockOperationSetBasicTelephony

java.lang.Object
  extended by net.java.sip.communicator.service.protocol.media.AbstractOperationSetBasicTelephony<MockProvider>
      extended by net.java.sip.communicator.impl.protocol.mock.MockOperationSetBasicTelephony
All Implemented Interfaces:
EventListener, CallChangeListener, OperationSet, OperationSetBasicTelephony<MockProvider>

public class MockOperationSetBasicTelephony
extends AbstractOperationSetBasicTelephony<MockProvider>
implements CallChangeListener

A mock implementation of a basic telephony operation set

Author:
Damian Minkov

Field Summary
 
Fields inherited from interface net.java.sip.communicator.service.protocol.OperationSetBasicTelephony
HANGUP_REASON_ENCRYPTION_REQUIRED, HANGUP_REASON_NORMAL_CLEARING, HANGUP_REASON_TIMEOUT, MAX_MEDIA_PORT_NUMBER_PROPERTY_NAME, MIN_MEDIA_PORT_NUMBER_PROPERTY_NAME
 
Constructor Summary
MockOperationSetBasicTelephony(MockProvider protocolProvider)
           
 
Method Summary
 CallPeer addNewCallPeer(Call call, String address)
           
 void answerCallPeer(CallPeer peer)
          Indicates a user request to answer an incoming call from the specified CallPeer.
 void callPeerAdded(CallPeerEvent evt)
          Indicates that a new call peer has joined the source call.
 void callPeerRemoved(CallPeerEvent evt)
          Indicates that a call peer has left the source call.
 void callStateChanged(CallChangeEvent evt)
          Indicates that a change has occurred in the state of the source call.
 Call createCall(Contact callee)
          Creates a new Call and invites a specific CallPeer to it given by her Contact.
 Call createCall(Contact callee, CallGroup group)
          Creates a new Call and invites a specific CallPeer to it given by her Contact.
 Call createCall(String uri)
          Creates a new Call and invites a specific CallPeer to it given by her String URI.
 Call createCall(String callee, CallGroup group)
          Creates a new Call and invites a specific CallPeer to it given by her String URI.
 Iterator<Call> getActiveCalls()
          Returns an iterator over all currently active calls.
 MockProvider getProtocolProvider()
          Returns the protocol provider that this operation set belongs to.
 void hangupCallPeer(CallPeer peer)
          Indicates a user request to end a call with the specified call particiapnt.
 void hangupCallPeer(CallPeer peer, int reasonCode, String reason)
          Ends the call with the specified peer.
 Call placeCall(String toAddress)
           
 void putOffHold(CallPeer peer)
          Resumes communication with a call peer previously put on hold.
 void putOnHold(CallPeer peer)
          Puts the specified CallPeer "on hold".
 Call receiveCall(String fromAddress)
           
 
Methods inherited from class net.java.sip.communicator.service.protocol.media.AbstractOperationSetBasicTelephony
addCallListener, createRecorder, fireCallEvent, fireCallEvent, removeCallListener, setMute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockOperationSetBasicTelephony

public MockOperationSetBasicTelephony(MockProvider protocolProvider)
Method Detail

answerCallPeer

public void answerCallPeer(CallPeer peer)
                    throws OperationFailedException
Indicates a user request to answer an incoming call from the specified CallPeer.

Specified by:
answerCallPeer in interface OperationSetBasicTelephony<MockProvider>
Parameters:
peer - the call peer that we'd like to answer.
Throws:
OperationFailedException - with the corresponding code if we encounter an error while performing this operation.

createCall

public Call createCall(String uri)
                throws OperationFailedException,
                       ParseException
Creates a new Call and invites a specific CallPeer to it given by her String URI.

Specified by:
createCall in interface OperationSetBasicTelephony<MockProvider>
Parameters:
uri - the address of the callee who we should invite to a new Call
Returns:
a newly created Call. The specified callee is available in the Call as a CallPeer
Throws:
OperationFailedException - with the corresponding code if we fail to create the call
ParseException - if callee is not a valid SIP address String
See Also:
OperationSetBasicTelephony.createCall(String)

createCall

public Call createCall(Contact callee)
                throws OperationFailedException
Creates a new Call and invites a specific CallPeer to it given by her Contact.

Specified by:
createCall in interface OperationSetBasicTelephony<MockProvider>
Parameters:
callee - the address of the callee who we should invite to a new call
Returns:
a newly created Call. The specified callee is available in the Call as a CallPeer
Throws:
OperationFailedException - with the corresponding code if we fail to create the call
See Also:
OperationSetBasicTelephony.createCall(Contact)

createCall

public Call createCall(String callee,
                       CallGroup group)
                throws OperationFailedException,
                       ParseException
Creates a new Call and invites a specific CallPeer to it given by her String URI.

Specified by:
createCall in interface OperationSetBasicTelephony<MockProvider>
Parameters:
callee - the address of the callee who we should invite to a new Call
group - CallGroup from which the Call will belong
Returns:
a newly created Call. The specified callee is available in the Call as a CallPeer
Throws:
OperationFailedException - with the corresponding code if we fail to create the call
ParseException - if callee is not a valid SIP address String

createCall

public Call createCall(Contact callee,
                       CallGroup group)
                throws OperationFailedException
Creates a new Call and invites a specific CallPeer to it given by her Contact.

Specified by:
createCall in interface OperationSetBasicTelephony<MockProvider>
Parameters:
callee - the address of the callee who we should invite to a new call
group - CallGroup from which the Call will belong
Returns:
a newly created Call. The specified callee is available in the Call as a CallPeer
Throws:
OperationFailedException - with the corresponding code if we fail to create the call

getActiveCalls

public Iterator<Call> getActiveCalls()
Returns an iterator over all currently active calls.

Specified by:
getActiveCalls in interface OperationSetBasicTelephony<MockProvider>
Returns:
Iterator

hangupCallPeer

public void hangupCallPeer(CallPeer peer)
                    throws OperationFailedException
Indicates a user request to end a call with the specified call particiapnt.

Specified by:
hangupCallPeer in interface OperationSetBasicTelephony<MockProvider>
Parameters:
peer - the peer that we'd like to hang up on.
Throws:
OperationFailedException - with the corresponding code if we encounter an error while performing this operation.

hangupCallPeer

public void hangupCallPeer(CallPeer peer,
                           int reasonCode,
                           String reason)
                    throws OperationFailedException
Ends the call with the specified peer.

Specified by:
hangupCallPeer in interface OperationSetBasicTelephony<MockProvider>
Parameters:
peer - the peer that we'd like to hang up on.
reasonCode - indicates if the hangup is following to a call failure or simply a disconnect indicate by the reason.
reason - the reason of the hangup. If the hangup is due to a call failure, then this string could indicate the reason of the failure
Throws:
OperationFailedException - if we fail to terminate the call.

putOffHold

public void putOffHold(CallPeer peer)
Resumes communication with a call peer previously put on hold.

Specified by:
putOffHold in interface OperationSetBasicTelephony<MockProvider>
Parameters:
peer - the call peer to put on hold.
To do:
Implement this net.java.sip.communicator.service.protocol.OperationSetBasicTelephony method

putOnHold

public void putOnHold(CallPeer peer)
               throws OperationFailedException
Puts the specified CallPeer "on hold".

Specified by:
putOnHold in interface OperationSetBasicTelephony<MockProvider>
Parameters:
peer - the peer that we'd like to put on hold.
Throws:
OperationFailedException - with the corresponding code if we encounter an error while performing this operation.
To do:
Implement this net.java.sip.communicator.service.protocol.OperationSetBasicTelephony method

receiveCall

public Call receiveCall(String fromAddress)
                 throws Exception
Throws:
Exception

placeCall

public Call placeCall(String toAddress)
               throws Exception
Throws:
Exception

addNewCallPeer

public CallPeer addNewCallPeer(Call call,
                               String address)

callPeerAdded

public void callPeerAdded(CallPeerEvent evt)
Description copied from interface: CallChangeListener
Indicates that a new call peer has joined the source call.

Specified by:
callPeerAdded in interface CallChangeListener
Parameters:
evt - the CallPeerEvent containing the source call and call peer.

callPeerRemoved

public void callPeerRemoved(CallPeerEvent evt)
Description copied from interface: CallChangeListener
Indicates that a call peer has left the source call.

Specified by:
callPeerRemoved in interface CallChangeListener
Parameters:
evt - the CallPeerEvent containing the source call and call peer.

callStateChanged

public void callStateChanged(CallChangeEvent evt)
Description copied from interface: CallChangeListener
Indicates that a change has occurred in the state of the source call.

Specified by:
callStateChanged in interface CallChangeListener
Parameters:
evt - the CallChangeEvent instance containing the source calls and its old and new state.

getProtocolProvider

public MockProvider getProtocolProvider()
Returns the protocol provider that this operation set belongs to.

Specified by:
getProtocolProvider in interface OperationSetBasicTelephony<MockProvider>
Returns:
a reference to the ProtocolProviderService that created this operation set.

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.