diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceApp2x.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceApp2x.scala index 15aff65510c52b2b5c66c5f56b87f69b76ea23be..a7f07a4c0a385acaf6a22155685d7bd382109b90 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceApp2x.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceApp2x.scala @@ -8,7 +8,8 @@ trait VoiceApp2x extends UserJoinedVoiceConfEvtMsgHdlr with UserLeftVoiceConfEvtMsgHdlr with UserMutedInVoiceConfEvtMsgHdlr with UserTalkingInVoiceConfEvtMsgHdlr - with RecordingStartedVoiceConfEvtMsgHdlr { + with RecordingStartedVoiceConfEvtMsgHdlr + with VoiceConfRunningEvtMsgHdlr { this: MeetingActor => } diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceConfRunningEvtMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceConfRunningEvtMsgHdlr.scala new file mode 100755 index 0000000000000000000000000000000000000000..6ab49fc36d82fd27d228404308a41630a60e7148 --- /dev/null +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceConfRunningEvtMsgHdlr.scala @@ -0,0 +1,15 @@ +package org.bigbluebutton.core.apps.voice + +import org.bigbluebutton.common2.msgs.VoiceConfRunningEvtMsg +import org.bigbluebutton.core.running.{ BaseMeetingActor, LiveMeeting, OutMsgRouter } + +trait VoiceConfRunningEvtMsgHdlr { + this: BaseMeetingActor => + + val liveMeeting: LiveMeeting + val outGW: OutMsgRouter + + def handleVoiceConfRunningEvtMsg(msg: VoiceConfRunningEvtMsg): Unit = { + log.info("Received VoiceConfRunningEvtMsg " + msg.body.running) + } +} diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala index 90c2bb537faf8ddb834d1c5941bb4e6f17ee02e3..0a12204f2d6c31ac4cf0dc639da7321ed46ea81d 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala @@ -107,6 +107,8 @@ class ReceivedJsonMsgHandlerActor( // Voice case RecordingStartedVoiceConfEvtMsg.NAME => routeVoiceMsg[RecordingStartedVoiceConfEvtMsg](envelope, jsonNode) + case VoiceConfRunningEvtMsg.NAME => + routeVoiceMsg[VoiceConfRunningEvtMsg](envelope, jsonNode) case UserJoinedVoiceConfEvtMsg.NAME => routeVoiceMsg[UserJoinedVoiceConfEvtMsg](envelope, jsonNode) case UserLeftVoiceConfEvtMsg.NAME => diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala index a444195df9a790c4ee993cff68a1fbedc030f3f8..674e72e3120ce08c15dd0167fa927088c9ae5f3a 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala @@ -246,6 +246,7 @@ class MeetingActor( case m: MuteMeetingCmdMsg => handleMuteMeetingCmdMsg(m) case m: UserConnectedToGlobalAudioMsg => handleUserConnectedToGlobalAudioMsg(m) case m: UserDisconnectedFromGlobalAudioMsg => handleUserDisconnectedFromGlobalAudioMsg(m) + case m: VoiceConfRunningEvtMsg => handleVoiceConfRunningEvtMsg(m) // Layout case m: GetCurrentLayoutReqMsg => handleGetCurrentLayoutReqMsg(m) diff --git a/akka-bbb-fsesl/src/main/java/org/bigbluebutton/freeswitch/voice/FreeswitchConferenceEventListener.java b/akka-bbb-fsesl/src/main/java/org/bigbluebutton/freeswitch/voice/FreeswitchConferenceEventListener.java index 6bdb81c4a4f35280d00dc72d2d3ccfa2653eb030..00e4ad6a2456953902fd7c118a55a5059c182d86 100755 --- a/akka-bbb-fsesl/src/main/java/org/bigbluebutton/freeswitch/voice/FreeswitchConferenceEventListener.java +++ b/akka-bbb-fsesl/src/main/java/org/bigbluebutton/freeswitch/voice/FreeswitchConferenceEventListener.java @@ -1,21 +1,20 @@ /** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. -* -*/ + * BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ + * <p> + * Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). + * <p> + * This program is free software; you can redistribute it and/or modify it under the + * terms of the GNU Lesser General Public License as published by the Free Software + * Foundation; either version 3.0 of the License, or (at your option) any later + * version. + * <p> + * BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + * <p> + * You should have received a copy of the GNU Lesser General Public License along + * with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. + */ package org.bigbluebutton.freeswitch.voice; import java.util.concurrent.BlockingQueue; @@ -24,106 +23,100 @@ import java.util.concurrent.Executors; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; -import org.bigbluebutton.freeswitch.voice.events.ScreenshareStartedEvent; -import org.bigbluebutton.freeswitch.voice.events.DeskShareEndedEvent; -import org.bigbluebutton.freeswitch.voice.events.ConferenceEventListener; -import org.bigbluebutton.freeswitch.voice.events.ScreenshareRTMPBroadcastEvent; -import org.bigbluebutton.freeswitch.voice.events.VoiceConferenceEvent; -import org.bigbluebutton.freeswitch.voice.events.VoiceStartRecordingEvent; -import org.bigbluebutton.freeswitch.voice.events.VoiceUserJoinedEvent; -import org.bigbluebutton.freeswitch.voice.events.VoiceUserLeftEvent; -import org.bigbluebutton.freeswitch.voice.events.VoiceUserMutedEvent; -import org.bigbluebutton.freeswitch.voice.events.VoiceUserTalkingEvent; +import org.bigbluebutton.freeswitch.voice.events.*; public class FreeswitchConferenceEventListener implements ConferenceEventListener { - private static final int SENDERTHREADS = 1; - private static final Executor msgSenderExec = Executors.newFixedThreadPool(SENDERTHREADS); - private static final Executor runExec = Executors.newFixedThreadPool(SENDERTHREADS); - private BlockingQueue<VoiceConferenceEvent> messages = new LinkedBlockingQueue<VoiceConferenceEvent>(); + private static final int SENDERTHREADS = 1; + private static final Executor msgSenderExec = Executors.newFixedThreadPool(SENDERTHREADS); + private static final Executor runExec = Executors.newFixedThreadPool(SENDERTHREADS); + private BlockingQueue<VoiceConferenceEvent> messages = new LinkedBlockingQueue<VoiceConferenceEvent>(); - private volatile boolean sendMessages = false; - private final IVoiceConferenceService vcs; - - public FreeswitchConferenceEventListener(IVoiceConferenceService vcs) { - this.vcs = vcs; - } - - private void queueMessage(VoiceConferenceEvent event) { - try { - messages.offer(event, 5, TimeUnit.SECONDS); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + private volatile boolean sendMessages = false; + private final IVoiceConferenceService vcs; + + public FreeswitchConferenceEventListener(IVoiceConferenceService vcs) { + this.vcs = vcs; + } + + private void queueMessage(VoiceConferenceEvent event) { + try { + messages.offer(event, 5, TimeUnit.SECONDS); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } - - private void sendMessageToBigBlueButton(final VoiceConferenceEvent event) { - Runnable task = new Runnable() { - public void run() { - if (event instanceof VoiceUserJoinedEvent) { - VoiceUserJoinedEvent evt = (VoiceUserJoinedEvent) event; - vcs.userJoinedVoiceConf(evt.getRoom(), evt.getVoiceUserId(), evt.getUserId(), evt.getCallerIdName(), - evt.getCallerIdNum(), evt.getMuted(), evt.getSpeaking(), evt.getAvatarURL()); - } else if (event instanceof VoiceUserLeftEvent) { - VoiceUserLeftEvent evt = (VoiceUserLeftEvent) event; - vcs.userLeftVoiceConf(evt.getRoom(), evt.getUserId()); - } else if (event instanceof VoiceUserMutedEvent) { - VoiceUserMutedEvent evt = (VoiceUserMutedEvent) event; - vcs.userMutedInVoiceConf(evt.getRoom(), evt.getUserId(), evt.isMuted()); - } else if (event instanceof VoiceUserTalkingEvent) { - VoiceUserTalkingEvent evt = (VoiceUserTalkingEvent) event; - vcs.userTalkingInVoiceConf(evt.getRoom(), evt.getUserId(), evt.isTalking()); - } else if (event instanceof VoiceStartRecordingEvent) { - VoiceStartRecordingEvent evt = (VoiceStartRecordingEvent) event; - vcs.voiceConfRecordingStarted(evt.getRoom(), evt.getRecordingFilename(), evt.startRecord(), evt.getTimestamp()); - } else if (event instanceof ScreenshareStartedEvent) { - ScreenshareStartedEvent evt = (ScreenshareStartedEvent) event; - vcs.deskShareStarted(evt.getRoom(), evt.getCallerIdNum(), evt.getCallerIdName()); - } else if (event instanceof DeskShareEndedEvent) { - DeskShareEndedEvent evt = (DeskShareEndedEvent) event; - vcs.deskShareEnded(evt.getRoom(), evt.getCallerIdNum(), evt.getCallerIdName()); - } else if (event instanceof ScreenshareRTMPBroadcastEvent) { - if (((ScreenshareRTMPBroadcastEvent) event).getBroadcast()) { - ScreenshareRTMPBroadcastEvent evt = (ScreenshareRTMPBroadcastEvent) event; - vcs.deskShareRTMPBroadcastStarted(evt.getRoom(), evt.getBroadcastingStreamUrl(), - evt.getVideoWidth(), evt.getVideoHeight(), evt.getTimestamp()); - } else { - ScreenshareRTMPBroadcastEvent evt = (ScreenshareRTMPBroadcastEvent) event; - vcs.deskShareRTMPBroadcastStopped(evt.getRoom(), evt.getBroadcastingStreamUrl(), - evt.getVideoWidth(), evt.getVideoHeight(), evt.getTimestamp()); - } - } - } - }; + } + + private void sendMessageToBigBlueButton(final VoiceConferenceEvent event) { + Runnable task = new Runnable() { + public void run() { + if (event instanceof VoiceUserJoinedEvent) { + VoiceUserJoinedEvent evt = (VoiceUserJoinedEvent) event; + vcs.userJoinedVoiceConf(evt.getRoom(), evt.getVoiceUserId(), evt.getUserId(), evt.getCallerIdName(), + evt.getCallerIdNum(), evt.getMuted(), evt.getSpeaking(), evt.getAvatarURL()); + } else if (event instanceof VoiceConfRunningEvent) { + VoiceConfRunningEvent evt = (VoiceConfRunningEvent) event; + vcs.voiceConfRunning(evt.getRoom(), evt.isRunning()); + } else if (event instanceof VoiceUserLeftEvent) { + VoiceUserLeftEvent evt = (VoiceUserLeftEvent) event; + vcs.userLeftVoiceConf(evt.getRoom(), evt.getUserId()); + } else if (event instanceof VoiceUserMutedEvent) { + VoiceUserMutedEvent evt = (VoiceUserMutedEvent) event; + vcs.userMutedInVoiceConf(evt.getRoom(), evt.getUserId(), evt.isMuted()); + } else if (event instanceof VoiceUserTalkingEvent) { + VoiceUserTalkingEvent evt = (VoiceUserTalkingEvent) event; + vcs.userTalkingInVoiceConf(evt.getRoom(), evt.getUserId(), evt.isTalking()); + } else if (event instanceof VoiceStartRecordingEvent) { + VoiceStartRecordingEvent evt = (VoiceStartRecordingEvent) event; + vcs.voiceConfRecordingStarted(evt.getRoom(), evt.getRecordingFilename(), evt.startRecord(), evt.getTimestamp()); + } else if (event instanceof ScreenshareStartedEvent) { + ScreenshareStartedEvent evt = (ScreenshareStartedEvent) event; + vcs.deskShareStarted(evt.getRoom(), evt.getCallerIdNum(), evt.getCallerIdName()); + } else if (event instanceof DeskShareEndedEvent) { + DeskShareEndedEvent evt = (DeskShareEndedEvent) event; + vcs.deskShareEnded(evt.getRoom(), evt.getCallerIdNum(), evt.getCallerIdName()); + } else if (event instanceof ScreenshareRTMPBroadcastEvent) { + if (((ScreenshareRTMPBroadcastEvent) event).getBroadcast()) { + ScreenshareRTMPBroadcastEvent evt = (ScreenshareRTMPBroadcastEvent) event; + vcs.deskShareRTMPBroadcastStarted(evt.getRoom(), evt.getBroadcastingStreamUrl(), + evt.getVideoWidth(), evt.getVideoHeight(), evt.getTimestamp()); + } else { + ScreenshareRTMPBroadcastEvent evt = (ScreenshareRTMPBroadcastEvent) event; + vcs.deskShareRTMPBroadcastStopped(evt.getRoom(), evt.getBroadcastingStreamUrl(), + evt.getVideoWidth(), evt.getVideoHeight(), evt.getTimestamp()); + } + } + } + }; + + runExec.execute(task); + } + + public void start() { + sendMessages = true; + Runnable sender = new Runnable() { + public void run() { + while (sendMessages) { + VoiceConferenceEvent message; + try { + message = messages.take(); + sendMessageToBigBlueButton(message); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + }; + msgSenderExec.execute(sender); + } - runExec.execute(task); - } + public void stop() { + sendMessages = false; + } - public void start() { - sendMessages = true; - Runnable sender = new Runnable() { - public void run() { - while (sendMessages) { - VoiceConferenceEvent message; - try { - message = messages.take(); - sendMessageToBigBlueButton(message); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - }; - msgSenderExec.execute(sender); - } - - public void stop() { - sendMessages = false; - } - - public void handleConferenceEvent(VoiceConferenceEvent event) { - queueMessage(event); - } + public void handleConferenceEvent(VoiceConferenceEvent event) { + queueMessage(event); + } } diff --git a/akka-bbb-fsesl/src/main/java/org/bigbluebutton/freeswitch/voice/IVoiceConferenceService.java b/akka-bbb-fsesl/src/main/java/org/bigbluebutton/freeswitch/voice/IVoiceConferenceService.java index 0f0e2ab68736b2bfc8c1aac378db20b4eae602e6..dd7fb1d13ec486b94bd3fc136f480402b389b965 100755 --- a/akka-bbb-fsesl/src/main/java/org/bigbluebutton/freeswitch/voice/IVoiceConferenceService.java +++ b/akka-bbb-fsesl/src/main/java/org/bigbluebutton/freeswitch/voice/IVoiceConferenceService.java @@ -1,16 +1,27 @@ package org.bigbluebutton.freeswitch.voice; public interface IVoiceConferenceService { - void voiceConfRecordingStarted(String voiceConfId, String recordStream, Boolean recording, String timestamp); - void userJoinedVoiceConf(String voiceConfId, String voiceUserId, String userId, String callerIdName, - String callerIdNum, Boolean muted, Boolean speaking, String avatarURL); - void userLeftVoiceConf(String voiceConfId, String voiceUserId); - void userLockedInVoiceConf(String voiceConfId, String voiceUserId, Boolean locked); - void userMutedInVoiceConf(String voiceConfId, String voiceUserId, Boolean muted); - void userTalkingInVoiceConf(String voiceConfId, String voiceUserId, Boolean talking); - void deskShareStarted(String voiceConfId, String callerIdNum, String callerIdName); - void deskShareEnded(String voiceConfId, String callerIdNum, String callerIdName); - void deskShareRTMPBroadcastStarted(String room, String streamname, Integer videoWidth, Integer videoHeight, String timestamp); - void deskShareRTMPBroadcastStopped(String room, String streamname, Integer videoWidth, Integer videoHeight, String timestamp); + void voiceConfRecordingStarted(String voiceConfId, String recordStream, Boolean recording, String timestamp); + + void voiceConfRunning(String voiceConfId, Boolean running); + + void userJoinedVoiceConf(String voiceConfId, String voiceUserId, String userId, String callerIdName, + String callerIdNum, Boolean muted, Boolean speaking, String avatarURL); + + void userLeftVoiceConf(String voiceConfId, String voiceUserId); + + void userLockedInVoiceConf(String voiceConfId, String voiceUserId, Boolean locked); + + void userMutedInVoiceConf(String voiceConfId, String voiceUserId, Boolean muted); + + void userTalkingInVoiceConf(String voiceConfId, String voiceUserId, Boolean talking); + + void deskShareStarted(String voiceConfId, String callerIdNum, String callerIdName); + + void deskShareEnded(String voiceConfId, String callerIdNum, String callerIdName); + + void deskShareRTMPBroadcastStarted(String room, String streamname, Integer videoWidth, Integer videoHeight, String timestamp); + + void deskShareRTMPBroadcastStopped(String room, String streamname, Integer videoWidth, Integer videoHeight, String timestamp); } diff --git a/akka-bbb-fsesl/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceConfRunningEvent.java b/akka-bbb-fsesl/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceConfRunningEvent.java new file mode 100755 index 0000000000000000000000000000000000000000..1bdfe45572f916ab7fd1746c1516963a72644146 --- /dev/null +++ b/akka-bbb-fsesl/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceConfRunningEvent.java @@ -0,0 +1,32 @@ +/** + * BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ + * <p> + * Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). + * <p> + * This program is free software; you can redistribute it and/or modify it under the + * terms of the GNU Lesser General Public License as published by the Free Software + * Foundation; either version 3.0 of the License, or (at your option) any later + * version. + * <p> + * BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + * <p> + * You should have received a copy of the GNU Lesser General Public License along + * with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. + */ +package org.bigbluebutton.freeswitch.voice.events; + +public class VoiceConfRunningEvent extends VoiceConferenceEvent { + + private boolean running; + + public VoiceConfRunningEvent(String room, boolean running) { + super(room); + this.running = running; + } + + public boolean isRunning() { + return running; + } +} diff --git a/akka-bbb-fsesl/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/ESLEventListener.java b/akka-bbb-fsesl/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/ESLEventListener.java index b3ef985bebe875a8ca705bc86bea3bafaf454917..87f2aad2e63e2593d9e403779b4fa49a64b38b3a 100755 --- a/akka-bbb-fsesl/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/ESLEventListener.java +++ b/akka-bbb-fsesl/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/ESLEventListener.java @@ -18,6 +18,8 @@ public class ESLEventListener implements IEslEventListener { private static final String STOP_TALKING_EVENT = "stop-talking"; private static final String START_RECORDING_EVENT = "start-recording"; private static final String STOP_RECORDING_EVENT = "stop-recording"; + private static final String CONFERENCE_CREATED_EVENT = "conference-create"; + private static final String CONFERENCE_DESTROYED_EVENT = "conference-destroy"; private static final String SCREENSHARE_CONFERENCE_NAME_SUFFIX = "-SCREENSHARE"; @@ -119,19 +121,24 @@ public class ESLEventListener implements IEslEventListener { @Override public void conferenceEventAction(String uniqueId, String confName, int confSize, String action, EslEvent event) { - Integer memberId = this.getMemberIdFromEvent(event); - VoiceUserTalkingEvent pt; - if (action == null) { return; } if (action.equals(START_TALKING_EVENT)) { - pt = new VoiceUserTalkingEvent(memberId.toString(), confName, true); + Integer memberId = this.getMemberIdFromEvent(event); + VoiceUserTalkingEvent pt = new VoiceUserTalkingEvent(memberId.toString(), confName, true); conferenceEventListener.handleConferenceEvent(pt); } else if (action.equals(STOP_TALKING_EVENT)) { - pt = new VoiceUserTalkingEvent(memberId.toString(), confName, false); + Integer memberId = this.getMemberIdFromEvent(event); + VoiceUserTalkingEvent pt = new VoiceUserTalkingEvent(memberId.toString(), confName, false); conferenceEventListener.handleConferenceEvent(pt); + } else if (action.equals(CONFERENCE_CREATED_EVENT)) { + VoiceConfRunningEvent pt = new VoiceConfRunningEvent(confName, true); + conferenceEventListener.handleConferenceEvent(pt); + } else if (action.equals(CONFERENCE_DESTROYED_EVENT)) { + VoiceConfRunningEvent pt = new VoiceConfRunningEvent(confName, false); + conferenceEventListener.handleConferenceEvent(pt); } else { System.out.println("Unknown conference Action [" + action + "]"); } diff --git a/akka-bbb-fsesl/src/main/scala/org/bigbluebutton/freeswitch/VoiceConferenceService.scala b/akka-bbb-fsesl/src/main/scala/org/bigbluebutton/freeswitch/VoiceConferenceService.scala index b00b3acea22c1511fa2c23e0bf58f4708b48690a..909c25a4c200b8591c6524b8019d6d1fd8e5d379 100755 --- a/akka-bbb-fsesl/src/main/scala/org/bigbluebutton/freeswitch/VoiceConferenceService.scala +++ b/akka-bbb-fsesl/src/main/scala/org/bigbluebutton/freeswitch/VoiceConferenceService.scala @@ -23,6 +23,19 @@ class VoiceConferenceService(sender: RedisPublisher) extends IVoiceConferenceSer } + def voiceConfRunning(voiceConfId: String, running: java.lang.Boolean): Unit = { + println("*************######## Conference voiceConfId=" + voiceConfId + " running=" + running) + val header = BbbCoreVoiceConfHeader(VoiceConfRunningEvtMsg.NAME, voiceConfId) + val body = VoiceConfRunningEvtMsgBody(voiceConfId, running.booleanValue()) + val envelope = BbbCoreEnvelope(VoiceConfRunningEvtMsg.NAME, Map("voiceConf" -> voiceConfId)) + + val msg = new VoiceConfRunningEvtMsg(header, body) + val msgEvent = BbbCommonEnvCoreMsg(envelope, msg) + + val json = JsonUtil.toJson(msgEvent) + sender.publish(fromVoiceConfRedisChannel, json) + } + def userJoinedVoiceConf(voiceConfId: String, voiceUserId: String, userId: String, callerIdName: String, callerIdNum: String, muted: java.lang.Boolean, talking: java.lang.Boolean, avatarURL: String) { diff --git a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/VoiceConfMsgs.scala b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/VoiceConfMsgs.scala index d2de5ec711f8800e59dcc3ecd619b1f8ac6ae2ae..9521dad5fde810a94a331e0ed1df8d463f038266 100755 --- a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/VoiceConfMsgs.scala +++ b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/VoiceConfMsgs.scala @@ -228,6 +228,15 @@ case class MeetingMutedEvtMsgBody(muted: Boolean, mutedBy: String) callerNum: String, muted: Boolean, talking: Boolean, callingWith: String, listenOnly: Boolean) +/** + * Received from FS about the conference is running (created, destroyed). + */ +object VoiceConfRunningEvtMsg { val NAME = "VoiceConfRunningEvtMsg" } +case class VoiceConfRunningEvtMsg(header: BbbCoreVoiceConfHeader, + body: VoiceConfRunningEvtMsgBody) extends VoiceStandardMsg +case class VoiceConfRunningEvtMsgBody(voiceConf: String, running: Boolean) + + /** * Received from FS that user has left the voice conference. */ @@ -305,4 +314,4 @@ case class UserConnectedToGlobalAudioMsgBody(userId: String, name: String) object UserDisconnectedFromGlobalAudioMsg { val NAME = "UserDisconnectedFromGlobalAudioMsg" } case class UserDisconnectedFromGlobalAudioMsg(header: BbbCoreVoiceConfHeader, body: UserDisconnectedFromGlobalAudioMsgBody) extends VoiceStandardMsg -case class UserDisconnectedFromGlobalAudioMsgBody(userId: String, name: String) \ No newline at end of file +case class UserDisconnectedFromGlobalAudioMsgBody(userId: String, name: String) diff --git a/bbb-fsesl-client/src/main/java/org/freeswitch/esl/client/inbound/Client.java b/bbb-fsesl-client/src/main/java/org/freeswitch/esl/client/inbound/Client.java index 577aa36f64b437281c3d68e3edfd52b46016d2b1..482067ed8e4e2112c1945ed9316108e41029f593 100755 --- a/bbb-fsesl-client/src/main/java/org/freeswitch/esl/client/inbound/Client.java +++ b/bbb-fsesl-client/src/main/java/org/freeswitch/esl/client/inbound/Client.java @@ -25,7 +25,7 @@ import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; - +import java.util.Iterator; import org.freeswitch.esl.client.IEslEventListener; import org.freeswitch.esl.client.internal.IEslProtocolListener; import org.freeswitch.esl.client.transport.CommandResponse; @@ -461,18 +461,36 @@ public class Client String eventFunc = eventHeaders.get("Event-Calling-Function"); String uniqueId = eventHeaders.get("Caller-Unique-ID"); String confName = eventHeaders.get("Conference-Name"); + String eventAction = eventHeaders.get("Action"); int confSize = Integer.parseInt(eventHeaders.get("Conference-Size")); +/** + StringBuilder sb = new StringBuilder(""); + sb.append("\n"); + for (Iterator it = eventHeaders.entrySet().iterator(); it.hasNext(); ) { + Map.Entry entry = (Map.Entry)it.next(); + sb.append(entry.getKey()); + sb.append(" => '"); + sb.append(entry.getValue()); + sb.append("'\n"); + } - //FIXME: all by Action eventHeader really.... maybe? - // But this way we filter whole sections of Action events - if (eventFunc == null) { + System.out.println("##### Received Event for " + confName); + System.out.println("##### " + sb.toString()); +**/ + if (eventFunc == null || eventAction == null) { //Noop... + } else if (eventAction.equals("conference-create")) { + listener.conferenceEventAction(uniqueId, confName, confSize, eventAction, event); + return; + } else if (eventAction.equals("conference-destroy")) { + listener.conferenceEventAction(uniqueId, confName, confSize, eventAction, event); + return; } else if (eventFunc.equals("conference_thread_run")) { - System.out.println("##### Client conference_thread_run"); + System.out.println("##### Client conference_thread_run"); listener.conferenceEventThreadRun(uniqueId, confName, confSize, event); return; } else if (eventFunc.equals("member_add_file_data")) { - System.out.println("##### Client member_add_file_data"); + System.out.println("##### Client member_add_file_data"); listener.conferenceEventPlayFile(uniqueId, confName, confSize, event); return; } else if (eventFunc.equals("conf_api_sub_transfer") || eventFunc.equals("conference_api_sub_transfer")) { @@ -480,11 +498,11 @@ public class Client listener.conferenceEventTransfer(uniqueId, confName, confSize, event); return; } else if (eventFunc.equals("conference_add_member") || eventFunc.equals("conference_member_add")) { - System.out.println("##### Client conference_add_member"); + System.out.println("##### Client conference_add_member"); listener.conferenceEventJoin(uniqueId, confName, confSize, event); return; } else if (eventFunc.equals("conference_del_member") || eventFunc.equals("conference_member_del")) { - System.out.println("##### Client conference_del_member"); + System.out.println("##### Client conference_del_member"); listener.conferenceEventLeave(uniqueId, confName, confSize, event); return; } else if (eventFunc.equals("conf_api_sub_mute") || eventFunc.equals("conference_api_sub_mute")) { @@ -494,19 +512,20 @@ public class Client listener.conferenceEventUnMute(uniqueId, confName, confSize, event); return; } else if (eventFunc.equals("conference_record_thread_run")) { - System.out.println("##### Client conference_record_thread_run"); + System.out.println("##### Client conference_record_thread_run"); listener.conferenceEventRecord(uniqueId, confName, confSize, event); return; } else if (eventFunc.equals("conference_loop_input")) { - listener.conferenceEventAction(uniqueId, confName, confSize, eventHeaders.get("Action"), event); + listener.conferenceEventAction(uniqueId, confName, confSize, eventAction, event); return; } else if (eventFunc.equals("stop_talking_handler")) { - listener.conferenceEventAction(uniqueId, confName, confSize, eventHeaders.get("Action"), event); + listener.conferenceEventAction(uniqueId, confName, confSize, eventAction, event); return; - } else { - /* StringBuilder sb = new StringBuilder(""); + } else { + /** + StringBuilder sb = new StringBuilder(""); sb.append("\n"); - for (Iterator it=eventHeaders.entrySet().iterator(); it.hasNext(); ) { + for (Iterator it = eventHeaders.entrySet().iterator(); it.hasNext(); ) { Map.Entry entry = (Map.Entry)it.next(); sb.append(entry.getKey()); sb.append(" => '"); @@ -514,11 +533,11 @@ public class Client sb.append("'\n"); } log.info ("Unknown Conference Event [{}] [{}]", confName, sb.toString()); - */ + System.out.println("##### unhandled Event for " + confName); + System.out.println("##### " + sb.toString()); + **/ } } - - listener.eventReceived( event ); } catch ( Throwable t ) { log.error( "Error caught notifying listener of event [" + event + ']', t );