diff options
author | Damian Minkov <damencho@jitsi.org> | 2015-02-05 15:34:52 +0200 |
---|---|---|
committer | Damian Minkov <damencho@jitsi.org> | 2015-02-10 13:01:54 +0200 |
commit | 84b528c9418f89fcb359300638ad40f9f619b98c (patch) | |
tree | 9e788dcd92db44e832b915e4d06a7ef69cc8a37a /src/net/java/sip | |
parent | e25de5721762b8d08c4ff75584e8f46a138aaa49 (diff) | |
download | jitsi-84b528c9418f89fcb359300638ad40f9f619b98c.zip jitsi-84b528c9418f89fcb359300638ad40f9f619b98c.tar.gz jitsi-84b528c9418f89fcb359300638ad40f9f619b98c.tar.bz2 |
Adds custom header to indicate screen sharing initiated calls.
Diffstat (limited to 'src/net/java/sip')
6 files changed, 142 insertions, 12 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/main/call/CallManager.java b/src/net/java/sip/communicator/impl/gui/main/call/CallManager.java index ac9e644..79a5c5f 100644 --- a/src/net/java/sip/communicator/impl/gui/main/call/CallManager.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/CallManager.java @@ -309,7 +309,8 @@ public class CallManager receivedCallDialog = new ReceivedCallDialog( sourceCall, isVideoCall, - (CallManager.getInProgressCalls().size() > 0)); + (CallManager.getInProgressCalls().size() > 0), + ev.isDesktopStreaming()); receivedCallDialog.setVisible(true); diff --git a/src/net/java/sip/communicator/impl/gui/main/call/ReceivedCallDialog.java b/src/net/java/sip/communicator/impl/gui/main/call/ReceivedCallDialog.java index c22b764..a8a55da 100644 --- a/src/net/java/sip/communicator/impl/gui/main/call/ReceivedCallDialog.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/ReceivedCallDialog.java @@ -53,15 +53,25 @@ public class ReceivedCallDialog * @param video if the call is a video call * @param existingCall true to answer the call in an existing call (thus * obtaining a conference call) + * @param desktopStreaming whether the incoming call is desktop streaming */ - public ReceivedCallDialog(Call call, boolean video, boolean existingCall) + public ReceivedCallDialog( + Call call, + boolean video, + boolean existingCall, + boolean desktopStreaming) { super(GuiActivator.getResources() .getSettingsString("service.gui.APPLICATION_NAME") + " " - + GuiActivator.getResources() - .getI18NString("service.gui.INCOMING_CALL_STATUS") - .toLowerCase(), video, existingCall); + + (desktopStreaming ? + GuiActivator.getResources() + .getI18NString("service.gui.INCOMING_SCREEN_SHARE_STATUS") + .toLowerCase() + : GuiActivator.getResources() + .getI18NString("service.gui.INCOMING_CALL_STATUS") + .toLowerCase()) + , video, existingCall); this.incomingCall = call; diff --git a/src/net/java/sip/communicator/impl/protocol/sip/CallSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/CallSipImpl.java index e954e75..b8e45e8 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/CallSipImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/CallSipImpl.java @@ -61,6 +61,12 @@ public class CallSipImpl = "Jitsi-Conference-Room-Pass"; /** + * Custom header included in initial desktop sharing call creation. + * Not included when we are upgrading an ongoing audio/video call. + */ + public static final String DS_SHARING_HEADER = "X-Desktop-Share"; + + /** * When starting call we may have quality preferences we must use * for the call. */ @@ -327,8 +333,29 @@ public class CallSipImpl Call sourceCall, Map<MediaType, MediaDirection> mediaDirections) { - getParentOperationSet().fireCallEvent( - eventID, sourceCall, mediaDirections); + CallEvent callEvent + = new CallEvent(sourceCall, eventID, mediaDirections); + + // just checks for existence of the custom desktop share header + // and indicate it in the call event + if(sourceCall.getCallPeerCount() == 1) + { + CallSipImpl callSip = (CallSipImpl)sourceCall; + + CallPeerSipImpl callPeer = callSip.getCallPeers().next(); + + Request request + = callPeer.getLatestInviteTransaction().getRequest(); + + Header dsHeader = request.getHeader(DS_SHARING_HEADER); + + if(dsHeader != null) + { + callEvent.setDesktopStreaming(true); + } + } + + getParentOperationSet().fireCallEvent(callEvent); } /** diff --git a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetDesktopStreamingSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetDesktopStreamingSipImpl.java index dd03a14..606f319 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetDesktopStreamingSipImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetDesktopStreamingSipImpl.java @@ -8,12 +8,17 @@ package net.java.sip.communicator.impl.protocol.sip; import java.awt.*; import java.text.*; +import java.util.*; import javax.sip.address.*; +import javax.sip.header.*; +import javax.sip.message.*; import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.service.protocol.event.*; import org.jitsi.service.neomedia.*; +import org.jitsi.service.neomedia.MediaType; import org.jitsi.service.neomedia.device.*; import org.jitsi.service.neomedia.format.*; @@ -38,6 +43,11 @@ public class OperationSetDesktopStreamingSipImpl protected Point origin = null; /** + * Whether handling desktop control out of dialog is enabled. + */ + private boolean desktopControlOutOfDialogEnabled = false; + + /** * Initializes a new <tt>OperationSetDesktopStreamingSipImpl</tt> instance * which builds upon the telephony-related functionality of a specific * <tt>OperationSetBasicTelephonySipImpl</tt>. @@ -49,6 +59,12 @@ public class OperationSetDesktopStreamingSipImpl OperationSetBasicTelephonySipImpl basicTelephony) { super(basicTelephony); + + desktopControlOutOfDialogEnabled + = SipActivator.getConfigurationService().getBoolean( + DesktopSharingCallSipImpl + .ENABLE_OUTOFDIALOG_DESKTOP_CONTROL_PROP, + false); } /** @@ -133,7 +149,37 @@ public class OperationSetDesktopStreamingSipImpl private Call createVideoCall(Address toAddress, MediaDevice mediaDevice) throws OperationFailedException { - CallSipImpl call = basicTelephony.createOutgoingCall(); + basicTelephony.assertRegistered(); + + CallSipImpl call; + if(desktopControlOutOfDialogEnabled) + { + call = new DesktopSharingCallSipImpl(basicTelephony) + { + @Override + protected void processExtraHeaders( + javax.sip.message.Message message) + throws ParseException + { + addDesktopShareHeader(message); + } + }; + } + else + { + call = new CallSipImpl(basicTelephony) + { + @Override + protected void processExtraHeaders( + javax.sip.message.Message message) + throws + ParseException + { + addDesktopShareHeader(message); + } + }; + } + MediaUseCase useCase = getMediaUseCase(); call.setVideoDevice(mediaDevice, useCase); @@ -145,6 +191,22 @@ public class OperationSetDesktopStreamingSipImpl } /** + * A place where we can handle any headers we need for requests + * and responses. + * @param message the SIP <tt>Message</tt> in which a header change + * is to be reflected + * @throws java.text.ParseException if modifying the specified SIP + * <tt>Message</tt> to reflect the header change fails + */ + protected void addDesktopShareHeader(javax.sip.message.Message message) + throws ParseException + { + Header customDesktopShareHeader = parentProvider.getHeaderFactory() + .createHeader(CallSipImpl.DS_SHARING_HEADER, "true"); + message.setHeader(customDesktopShareHeader); + } + + /** * Create a new video call and invite the specified CallPeer to it. * * @param uri the address of the callee that we should invite to a new diff --git a/src/net/java/sip/communicator/plugin/notificationwiring/NotificationManager.java b/src/net/java/sip/communicator/plugin/notificationwiring/NotificationManager.java index 6390529..cd827fe 100644 --- a/src/net/java/sip/communicator/plugin/notificationwiring/NotificationManager.java +++ b/src/net/java/sip/communicator/plugin/notificationwiring/NotificationManager.java @@ -907,10 +907,15 @@ public class NotificationManager = fireNotification( INCOMING_CALL, "", - NotificationWiringActivator.getResources() - .getI18NString( - "service.gui.INCOMING_CALL", - new String[] { peerName }), + ev.isDesktopStreaming() ? + NotificationWiringActivator.getResources() + .getI18NString( + "service.gui.INCOMING_SCREEN_SHARE", + new String[] { peerName }) + : NotificationWiringActivator.getResources() + .getI18NString( + "service.gui.INCOMING_CALL", + new String[] { peerName }), peerInfo, new Callable<Boolean>() { diff --git a/src/net/java/sip/communicator/service/protocol/event/CallEvent.java b/src/net/java/sip/communicator/service/protocol/event/CallEvent.java index d625082..6b3ec21 100644 --- a/src/net/java/sip/communicator/service/protocol/event/CallEvent.java +++ b/src/net/java/sip/communicator/service/protocol/event/CallEvent.java @@ -65,6 +65,12 @@ public class CallEvent private final CallConference conference; /** + * Indicate whether the call is recognized to be video call and + * desktop streaming call. + */ + private boolean isDesktopStreaming = false; + + /** * Creates an event instance indicating that an incoming/outgoing call * has been created * @@ -175,6 +181,25 @@ public class CallEvent } /** + * Returns whether the current event is for video call and desktop streaming + * one. + * @return true if this is video call and desktop streaming one. + */ + public boolean isDesktopStreaming() + { + return isDesktopStreaming; + } + + /** + * Change the desktop streaming indication for this event. + * @param value the new value. + */ + public void setDesktopStreaming(boolean value) + { + this.isDesktopStreaming = value; + } + + /** * Returns a String representation of this CallEvent. * * @return A a String representation of this CallEvent. |