aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java
diff options
context:
space:
mode:
authorpaweldomas <pawel.domas@jitsi.org>2014-09-01 14:22:11 +0200
committerpaweldomas <pawel.domas@jitsi.org>2014-09-02 09:35:11 +0200
commit415b180c09c9e444b349b54122965a2589f62f4d (patch)
tree0040312d11790d826544d87806c7dc3dceb5114b /src/net/java
parente0597082be7ae20dd6e3e8bd8f9f32093bdad3a4 (diff)
downloadjitsi-415b180c09c9e444b349b54122965a2589f62f4d.zip
jitsi-415b180c09c9e444b349b54122965a2589f62f4d.tar.gz
jitsi-415b180c09c9e444b349b54122965a2589f62f4d.tar.bz2
Extends JitsiMeet tools operation set by functionality that handles extra SIP header in incoming calls.
Diffstat (limited to 'src/net/java')
-rw-r--r--src/net/java/sip/communicator/impl/protocol/jabber/OperationSetJitsiMeetToolsJabberImpl.java12
-rw-r--r--src/net/java/sip/communicator/impl/protocol/sip/CallSipImpl.java21
-rw-r--r--src/net/java/sip/communicator/impl/protocol/sip/OperationSetJitsiMeetToolsSipImpl.java120
-rw-r--r--src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java5
-rw-r--r--src/net/java/sip/communicator/service/protocol/OperationSetJitsiMeetTools.java33
5 files changed, 190 insertions, 1 deletions
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetJitsiMeetToolsJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetJitsiMeetToolsJabberImpl.java
index ee78002..73777a3 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetJitsiMeetToolsJabberImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetJitsiMeetToolsJabberImpl.java
@@ -35,4 +35,16 @@ public class OperationSetJitsiMeetToolsJabberImpl
{
((ChatRoomJabberImpl)chatRoom).publishPresenceStatus(statusMessage);
}
+
+ @Override
+ public void addRequestListener(JitsiMeetRequestListener requestHandler)
+ {
+ // Not used
+ }
+
+ @Override
+ public void removeRequestListener(JitsiMeetRequestListener requestHandler)
+ {
+ // Not used
+ }
}
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 075a318..55cc5f3 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/CallSipImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/sip/CallSipImpl.java
@@ -14,6 +14,7 @@ import javax.sip.address.*;
import javax.sip.header.*;
import javax.sip.message.*;
+import gov.nist.javax.sip.header.*;
import gov.nist.javax.sip.stack.*;
import net.java.sip.communicator.impl.protocol.sip.sdp.*;
@@ -45,6 +46,13 @@ public class CallSipImpl
private static final Logger logger = Logger.getLogger(CallSipImpl.class);
/**
+ * Name of extra INVITE header which specifies name of MUC room that is
+ * hosting the Jitsi Meet conference.
+ */
+ public static final String JITSI_MEET_ROOM_HEADER
+ = "Jitsi-Conference-Room";
+
+ /**
* When starting call we may have quality preferences we must use
* for the call.
*/
@@ -472,6 +480,19 @@ public class CallSipImpl
if (alternativeIMPPAddress != null)
peer.setAlternativeIMPPAddress(alternativeIMPPAddress);
+ // Parses Jitsi Meet room name header
+ SIPHeader joinRoomHeader
+ = (SIPHeader) invite.getHeader(JITSI_MEET_ROOM_HEADER);
+ if (joinRoomHeader != null)
+ {
+ OperationSetJitsiMeetToolsSipImpl jitsiMeetTools
+ = (OperationSetJitsiMeetToolsSipImpl) getProtocolProvider()
+ .getOperationSet(OperationSetJitsiMeetTools.class);
+
+ jitsiMeetTools.notifyJoinJitsiMeetRoom(
+ this, joinRoomHeader.getValue());
+ }
+
//send a ringing response
Response response = null;
try
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetJitsiMeetToolsSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetJitsiMeetToolsSipImpl.java
new file mode 100644
index 0000000..7184351
--- /dev/null
+++ b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetJitsiMeetToolsSipImpl.java
@@ -0,0 +1,120 @@
+/*
+ * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.impl.protocol.sip;
+
+import net.java.sip.communicator.service.protocol.*;
+import net.java.sip.communicator.util.*;
+
+import org.jivesoftware.smack.packet.*;
+
+import java.util.*;
+import java.util.concurrent.*;
+
+/**
+ * The SIP implementation of {@link OperationSetJitsiMeetTools}.
+ *
+ * @author Pawel Domas
+ */
+public class OperationSetJitsiMeetToolsSipImpl
+ implements OperationSetJitsiMeetTools
+{
+ /**
+ * The logger used by this class.
+ */
+ private final static Logger logger
+ = Logger.getLogger(OperationSetJitsiMeetToolsSipImpl.class);
+
+ /**
+ * The list of {@link JitsiMeetRequestListener}.
+ */
+ private final List<JitsiMeetRequestListener> requestHandlers
+ = new CopyOnWriteArrayList<JitsiMeetRequestListener>();
+
+ /*private ProtocolProviderServiceSipImpl parentProvider;
+
+ public OperationSetJitsiMeetToolsSipImpl(
+ ProtocolProviderServiceSipImpl parentProvider)
+ {
+ this.parentProvider = parentProvider;
+ }*/
+
+ //@Override
+ //public Call createGatewayCall(String uri, String roomName)
+ //{
+ /*OperationSetBasicTelephonySipImpl sipTelephony
+ = (OperationSetBasicTelephonySipImpl)
+ parentProvider.getOperationSet(
+ OperationSetBasicTelephony.class);
+
+ Map<String, String> parameters = new HashMap<String, String>();
+
+ parameters.put(CallSipImpl.JITSI_MEET_ROOM_HEADER, roomName);
+
+ return sipTelephony.createCall(uri, parameters);*/
+ //}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void addRequestListener(JitsiMeetRequestListener requestHandler)
+ {
+ this.requestHandlers.add(requestHandler);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void removeRequestListener(JitsiMeetRequestListener requestHandler)
+ {
+ this.requestHandlers.remove(requestHandler);
+ }
+
+ /**
+ * Notifies all registered {@link JitsiMeetRequestListener} about incoming
+ * call that contains name of the MUC room which is hosting Jitsi Meet
+ * conference.
+ * @param call the incoming {@link Call} instance.
+ * @param jitsiMeetRoom the name of the chat room of Jitsi Meet conference
+ * to be joined.
+ */
+ public void notifyJoinJitsiMeetRoom(Call call, String jitsiMeetRoom)
+ {
+ boolean handled = false;
+ for (JitsiMeetRequestListener l : requestHandlers)
+ {
+ l.onJoinJitsiMeetRequest(call, jitsiMeetRoom);
+ handled = true;
+ }
+ if (!handled)
+ {
+ logger.warn(
+ "Unhandled join Jitsi Meet request R:" + jitsiMeetRoom
+ + " C: " + call);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void sendPresenceExtension(ChatRoom chatRoom,
+ PacketExtension extension)
+ {
+ throw new RuntimeException("Not implemented for SIP");
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setPresenceStatus(ChatRoom chatRoom, String statusMessage)
+ {
+ throw new RuntimeException("Not implemented for SIP");
+ }
+}
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java
index 7877a7c..fbd87bc 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java
@@ -540,6 +540,11 @@ public class ProtocolProviderServiceSipImpl
new OperationSetDesktopSharingClientSipImpl(this));
}
}
+
+ // Jitsi Meet Tools
+ addSupportedOperationSet(
+ OperationSetJitsiMeetTools.class,
+ new OperationSetJitsiMeetToolsSipImpl());
}
if (enablePresence)
diff --git a/src/net/java/sip/communicator/service/protocol/OperationSetJitsiMeetTools.java b/src/net/java/sip/communicator/service/protocol/OperationSetJitsiMeetTools.java
index 9c5fc31..2e25150 100644
--- a/src/net/java/sip/communicator/service/protocol/OperationSetJitsiMeetTools.java
+++ b/src/net/java/sip/communicator/service/protocol/OperationSetJitsiMeetTools.java
@@ -10,7 +10,7 @@ import org.jivesoftware.smack.packet.*;
/**
* The operation set provides functionality specific to Jitsi Meet WebRTC
- * conference.
+ * conference and is currently used in the SIP gateway.
*
* @author Pawel Domas
*/
@@ -37,4 +37,35 @@ public interface OperationSetJitsiMeetTools
* message in the MUC.
*/
public void setPresenceStatus(ChatRoom chatRoom, String statusMessage);
+
+ /**
+ * Adds given <tt>listener</tt> to the list of
+ * {@link JitsiMeetRequestListener}s.
+ * @param listener the {@link JitsiMeetRequestListener} to be notified about
+ * future events.
+ */
+ public void addRequestListener(JitsiMeetRequestListener listener);
+
+ /**
+ * Removes given <tt>listener</tt> from the list of
+ * {@link JitsiMeetRequestListener}s.
+ * @param listener the {@link JitsiMeetRequestListener} that will be no
+ * longer notified about Jitsi Meet events.
+ */
+ public void removeRequestListener(JitsiMeetRequestListener listener);
+
+ /**
+ * Interface used to handle Jitsi Meet conference requests.
+ */
+ interface JitsiMeetRequestListener
+ {
+ /**
+ * Events is fired for an incoming call that contains information about
+ * Jitsi Meet conference room to be joined.
+ * @param call the incoming {@link Call} instance.
+ * @param jitsiMeetRoom the name of multi user chat room that is hosting
+ * Jitsi Meet conference.
+ */
+ void onJoinJitsiMeetRequest(Call call, String jitsiMeetRoom);
+ }
}