From a7156aa0a6e10fdb128dc230861f1c8083934912 Mon Sep 17 00:00:00 2001 From: alexbbb Date: Mon, 12 Nov 2012 16:59:15 +0100 Subject: [PATCH] Modified API to be able to map conferences by their name instead of their voiceBridge number. To preserve backwards compatibility is sufficient to pass the voiceBridge number as the conference name in the API call. --- .../conference/BigBlueButtonApplication.java | 8 +++++++- .../conference/service/voice/VoiceHandler.java | 9 ++++++++- .../conference/service/voice/VoiceService.java | 16 ++++++++-------- .../web/controllers/ApiController.groovy | 7 +++---- 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/BigBlueButtonApplication.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/BigBlueButtonApplication.java index 85fd146ae7..449f6d4f0d 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/BigBlueButtonApplication.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/BigBlueButtonApplication.java @@ -87,6 +87,10 @@ public class BigBlueButtonApplication extends MultiThreadedApplicationAdapter { @Override public boolean roomConnect(IConnection connection, Object[] params) { + System.out.println("\n\nVOISMART: ROOM CONNECT\n\n"); + for (int i = 0; i < params.length; i++) { + System.out.println("VOISMART: Parameter " + (i+1) + ": " + params[i]); + } String remoteHost = Red5.getConnectionLocal().getRemoteAddress(); int remotePort = Red5.getConnectionLocal().getRemotePort(); String username = ((String) params[0]).toString(); @@ -98,7 +102,9 @@ public class BigBlueButtonApplication extends MultiThreadedApplicationAdapter { * equivalent (i.e. zero (0) becomes 48) if we don't. */ long clientID = Long.parseLong(Red5.getConnectionLocal().getClient().getId()); - String sessionName = connection.getScope().getName(); + //VOISMART + //String sessionName = connection.getScope().getName(); + String sessionName = ((String)params[3]).toString(); log.info("[clientid=" + clientID + "] connected from " + remoteHost + ":" + remotePort + "."); String voiceBridge = ((String) params[4]).toString(); diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceHandler.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceHandler.java index 3500e75c7e..79e7b41d6b 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceHandler.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceHandler.java @@ -79,11 +79,18 @@ public class VoiceHandler extends ApplicationAdapter implements IApplication{ @Override public boolean roomConnect(IConnection connection, Object[] params) { + System.out.println("\n\nVOISMART: roomConnect in VoiceHandler\n\n"); + + for (int i = 0; i < params.length; i++) { + System.out.println("Parameter " + i + ": " + params[i]); + } + log.debug(APP + ":roomConnect"); log.debug("In live mode"); ISharedObject so = getSharedObject(connection.getScope(), VOICE_SO); - String voiceBridge = getBbbSession().getVoiceBridge(); + String voiceBridge = getBbbSession().getSessionName(); + System.out.println("\n\nVOISMART: roomConnect voiceBridge (sessionName): " + voiceBridge); String meetingid = getBbbSession().getConference(); Boolean record = getBbbSession().getRecord(); diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceService.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceService.java index f332822cf9..daf2ca9958 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceService.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceService.java @@ -34,10 +34,10 @@ public class VoiceService { @SuppressWarnings("unchecked") public Map getMeetMeUsers() { - String voiceBridge = getBbbSession().getVoiceBridge(); + String confName = getBbbSession().getSessionName(); - log.debug("GetMeetmeUsers request for room[" + voiceBridge + "]"); - ArrayList p = conferenceService.getParticipants(voiceBridge); + log.debug("GetMeetmeUsers request for room[" + confName + "]"); + ArrayList p = conferenceService.getParticipants(confName); Map participants = new HashMap(); if (p == null) { @@ -71,30 +71,30 @@ public class VoiceService { } public void muteAllUsers(boolean mute) { - String conference = getBbbSession().getVoiceBridge(); + String conference = getBbbSession().getSessionName(); log.debug("Mute all users in room[" + conference + "]"); conferenceService.mute(conference, mute); } public boolean isRoomMuted(){ - String conference = getBbbSession().getVoiceBridge(); + String conference = getBbbSession().getSessionName(); return conferenceService.isRoomMuted(conference); } public void muteUnmuteUser(Integer userid,Boolean mute) { - String conference = getBbbSession().getVoiceBridge(); + String conference = getBbbSession().getSessionName(); log.debug("MuteUnmute request for user [" + userid + "] in room[" + conference + "]"); conferenceService.mute(userid, conference, mute); } public void lockMuteUser(Integer userid, Boolean lock) { - String conference = getBbbSession().getVoiceBridge(); + String conference = getBbbSession().getSessionName(); log.debug("Lock request for user [" + userid + "] in room[" + conference + "]"); conferenceService.lock(userid, conference, lock); } public void kickUSer(Integer userid) { - String conference = getBbbSession().getVoiceBridge(); + String conference = getBbbSession().getSessionName(); log.debug("KickUser " + userid + " from " + conference); conferenceService.eject(userid, conference); } diff --git a/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy b/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy index f84d646ac1..a16b9fb511 100755 --- a/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy +++ b/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy @@ -306,7 +306,7 @@ class ApiController { us.fullname = fullName us.role = role us.conference = meeting.getInternalId() - us.room = meeting.getInternalId() + us.room = meeting.getName() us.voicebridge = meeting.getTelVoice() us.webvoiceconf = meeting.getWebVoice() us.mode = "LIVE" @@ -717,8 +717,7 @@ class ApiController { } } else { - UserSession us = meetingService.getUserSession(session['user-token']); - log.info("Found conference for " + us.fullname) + UserSession us = meetingService.getUserSession(session['user-token']); response.addHeader("Cache-Control", "no-cache") withFormat { xml { @@ -1189,7 +1188,7 @@ class ApiController { } def respondWithConference(meeting, msgKey, msg) { - response.addHeader("Cache-Control", "no-cache") + response.addHeader("Cache-Control", "no-cache") withFormat { xml { log.debug "Rendering as xml"