Repository: openmeetings Updated Branches: refs/heads/3.3.x 18c013459 -> a3f41b241
[OPENMEETINGS-1664] sip room exit seems to be fixed Project: http://git-wip-us.apache.org/repos/asf/openmeetings/repo Commit: http://git-wip-us.apache.org/repos/asf/openmeetings/commit/a3f41b24 Tree: http://git-wip-us.apache.org/repos/asf/openmeetings/tree/a3f41b24 Diff: http://git-wip-us.apache.org/repos/asf/openmeetings/diff/a3f41b24 Branch: refs/heads/3.3.x Commit: a3f41b2417f319b8bddb9784ea6eb4dd8161342d Parents: 18c0134 Author: Maxim Solodovnik <[email protected]> Authored: Thu Jul 6 22:23:50 2017 +0700 Committer: Maxim Solodovnik <[email protected]> Committed: Thu Jul 6 22:23:50 2017 +0700 ---------------------------------------------------------------------- .../remote/red5/ScopeApplicationAdapter.java | 252 +++++++++---------- .../apache/openmeetings/db/dao/room/SipDao.java | 2 + .../openmeetings/web/app/Application.java | 7 +- .../web/room/activities/ActivitiesPanel.java | 11 +- 4 files changed, 130 insertions(+), 142 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/openmeetings/blob/a3f41b24/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/red5/ScopeApplicationAdapter.java ---------------------------------------------------------------------- diff --git a/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/red5/ScopeApplicationAdapter.java b/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/red5/ScopeApplicationAdapter.java index 4e18027..267cf91 100644 --- a/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/red5/ScopeApplicationAdapter.java +++ b/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/red5/ScopeApplicationAdapter.java @@ -100,7 +100,7 @@ import org.slf4j.Logger; import org.springframework.beans.factory.annotation.Autowired; public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter implements IPendingServiceCallback { - private static final Logger log = Red5LoggerFactory.getLogger(ScopeApplicationAdapter.class, webAppRootKey); + private static final Logger _log = Red5LoggerFactory.getLogger(ScopeApplicationAdapter.class, webAppRootKey); private static final String SECURITY_CODE_PARAM = "securityCode"; private static final String WIDTH_PARAM = "width"; private static final String HEIGHT_PARAM = "height"; @@ -141,8 +141,8 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp @Override public void resultReceived(IPendingServiceCall arg0) { - if (log.isTraceEnabled()) { - log.trace("resultReceived:: {}", arg0); + if (_log.isTraceEnabled()) { + _log.trace("resultReceived:: {}", arg0); } } @@ -152,7 +152,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp OmFileHelper.setOmHome(scope.getResource("/").getFile()); LabelDao.initLanguageMap(); - log.debug("webAppPath : " + OmFileHelper.getOmHome()); + _log.debug("webAppPath : " + OmFileHelper.getOmHome()); // Only load this Class one time Initially this value might by empty, because the DB is empty yet getCryptKey(); @@ -160,7 +160,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp // init your handler here for (String scopeName : scope.getScopeNames()) { - log.debug("scopeName :: " + scopeName); + _log.debug("scopeName :: " + scopeName); } InitializationContainer.initComplete = true; @@ -173,7 +173,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp recordingDao.resetProcessingStatus(); //we are starting so all processing recordings are now errors sessionManager.clearCache(); // 'sticky' clients should be cleaned up from DB } catch (Exception err) { - log.error("[appStart]", err); + _log.error("[appStart]", err); } return true; } @@ -188,12 +188,12 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp @Override public boolean roomConnect(IConnection conn, Object[] params) { - log.debug("roomConnect : "); + _log.debug("roomConnect : "); IServiceCapableConnection service = (IServiceCapableConnection) conn; String streamId = conn.getClient().getId(); - log.debug("### Client connected to OpenMeetings, register Client StreamId: " + streamId + " scope " + conn.getScope().getName()); + _log.debug("### Client connected to OpenMeetings, register Client StreamId: " + streamId + " scope " + conn.getScope().getName()); // Set StreamId in Client service.invoke("setId", new Object[] { streamId }, this); @@ -215,7 +215,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp if (!Strings.isEmpty(securityCode)) { //this is for external applications like ffmpeg [OPENMEETINGS-1574] if (rcm.getRoomId() == null) { - log.warn("Trying to enter invalid scope using security code, client is rejected:: " + rcm.getRoomId()); + _log.warn("Trying to enter invalid scope using security code, client is rejected:: " + rcm.getRoomId()); return rejectClient(); } String _uid = null; @@ -226,12 +226,12 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp } } if (_uid == null) { - log.warn("Client is not found by security id, client is rejected"); + _log.warn("Client is not found by security id, client is rejected"); return rejectClient(); } Client parent = sessionManager.getClientByPublicSID(_uid, null); if (parent == null || !parent.getScope().equals(rcm.getScope())) { - log.warn("Security code is invalid, client is rejected"); + _log.warn("Security code is invalid, client is rejected"); return rejectClient(); } rcm.setUsername(parent.getUsername()); @@ -248,7 +248,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp } } if (Strings.isEmpty(uid) && Strings.isEmpty(securityCode) && Strings.isEmpty(parentSid)) { - log.warn("No UIDs are provided, client is rejected"); + _log.warn("No UIDs are provided, client is rejected"); return rejectClient(); } if (hibernate && "noclient".equals(uid)) { @@ -258,7 +258,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp if (map.containsKey("screenClient")) { Client parent = sessionManager.getClientByPublicSID(parentSid, null); if (parent == null) { - log.warn("Bad parent for screen-sharing client, client is rejected"); + _log.warn("Bad parent for screen-sharing client, client is rejected"); return rejectClient(); } SessionVariablesUtil.setIsScreenClient(conn.getClient()); @@ -269,7 +269,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp } rcm.setStreamid(conn.getClient().getId()); if (rcm.getRoomId() == null && !hibernate) { - log.warn("Bad room specified, client is rejected"); + _log.warn("Bad room specified, client is rejected"); return rejectClient(); } if (Boolean.TRUE.equals(connParams.get(SIP_PARAM))) { @@ -278,7 +278,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp if (connParams.containsKey("mobileClient")) { Sessiondata sd = sessiondataDao.check(parentSid); if (sd.getUserId() == null && !hibernate) { - log.warn("Attempt of unauthorized room enter, client is rejected"); + _log.warn("Attempt of unauthorized room enter, client is rejected"); return rejectClient(); } rcm.setMobile(true); @@ -286,7 +286,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp if (rcm.getUserId() != null) { User u = userDao.get(rcm.getUserId()); if (u == null) { - log.error("Attempt of unauthorized room enter: USER not found, client is rejected"); + _log.error("Attempt of unauthorized room enter: USER not found, client is rejected"); return rejectClient(); } rcm.setUsername(u.getLogin()); @@ -307,7 +307,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp } rcm = sessionManager.add(iapp.updateClient(rcm, false), null); if (rcm == null) { - log.warn("Failed to create Client on room connect"); + _log.warn("Failed to create Client on room connect"); return false; } @@ -327,7 +327,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp rcm.setFirstname(u.getFirstname()); rcm.setLastname(u.getLastname()); } - log.debug("publishName :: " + rcm.getStreamPublishName()); + _log.debug("publishName :: " + rcm.getStreamPublishName()); sessionManager.updateClientByStreamId(streamId, rcm, false, null); } @@ -341,7 +341,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp public Map<String, String> screenSharerAction(Map<String, Object> map) { Map<String, String> returnMap = new HashMap<>(); try { - log.debug("----------- screenSharerAction ENTER"); + _log.debug("----------- screenSharerAction ENTER"); IConnection current = Red5.getConnectionLocal(); Client client = sessionManager.getClientByStreamId(current.getClient().getId(), null); @@ -383,9 +383,9 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp } } } - log.debug("----------- screenSharerAction, return: " + returnMap); + _log.debug("----------- screenSharerAction, return: " + returnMap); } catch (Exception err) { - log.error("[screenSharerAction]", err); + _log.error("[screenSharerAction]", err); } return returnMap; } @@ -395,7 +395,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp IConnection current = Red5.getConnectionLocal(); String streamid = current.getClient().getId(); - log.debug("checkScreenSharing -2- " + streamid); + _log.debug("checkScreenSharing -2- " + streamid); List<Client> screenSharerList = new LinkedList<>(); @@ -410,7 +410,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp return screenSharerList; } catch (Exception err) { - log.error("[checkScreenSharing]", err); + _log.error("[checkScreenSharing]", err); } return null; } @@ -423,7 +423,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp */ public Map<String, Object> setConnectionAsSharingClient(Map<String, Object> map) { try { - log.debug("----------- setConnectionAsSharingClient"); + _log.debug("----------- setConnectionAsSharingClient"); IConnection current = Red5.getConnectionLocal(); Client client = sessionManager.getClientByStreamId(current.getClient().getId(), null); @@ -461,19 +461,19 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp returnMap.put("alreadyPublished", true); } - log.debug("screen x,y,width,height {},{},{},{}", client.getVX(), client.getVY(), client.getVWidth(), client.getVHeight()); + _log.debug("screen x,y,width,height {},{},{},{}", client.getVX(), client.getVY(), client.getVWidth(), client.getVHeight()); if (startStreaming) { if (!alreadyStreaming) { returnMap.put("modus", "startStreaming"); - log.debug("start streamPublishStart Is Screen Sharing "); + _log.debug("start streamPublishStart Is Screen Sharing "); //Send message to all users sendMessageToCurrentScope("newScreenSharing", client, false); WebSocketHelper.sendRoom(new TextRoomMessage(client.getRoomId(), client.getUserId(), RoomMessage.Type.sharingStarted, client.getStreamPublishName())); } else { - log.warn("Streaming is already started for the client id=" + client.getId() + ". Second request is ignored."); + _log.warn("Streaming is already started for the client id=" + client.getId() + ". Second request is ignored."); } } if (startRecording) { @@ -484,7 +484,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp recordingService.recordMeetingStream(current, client, recordingName, "", false); } else { - log.warn("Recording is already started for the client id=" + client.getId() + ". Second request is ignored."); + _log.warn("Recording is already started for the client id=" + client.getId() + ". Second request is ignored."); } } if (startPublishing) { @@ -494,10 +494,10 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp } return returnMap; } else { - log.error("[setConnectionAsSharingClient] Could not find Screen Sharing Client " + current.getClient().getId()); + _log.error("[setConnectionAsSharingClient] Could not find Screen Sharing Client " + current.getClient().getId()); } } catch (Exception err) { - log.error("[setConnectionAsSharingClient]", err); + _log.error("[setConnectionAsSharingClient]", err); } return null; } @@ -533,26 +533,13 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp } /** - * this function is invoked directly after initial connecting - * - * @return publicSID of current client - */ - public String getPublicSID() { - log.debug("----------- getPublicSID"); - IConnection current = Red5.getConnectionLocal(); - Client currentClient = sessionManager.getClientByStreamId(current.getClient().getId(), null); - sessionManager.updateClientByStreamId(current.getClient().getId(), currentClient, false, null); - return currentClient.getPublicSID(); - } - - /** * this function is invoked after a reconnect * * @param newPublicSID */ public boolean overwritePublicSID(String newPublicSID) { try { - log.debug("----------- overwritePublicSID"); + _log.debug("----------- overwritePublicSID"); IConnection current = Red5.getConnectionLocal(); IClient c = current.getClient(); Client currentClient = sessionManager.getClientByStreamId(c.getId(), null); @@ -564,7 +551,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp sessionManager.updateClientByStreamId(c.getId(), currentClient, false, null); return true; } catch (Exception err) { - log.error("[overwritePublicSID]", err); + _log.error("[overwritePublicSID]", err); } return false; } @@ -577,25 +564,25 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp @Override public void roomLeave(IClient client, IScope room) { try { - log.debug("[roomLeave] {} {} {} {}", client.getId(), room.getClients().size(), room.getContextPath(), room.getName()); + _log.debug("[roomLeave] {} {} {} {}", client.getId(), room.getClients().size(), room.getContextPath(), room.getName()); Client rcl = sessionManager.getClientByStreamId(client.getId(), null); // The Room Client can be null if the Client left the room by using // logicalRoomLeave if (rcl != null) { - log.debug("currentClient IS NOT NULL"); + _log.debug("currentClient IS NOT NULL"); roomLeaveByScope(rcl, room); } } catch (Exception err) { - log.error("[roomLeave]", err); + _log.error("[roomLeave]", err); } } public void roomLeaveByScope(String uid, Long roomId) { Client rcl = sessionManager.getClientByPublicSID(uid, null); IScope scope = getRoomScope("" + roomId); - log.debug("[roomLeaveByScope] {} {} {} {}", uid, roomId, rcl, scope); + _log.debug("[roomLeaveByScope] {} {} {} {}", uid, roomId, rcl, scope); if (rcl != null && scope != null) { roomLeaveByScope(rcl, scope); } @@ -613,7 +600,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp */ public void roomLeaveByScope(Client client, IScope scope) { try { - log.debug("[roomLeaveByScope] currentClient " + client); + _log.debug("[roomLeaveByScope] currentClient " + client); Long roomId = client.getRoomId(); if (client.isScreenClient() && client.isStartStreaming()) { @@ -626,13 +613,13 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp whiteBoardService.removeUserFromAllLists(scope, client); } - log.debug("removing Username " + client.getUsername() + " " + _log.debug("removing Username " + client.getUsername() + " " + client.getConnectedSince() + " streamid: " + client.getStreamid()); // stop and save any recordings if (client.getIsRecording()) { - log.debug("*** roomLeave Current Client is Recording - stop that"); + _log.debug("*** roomLeave Current Client is Recording - stop that"); if (client.getInterviewPodId() != null) { //interview, TODO need better check _stopInterviewRecording(client, scope); @@ -648,7 +635,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp // Notify all clients of the same currentScope (room) with domain // and room except the current disconnected cause it could throw an exception - log.debug("currentScope " + scope); + _log.debug("currentScope " + scope); new MessageSender(scope, "roomDisconnect", client, this) { @Override @@ -672,7 +659,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp } sessionManager.removeClient(client.getStreamid(), null); } catch (Exception err) { - log.error("[roomLeaveByScope]", err); + _log.error("[roomLeaveByScope]", err); } } @@ -687,7 +674,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp @Override public void streamPublishStart(IBroadcastStream stream) { try { - log.debug("----------- streamPublishStart"); + _log.debug("----------- streamPublishStart"); IConnection current = Red5.getConnectionLocal(); final String streamid = current.getClient().getId(); final Client c = sessionManager.getClientByStreamId(streamid, null); @@ -697,7 +684,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp Client clientObjectSendToSync = c; // Notify all the clients that the stream had been started - log.debug("start streamPublishStart broadcast start: " + stream.getPublishedName() + " CONN " + current); + _log.debug("start streamPublishStart broadcast start: " + stream.getPublishedName() + " CONN " + current); // In case its a screen sharing we start a new Video for that if (c.isScreenClient()) { @@ -715,7 +702,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp sessionManager.updateClientByStreamId(streamid, c, false, null); } - log.debug("newStream SEND: " + c); + _log.debug("newStream SEND: " + c); // Notify all users of the same Scope // We need to iterate through the streams to catch if anybody is recording @@ -725,35 +712,35 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp Client rcl = sessionManager.getClientByStreamId(conn.getClient().getId(), null); if (rcl == null) { - log.debug("RCL IS NULL newStream SEND"); + _log.debug("RCL IS NULL newStream SEND"); return true; } - log.debug("check send to "+rcl); + _log.debug("check send to "+rcl); if (Strings.isEmpty(rcl.getPublicSID())) { - log.debug("publicSID IS NULL newStream SEND"); + _log.debug("publicSID IS NULL newStream SEND"); return true; } if (rcl.getIsRecording()) { - log.debug("RCL getIsRecording newStream SEND"); + _log.debug("RCL getIsRecording newStream SEND"); recordingService.addRecordingByStreamId(current, c, rcl.getRecordingId()); } if (rcl.isScreenClient()) { - log.debug("RCL getIsScreenClient newStream SEND"); + _log.debug("RCL getIsScreenClient newStream SEND"); return true; } if (rcl.getPublicSID().equals(c.getPublicSID())) { - log.debug("RCL publicSID is equal newStream SEND"); + _log.debug("RCL publicSID is equal newStream SEND"); return true; } - log.debug("RCL SEND is equal newStream SEND "+rcl.getPublicSID()+" || "+rcl.getUserport()); + _log.debug("RCL SEND is equal newStream SEND "+rcl.getPublicSID()+" || "+rcl.getUserport()); return false; } }.start(); } catch (Exception err) { - log.error("[streamPublishStart]", err); + _log.error("[streamPublishStart]", err); } } @@ -777,7 +764,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp @Override public void streamBroadcastClose(IBroadcastStream stream) { // Notify all the clients that the stream had been closed - log.debug("start streamBroadcastClose broadcast close: " + stream.getPublishedName()); + _log.debug("start streamBroadcastClose broadcast close: " + stream.getPublishedName()); try { IConnection current = Red5.getConnectionLocal(); String streamId = current.getClient().getId(); @@ -795,10 +782,10 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp } // Notify all the clients that the stream had been started - log.debug("streamBroadcastClose : " + rcl + " " + rcl.getStreamid()); + _log.debug("streamBroadcastClose : " + rcl + " " + rcl.getStreamid()); // this close stream event, stop the recording of this stream if (rcl.getIsRecording()) { - log.debug("*** +++++++ ######## sendClientBroadcastNotifications Any Client is Recording - stop that"); + _log.debug("*** +++++++ ######## sendClientBroadcastNotifications Any Client is Recording - stop that"); recordingService.stopRecordingShowForClient(current.getScope(), rcl); } if (stream.getPublishedName().equals("" + rcl.getBroadCastID())) { @@ -810,7 +797,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp // Notify all clients of the same scope (room) sendMessageToCurrentScope("closeStream", rcl, rcl.isMobile()); } catch (Exception e) { - log.error("[streamBroadcastClose]", e); + _log.error("[streamBroadcastClose]", e); } } @@ -826,13 +813,13 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp sendMessageToCurrentScope("newRed5ScreenCursor", cursor, true, false); } catch (Exception err) { - log.error("[setNewCursorPosition]", err); + _log.error("[setNewCursorPosition]", err); } } public long removeModerator(String publicSID) { try { - log.debug("----------- removeModerator: " + publicSID); + _log.debug("----------- removeModerator: " + publicSID); Client currentClient = sessionManager.getClientByPublicSID(publicSID, null); @@ -849,14 +836,14 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp sendMessageToCurrentScope("setNewModeratorByList", currentMods, true); } catch (Exception err) { - log.error("[removeModerator]", err); + _log.error("[removeModerator]", err); } return -1L; } public long switchMicMuted(String publicSID, boolean mute) { try { - log.debug("----------- switchMicMuted: " + publicSID); + _log.debug("----------- switchMicMuted: " + publicSID); Client currentClient = sessionManager.getClientByPublicSID(publicSID, null); if (currentClient == null) { @@ -871,7 +858,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp newMessage.put(1, currentClient); sendMessageWithClient(newMessage); } catch (Exception err) { - log.error("[switchMicMuted]", err); + _log.error("[switchMicMuted]", err); } return 0L; } @@ -886,7 +873,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp //Put the mod-flag to true for this client return currentClient.getMicMuted(); } catch (Exception err) { - log.error("[getMicMutedByPublicSID]",err); + _log.error("[getMicMutedByPublicSID]",err); } return true; } @@ -905,10 +892,10 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp public long setUserAVSettings(boolean updateBroadcastId) { try { String streamid = Red5.getConnectionLocal().getClient().getId(); - log.debug("----------- setUserAVSettings {}", streamid); + _log.debug("----------- setUserAVSettings {}", streamid); Client rcl = sessionManager.getClientByStreamId(streamid, null); if (rcl == null) { - log.warn("Failed to find appropriate clients"); + _log.warn("Failed to find appropriate clients"); return -1; } if (updateBroadcastId) { @@ -917,7 +904,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp } return rcl.getBroadCastID(); } catch (Exception err) { - log.error("[setUserAVSettings]", err); + _log.error("[setUserAVSettings]", err); } return -1; } @@ -950,7 +937,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp } } catch (Exception err) { - log.error("[checkRoomValues]", err); + _log.error("[checkRoomValues]", err); } return false; } @@ -989,7 +976,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp */ public RoomStatus setRoomValues(Long roomId, boolean becomeModerator, boolean isSuperModerator, String colorObj) { try { - log.debug("----------- setRoomValues"); + _log.debug("----------- setRoomValues"); IConnection current = Red5.getConnectionLocal(); String streamid = current.getClient().getId(); Client client = sessionManager.getClientByStreamId(streamid, null); @@ -1055,7 +1042,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp return roomStatus; } catch (Exception err) { - log.error("[setRoomValues]", err); + _log.error("[setRoomValues]", err); } return null; } @@ -1072,7 +1059,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp */ public Client setUsernameAndSession(String SID, Long userId, String username, String firstname, String lastname) { try { - log.debug("----------- setUsernameAndSession"); + _log.debug("----------- setUsernameAndSession"); IConnection current = Red5.getConnectionLocal(); String streamid = current.getClient().getId(); Client currentClient = sessionManager.getClientByStreamId(streamid, null); @@ -1083,7 +1070,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp currentClient.setUserObject(userId, username, firstname, lastname); // Update Session Data - log.debug("UDPATE SESSION " + SID + ", " + userId); + _log.debug("UDPATE SESSION " + SID + ", " + userId); sessiondataDao.updateUserWithoutSession(SID, userId); User user = userDao.get(userId); @@ -1104,7 +1091,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp sessionManager.updateClientByStreamId(streamid, currentClient, false, null); return currentClient; } catch (Exception err) { - log.error("[setUsername]", err); + _log.error("[setUsername]", err); } return null; } @@ -1120,7 +1107,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp Map<String, Client> roomClientList = new HashMap<>(); try { - log.debug("sendMessageByRoomAndDomain " + roomId); + _log.debug("sendMessageByRoomAndDomain " + roomId); IScope scope = getRoomScope(roomId.toString()); @@ -1132,7 +1119,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp } }.start(); } catch (Exception err) { - log.error("[getClientListBYRoomAndDomain]", err); + _log.error("[getClientListBYRoomAndDomain]", err); } return roomClientList; } @@ -1147,7 +1134,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp return sessionManager.getCurrentModeratorByRoom(roomId); } } catch (Exception err) { - log.error("[getCurrentModerator]", err); + _log.error("[getCurrentModerator]", err); } return null; } @@ -1165,7 +1152,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp Client client = sessionManager.getClientByStreamId(current.getClient().getId(), null); return sendToWhiteboard(client, whiteboardObjParam, whiteboardId); } catch (Exception err) { - log.error("[sendVarsByWhiteboardId]", err); + _log.error("[sendVarsByWhiteboardId]", err); return -1; } } @@ -1256,14 +1243,14 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp } } } catch (Exception err) { - log.error("[copyFileToCurrentRoom] ", err); + _log.error("[copyFileToCurrentRoom] ", err); } } public void sendToWhiteboard(String uid, Long wbId, FileItem fi, String url, boolean clean) { ClientSessionInfo csi = sessionManager.getClientByPublicSIDAnyServer(uid); if (csi == null) { - log.warn("No client was found to send Wml:: {}", uid); + _log.warn("No client was found to send Wml:: {}", uid); return; } Client client = csi.getRcl(); @@ -1352,7 +1339,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp sendToScope(roomId, "sendVarsToWhiteboardById", new Object[] { showDrawStatus ? client : null, sendObject }); } catch (Exception err) { - log.error("[sendToWhiteboard]", err); + _log.error("[sendToWhiteboard]", err); return -1; } return 1; @@ -1400,7 +1387,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp sendMessageToCurrentScope("sendVarsToMessage", newMessage, false); } catch (Exception err) { - log.error("[sendMessage]", err); + _log.error("[sendMessage]", err); } return 1; } @@ -1479,7 +1466,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp public void sendMessageToCurrentScope(final String method, final Object msg, final boolean sendSelf, final boolean sendScreen) { IConnection conn = Red5.getConnectionLocal(); if (conn == null) { - log.warn("[sendMessageToCurrentScope] -> 'Unable to send message using NULL connection' {}, {}", method, msg); + _log.warn("[sendMessageToCurrentScope] -> 'Unable to send message using NULL connection' {}, {}", method, msg); return; } sendMessageToCurrentScope(conn.getScope().getName(), method, msg, sendSelf, sendScreen); @@ -1529,10 +1516,10 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp public void run() { try { if (scope == null) { - log.debug("[MessageSender] -> 'Unable to send message to NULL scope' {}, {}", method, msg); + _log.debug("[MessageSender] -> 'Unable to send message to NULL scope' {}, {}", method, msg); } else { - if (log.isTraceEnabled()) { - log.trace("[MessageSender] -> 'sending message' {}, {}", method, msg); + if (_log.isTraceEnabled()) { + _log.trace("[MessageSender] -> 'sending message' {}, {}", method, msg); } // Send to all Clients of that Scope(Room) int count = 0; @@ -1545,12 +1532,12 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp count++; } } - if (log.isTraceEnabled()) { - log.trace("[MessageSender] -> 'sending message to {} clients, DONE' {}", count, method); + if (_log.isTraceEnabled()) { + _log.trace("[MessageSender] -> 'sending message to {} clients, DONE' {}", count, method); } } } catch (Exception err) { - log.error(String.format("[MessageSender -> %s, %s]", method, msg), err); + _log.error(String.format("[MessageSender -> %s, %s]", method, msg), err); } } } @@ -1565,7 +1552,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp sendMessageWithClientWithSyncObject(newMessage, true); } catch (Exception err) { - log.error("[sendMessageWithClient] ", err); + _log.error("[sendMessageWithClient] ", err); return -1; } return 1; @@ -1590,7 +1577,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp sendMessageToCurrentScope("sendVarsToMessageWithClient", hsm, sync); } catch (Exception err) { - log.error("[sendMessageWithClient] ", err); + _log.error("[sendMessageWithClient] ", err); return -1; } return 1; @@ -1606,7 +1593,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp */ public int sendMessageById(Object newMessage, String clientId, IScope scope) { try { - log.debug("### sendMessageById ###" + clientId); + _log.debug("### sendMessageById ###" + clientId); Map<String, Object> hsm = new HashMap<>(); hsm.put("message", newMessage); @@ -1622,7 +1609,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp } } } catch (Exception err) { - log.error("[sendMessageWithClient] ", err); + _log.error("[sendMessageWithClient] ", err); return -1; } return 1; @@ -1651,7 +1638,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp } } } catch (Exception err) { - log.error("[sendMessageWithClient] ", err); + _log.error("[sendMessageWithClient] ", err); return -1; } return 1; @@ -1660,7 +1647,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp public void sendMessageWithClientByPublicSID(Object message, String publicSID) { try { if (publicSID == null) { - log.warn("'null' publicSID was passed to sendMessageWithClientByPublicSID"); + _log.warn("'null' publicSID was passed to sendMessageWithClientByPublicSID"); return; } @@ -1692,7 +1679,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp // Scope not yet started } } catch (Exception err) { - log.error("[sendMessageWithClientByPublicSID] ", err); + _log.error("[sendMessageWithClientByPublicSID] ", err); } } @@ -1717,7 +1704,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp } } } catch (Exception err) { - log.error("[getInterviewRecordingStatus]", err); + _log.error("[getInterviewRecordingStatus]", err); } return false; } @@ -1729,7 +1716,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp @Deprecated public boolean startInterviewRecording() { try { - log.debug("----------- startInterviewRecording"); + _log.debug("----------- startInterviewRecording"); IConnection current = Red5.getConnectionLocal(); for (IConnection conn : current.getScope().getClientConnections()) { @@ -1760,7 +1747,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp } ((IServiceCapableConnection) conn).invoke("interviewStatus", new Object[] { interviewStatus }, this); - log.debug("-- startInterviewRecording " + interviewStatus); + _log.debug("-- startInterviewRecording " + interviewStatus); } } String recordingName = "Interview " + CalendarPatterns.getDateWithTimeByMiliSeconds(new Date()); @@ -1769,7 +1756,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp return true; } catch (Exception err) { - log.debug("[startInterviewRecording]", err); + _log.debug("[startInterviewRecording]", err); } return false; } @@ -1822,7 +1809,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp */ private boolean _stopInterviewRecording(Client currentClient, IScope currentScope) { try { - log.debug("----------- stopInterviewRecording"); + _log.debug("----------- stopInterviewRecording"); Long clientRecordingId = currentClient.getRecordingId(); for (IConnection conn : currentScope.getClientConnections()) { @@ -1832,7 +1819,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp } } if (clientRecordingId == null) { - log.debug("stopInterviewRecording:: unable to find recording client"); + _log.debug("stopInterviewRecording:: unable to find recording client"); return false; } @@ -1845,7 +1832,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp return true; } catch (Exception err) { - log.debug("[stopInterviewRecording]", err); + _log.debug("[stopInterviewRecording]", err); } return false; } @@ -1863,7 +1850,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp return sessionManager.getClientListByRoom(currentClient.getRoomId()); } catch (Exception err) { - log.debug("[getClientListScope]", err); + _log.debug("[getClientListScope]", err); } return new ArrayList<>(); } @@ -1915,7 +1902,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp public String getSipNumber(Double roomId) { Room r = roomDao.get(roomId.longValue()); if (r != null && r.getConfno() != null) { - log.debug("getSipNumber: roomId: {}, sipNumber: {}", new Object[]{roomId, r.getConfno()}); + _log.debug("getSipNumber: roomId: {}, sipNumber: {}", new Object[]{roomId, r.getConfno()}); return r.getConfno(); } return null; @@ -1931,45 +1918,34 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp } public synchronized int updateSipTransport() { - log.debug("----------- updateSipTransport"); + _log.debug("----------- updateSipTransport"); IConnection current = Red5.getConnectionLocal(); String streamid = current.getClient().getId(); Client client = sessionManager.getClientByStreamId(streamid, null); Long roomId = client.getRoomId(); Integer count = roomManager.getSipConferenceMembersNumber(roomId); String newNumber = getSipTransportLastname(count); - log.debug("getSipConferenceMembersNumber: " + newNumber); + _log.debug("getSipConferenceMembersNumber: " + newNumber); if (!newNumber.equals(client.getLastname())) { client.setLastname(newNumber); sessionManager.updateClientByStreamId(streamid, client, false, null); - log.debug("updateSipTransport: {}, {}, {}, {}, {}", new Object[] { client.getPublicSID(), client.getRoomId(), + _log.debug("updateSipTransport: {}, {}, {}, {}, {}", new Object[] { client.getPublicSID(), client.getRoomId(), client.getFirstname(), client.getLastname(), client.getAvsettings() }); sendMessageWithClient(new String[] { "personal", client.getFirstname(), client.getLastname() }); } return count != null && count > 0 ? count - 1 : 0; } - public void setSipTransport(Long roomId, String publicSID, String broadCastId) { - log.debug("----------- setSipTransport"); + public void setSipTransport(String broadCastId) { + _log.debug("----------- setSipTransport"); IConnection current = Red5.getConnectionLocal(); - IClient c = current.getClient(); - String streamid = c.getId(); + String streamid = current.getClient().getId(); // Notify all clients of the same scope (room) - Client currentClient = sessionManager.getClientByStreamId(streamid, null); - currentClient.setSipTransport(true); - currentClient.setRoomId(roomId); - currentClient.setRoomEnter(new Date()); - currentClient.setFirstname("SIP Transport"); - currentClient.setLastname(getSipTransportLastname(roomId)); - currentClient.setBroadCastID(Long.parseLong(broadCastId)); - currentClient.setIsBroadcasting(true); - currentClient.setPublicSID(publicSID); - currentClient.setVWidth(120); - currentClient.setVHeight(90); - currentClient.setPicture_uri("phone.png"); - sessionManager.updateClientByStreamId(streamid, currentClient, false, null); - SessionVariablesUtil.initClient(c, publicSID); - - sendMessageToCurrentScope("addNewUser", currentClient, false); + Client c = sessionManager.getClientByStreamId(streamid, null); + c.setLastname(getSipTransportLastname(c.getRoomId())); + c.setBroadCastID(Long.parseLong(broadCastId)); + sessionManager.updateClientByStreamId(streamid, c, false, null); + + sendMessageToCurrentScope("addNewUser", c, false); } } http://git-wip-us.apache.org/repos/asf/openmeetings/blob/a3f41b24/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/room/SipDao.java ---------------------------------------------------------------------- diff --git a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/room/SipDao.java b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/room/SipDao.java index c9865f4..0192b9a 100644 --- a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/room/SipDao.java +++ b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/room/SipDao.java @@ -40,6 +40,8 @@ public class SipDao { private static final Logger log = Red5LoggerFactory.getLogger(SipDao.class); public static final String ASTERISK_OM_FAMILY = "openmeetings"; public static final String ASTERISK_OM_KEY = "rooms"; + public static final Long SIP_USER_ID = -1L; + public static final String SIP_USER_NAME = "SIP Transport"; private String sipHostname; private int sipPort; private String sipUsername; http://git-wip-us.apache.org/repos/asf/openmeetings/blob/a3f41b24/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.java ---------------------------------------------------------------------- diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.java b/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.java index add10f2..2a5e608 100644 --- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.java +++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.java @@ -19,6 +19,7 @@ package org.apache.openmeetings.web.app; import static org.apache.openmeetings.core.util.WebSocketHelper.sendRoom; +import static org.apache.openmeetings.db.dao.room.SipDao.SIP_USER_ID; import static org.apache.openmeetings.util.OpenmeetingsVariables.HEADER_XFRAME_SAMEORIGIN; import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey; import static org.apache.openmeetings.util.OpenmeetingsVariables.wicketApplicationName; @@ -325,9 +326,11 @@ public class Application extends AuthenticatedWebApplication implements IApplica if (!getBean(SipDao.class).getUid().equals(rcl.getPublicSID())) { return null; } + rcl.setPicture_uri("phone.png"); //SipTransport enters the room - User u = new User(); //fake - u.setFirstname("SIP Transport"); //TODO check this + User u = new User(); + u.setId(SIP_USER_ID); + u.setFirstname(SipDao.SIP_USER_NAME); client = new Client(rcl, u); addOnlineUser(client); client.setCam(0); http://git-wip-us.apache.org/repos/asf/openmeetings/blob/a3f41b24/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/ActivitiesPanel.java ---------------------------------------------------------------------- diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/ActivitiesPanel.java b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/ActivitiesPanel.java index 7797bc7..b4b056e 100644 --- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/ActivitiesPanel.java +++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/ActivitiesPanel.java @@ -19,6 +19,8 @@ package org.apache.openmeetings.web.room.activities; import static org.apache.openmeetings.core.util.WebSocketHelper.sendRoom; +import static org.apache.openmeetings.db.dao.room.SipDao.SIP_USER_ID; +import static org.apache.openmeetings.db.dao.room.SipDao.SIP_USER_NAME; import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey; import static org.apache.openmeetings.web.app.Application.getBean; import static org.apache.openmeetings.web.app.Application.getOnlineClient; @@ -179,8 +181,13 @@ public class ActivitiesPanel extends BasePanel { decline.setVisible(false); break; } - User u = getBean(UserDao.class).get(a.getSender()); - String name = self ? getString("1362") : String.format("%s %s", u.getFirstname(), u.getLastname()); + String name; + if (SIP_USER_ID.equals(a.getSender())) { + name = SIP_USER_NAME; + } else { + User u = getBean(UserDao.class).get(a.getSender()); + name = self ? getString("1362") : String.format("%s %s", u.getFirstname(), u.getLastname()); + } switch (a.getType()) { case roomEnter: text = ""; // TODO should this be fixed?
