Creates config activityReportTracking to enable Activity Report

This commit is contained in:
Gustavo Trott 2021-07-22 11:09:44 -03:00
parent 1267bfd880
commit 3c6155a73e
13 changed files with 95 additions and 37 deletions

View File

@ -161,20 +161,17 @@ class ActivityTrackerActor(
private def handleUserJoinedMeetingEvtMsg(msg: UserJoinedMeetingEvtMsg): Unit = {
val meeting: MeetingActivityTracker = meetings.values.find(m => m.intId == msg.header.meetingId)
.getOrElse({
MeetingActivityTracker(
msg.header.meetingId, msg.header.meetingId, msg.header.meetingId, Map()
)
})
for {
meeting <- meetings.values.find(m => m.intId == msg.header.meetingId)
} yield {
val user: UserActivityTracker = meeting.users.values.find(u => u.intId == msg.body.intId).getOrElse({
UserActivityTracker(
msg.body.intId, msg.body.extId, msg.body.name
)
})
val user: UserActivityTracker = meeting.users.values.find(u => u.intId == msg.body.intId).getOrElse({
UserActivityTracker(
msg.body.intId, msg.body.extId, msg.body.name
)
})
meetings += (meeting.intId -> meeting.copy(users = meeting.users + (user.intId -> user.copy(leftOn = 0))))
meetings += (meeting.intId -> meeting.copy(users = meeting.users + (user.intId -> user.copy(leftOn = 0))))
}
}
private def handleUserLeftMeetingEvtMsg(msg: UserLeftMeetingEvtMsg): Unit = {
@ -340,23 +337,31 @@ class ActivityTrackerActor(
}
private def handleCreateMeetingReqMsg(msg: CreateMeetingReqMsg): Unit = {
val newMeeting = MeetingActivityTracker(
msg.body.props.meetingProp.intId,
msg.body.props.meetingProp.extId,
msg.body.props.meetingProp.name,
)
if(msg.body.props.meetingProp.activityReportTracking) {
val newMeeting = MeetingActivityTracker(
msg.body.props.meetingProp.intId,
msg.body.props.meetingProp.extId,
msg.body.props.meetingProp.name,
)
meetings += (newMeeting.intId -> newMeeting)
meetings += (newMeeting.intId -> newMeeting)
log.info("ActivityTracker created for meeting {}.",msg.body.props.meetingProp.intId)
} else {
log.info("ActivityTracker disabled for meeting {}.",msg.body.props.meetingProp.intId)
}
}
private def handleMeetingEndingEvtMsg(msg: MeetingEndingEvtMsg): Unit = {
for {
meeting <- meetings.values.find(m => m.intId == msg.body.meetingId)
} yield {
meeting.users.map(user => {
log.info(user._2.toString)
})
//Send report one last time
sendPeriodicReport()
meetings = meetings.-(meeting.intId)
log.info("ActivityTracker removed for meeting {}.",meeting.intId)
}
}
@ -365,6 +370,8 @@ class ActivityTrackerActor(
val activityJson: String = JsonUtil.toJson(meeting._2)
val event = MsgBuilder.buildActivityReportEvtMsg(meeting._2.intId, activityJson)
outGW.send(event)
log.info("Activity Report sent for meeting {}: {}",meeting._2.intId,activityJson)
})
}

View File

