Skip to content

Commit

Permalink
feat(visitors): Notifies for not live call via sip info msg.
Browse files Browse the repository at this point in the history
  • Loading branch information
damencho committed Sep 21, 2024
1 parent 1265067 commit b49e1f7
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/org/jitsi/jigasi/AbstractGatewaySession.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/jitsi/jigasi/JvbConference.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
18 changes: 18 additions & 0 deletions src/main/java/org/jitsi/jigasi/SipGatewaySession.java
Original file line number Diff line number Diff line change
Expand Up @@ -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}
*/
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/org/jitsi/jigasi/sip/SipInfoJsonProtocol.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
}

0 comments on commit b49e1f7

Please sign in to comment.