Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.protocol.jabber
Class CallJabberImpl

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<CallPeerJabberImpl,OperationSetBasicTelephonyJabberImpl,ProtocolProviderServiceJabberImpl>
              extended by net.java.sip.communicator.impl.protocol.jabber.CallJabberImpl
All Implemented Interfaces:
PropertyChangeListener, EventListener, CallChangeListener, CallGroupListener, CallPeerListener

public class CallJabberImpl
extends MediaAwareCall<CallPeerJabberImpl,OperationSetBasicTelephonyJabberImpl,ProtocolProviderServiceJabberImpl>

A Jabber implementation of the Call abstract class encapsulating Jabber jingle sessions.

Author:
Emil Ivov, Lyubomir Marinov

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 CallJabberImpl(OperationSetBasicTelephonyJabberImpl parentOpSet)
          Initializes a new CallJabberImpl instance belonging to sourceProvider and associated with the jingle session with the specified jingleSID.
 
Method Summary
 void callAdded(CallGroupEvent evt)
          Notifies this instance that a specific Call has been added to a CallGroup.
 void closeCobriStreamConnector(CallPeerJabberImpl peer, MediaType mediaType, CobriStreamConnector cobriStreamConnector)
          Closes a specific CobriStreamConnector which is associated with a MediaStream of a specific MediaType upon request from a specific CallPeer.
 boolean containsJingleSID(String sid)
          Determines if this call contains a peer whose corresponding session has the specified sid.
 CobriConferenceIQ createCobriChannels(CallPeerJabberImpl peer, Iterable<RtpDescriptionPacketExtension> rdpes)
          Allocates cobri (conference) channels for a specific MediaType to be used by a specific CallPeer.
 CobriStreamConnector createCobriStreamConnector(CallPeerJabberImpl peer, MediaType mediaType, CobriConferenceIQ.Channel channel, StreamConnectorFactory factory)
          Initializes a CobriStreamConnector on behalf of a specific CallPeer to be used in association with a specific CobriConferenceIQ.Channel of a specific MediaType.
 void expireCobriChannels(CallPeerJabberImpl peer, CobriConferenceIQ conference)
          Expires specific (cobri) conference channels used by a specific CallPeer.
 boolean getLocalInputEvtAware()
          Returns if the call support inputevt (remote control).
 CallPeerJabberImpl getPeer(String sid)
          Returns the peer whose corresponding session has the specified sid.
 CallPeerJabberImpl getPeerBySessInitPacketID(String id)
          Returns the peer whose corresponding session-init ID has the specified id.
 CallPeerJabberImpl initiateSession(String calleeJID, org.jivesoftware.smackx.packet.DiscoverInfo discoverInfo, Iterable<org.jivesoftware.smack.packet.PacketExtension> sessionInitiateExtensions)
          Creates a CallPeerJabberImpl from calleeJID and sends them session-initiate IQ request.
 void modifyVideoContent(boolean allowed)
          Send a content-modify message for all current CallPeer to reflect possible video change in media setup.
 CallPeerJabberImpl processSessionInitiate(JingleIQ jingleIQ)
          Creates a new call peer and sends a RINGING response.
 void setLocalInputEvtAware(boolean enable)
          Enable or disable inputevt support (remote control).
 
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, getProtocolProvider, 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
 

Constructor Detail

CallJabberImpl

protected CallJabberImpl(OperationSetBasicTelephonyJabberImpl parentOpSet)
Initializes a new CallJabberImpl instance belonging to sourceProvider and associated with the jingle session with the specified jingleSID. If the new instance corresponds to an incoming jingle session, then the jingleSID would come from there. Otherwise, one could generate one using JingleIQ.generateSID().

Parameters:
parentOpSet - the OperationSetBasicTelephonyJabberImpl instance in the context of which this call has been created.
Method Detail

setLocalInputEvtAware

public void setLocalInputEvtAware(boolean enable)
Enable or disable inputevt support (remote control).

Parameters:
enable - new state of inputevt support

getLocalInputEvtAware

public boolean getLocalInputEvtAware()
Returns if the call support inputevt (remote control).

Returns:
true if the call support inputevt, false otherwise

processSessionInitiate

public CallPeerJabberImpl processSessionInitiate(JingleIQ jingleIQ)
Creates a new call peer and sends a RINGING response.

Parameters:
jingleIQ - the JingleIQ that created the session.
Returns:
the newly created CallPeerJabberImpl (the one that sent the INVITE).

initiateSession

public CallPeerJabberImpl initiateSession(String calleeJID,
                                          org.jivesoftware.smackx.packet.DiscoverInfo discoverInfo,
                                          Iterable<org.jivesoftware.smack.packet.PacketExtension> sessionInitiateExtensions)
                                   throws OperationFailedException
