diff --git a/src/main/java/org/jitsi/jigasi/AbstractGatewaySession.java b/src/main/java/org/jitsi/jigasi/AbstractGatewaySession.java index 882653e5..1640286d 100644 --- a/src/main/java/org/jitsi/jigasi/AbstractGatewaySession.java +++ b/src/main/java/org/jitsi/jigasi/AbstractGatewaySession.java @@ -307,6 +307,12 @@ public void notifyOnLobbyWaitReview(ChatRoom lobbyRoom) } } + /** + * Method called to notify that the conference is not live yet. + */ + public void notifyConferenceNotLive() + {} + /** * Method called by {@link JvbConference} that it has reached * the maximum number of occupants and gives a chance to the session to diff --git a/src/main/java/org/jitsi/jigasi/JvbConference.java b/src/main/java/org/jitsi/jigasi/JvbConference.java index 2c4799d3..f108cef8 100644 --- a/src/main/java/org/jitsi/jigasi/JvbConference.java +++ b/src/main/java/org/jitsi/jigasi/JvbConference.java @@ -1165,6 +1165,8 @@ else if (opex.getErrorCode() == NOT_LIVE_ERROR_CODE) { logger.info(this.callContext + " Conference is not live yet."); + gatewaySession.notifyConferenceNotLive(); + websocketClient = new WebsocketClient(this, visitorsQueueServiceUrl, this.callContext); websocketClient.connect(); diff --git a/src/main/java/org/jitsi/jigasi/SipGatewaySession.java b/src/main/java/org/jitsi/jigasi/SipGatewaySession.java index 58744a9c..9e3e4a45 100644 --- a/src/main/java/org/jitsi/jigasi/SipGatewaySession.java +++ b/src/main/java/org/jitsi/jigasi/SipGatewaySession.java @@ -1193,6 +1193,24 @@ public void notifyOnLobbyWaitReview(ChatRoom lobbyRoom) } } + /** + * {@inheritDoc} + */ + @Override + public void notifyConferenceNotLive() + { + super.notifyConferenceNotLive(); + + try + { + SipGatewaySession.this.sendJson(SipInfoJsonProtocol.createSIPCallNotLive()); + } + catch(OperationFailedException ex) + { + logger.error("Cannot send visitor message", ex); + } + } + /** * {@inheritDoc} */ diff --git a/src/main/java/org/jitsi/jigasi/sip/SipInfoJsonProtocol.java b/src/main/java/org/jitsi/jigasi/sip/SipInfoJsonProtocol.java index 2936d6b5..5f1e2c98 100644 --- a/src/main/java/org/jitsi/jigasi/sip/SipInfoJsonProtocol.java +++ b/src/main/java/org/jitsi/jigasi/sip/SipInfoJsonProtocol.java @@ -66,6 +66,7 @@ public static class MESSAGE_TYPE public static final int AV_MODERATION_DENIED = 10; public static final int SIP_CALL_HEARTBEAT = 11; public static final int SIP_CALL_VISITOR = 12; + public static final int SIP_CALL_NOT_LIVE = 14; } private static class MESSAGE_HEADER @@ -324,4 +325,19 @@ public static JSONObject createSIPCallVisitors(boolean enabled) return obj; } + + /** + * Creates new JSONObject for call that is not live. + * + * @return JSONObject representing a message to be sent over SIP. + */ + public static JSONObject createSIPCallNotLive() + { + JSONObject obj = new JSONObject(); + + obj.put(MESSAGE_HEADER.MESSAGE_TYPE, MESSAGE_TYPE.SIP_CALL_NOT_LIVE); + obj.put(MESSAGE_HEADER.MESSAGE_DATA, true); + + return obj; + } }