Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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

java.lang.Object
  extended by net.java.sip.communicator.service.protocol.Call
      extended by net.java.sip.communicator.service.protocol.AbstractCall<T,V>
          extended by net.java.sip.communicator.service.protocol.media.MediaAwareCall<CallPeerSipImpl,OperationSetBasicTelephonySipImpl,ProtocolProviderServiceSipImpl>
              extended by net.java.sip.communicator.impl.protocol.sip.CallSipImpl
All Implemented Interfaces:
PropertyChangeListener, EventListener, CallChangeListener, CallGroupListener, CallPeerListener

public class CallSipImpl
extends MediaAwareCall<CallPeerSipImpl,OperationSetBasicTelephonySipImpl,ProtocolProviderServiceSipImpl>
implements CallPeerListener

A SIP implementation of the Call abstract class encapsulating SIP dialogs.

Author:
Emil Ivov

Field Summary
 
Fields inherited from class net.java.sip.communicator.service.protocol.media.MediaAwareCall
DEFAULT_DEVICE, localVideoAllowed, mediaUseCase, parentOpSet
 
Fields inherited from class net.java.sip.communicator.service.protocol.AbstractCall
callGroup
 
Constructor Summary
protected CallSipImpl(OperationSetBasicTelephonySipImpl parentOpSet)
          Crates a CallSipImpl instance belonging to sourceProvider and initiated by CallCreator.
 
Method Summary
 void callAdded(CallGroupEvent evt)
          Notified when a call are added to a CallGroup.
 boolean contains(javax.sip.Dialog dialog)
          Returns true if dialog matches the jain sip dialog established with one of the peers in this call.
 CallPeerSipImpl findCallPeer(javax.sip.Dialog dialog)
          Returns the call peer whose associated jain sip dialog matches dialog.
 ProtocolProviderServiceSipImpl getProtocolProvider()
          Returns a reference to the ProtocolProviderServiceSipImpl instance that created this call.
 CallPeerSipImpl invite(javax.sip.address.Address calleeAddress, javax.sip.message.Message cause)
          Creates a CallPeerSipImpl from calleeAddress and sends them an invite request.
 CallPeerSipImpl processInvite(javax.sip.SipProvider jainSipProvider, javax.sip.ServerTransaction serverTran)
          Creates a new call and sends a RINGING response.
 void processReplacingInvite(javax.sip.SipProvider jainSipProvider, javax.sip.ServerTransaction serverTransaction, CallPeerSipImpl callPeerToReplace)
          Processes an incoming INVITE that is meant to replace an existing CallPeerSipImpl that is participating in this call.
 void reInvite()
          Send a RE-INVITE request for all current CallPeer to reflect possible change in media setup (video start/stop, ...).
 void setInitialQualityPreferences(QualityPreset qualityPreferences)
          Set a quality preferences we may use when we start the call.
 
Methods inherited from class net.java.sip.communicator.service.protocol.media.MediaAwareCall
addCallPeer, addLocalUserSoundLevelListener, addPropertyChangeListener, addVideoPropertyChangeListener, callPeerAdded, callPeerRemoved, callRemoved, callStateChanged, createRecorder, getDefaultDevice, getMediaUseCase, getParentOperationSet, getRTPTranslator, isConferenceFocus, isLocalVideoAllowed, isLocalVideoStreaming, isMute, peerAddressChanged, peerDisplayNameChanged, peerImageChanged, peerStateChanged, peerTransportAddressChanged, propertyChange, removeLocalUserSoundLevelListener, removePropertyChangeListener, removeVideoPropertyChangeListener, setAudioDevice, setCallState, setConferenceFocus, setLocalVideoAllowed, setMute, setVideoDevice
 
Methods inherited from class net.java.sip.communicator.service.protocol.AbstractCall
getCallGroup, getCallPeerCount, getCallPeers, getCallPeersVector, getCrossProtocolCallPeerCount, getCrossProtocolCallPeers, getCrossProtocolCallPeersVector, setCallGroup
 
