Skip to content

Commit

Permalink
record command; record messages
Browse files Browse the repository at this point in the history
  • Loading branch information
antobinary committed Jun 19, 2015
1 parent bdb56d4 commit 8b161e8
Show file tree
Hide file tree
Showing 12 changed files with 396 additions and 90 deletions.
Expand Up @@ -7,6 +7,8 @@
import org.bigbluebutton.common.messages.DeskShareEndedEventMessage;
import org.bigbluebutton.common.messages.DeskShareViewerJoinedEventMessage;
import org.bigbluebutton.common.messages.DeskShareViewerLeftEventMessage;
import org.bigbluebutton.common.messages.DeskShareStartRecordingEventMessage;
import org.bigbluebutton.common.messages.DeskShareStopRecordingEventMessage;
import org.bigbluebutton.common.messages.MessagingConstants;
import org.bigbluebutton.core.api.IBigBlueButtonInGW;

Expand All @@ -28,7 +30,7 @@ public void handleMessage(String pattern, String channel, String message) {
if (header.has("name")) {
String messageName = header.get("name").getAsString();

if (DeskShareStartedEventMessage.DESK_SHARE_STARTED_MESSAGE.equals(messageName)) {
if (DeskShareStartedEventMessage.DESKSHARE_STARTED_MESSAGE.equals(messageName)) {
DeskShareStartedEventMessage msg = DeskShareStartedEventMessage.fromJson(message);
// // TODO
} else if (DeskShareEndedEventMessage.DESK_SHARE_ENDED_MESSAGE.equals(messageName)) {
Expand All @@ -40,6 +42,14 @@ public void handleMessage(String pattern, String channel, String message) {
} else if (DeskShareViewerLeftEventMessage.DESK_SHARE_VIEWER_LEFT_MESSAGE.equals(messageName)) {
DeskShareViewerLeftEventMessage msg = DeskShareViewerLeftEventMessage.fromJson(message);
// // TODO
} else if (DeskShareStartRecordingEventMessage.DESKSHARE_START_RECORDING_MESSAGE.equals(messageName)) {
DeskShareStartRecordingEventMessage msg = DeskShareStartRecordingEventMessage.fromJson(message);
// // TODO
System.out.println("^^^^^^^START REC^^^^^^");
} else if (DeskShareStopRecordingEventMessage.DESKSHARE_STOP_RECORDING_MESSAGE.equals(messageName)) {
DeskShareStopRecordingEventMessage msg = DeskShareStopRecordingEventMessage.fromJson(message);
// // TODO
System.out.println("^^^^^^^STOP REC^^^^^^");
}
}
}
Expand Down
Expand Up @@ -24,6 +24,7 @@
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;

import org.bigbluebutton.freeswitch.voice.events.DeskShareRecordingEvent;
import org.bigbluebutton.freeswitch.voice.events.DeskShareStartedEvent;
import org.bigbluebutton.freeswitch.voice.events.DeskShareEndedEvent;
import org.bigbluebutton.freeswitch.voice.events.ConferenceEventListener;
Expand Down Expand Up @@ -102,6 +103,11 @@ public void run() {
DeskShareViewerLeftEvent evt = (DeskShareViewerLeftEvent) event;
System.out.println("************** FreeswitchConferenceEventListener DeskShareViewerLeftEvent");
vcs.deskShareViewerLeft(evt.getRoom(), evt.getCallerIdNum(), evt.getCallerIdName());
} else if (event instanceof DeskShareRecordingEvent) {
System.out.println("******** RECORDING******\n\n\n\n\n FreeswitchConferenceEventListener ");
DeskShareRecordingEvent evt = (DeskShareRecordingEvent) event;
System.out.println("************** FreeswitchConferenceEventListener DeskShareRecordingEvent");
vcs.deskShareRecording(evt.getRoom(), evt.getRecordingFilename(), evt.getRecord(), evt.getTimestamp());
}
}
};
Expand Down
Expand Up @@ -12,5 +12,6 @@ void userJoinedVoiceConf(String voiceConfId, String voiceUserId, String userId,
void deskShareEnded(String voiceConfId, String callerIdNum, String callerIdName);
void deskShareViewerJoined(String voiceConfId, String callerIdNum, String callerIdName);
void deskShareViewerLeft(String voiceConfId, String callerIdNum, String callerIdName);
void deskShareRecording(String room, String recordingFilename, boolean record, String timestamp);

}
@@ -0,0 +1,51 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2015 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/>.
*
*/
package org.bigbluebutton.freeswitch.voice.events;

public class DeskShareRecordingEvent extends VoiceConferenceEvent {

private String timestamp;
private String filename;
private boolean record;

public DeskShareRecordingEvent(String room, boolean record) {
super(room);
this.record = record;
}

public void setTimestamp(String timestamp) {
this.timestamp = timestamp;
}

public void setRecordingFilename(String filename) {
this.filename = filename;
}

public String getTimestamp() {
return timestamp;
}

public String getRecordingFilename() {
return filename;
}

public boolean getRecord() {
return record;
}
}
Expand Up @@ -25,6 +25,7 @@

