|
SIP Communicator: the OpenSource Java VoIP and Instant Messaging client. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.java.sip.communicator.util.PropertyChangeNotifier
net.java.sip.communicator.impl.media.CallSessionImpl
public class CallSessionImpl
Contains parameters associated with a particular Call such as media (audio video), a reference to the call itself, RTPManagers and others.
Currently the class works in the following way:
We create 2 rtp managers (one for video and one for audio) upon initialization of this call session and initialize/bind them on local addresses.
When we are asked to create an SDP offer we ask the MediaControl for the Formats/Encodings that we support and create a media description that would advertise these formats as well as the ports that our RTP managers are bound upon.
When we need to process an incoming offer we ask the MediaControl for the Formats/Encodings that we support, intersect them with those that were sent by the offerer and make MediaControl configure our source processor so that it would transmit in the format that it is expected to according to the format set that resulted from the intersection. We also prepare our RTPManager-s to send streams for every media type requested in the offer. (Note that these streams are not started until the associated call enters the CONNECTED state).
Processing an SDP answer is quite similar to processing an offer with the exception that the intersection of all supported formats has been performed bye the remote party and we only need to configure our processor and RTPManagers.
| Nested Class Summary | |
|---|---|
static class |
CallSessionImpl.ZRTPCustomInfoCodes
Additional info codes for and data to support ZRTP4J. |
| Field Summary | |
|---|---|
static String |
AUDIO_SESSION
Indicates an audio session type. |
static String |
VIDEO_SESSION
Indicates a video session type. |
| Fields inherited from interface net.java.sip.communicator.service.media.CallSession |
|---|
LOCAL_VIDEO_STREAMING, ON_HOLD_REMOTELY, RECEIVE_AUDIO, RECEIVE_VIDEO |
| Constructor Summary | |
|---|---|
CallSessionImpl(Call call,
MediaServiceImpl mediaServCallback)
Creates a new session for the specified call. |
|
CallSessionImpl(Call call,
MediaServiceImpl mediaServCallback,
URL dataSink)
Creates a new session for the specified call with a custom destination for incoming data. |
|
| Method Summary | |
|---|---|
void |
addVideoListener(VideoListener listener)
Adds a specific VideoListener to this
CallSession in order to receive notifications when
visual/video Components are being added and removed. |
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. |
void |
controllerUpdate(javax.media.ControllerEvent ce)
This method is called when an event is generated by a Controller that this listener is registered with. |
Component |
createLocalVisualComponent(VideoListener listener)
Creates a visual Component which represents the local video
streamed by this CallSession (to remote destinations). |
String |
createSdpDescriptionForHold(String peerSdpDescription,
boolean on)
The method is meant for use by protocol service implementations when willing to send an in-dialog invitation to a remote callee to put her on/off hold or to send an answer to an offer to be put on/off hold. |
String |
createSdpOffer()
The method is meant for use by protocol service implementations when willing to send an invitation to a remote callee. |
String |
createSdpOffer(InetAddress intendedDestination)
The method is meant for use by protocol service implementations when willing to send an invitation to a remote callee. |
String |
createSdpOffer(String peerSdpDescription)
Creates a SDP description including the current state of the local media setup and in accord with a specific SDP description of a call peer (who is to be offered the created SDP description, for example, as part of a re-INVITE). |
void |
disposeLocalVisualComponent(Component component)
Disposes of a specific visual Component representing local
video which has been created by this instance with
CallSession.createLocalVisualComponent(VideoListener). |
protected void |
fireVideoEvent(int type,
Component visualComponent,
int origin)
Notifies the VideoListeners registered with this
CallSession about a specific type of change in the
availability of a specific visual Component depicting video. |
int |
getAudioPort()
Returns the port that we are using for receiving audio data in this CallSession. |
javax.media.rtp.RTPManager |
getAudioRtpManager()
Returns the rtp manager that we are using for audio streams. |
Call |
getCall()
Returns the call associated with this Session. |
URL |
getCallInfoURL()
RFC 4566 specifies that an SDP description may contain a URI (i.r. |
int |
getSdpOfferMediaFlags(String sdpOffer)
Determines whether a specific SDP description String offers this party to be put on hold and which media types are offered to be received. |
boolean |
getSecureCommunicationStatus()
Method for getting the default secure status value for communication |
SessionCreatorCallback |
getSessionCreatorCallback()
Returns the SessionCreatorCallback which listens for security events. |
int |
getVideoPort()
Returns the port that we are using for receiving video data in this CallSession. |
javax.media.rtp.RTPManager |
getVideoRtpManager()
Returns the rtp manager that we are using for video streams. |
Component[] |
getVisualComponents()
Gets the visual/video Components available in this
CallSession. |
void |
initializeSupportedKeyProviders()
Initializes the supported key management types and establishes default usage priorities for them. |
boolean |
isLocalVideoAllowed()
Gets the indicator which determines whether the streaming of local video in this CallSession is allowed. |
boolean |
isLocalVideoStreaming()
Gets the indicator which determines whether this CallSession
is currently streaming the local video (to a remote destination). |
boolean |
isMute()
Determines whether the audio of this session is (set to) mute. |
void |
processSdpAnswer(CallPeer responder,
String sdpAnswerStr)
The method is meant for use by protocol service implementations upon reception of an SDP answer in response to an offer sent by us earlier. |
String |
processSdpOffer(CallPeer offerer,
String sdpOfferStr)
The method is meant for use by protocol service implementations when willing to respond to an invitation received from a remote caller. |
void |
putOnHold(boolean on,
boolean here)
Puts the media of this CallSession on/off hold depending on the origin of the request. |
(package private) static void |
registerCustomCodecFormats(javax.media.rtp.RTPManager rtpManager)
Registers the RTP formats which are supported by SIP Communicator in addition to the JMF standard formats. |
(package private) static void |
registerCustomVideoCodecFormats(javax.media.rtp.RTPManager rtpManager)
|
void |
removeVideoListener(VideoListener listener)
Removes a specific VideoListener from this
CallSession in order to no longer have it receive
notifications when visual/video Components are being added
and removed. |
KeyProviderAlgorithm |
selectDefaultKeyProviderAlgorithm()
Selects a default key management type to use in securing based on which the actual implementation for that solution will be started This part should be further developed (by adding a more detailed priority choosing mechanism in case of addition of other security providers). |
KeyProviderAlgorithm |
selectKeyProviderAlgorithm(int priority)
Selects a key management type to use in securing based on priority For now the priorities are equal with the position in the Vector holding the keymanagement types. |
void |
setLocalVideoAllowed(boolean allowed)
Sets the indicator which determines whether the streaming of local video in this CallSession is allowed. |
void |
setMute(boolean mute)
Sets the mute state of the audio of this session. |
void |
setReceiveStreaming(int mediaFlags)
Modifies the current setup of the stream receiving in accord with a specific set of media flags (which are usually obtained through CallSession.getSdpOfferMediaFlags(String). |
void |
setSessionCreatorCallback(SessionCreatorCallback securityCallback)
Sets a SessionCreatorCallback that will listen for security events. |
boolean |
setZrtpSASVerification(boolean verified)
Sets the SAS verification |
void |
startStreaming()
Opens all streams that have been initialized for local RTP managers. |
void |
startStreamingAndProcessingMedia()
Calls CallSession.startStreaming() in order to start the streaming of the
local media and then begins processing the received and sent media
streams. |
int |
startZrtpMultiStreams()
Start multi-stream ZRTP sessions. |
boolean |
stopStreaming()
Stops and closes all streams that have been initialized for local RTP managers and disposes of the local RTP managers. |
void |
update(javax.media.rtp.event.ReceiveStreamEvent evt)
Method called back in the RTPSessionListener to notify listener of all ReceiveStream Events. |
void |
update(javax.media.rtp.event.SendStreamEvent event)
Method called back in the RTPSessionListener to notify listener of all SendStream Events. |
void |
update(javax.media.rtp.event.SessionEvent event)
Method called back in the SessionListener to notify listener of all Session Events.SessionEvents could be one of NewParticipantEvent or LocalCollisionEvent. |
| Methods inherited from class net.java.sip.communicator.util.PropertyChangeNotifier |
|---|
addPropertyChangeListener, firePropertyChange, getPropertyChangeSource, removePropertyChangeListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface net.java.sip.communicator.service.media.CallSession |
|---|
addPropertyChangeListener, removePropertyChangeListener |
| Field Detail |
|---|
public static final String AUDIO_SESSION
public static final String VIDEO_SESSION
| Constructor Detail |
|---|
public CallSessionImpl(Call call,
MediaServiceImpl mediaServCallback,
URL dataSink)
call - The call associated with this session.mediaServCallback - the media service instance that created us.dataSink - the place to send incoming data.
public CallSessionImpl(Call call,
MediaServiceImpl mediaServCallback)
call - The call associated with this session.mediaServCallback - the media service instance that created us.| Method Detail |
|---|
public Call getCall()
getCall in interface CallSessionpublic int getVideoPort()
getVideoPort in interface CallSessionpublic int getAudioPort()
getAudioPort in interface CallSessionpublic javax.media.rtp.RTPManager getAudioRtpManager()
public javax.media.rtp.RTPManager getVideoRtpManager()
public void startStreaming()
throws MediaException
startStreaming in interface CallSessionMediaException - if start() fails for all send streams.
public void startStreamingAndProcessingMedia()
throws MediaException
CallSessionCallSession.startStreaming() in order to start the streaming of the
local media and then begins processing the received and sent media
streams.
startStreamingAndProcessingMedia in interface CallSessionMediaExceptionpublic boolean stopStreaming()
stopStreaming in interface CallSession
public String createSdpOffer()
throws MediaException
createSdpOffer in interface CallSessionMediaException - code SERVICE_NOT_STARTED if this method is called
before the service was started.
public String createSdpOffer(InetAddress intendedDestination)
throws MediaException
createSdpOffer in interface CallSessionintendedDestination - the address of the call peer that the
descriptions is to be sent to.
MediaException - code SERVICE_NOT_STARTED if this method is called
before the service was started.
public String createSdpOffer(String peerSdpDescription)
throws MediaException
CallSession
createSdpOffer in interface CallSessionpeerSdpDescription - the SDP description (of a call
peer) to have the created SDP description in accord
with
MediaException
public String createSdpDescriptionForHold(String peerSdpDescription,
boolean on)
throws MediaException
createSdpDescriptionForHold in interface CallSessionpeerSdpDescription - the last SDP description of the remote
calleeon - true if the SDP description should offer the remote
callee to be put on hold or answer an offer from the remote
callee to be put on hold; false to work in the
context of a put-off-hold offer
MediaException
public int getSdpOfferMediaFlags(String sdpOffer)
throws MediaException
CallSession
getSdpOfferMediaFlags in interface CallSessionsdpOffer - the SDP description String to be examined for
an offer to this party to be put on hold and media types to be
received
ON_HOLD_REMOTELY if the specified SDP description
offers this party to be put on hold, RECEIVE_AUDIO
and/or RECEIVE_VIDEO if audio and/or video,
respectively, are to be received
MediaException
public void putOnHold(boolean on,
boolean here)
For example, a remote request to have this party put off hold cannot override an earlier local request to put the remote party on hold.
putOnHold in interface CallSessionon - true to request the media of this
CallSession be put on hold; false,
otherwisehere - true if the request comes from this side of the
call; false if the remote party is the issuer of
the request i.e. it's the result of a remote offer
public void processSdpAnswer(CallPeer responder,
String sdpAnswerStr)
throws MediaException,
ParseException
processSdpAnswer in interface CallSessionsdpAnswerStr - the SDP answer that we'd like to handle.responder - the peer that has sent the answer.
MediaException - code SERVICE_NOT_STARTED if this method is called
before the service was started.
ParseException - if sdpAnswerStr does not contain a valid sdp
String.
public String processSdpOffer(CallPeer offerer,
String sdpOfferStr)
throws MediaException,
ParseException
processSdpOffer in interface CallSessionsdpOfferStr - the SDP offer that we'd like to create an answer for.offerer - the peer that has sent the offer.
MediaException - code INTERNAL_ERROR if processing the offer and/or
generating the answer fail for some reason.
ParseException - if sdpOfferStr does not contain a valid
sdp string.public URL getCallInfoURL()
getCallInfoURL in interface CallSessionstatic void registerCustomCodecFormats(javax.media.rtp.RTPManager rtpManager)
JMF stores this statically, so it only has to be done once. FMJ does it dynamically (per instance, so it needs to be done for each instance.
rtpManager - The manager with which to register the formats.EncodingConfiguration.registerCustomCodecs()static void registerCustomVideoCodecFormats(javax.media.rtp.RTPManager rtpManager)
public void callStateChanged(CallChangeEvent evt)
callStateChanged in interface CallChangeListenerevt - the CallChangeEvent instance containing the source
calls and its old and new state.public void callPeerAdded(CallPeerEvent evt)
callPeerAdded in interface CallChangeListenerevt - the CallPeerEvent containing the source call
and call peer.public void callPeerRemoved(CallPeerEvent evt)
callPeerRemoved in interface CallChangeListenerevt - the CallPeerEvent containing the source call
and call peer.public void update(javax.media.rtp.event.SessionEvent event)
update in interface javax.media.rtp.SessionListenerevent - the newly received SessionEventpublic void update(javax.media.rtp.event.SendStreamEvent event)
update in interface javax.media.rtp.SendStreamListenerevent - the newly received SendStreamEventpublic void update(javax.media.rtp.event.ReceiveStreamEvent evt)
update in interface javax.media.rtp.ReceiveStreamListenerevt - the newly received ReceiveStreamEventpublic void controllerUpdate(javax.media.ControllerEvent ce)
Controller that this listener is registered with.
controllerUpdate in interface javax.media.ControllerListenerce - The event generated.public boolean getSecureCommunicationStatus()
getSecureCommunicationStatus in interface CallSessionpublic boolean setZrtpSASVerification(boolean verified)
CallSession
setZrtpSASVerification in interface CallSessionpublic int startZrtpMultiStreams()
public void initializeSupportedKeyProviders()
public KeyProviderAlgorithm selectDefaultKeyProviderAlgorithm()
public KeyProviderAlgorithm selectKeyProviderAlgorithm(int priority)
priority - the priority of the selected key management type with
0 indicating top priority
public boolean isMute()
isMute in interface CallSessionpublic void setMute(boolean mute)
setMute in interface CallSessionmute - true to mute the audio of this session; otherwise,
falsepublic void addVideoListener(VideoListener listener)
CallSessionVideoListener to this
CallSession in order to receive notifications when
visual/video Components are being added and removed.
addVideoListener in interface CallSessionlistener - the VideoListener to be notified when
visual/video Components are being added or
removed in this CallSession
public Component createLocalVisualComponent(VideoListener listener)
throws MediaException
CallSessionComponent which represents the local video
streamed by this CallSession (to remote destinations). If
the synchronous creation of the Component isn't supported,
it will be carried out asynchronously and the progress of the operation
and its result will be delivered through a specific
VideoListener.
createLocalVisualComponent in interface CallSessionlistener - the VideoListener to track the progress of
the creation and deliver its result in case the operation is
carried out asynchronously by this implementation
Component which represents the local video
if this implementation creates it synchronously; null if
this implementation attempts asynchronous creation in which case
the result will be delivered to the specified
VideoListener
MediaExceptionpublic void disposeLocalVisualComponent(Component component)
CallSessionComponent representing local
video which has been created by this instance with
CallSession.createLocalVisualComponent(VideoListener).
disposeLocalVisualComponent in interface CallSessioncomponent - the visual Component representing local
video to be disposedpublic Component[] getVisualComponents()
CallSessionComponents available in this
CallSession.
getVisualComponents in interface CallSessionComponents available in this
CallSessionpublic void removeVideoListener(VideoListener listener)
CallSessionVideoListener from this
CallSession in order to no longer have it receive
notifications when visual/video Components are being added
and removed.
removeVideoListener in interface CallSessionlistener - the VideoListener to no longer be notified
when visual/video Components are being added or
removed in this CallSession
protected void fireVideoEvent(int type,
Component visualComponent,
int origin)
VideoListeners registered with this
CallSession about a specific type of change in the
availability of a specific visual Component depicting video.
type - the type of change as defined by VideoEvent in
the availability of the specified visual
Component depciting videovisualComponent - the visual Component depicting video
which has been added or removed in this
CallSessionorigin -
public void setLocalVideoAllowed(boolean allowed)
throws MediaException
CallSessionCallSession is allowed. The setting does not reflect
the availability of actual video capture devices, it just expresses the
desire of the user to have the local video streamed in the case the
system is actually able to do so.
setLocalVideoAllowed in interface CallSessionallowed - true to allow the streaming of local video for
this CallSession; false to disallow it
MediaExceptionpublic boolean isLocalVideoAllowed()
CallSessionCallSession is allowed. The setting does not reflect
the availability of actual video capture devices, it just expresses the
desire of the user to have the local video streamed in the case the
system is actually able to do so.
isLocalVideoAllowed in interface CallSessionCallSession is allowed; otherwise, falsepublic boolean isLocalVideoStreaming()
CallSessionCallSession
is currently streaming the local video (to a remote destination).
isLocalVideoStreaming in interface CallSessionCallSession is currently
streaming the local video (to a remote destination); otherwise,
falsepublic void setReceiveStreaming(int mediaFlags)
CallSessionCallSession.getSdpOfferMediaFlags(String). For example, if
RECEIVE_VIDEO isn't present and video is currently being
received and played, stops its receiving and playback.
setReceiveStreaming in interface CallSessionmediaFlags - an int bit mask containing any of the
media-related flags such as RECEIVE_AUDIO and
RECEIVE_VIDEO and thus specifying which media
types are to be receivedpublic void setSessionCreatorCallback(SessionCreatorCallback securityCallback)
setSessionCreatorCallback in interface CallSessionsecurityCallback - the SessionCreatorCallback to
setpublic SessionCreatorCallback getSessionCreatorCallback()
getSessionCreatorCallback in interface CallSession
|
SIP Communicator: the OpenSource Java VoIP and Instant Messaging client. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||