Methods inherited from class net.java.sip.communicator.service.protocol.Call
addCallChangeListener, equals, fireCallChangeEvent, fireCallChangeEvent, fireCallPeerEvent, getCallID, getCallState, hashCode, isDefaultEncrypted, isSipZrtpAttribute, removeCallChangeListener, setCallState, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.java.sip.communicator.service.protocol.event.CallPeerListener
peerAddressChanged, peerDisplayNameChanged, peerImageChanged, peerStateChanged, peerTransportAddressChanged
 

Constructor Detail

CallSipImpl

protected CallSipImpl(OperationSetBasicTelephonySipImpl parentOpSet)
Crates a CallSipImpl instance belonging to sourceProvider and initiated by CallCreator.

Parameters:
parentOpSet - a reference to the operation set that's creating us and that we would be able to use for even dispatching.
Method Detail

contains

public boolean contains(javax.sip.Dialog dialog)
Returns true if dialog matches the jain sip dialog established with one of the peers in this call.

Parameters:
dialog - the dialog whose corresponding peer we're looking for.
Returns:
true if this call contains a call peer whose jain sip dialog is the same as the specified and false otherwise.

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.

getProtocolProvider

public ProtocolProviderServiceSipImpl getProtocolProvider()
Returns a reference to the ProtocolProviderServiceSipImpl instance that created this call.

Overrides:
getProtocolProvider in class AbstractCall<CallPeerSipImpl,ProtocolProviderServiceSipImpl>
Returns:
a reference to the ProtocolProviderServiceSipImpl instance that created this call.

invite

public CallPeerSipImpl invite(javax.sip.address.Address calleeAddress,
                              javax.sip.message.Message cause)
                       throws OperationFailedException
Creates a CallPeerSipImpl from calleeAddress and sends them an invite request. The invite request will be initialized according to any relevant parameters in the cause message (if different from null) that is the reason for creating this call.

Parameters:
calleeAddress - the party that we would like to invite to this call.
cause - the message (e.g. a Refer request), that is the reason for this invite or null if this is a user-initiated invitation
Returns:
the newly created CallPeer corresponding to calleeAddress. All following state change events will be delivered through this call peer.
Throws:
OperationFailedException - with the corresponding code if we fail to create the call.

reInvite

public void reInvite()
              throws OperationFailedException
Send a RE-INVITE request for all current CallPeer to reflect possible change in media setup (video start/stop, ...).

Throws:
OperationFailedException - if problem occurred during SDP generation or network problem

processReplacingInvite

public void processReplacingInvite(javax.sip.SipProvider jainSipProvider,
                                   javax.sip.ServerTransaction serverTransaction,
                                   CallPeerSipImpl callPeerToReplace)
Processes an incoming INVITE that is meant to replace an existing CallPeerSipImpl that is participating in this call. Typically this would happen as a result of an attended transfer.

Parameters:
jainSipProvider - the JAIN-SIP SipProvider that received the request.
serverTransaction - the transaction containing the INVITE request.
callPeerToReplace - a reference to the CallPeer that this INVITE is trying to replace.

processInvite

public CallPeerSipImpl processInvite(javax.sip.SipProvider jainSipProvider,
                                     javax.sip.ServerTransaction serverTran)
Creates a new call and sends a RINGING response.

Parameters:
jainSipProvider - the provider containing sourceTransaction.
serverTran - the transaction containing the received request.
Returns:
CallPeerSipImpl the newly created call peer (the one that sent the INVITE).

setInitialQualityPreferences

public void setInitialQualityPreferences(QualityPreset qualityPreferences)
Set a quality preferences we may use when we start the call.

Parameters:
qualityPreferences - the initial quality preferences.

callAdded

public void callAdded(CallGroupEvent evt)
Notified when a call are added to a CallGroup.

Specified by:
callAdded in interface CallGroupListener
Overrides:
callAdded in class MediaAwareCall<CallPeerSipImpl,OperationSetBasicTelephonySipImpl,ProtocolProviderServiceSipImpl>
Parameters:
evt - event
See Also:
CallGroupListener.callAdded(CallGroupEvent)

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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