From dcea25fe5d6b4e0ede6703f78484cfc43dd9e69c Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Mon, 4 Jan 2010 16:22:53 +0000 Subject: [PATCH] - fix AGI to query dynamic conference service if conference is not found from database. git-svn-id: http://bigbluebutton.googlecode.com/svn/trunk@3199 af16638f-c34d-0410-8cfa-b39d5352b314 --- .../grails-app/conf/bigbluebutton.properties | 1 - .../grails-app/conf/spring/resources.xml | 4 ++- .../pbx/asterisk/AsteriskAgiService.groovy | 35 ++++++++++++------- .../services/DynamicConferenceService.groovy | 19 +++++++--- 4 files changed, 41 insertions(+), 18 deletions(-) diff --git a/bigbluebutton-web/grails-app/conf/bigbluebutton.properties b/bigbluebutton-web/grails-app/conf/bigbluebutton.properties index 038ae4ab7e..ff2b07d296 100644 --- a/bigbluebutton-web/grails-app/conf/bigbluebutton.properties +++ b/bigbluebutton-web/grails-app/conf/bigbluebutton.properties @@ -36,7 +36,6 @@ maxConversionTime=5 maxNumPages=100 beans.presentationService.presentationDir=${presentationDir} - beans.adhocConferenceService.serviceEnabled=true beans.dynamicConferenceService.serviceEnabled=true beans.dynamicConferenceService.securitySalt=639259d4-9dd8-4b25-bf01-95f9567eaf4b diff --git a/bigbluebutton-web/grails-app/conf/spring/resources.xml b/bigbluebutton-web/grails-app/conf/spring/resources.xml index 784f4586c1..eba9dc54f4 100644 --- a/bigbluebutton-web/grails-app/conf/spring/resources.xml +++ b/bigbluebutton-web/grails-app/conf/spring/resources.xml @@ -36,7 +36,9 @@ - + + + diff --git a/bigbluebutton-web/grails-app/services/org/bigbluebutton/pbx/asterisk/AsteriskAgiService.groovy b/bigbluebutton-web/grails-app/services/org/bigbluebutton/pbx/asterisk/AsteriskAgiService.groovy index 9300caa3b8..85b1a305c4 100644 --- a/bigbluebutton-web/grails-app/services/org/bigbluebutton/pbx/asterisk/AsteriskAgiService.groovy +++ b/bigbluebutton-web/grails-app/services/org/bigbluebutton/pbx/asterisk/AsteriskAgiService.groovy @@ -26,24 +26,24 @@ import org.asteriskjava.fastagi.AgiRequest import org.asteriskjava.fastagi.AgiScript import java.util.Calendar - import org.bigbluebutton.web.domain.ScheduledSession - -class AsteriskAgiService implements AgiScript { +import org.bigbluebutton.web.services.DynamicConferenceService + + +public class AsteriskAgiService implements AgiScript { private long _10_minutes = 10*60*1000 + def dynamicConferenceService public void service(AgiRequest request, AgiChannel channel) throws AgiException { def number = request.getParameter("conference") log.debug "Looking for conference $number" - def conf = ScheduledSession.findByVoiceConferenceBridge(number) - + if (conf) { - log.debug("found conference " + conf.name) - + log.debug("found conference " + conf.name) def startTime = conf.startDateTime.time - _10_minutes def endTime = conf.endDateTime.time + _10_minutes def now = new Date() @@ -55,11 +55,22 @@ class AsteriskAgiService implements AgiScript { channel.setVariable("CONFERENCE_FOUND", number) } else { log.debug("The conference $number has no schedule at this moment") - channel.setVariable("CONFERENCE_FOUND", "0") + setConferenceNotFound() + } + } else { + log.debug "Cannot find conference from database. Looking in Dynamic conference" + if (dynamicConferenceService == null) log.error "dynamicConferenceService is NULL" + if (dynamicConferenceService.isMeetingWithVoiceBridgeExist(number)) { + log.debug("Setting channel var CONFERENCE_FOUND to $number") + channel.setVariable("CONFERENCE_FOUND", number) + } else { + log.debug("Could not find conference $number") + setConferenceNotFound() } - } else { - log.debug("Could not find conference $number") - channel.setVariable("CONFERENCE_FOUND", "0") } - } + } + + private void setConferenceNotFound() { + channel.setVariable("CONFERENCE_FOUND", "0") + } } \ No newline at end of file diff --git a/bigbluebutton-web/grails-app/services/org/bigbluebutton/web/services/DynamicConferenceService.groovy b/bigbluebutton-web/grails-app/services/org/bigbluebutton/web/services/DynamicConferenceService.groovy index 34a6a0153b..f2b5bc500c 100644 --- a/bigbluebutton-web/grails-app/services/org/bigbluebutton/web/services/DynamicConferenceService.groovy +++ b/bigbluebutton-web/grails-app/services/org/bigbluebutton/web/services/DynamicConferenceService.groovy @@ -21,11 +21,10 @@ package org.bigbluebutton.web.services import java.util.concurrent.ConcurrentHashMap - +import java.util.Collection import org.bigbluebutton.api.domain.DynamicConference; - -public class DynamicConferenceService { - + +public class DynamicConferenceService { boolean transactional = false def serviceEnabled = false def securitySalt = null; @@ -88,4 +87,16 @@ public class DynamicConferenceService { log.debug "found conference and set end date" } } + + public boolean isMeetingWithVoiceBridgeExist(String voiceBridge) { + Collection confs = confsByMtgID.values() + for (DynamicConference c : confs) { + if (voiceBridge == c.voiceBridge) { + log.debug "Found voice bridge $voiceBridge" + return true + } + } + log.debug "could not find voice bridge $voiceBridge" + return false + } }