@ -8,7 +8,7 @@ case class DurationProps(duration: Int, createdTime: Long, createdDate: String,
userActivitySignResponseDelayInMinutes: Int,
endWhenNoModerator: Boolean, endWhenNoModeratorDelayInMinutes: Int)
case class MeetingProp(name: String, extId: String, intId: String, isBreakout: Boolean)
case class MeetingProp(name: String, extId: String, intId: String, isBreakout: Boolean, activityReportTracking: Boolean)
case class BreakoutProps(
parentId: String,

View File

@ -29,12 +29,18 @@ public class ActivityService {
private static String activitiesDir = "/var/bigbluebutton/activity-report";
public void writeActivityJsonFile(String meetingId, String activityReportAccessToken, String activityJson) {
File baseDir = new File(this.getDestinationBaseDirectoryName(meetingId,activityReportAccessToken));
if (!baseDir.exists()) baseDir.mkdirs();
File jsonFile = new File(baseDir.getAbsolutePath() + File.separatorChar + "activity_report.json");
try {
if(activityReportAccessToken.length() == 0) {
log.error("ActivityReport AccessToken not found. JSON file will not be saved for meeting {}.",meetingId);
return;
}
File baseDir = new File(this.getDestinationBaseDirectoryName(meetingId,activityReportAccessToken));
if (!baseDir.exists()) baseDir.mkdirs();
File jsonFile = new File(baseDir.getAbsolutePath() + File.separatorChar + "activity_report.json");
FileOutputStream fileOutput = new FileOutputStream(jsonFile);
fileOutput.write(activityJson.getBytes());

View File

@ -54,6 +54,7 @@ public class ApiParams {
public static final String SEQUENCE = "sequence";
public static final String VOICE_BRIDGE = "voiceBridge";
public static final String WEB_VOICE = "webVoice";
public static final String ACTIVITY_REPORT_TRACKING = "activityReportTracking";
public static final String WEBCAMS_ONLY_FOR_MODERATOR = "webcamsOnlyForModerator";
public static final String WELCOME = "welcome";
public static final String HTML5_INSTANCE_ID = "html5InstanceId";

View File

@ -401,7 +401,8 @@ public class MeetingService implements MessageListener {
gw.createMeeting(m.getInternalId(), m.getExternalId(), m.getParentMeetingId(), m.getName(), m.isRecord(),
m.getTelVoice(), m.getDuration(), m.getAutoStartRecording(), m.getAllowStartStopRecording(),
m.getWebcamsOnlyForModerator(), m.getModeratorPassword(), m.getViewerPassword(), m.getActivityReportAccessToken(), m.getCreateTime(),
m.getWebcamsOnlyForModerator(), m.getModeratorPassword(), m.getViewerPassword(),
m.getActivityReportTracking(), m.getActivityReportAccessToken(), m.getCreateTime(),
formatPrettyDate(m.getCreateTime()), m.isBreakout(), m.getSequence(), m.isFreeJoin(), m.getMetadata(),
m.getGuestPolicy(), m.getAuthenticatedGuest(), m.getWelcomeMessageTemplate(), m.getWelcomeMessage(), m.getModeratorOnlyMessage(),
m.getDialNumber(), m.getMaxUsers(),

View File

@ -81,6 +81,7 @@ public class ParamsProcessorUtil {
private boolean disableRecordingDefault;
private boolean autoStartRecording;
private boolean allowStartStopRecording;
private boolean activityReportTracking;
private boolean webcamsOnlyForModerator;
private boolean defaultMuteOnStart = false;
private boolean defaultAllowModsToUnmuteUsers = false;
@ -344,9 +345,6 @@ public class ParamsProcessorUtil {
String viewerPass = processPassword(params.get(ApiParams.ATTENDEE_PW));
String modPass = processPassword(params.get(ApiParams.MODERATOR_PW));
//Generate token to access Activity Report
String activityReportAccessToken = RandomStringUtils.randomAlphanumeric(12).toLowerCase();
// Get the digits for voice conference for users joining through the
// phone.
// If none is provided, generate one.
@ -417,6 +415,28 @@ public class ParamsProcessorUtil {
}
}
boolean activityReportTrack = activityReportTracking;
if (!StringUtils.isEmpty(params.get(ApiParams.ACTIVITY_REPORT_TRACKING))) {
try {
activityReportTrack = Boolean.parseBoolean(params
.get(ApiParams.ACTIVITY_REPORT_TRACKING));
} catch (Exception ex) {
log.warn(
"Invalid param [activityReportTracking] for meeting=[{}]",
internalMeetingId);
}
}
log.info("activityReportTrack--------------------------------");
log.info("activityReportTrack--------------------------------");
log.info(activityReportTrack ? "true" : "false");
//Generate token to access Activity Report
String activityReportAccessToken = "";
if(activityReportTrack == true) {
activityReportAccessToken = RandomStringUtils.randomAlphanumeric(12).toLowerCase();
}
boolean webcamsOnlyForMod = webcamsOnlyForModerator;
if (!StringUtils.isEmpty(params.get(ApiParams.WEBCAMS_ONLY_FOR_MODERATOR))) {
try {
@ -508,6 +528,7 @@ public class ParamsProcessorUtil {
.withLockSettingsParams(lockSettingsParams)
.withAllowDuplicateExtUserid(defaultAllowDuplicateExtUserid)
.withHTML5InstanceId(html5InstanceId)
.withActivityReportTracking(activityReportTrack)
.withActivityReportAccessToken(activityReportAccessToken)
.build();
@ -898,6 +919,10 @@ public class ParamsProcessorUtil {
this.allowStartStopRecording = allowStartStopRecording;
}
public void setActivityReportTracking(boolean activityReportTracking) {
this.activityReportTracking = activityReportTracking;
}
public void setWebcamsOnlyForModerator(boolean webcamsOnlyForModerator) {
this.webcamsOnlyForModerator = webcamsOnlyForModerator;
}

View File

@ -51,6 +51,7 @@ public class Meeting {
private String webVoice;
private String moderatorPass;
private String viewerPass;
private Boolean activityReportTracking;
private String activityReportAccessToken;
private String welcomeMsgTemplate;
private String welcomeMsg;
@ -108,6 +109,7 @@ public class Meeting {
intMeetingId = builder.internalId;
viewerPass = builder.viewerPass;
moderatorPass = builder.moderatorPass;
activityReportTracking = builder.activityReportTracking;
activityReportAccessToken = builder.activityReportAccessToken;
maxUsers = builder.maxUsers;
bannerColor = builder.bannerColor;
@ -326,6 +328,9 @@ public class Meeting {
return viewerPass;
}
public Boolean getActivityReportTracking() {
return activityReportTracking;
}
public String getActivityReportAccessToken() {
return activityReportAccessToken;
}
@ -710,6 +715,7 @@ public class Meeting {
private boolean webcamsOnlyForModerator;
private String moderatorPass;
private String viewerPass;
private Boolean activityReportTracking;
private String activityReportAccessToken;
private int duration;
private String webVoice;
@ -800,8 +806,13 @@ public class Meeting {
return this;
}
public Builder withActivityReportAccessToken(String p) {
this.activityReportAccessToken = p;
public Builder withActivityReportTracking(Boolean e) {
this.activityReportTracking = e;
return this;
}
public Builder withActivityReportAccessToken(String t) {
this.activityReportAccessToken = t;
return this;
}

View File

@ -18,6 +18,7 @@ public class CreateMeetingMessage {
public final String moderatorPass;
public final String viewerPass;
public final String activityReportAccessToken;
public final Boolean activityReportTracking;
public final Long createTime;
public final String createDate;
public final Map<String, String> metadata;
@ -26,7 +27,7 @@ public class CreateMeetingMessage {
String voiceBridge, Long duration,
Boolean autoStartRecording, Boolean allowStartStopRecording,
Boolean webcamsOnlyForModerator, String moderatorPass,
String viewerPass, String activityReportAccessToken,
String viewerPass, String activityReportAccessToken, Boolean activityReportTracking,
Long createTime, String createDate, Map<String, String> metadata) {
this.id = id;
this.externalId = externalId;
@ -40,6 +41,7 @@ public class CreateMeetingMessage {
this.moderatorPass = moderatorPass;
this.viewerPass = viewerPass;
this.activityReportAccessToken = activityReportAccessToken;
this.activityReportTracking = activityReportTracking;
this.createTime = createTime;
this.createDate = createDate;
this.metadata = metadata;

View File

@ -17,7 +17,7 @@ public interface IBbbWebApiGWApp {
String parentMeetingID, String meetingName, Boolean recorded,
String voiceBridge, Integer duration, Boolean autoStartRecording,
Boolean allowStartStopRecording, Boolean webcamsOnlyForModerator,
String moderatorPass, String viewerPass, String activityReportAccessToken, Long createTime,
String moderatorPass, String viewerPass, Boolean activityReportTracking, String activityReportAccessToken, Long createTime,
String createDate, Boolean isBreakout, Integer sequence, Boolean freejoin, Map<String, String> metadata,
String guestPolicy, Boolean authenticatedGuest, String welcomeMsgTemplate, String welcomeMsg, String modOnlyMessage,
String dialNumber, Integer maxUsers,

View File

@ -124,7 +124,7 @@ class BbbWebApiGWApp(
recorded: java.lang.Boolean, voiceBridge: String, duration: java.lang.Integer,
autoStartRecording: java.lang.Boolean,
allowStartStopRecording: java.lang.Boolean, webcamsOnlyForModerator: java.lang.Boolean,
moderatorPass: String, viewerPass: String, activityReportAccessToken: String,
moderatorPass: String, viewerPass: String, activityReportTracking: java.lang.Boolean, activityReportAccessToken: String,
createTime: java.lang.Long, createDate: String, isBreakout: java.lang.Boolean,
sequence: java.lang.Integer,
freeJoin: java.lang.Boolean,
@ -146,7 +146,7 @@ class BbbWebApiGWApp(
html5InstanceId: java.lang.Integer): Unit = {
val meetingProp = MeetingProp(name = meetingName, extId = extMeetingId, intId = meetingId,
isBreakout = isBreakout.booleanValue())
isBreakout = isBreakout.booleanValue(), activityReportTracking = activityReportTracking.booleanValue())
val durationProps = DurationProps(
duration = duration.intValue(),
createdTime = createTime.longValue(), createDate,

View File

@ -51,6 +51,7 @@ export default function addMeeting(meeting) {
intId: String,
extId: String,
isBreakout: Boolean,
activityReportTracking: Boolean,
name: String,
},
usersProp: {

View File

@ -238,6 +238,9 @@ autoStartRecording=false
# Allow the user to start/stop recording.
allowStartStopRecording=true
# this is the default value, can be customized using the create API
activityReportTracking=false
# Allow webcams streaming reception only to and from moderators
webcamsOnlyForModerator=false

View File

@ -151,6 +151,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<property name="disableRecordingDefault" value="${disableRecordingDefault}"/>
<property name="autoStartRecording" value="${autoStartRecording}"/>
<property name="allowStartStopRecording" value="${allowStartStopRecording}"/>
<property name="activityReportTracking" value="${activityReportTracking}"/>
<property name="webcamsOnlyForModerator" value="${webcamsOnlyForModerator}"/>
<property name="useDefaultAvatar" value="${useDefaultAvatar}"/>
<property name="defaultAvatarURL" value="${defaultAvatarURL}"/>