SIP Communicator: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.protocol.sip
Class ActiveCallsRepository

java.lang.Object
  extended by net.java.sip.communicator.service.protocol.event.CallChangeAdapter
      extended by net.java.sip.communicator.impl.protocol.sip.ActiveCallsRepository
All Implemented Interfaces:
EventListener, CallChangeListener

public class ActiveCallsRepository
extends CallChangeAdapter

Keeps a list of all calls currently active and maintained by this protocol povider. Offers methods for finding a call by its ID, peer dialog and others.

Author:
Emil Ivov

Constructor Summary
ActiveCallsRepository(OperationSetBasicTelephonySipImpl opSet)
          Creates a new instance of this repository.
 
Method Summary
 void addCall(CallSipImpl call)
          Adds the specified call to the list of calls tracked by this repository.
 void callStateChanged(CallChangeEvent evt)
          If evt indicates that the call has been ended we remove it from the repository.
 CallSipImpl findCall(javax.sip.Dialog dialog)
          Returns the call that contains the specified dialog (i.e.
 CallSipImpl findCall(String callID, String localTag, String remoteTag)
          Returns the CallSipImpl instance with a Dialog matching the specified Call-ID, local and remote tags.
 CallPeerSipImpl findCallPeer(javax.sip.Dialog dialog)
          Returns the call peer whose associated jain sip dialog matches dialog.
 CallPeerSipImpl findCallPeer(String branchID, javax.sip.header.Header cidHeader)
          Returns the CallPeerSipImpl whose INVITE transaction has the specified branchID and whose corresponding INVITE request contains the specified callID.
 CallPeerSipImpl findCallPeer(String branchID, String callID)
          Returns the CallPeerSipImpl whose INVITE transaction has the specified branchID and whose corresponding INVITE request contains the specified callID.
 CallPeerSipImpl findCallPeer(String callID, String localTag, String remoteTag)
          Returns the CallPeerSipImpl instance with a Dialog matching CallID, local and remote tags.
 Iterator<CallSipImpl> getActiveCalls()
          Returns an iterator over all currently active (non-ended) calls.
 
Methods inherited from class net.java.sip.communicator.service.protocol.event.CallChangeAdapter
callPeerAdded, callPeerRemoved
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActiveCallsRepository

public ActiveCallsRepository(OperationSetBasicTelephonySipImpl opSet)
Creates a new instance of this repository.

Parameters:
opSet - a reference to the OperationSetBasicTelephonySipImpl that craeted us.
Method Detail

addCall

public void addCall(CallSipImpl call)
Adds the specified call to the list of calls tracked by this repository.

Parameters:
call - CallSipImpl

callStateChanged

public void callStateChanged(CallChangeEvent evt)
If evt indicates that the call has been ended we remove it from the repository.

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

getActiveCalls

public Iterator<CallSipImpl> getActiveCalls()
Returns an iterator over all currently active (non-ended) calls.

Returns:
an iterator over all currently active (non-ended) calls.

findCall

public CallSipImpl findCall(javax.sip.Dialog dialog)
Returns the call that contains the specified dialog (i.e. it is established between us and one of the other call peers).

Parameters:
dialog - the jain sip Dialog whose containing call we're looking for.
Returns:
the CallSipImpl containing dialog or null if no call contains the specified dialog.

findCallPeer

public CallPeerSipImpl findCallPeer(javax.sip.Dialog dialog)
Returns the call peer whose associated jain sip dialog matches dialog.

Parameters:
dialog - the jain sip dialog whose corresponding peer we're looking for.
Returns:
the call peer whose jain sip dialog is the same as the specified or null if no such call peer was found.

findCallPeer

public CallPeerSipImpl findCallPeer(String callID,
                                    String localTag,
                                    String remoteTag)
Returns the CallPeerSipImpl instance with a Dialog matching CallID, local and remote tags.

Parameters:
callID - the Call-ID of the dialog we are looking for.
localTag - the local tag of the dialog we are looking for.
remoteTag - the remote tag of the dialog we are looking for.
Returns:
the CallPeerSipImpl matching specified dialog ID or null if no such peer is known to this repository.

findCallPeer

public CallPeerSipImpl findCallPeer(String branchID,
                                    String callID)
Returns the CallPeerSipImpl whose INVITE transaction has the specified branchID and whose corresponding INVITE request contains the specified callID.

Parameters:
callID - the Call-ID of the dialog we are looking for.
branchID - a String corresponding to the branch id of the latest INVITE transaction that was associated with the peer we are looking for.
Returns:
the CallPeerSipImpl matching specified call and branch id-s or null if no such peer is known to this repository.

findCallPeer

public CallPeerSipImpl findCallPeer(String branchID,
                                    javax.sip.header.Header cidHeader)
Returns the CallPeerSipImpl whose INVITE transaction has the specified branchID and whose corresponding INVITE request contains the specified callID.

Parameters:
cidHeader - the Call-ID of the dialog we are looking for.
branchID - a String corresponding to the branch id of the latest INVITE transaction that was associated with the peer we are looking for.
Returns:
the CallPeerSipImpl matching specified call and branch id-s or null if no such peer is known to this repository.

findCall

public CallSipImpl findCall(String callID,
                            String localTag,
                            String remoteTag)
Returns the CallSipImpl instance with a Dialog matching the specified Call-ID, local and remote tags.

Parameters:
callID - the Call-ID of the dialog we are looking for.
localTag - the local tag of the dialog we are looking for.
remoteTag - the remote tag of the dialog we are looking for.
Returns:
the CallSipImpl responsible for handling the Dialog with the matching ID or null if no such call was found.

SIP Communicator: the OpenSource Java VoIP and Instant Messaging client.

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