diff --git a/bbb-lti/application.properties b/bbb-lti/application.properties index 90bff939f0ba3169fd230ed613a82cfff49d9c0e..2c7d2d179c37f43c999896cd8987b88bc5f7ef5f 100644 --- a/bbb-lti/application.properties +++ b/bbb-lti/application.properties @@ -1,6 +1,6 @@ #utf-8 #Wed Oct 10 08:34:02 PDT 2012 -app.version=0.1 +app.version=0.1.1 app.servlet.version=2.4 app.grails.version=1.1.1 plugins.hibernate=1.1.1 diff --git a/bbb-lti/grails-app/conf/lti.properties b/bbb-lti/grails-app/conf/lti.properties index 29332adf5929310ce4963126821fde288688f7d1..d65bd00afcccbe438a879149320057d6781d784b 100644 --- a/bbb-lti/grails-app/conf/lti.properties +++ b/bbb-lti/grails-app/conf/lti.properties @@ -21,17 +21,24 @@ # BigBlueButton integration information #---------------------------------------------------- # This URL is where the BBB client is accessible. -bigbluebuttonURL=http://localhost/bigbluebutton +#bigbluebuttonURL=http://localhost/bigbluebutton +bigbluebuttonURL=http://192.168.0.153/bigbluebutton # Salt which is used by 3rd-party apps to authenticate api calls -bigbluebuttonSalt=bbb_salt +#bigbluebuttonSalt=bbb_salt +bigbluebuttonSalt=e1f2f284119d5754cef6c80ba1e2f393 # LTI basic information #---------------------------------------------------- # This URL is where the LTI plugin is accessible. It can be a different server than the BigBluebutton one ltiEndPoint=http://localhost/lti/tool.xml # The list of consumers allowed to access this lti service. -# Format: {consumerId1:sharedSecret1[,consumerId2:sharedSecret2]} -ltiConsumers=bbb:lti_secret +# Format: {consumerId1:sharedSecret1}[,consumerId2:sharedSecret2] +#ltiConsumers=bbb:lti_secret +ltiConsumers=bbb:welcome +# The mode used to interact with BigBlueButton +# Format: [<simple>|extended] +ltiMode=extended + #---------------------------------------------------- # Inject configuration values into BigbluebuttonSrvice beans @@ -42,4 +49,5 @@ beans.bigbluebuttonService.salt=${bigbluebuttonSalt} # Inject configuration values into LtiSrvice beans beans.ltiService.endPoint=${ltiEndPoint} beans.ltiService.consumers=${ltiConsumers} +beans.ltiService.mode=${ltiMode} diff --git a/bbb-lti/grails-app/controllers/ToolController.groovy b/bbb-lti/grails-app/controllers/ToolController.groovy index ac04f94277c532c28fe099e8b7d863d2aa908a1a..5ec3bf477f08af41f7a01bf3ca56d95d79b0ffdf 100644 --- a/bbb-lti/grails-app/controllers/ToolController.groovy +++ b/bbb-lti/grails-app/controllers/ToolController.groovy @@ -74,8 +74,7 @@ class ToolController { String welcome = message(code: "bigbluebutton.welcome", args: ["\"{0}\"", "\"{1}\""]) log.debug "Localized default welcome message: [" + welcome + "]" - //String destinationURL = "http://www.bigbluebutton.org/" - String destinationURL = bigbluebuttonService.getJoinURL(params, welcome) + String destinationURL = bigbluebuttonService.getJoinURL(params, welcome, ltiService.mode) log.debug "redirecting to " + destinationURL if( destinationURL != null ) { @@ -193,6 +192,11 @@ class ToolController { hasAllParams = false; } + if (! ((Map<String, String>)params).containsKey(Parameter.RESOURCE_LINK_ID)) { + ((ArrayList<String>)missingParams).add(Parameter.RESOURCE_LINK_ID); + hasAllParams = false; + } + return hasAllParams } diff --git a/bbb-lti/grails-app/services/BigbluebuttonService.groovy b/bbb-lti/grails-app/services/BigbluebuttonService.groovy index 5bab076a1122b82b412a423e69179cd9c8ea44b5..d9a904039cc477da613b8d5474e557d636ece0fc 100644 --- a/bbb-lti/grails-app/services/BigbluebuttonService.groovy +++ b/bbb-lti/grails-app/services/BigbluebuttonService.groovy @@ -70,7 +70,7 @@ class BigbluebuttonService { } - public String getJoinURL(params, welcome){ + public String getJoinURL(params, welcome, mode){ //Set the injected values if( !url.equals(bbbProxy.url) && !url.equals("") ) bbbProxy.setUrl(url) if( !salt.equals(bbbProxy.salt) && !salt.equals("") ) bbbProxy.setSalt(salt) @@ -87,12 +87,21 @@ class BigbluebuttonService { String courseTitle = getValidatedCourseTitle(params.get(Parameter.COURSE_TITLE)) String userID = getValidatedUserId(params.get(Parameter.USER_ID)) + Integer voiceBridge = 0 + Boolean record = false + Integer duration = 0 + if( "extended".equals(mode) ){ + voiceBridge = getValidatedBBBVoiceBridge(params.get(Parameter.CUSTOM_BBB_VOICEBRIDGE)) + record = getValidatedBBBRecord(params.get(Parameter.CUSTOM_BBB_RECORD)) + duration = getValidatedBBBDuration(params.get(Parameter.CUSTOM_BBB_DURATION)) + } + String[] values = [meetingName, courseTitle] String welcomeMsg = MessageFormat.format(welcome, values) String meta = getMonitoringMetaData(params) - String createURL = getCreateURL( meetingName, meetingID, attendeePW, moderatorPW, welcomeMsg, logoutURL, meta ) + String createURL = getCreateURL( meetingName, meetingID, attendeePW, moderatorPW, welcomeMsg, voiceBridge, logoutURL, record, duration, meta ) //log.debug "createURL: " + createURL Map<String, Object> createResponse = doAPICall(createURL) //log.debug "createResponse: " + createResponse @@ -110,10 +119,10 @@ class BigbluebuttonService { } - private String getCreateURL(String name, String meetingID, String attendeePW, String moderatorPW, String welcome, String logoutURL, String meta ) { - Integer voiceBridge = 70000 + new Random(System.currentTimeMillis()).nextInt(10000); + private String getCreateURL(String name, String meetingID, String attendeePW, String moderatorPW, String welcome, Integer voiceBridge, String logoutURL, Boolean record, Integer duration, String meta ) { + voiceBridge = ( voiceBridge == null || voiceBridge == 0 )? 70000 + new Random(System.currentTimeMillis()).nextInt(10000): voiceBridge; - String url = bbbProxy.getCreateURL(name, meetingID, attendeePW, moderatorPW, welcome, "", voiceBridge.toString(), "", logoutURL, "", "", "", meta ); + String url = bbbProxy.getCreateURL(name, meetingID, attendeePW, moderatorPW, welcome, "", voiceBridge.toString(), "", logoutURL, "", record.toString(), duration.toString(), meta ); return url; } @@ -121,8 +130,8 @@ class BigbluebuttonService { return (meetingName == null || meetingName == "")? "Meeting": meetingName } - private String getValidatedMeetingId(String meetingId, String consumerId){ - return DigestUtils.shaHex(meetingId + consumerId) + private String getValidatedMeetingId(String resourceId, String consumerId){ + return DigestUtils.shaHex(resourceId + consumerId) } private String getValidatedLogoutURL(String logoutURL){ @@ -157,6 +166,18 @@ class BigbluebuttonService { return (userId == null)? "": userId } + private Integer getValidatedBBBVoiceBridge(String voiceBridge){ + return (voiceBridge != null )? voiceBridge.toInteger(): 0 + } + + private Boolean getValidatedBBBRecord(String record){ + return (record != null && record == "true")? true: false + } + + private Integer getValidatedBBBDuration(String duration){ + return (duration != null )? duration.toInteger(): 0 + } + private String getMonitoringMetaData(params){ String meta diff --git a/bbb-lti/grails-app/services/LtiService.groovy b/bbb-lti/grails-app/services/LtiService.groovy index fcb8b92406a4eb95b022634ad37544049432e9bd..9999219a4b26b0de47ed1a4c89b116a29c86d9af 100644 --- a/bbb-lti/grails-app/services/LtiService.groovy +++ b/bbb-lti/grails-app/services/LtiService.groovy @@ -28,6 +28,7 @@ class LtiService { def endPoint = "http://192.168.0.153/lti/tool.xml" def consumers = "demo:welcome" + def mode = "simple" Map<String, String> consumerMap private Map<String, String> getConsumer(consumerId) { diff --git a/bbb-lti/src/java/org/bigbluebutton/lti/Parameter.java b/bbb-lti/src/java/org/bigbluebutton/lti/Parameter.java index 64e46622d90ed8e76e1370891bd4e97f51799c8c..dc2d774589616e81117777f82d5f1b80403da7db 100644 --- a/bbb-lti/src/java/org/bigbluebutton/lti/Parameter.java +++ b/bbb-lti/src/java/org/bigbluebutton/lti/Parameter.java @@ -47,6 +47,10 @@ public class Parameter { public static final String TOOL_CONSUMER_INSTANCE_URL = "tool_consumer_instance_url"; public static final String CUSTOM_USER_ID = "custom_lis_person_sourcedid"; - + + //BigBlueButton custom parameters + public static final String CUSTOM_BBB_RECORD = "custom_bbb_record"; + public static final String CUSTOM_BBB_VOICEBRIDGE = "custom_bbb_voicebridge"; + public static final String CUSTOM_BBB_DURATION = "custom_bbb_duration"; }