- 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
This commit is contained in:
Richard Alam 2010-01-04 16:22:53 +00:00
parent ed9cfd7240
commit dcea25fe5d
4 changed files with 41 additions and 18 deletions

View File

@ -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

View File

@ -36,7 +36,9 @@
</property>
</bean>
<bean id="asteriskAgi" class="org.bigbluebutton.pbx.asterisk.AsteriskAgiService" />
<bean id="asteriskAgi" class="org.bigbluebutton.pbx.asterisk.AsteriskAgiService">
<property name="dynamicConferenceService" ref="dynamicConferenceService"/>
</bean>
<!-- Spring Integration / JMS gateways -->
<bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">

View File

@ -26,24 +26,24 @@ import org.asteriskjava.fastagi.AgiRequest
import org.asteriskjava.fastagi.AgiScript
import java.util.Calendar
import org.bigbluebutton.web.domain.ScheduledSession
import org.bigbluebutton.web.services.DynamicConferenceService
class AsteriskAgiService implements AgiScript {
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)
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()
}
}
}
private void setConferenceNotFound() {
channel.setVariable("CONFERENCE_FOUND", "0")
}
}
}

View File

@ -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 {
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<DynamicConference> 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
}
}