Creates a CallPeerJabberImpl from calleeJID and sends them session-initiate IQ request.

Parameters:
calleeJID - the party that we would like to invite to this call.
discoverInfo - any discovery information that we have for the jid we are trying to reach and that we are passing in order to avoid having to ask for it again.
sessionInitiateExtensions - a collection of additional and optional PacketExtensions to be added to the session-initiate JingleIQ which is to init this CallJabberImpl
Returns:
the newly created Call corresponding to calleeJID. 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.

modifyVideoContent

public void modifyVideoContent(boolean allowed)
                        throws OperationFailedException
Send a content-modify message for all current CallPeer to reflect possible video change in media setup.

Parameters:
allowed - if the local video is allowed or not
Throws:
OperationFailedException - if problem occurred during message generation or network problem

containsJingleSID

public boolean containsJingleSID(String sid)
Determines if this call contains a peer whose corresponding session has the specified sid.

Parameters:
sid - the ID of the session whose peer we are looking for.
Returns:
true if this call contains a peer with the specified jingle sid and false otherwise.

getPeer

public CallPeerJabberImpl getPeer(String sid)
Returns the peer whose corresponding session has the specified sid.

Parameters:
sid - the ID of the session whose peer we are looking for.
Returns:
the CallPeerJabberImpl with the specified jingle sid and null if no such peer exists in this call.

getPeerBySessInitPacketID

public CallPeerJabberImpl getPeerBySessInitPacketID(String id)
Returns the peer whose corresponding session-init ID has the specified id.

Parameters:
id - the ID of the session-init IQ whose peer we are looking for.
Returns:
the CallPeerJabberImpl with the specified IQ id and null if no such peer exists in this call.

callAdded

public void callAdded(CallGroupEvent evt)
Notifies this instance that a specific Call has been added to a CallGroup.

Specified by:
callAdded in interface CallGroupListener
Overrides:
callAdded in class MediaAwareCall<CallPeerJabberImpl,OperationSetBasicTelephonyJabberImpl,ProtocolProviderServiceJabberImpl>
Parameters:
evt - a CallGroupEvent which specifies the Call which has been added to a CallGroup
See Also:
MediaAwareCall.callAdded(CallGroupEvent)

closeCobriStreamConnector

public void closeCobriStreamConnector(CallPeerJabberImpl peer,
                                      MediaType mediaType,
                                      CobriStreamConnector cobriStreamConnector)
Closes a specific CobriStreamConnector which is associated with a MediaStream of a specific MediaType upon request from a specific CallPeer.

Parameters:
peer - the CallPeer which requests the closing of the specified cobriStreamConnector
mediaType - the MediaType of the MediaStream with which the specified cobriStreamConnector is associated
cobriStreamConnector - the CobriStreamConnector to close on behalf of the specified peer

createCobriChannels

public CobriConferenceIQ createCobriChannels(CallPeerJabberImpl peer,
                                             Iterable<RtpDescriptionPacketExtension> rdpes)
Allocates cobri (conference) channels for a specific MediaType to be used by a specific CallPeer.

Parameters:
peer - the CallPeer which is to use the allocated cobri (conference) channels
rdpes - the RtpDescriptionPacketExtensions which specify the MediaTypes for which cobri (conference) channels are to be allocated
Returns:
a CobriConferenceIQ which describes the allocated cobri (conference) channels for the specified mediaTypes which are to be used by the specified peer; otherwise, null

createCobriStreamConnector

public CobriStreamConnector createCobriStreamConnector(CallPeerJabberImpl peer,
                                                       MediaType mediaType,
                                                       CobriConferenceIQ.Channel channel,
                                                       StreamConnectorFactory factory)
Initializes a CobriStreamConnector on behalf of a specific CallPeer to be used in association with a specific CobriConferenceIQ.Channel of a specific MediaType.

Parameters:
peer - the CallPeer which requests the initialization of a CobriStreamConnector
mediaType - the MediaType of the stream which is to use the initialized CobriStreamConnector for RTP and RTCP traffic
channel - the CobriConferenceIQ.Channel to which RTP and RTCP traffic is to be sent and from which such traffic is to be received via the initialized CobriStreamConnector
factory - a StreamConnectorFactory implementation which is to allocate the sockets to be used for RTP and RTCP traffic
Returns:
a CobriStreamConnector to be used for RTP and RTCP traffic associated with the specified channel

expireCobriChannels

public void expireCobriChannels(CallPeerJabberImpl peer,
                                CobriConferenceIQ conference)
Expires specific (cobri) conference channels used by a specific CallPeer.

Parameters:
peer - the CallPeer which uses the specified (cobri) conference channels to be expired
conference - a CobriConferenceIQ which specifies the (cobri) conference channels to be expired

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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