import org.bigbluebutton.freeswitch.voice.events.ConferenceEventListener;
import org.bigbluebutton.freeswitch.voice.freeswitch.actions.BroadcastConferenceCommand;
import org.bigbluebutton.freeswitch.voice.freeswitch.actions.DeskShareRecordCommand;
import org.bigbluebutton.freeswitch.voice.freeswitch.actions.EjectAllUsersCommand;
import org.bigbluebutton.freeswitch.voice.freeswitch.actions.EjectUserCommand;
import org.bigbluebutton.freeswitch.voice.freeswitch.actions.MuteUserCommand;
Expand Down Expand Up @@ -143,5 +144,13 @@ public void record(RecordConferenceCommand rcc) {
EslMessage response = c.sendSyncApiCommand(rcc.getCommand(), rcc.getCommandArgs());
rcc.handleResponse(response, conferenceEventListener);
}
}
}

public void record(DeskShareRecordCommand dsrc) {
Client c = manager.getESLClient();
if (c.canSend()) {
EslMessage response = c.sendSyncApiCommand(dsrc.getCommand(), dsrc.getCommandArgs());
dsrc.handleResponse(response, conferenceEventListener);
}
}
}
Expand Up @@ -8,9 +8,11 @@

import org.bigbluebutton.freeswitch.voice.events.ConferenceEventListener;
import org.bigbluebutton.freeswitch.voice.events.DeskShareEndedEvent;
import org.bigbluebutton.freeswitch.voice.events.DeskShareRecordingEvent;
import org.bigbluebutton.freeswitch.voice.events.DeskShareStartedEvent;
import org.bigbluebutton.freeswitch.voice.events.DeskShareViewerJoinedEvent;
import org.bigbluebutton.freeswitch.voice.events.DeskShareViewerLeftEvent;
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;
Expand Down Expand Up @@ -177,32 +179,49 @@ public void conferenceEventThreadRun(String uniqueId, String confName, int confS

//@Override
public void conferenceEventRecord(String uniqueId, String confName, int confSize, EslEvent event) {
String action = event.getEventHeaders().get("Action");
if(action == null) {
String action = event.getEventHeaders().get("Action");

if(action == null) {
return;
}

System.out.println("Handling conferenceEventRecord " + action);

if (action.equals(START_RECORDING_EVENT)) {
VoiceStartRecordingEvent sre = new VoiceStartRecordingEvent(confName, true);
sre.setRecordingFilename(getRecordFilenameFromEvent(event));
sre.setTimestamp(genTimestamp().toString());

System.out.println("Voice conference recording started. file=[" + getRecordFilenameFromEvent(event) + "], conf=[" + confName + "]");

conferenceEventListener.handleConferenceEvent(sre);
} else if (action.equals(STOP_RECORDING_EVENT)) {
VoiceStartRecordingEvent srev = new VoiceStartRecordingEvent(confName, false);
srev.setRecordingFilename(getRecordFilenameFromEvent(event));
srev.setTimestamp(genTimestamp().toString());

System.out.println("Voice conference recording stopped. file=[" + getRecordFilenameFromEvent(event) + "], conf=[" + confName + "]");
conferenceEventListener.handleConferenceEvent(srev);
} else {
System.out.println("Processing UNKNOWN conference Action " + action + "]");
}

System.out.println("Handling conferenceEventRecord " + action);

if (action.equals(START_RECORDING_EVENT)) {
if (confName.endsWith(DESKSHARE_CONFERENCE_NAME_LABEL)){
DeskShareRecordingEvent dssre = new DeskShareRecordingEvent(confName, true);
dssre.setRecordingFilename(getRecordFilenameFromEvent(event));
dssre.setTimestamp(genTimestamp().toString());
System.out.println("DeskShare conference recording started. file=["
+ getRecordFilenameFromEvent(event) + "], conf=[" + confName + "]");
conferenceEventListener.handleConferenceEvent( (VoiceConferenceEvent)dssre);
} else {
VoiceStartRecordingEvent sre = new VoiceStartRecordingEvent(confName, true);
sre.setRecordingFilename(getRecordFilenameFromEvent(event));
sre.setTimestamp(genTimestamp().toString());
System.out.println("Voice conference recording started. file=["
+ getRecordFilenameFromEvent(event) + "], conf=[" + confName + "]");
conferenceEventListener.handleConferenceEvent(sre);
}
} else if (action.equals(STOP_RECORDING_EVENT)) {
if (confName.endsWith(DESKSHARE_CONFERENCE_NAME_LABEL)){
DeskShareRecordingEvent dssre = new DeskShareRecordingEvent(confName, false);
dssre.setRecordingFilename(getRecordFilenameFromEvent(event));
dssre.setTimestamp(genTimestamp().toString());
System.out.println("DeskShare conference recording stopped. file=["
+ getRecordFilenameFromEvent(event) + "], conf=[" + confName + "]");
conferenceEventListener.handleConferenceEvent( (VoiceConferenceEvent)dssre);
} else {
VoiceStartRecordingEvent sre = new VoiceStartRecordingEvent(confName, false);
sre.setRecordingFilename(getRecordFilenameFromEvent(event));
sre.setTimestamp(genTimestamp().toString());
System.out.println("Voice conference recording stopped. file=["
+ getRecordFilenameFromEvent(event) + "], conf=[" + confName + "]");
conferenceEventListener.handleConferenceEvent(sre);
}
} else {
System.out.println("Processing UNKNOWN conference Action " + action + "]");
}
}

private Long genTimestamp() {
Expand Down

0 comments on commit 8b161e8

Please sign in to comment.