aboutsummaryrefslogtreecommitdiffstats
path: root/src/net
diff options
context:
space:
mode:
authorDamian Minkov <damencho@jitsi.org>2014-12-18 18:52:59 +0200
committerDamian Minkov <damencho@jitsi.org>2014-12-18 18:53:56 +0200
commitb5095421b06a6f0737532022eb09d9983ac0e838 (patch)
treefdae75e6d009685ab0f82af05b0517f04fd48212 /src/net
parent9d872a1008a1d13bf5a0c6cb5c76baa80744ba1a (diff)
downloadjitsi-b5095421b06a6f0737532022eb09d9983ac0e838.zip
jitsi-b5095421b06a6f0737532022eb09d9983ac0e838.tar.gz
jitsi-b5095421b06a6f0737532022eb09d9983ac0e838.tar.bz2
Fixes searching for DesktopSharingCallSipImpl when working out of dialog.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/java/sip/communicator/impl/protocol/sip/OperationSetDesktopSharingClientSipImpl.java87
1 files changed, 77 insertions, 10 deletions
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetDesktopSharingClientSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetDesktopSharingClientSipImpl.java
index cac902a..189f112 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetDesktopSharingClientSipImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetDesktopSharingClientSipImpl.java
@@ -136,9 +136,15 @@ public class OperationSetDesktopSharingClientSipImpl
String eventId)
{
/* new subscription received */
- return new RemoteControlNotifierSubscription(
- fromAddress,
- eventId);
+ RemoteControlNotifierSubscription rcNotifierSubscription
+ = new RemoteControlNotifierSubscription(
+ fromAddress,
+ eventId);
+
+ if(dssid != null)
+ rcNotifierSubscription.setDSSID(dssid);
+
+ return rcNotifierSubscription;
}
/**
@@ -169,9 +175,14 @@ public class OperationSetDesktopSharingClientSipImpl
if(subs instanceof RemoteControlNotifierSubscription)
{
- fireRemoteControlGranted(
- ((RemoteControlNotifierSubscription)subs).
- getCallPeer());
+ RemoteControlNotifierSubscription rcnSub
+ = (RemoteControlNotifierSubscription)subs;
+
+ fireRemoteControlGranted(rcnSub.getCallPeer());
+
+ // if we have dssid set it to notifier
+ if(dssid != null)
+ rcnSub.setDSSID(dssid);
}
return ret;
@@ -429,6 +440,12 @@ public class OperationSetDesktopSharingClientSipImpl
private CallPeerSipImpl callPeer = null;
/**
+ * The received dssid from the subscription and the one to be used
+ * in the notify requests.
+ */
+ private String dssid = null;
+
+ /**
* Initializes a new <tt>RemoteControlNotifierSubscription</tt> instance
* with a specific subscription <tt>Address</tt>/Request URI and a
* specific id tag of the associated Event headers.
@@ -530,11 +547,19 @@ public class OperationSetDesktopSharingClientSipImpl
if (basicTelephony != null)
{
- callPeer
+ ActiveCallsRepositorySipImpl callRepo
= ((OperationSetBasicTelephonySipImpl)
- basicTelephony)
- .getActiveCallsRepository()
- .findCallPeer(dialog);
+ basicTelephony).getActiveCallsRepository();
+
+ callPeer = callRepo.findCallPeer(dialog);
+
+ // if call peer is still null and we have enabled
+ // working out of dialog desktop sharing, search the
+ // peer based on the dssid we have
+ if(callPeer == null && dssid != null)
+ {
+ callPeer = findCallPeerByDSSID(callRepo);
+ }
if (callPeer != null)
callPeer.addCallPeerListener(callPeerListener);
@@ -543,5 +568,47 @@ public class OperationSetDesktopSharingClientSipImpl
}
return callPeer;
}
+
+ /**
+ * Sets dssid value.
+ * @param value
+ */
+ public void setDSSID(String value)
+ {
+ this.dssid = value;
+ }
+
+ /**
+ * Finds a call peer by a call with same <tt>dssid</tt> if any.
+ * @param callRepo the active call repository to use while
+ * searching calls.
+ * @return a matching call peer.
+ */
+ public CallPeerSipImpl findCallPeerByDSSID(
+ ActiveCallsRepositorySipImpl callRepo)
+ {
+ if(dssid == null)
+ return null;
+
+ for (Iterator<CallSipImpl> activeCalls = callRepo.getActiveCalls();
+ activeCalls.hasNext();)
+ {
+ CallSipImpl call = activeCalls.next();
+
+ if(call instanceof DesktopSharingCallSipImpl)
+ {
+ DesktopSharingCallSipImpl dsCall
+ = (DesktopSharingCallSipImpl)call;
+
+ if( dsCall.getDesktopSharingSessionID() != null
+ && dsCall.getDesktopSharingSessionID().equals(dssid))
+ {
+ return dsCall.getCallPeers().next();
+ }
+ }
+ }
+
+ return null;
+ }
}
}