forked from External/greenlight
add more information to recording ready email
This commit is contained in:
parent
78a2f33f2d
commit
7e16f042a5
|
@ -263,6 +263,7 @@ class BbbController < ApplicationController
|
||||||
token = event['payload']['metadata'][META_TOKEN]
|
token = event['payload']['metadata'][META_TOKEN]
|
||||||
room_id = event['payload']['metadata']['room-id']
|
room_id = event['payload']['metadata']['room-id']
|
||||||
record_id = event['payload']['meeting_id']
|
record_id = event['payload']['meeting_id']
|
||||||
|
duration_data = event['payload']['duration']
|
||||||
|
|
||||||
# the webhook event doesn't have all the data we need, so we need
|
# the webhook event doesn't have all the data we need, so we need
|
||||||
# to send a getRecordings anyway
|
# to send a getRecordings anyway
|
||||||
|
@ -271,6 +272,8 @@ class BbbController < ApplicationController
|
||||||
rec_info = rec_info[:recordings].first
|
rec_info = rec_info[:recordings].first
|
||||||
RecordingCreatedJob.perform_later(token, room_id, parse_recording_for_view(rec_info))
|
RecordingCreatedJob.perform_later(token, room_id, parse_recording_for_view(rec_info))
|
||||||
|
|
||||||
|
rec_info[:duration] = duration_data.to_json
|
||||||
|
|
||||||
# send an email to the owner of this recording, if defined
|
# send an email to the owner of this recording, if defined
|
||||||
if Rails.configuration.mail_notifications
|
if Rails.configuration.mail_notifications
|
||||||
owner = User.find_by(encrypted_id: room_id)
|
owner = User.find_by(encrypted_id: room_id)
|
||||||
|
|
|
@ -263,7 +263,8 @@ module BbbApi
|
||||||
listed: recording[:listed],
|
listed: recording[:listed],
|
||||||
playbacks: playbacks,
|
playbacks: playbacks,
|
||||||
previews: previews,
|
previews: previews,
|
||||||
participants: recording[:participants]
|
participants: recording[:participants],
|
||||||
|
duration: recording[:duration]
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ class NotificationMailer < ActionMailer::Base
|
||||||
def recording_ready_email(user, rec)
|
def recording_ready_email(user, rec)
|
||||||
@user = user
|
@user = user
|
||||||
@recording = rec
|
@recording = rec
|
||||||
|
@duration = JSON.parse(rec[:duration])
|
||||||
@room_url = meeting_room_url(resource: 'rooms', id: user.encrypted_id)
|
@room_url = meeting_room_url(resource: 'rooms', id: user.encrypted_id)
|
||||||
|
|
||||||
# Need this because URL doesn't respect the relative_url_root by default
|
# Need this because URL doesn't respect the relative_url_root by default
|
||||||
|
|
|
@ -43,6 +43,30 @@
|
||||||
<td><b><%= @recording[:participants] %></b></td>
|
<td><b><%= @recording[:participants] %></b></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
<br>
|
||||||
|
<table style = "padding:0 15px 0 15px;">
|
||||||
|
<tr>
|
||||||
|
<th style = "padding:0 15px 0 15px;"><b><%= t('.user_table.user') %></b></th>
|
||||||
|
<th style = "padding:0 15px 0 15px;"><b><%= t('.user_table.role') %></b></th>
|
||||||
|
<th style = "padding:0 15px 0 15px;"><b><%= t('.user_table.join') %></b></th>
|
||||||
|
<th style = "padding:0 15px 0 15px;"><b><%= t('.user_table.left') %></b></th>
|
||||||
|
<th style = "padding:0 15px 0 15px;"><b><%= t('.user_table.duration') %></b></th>
|
||||||
|
</tr>
|
||||||
|
<% @duration.each do |user| %>
|
||||||
|
<tr>
|
||||||
|
<td style = "padding:0 15px 0 15px;"><%= user[1]['name'] %></td>
|
||||||
|
<td style = "padding:0 15px 0 15px;"><%= user[1]['role'].downcase.capitalize %></td>
|
||||||
|
<td style = "padding:0 15px 0 15px;"><%= Time.at(user[1]['join'] / 1000).strftime("%H:%M:%S") %></td>
|
||||||
|
<td style = "padding:0 15px 0 15px;"><%= Time.at(user[1]['left'] / 1000).strftime("%H:%M:%S") %></td>
|
||||||
|
<td style = "padding:0 15px 0 15px;"><%= Time.at(user[1]['duration'] / 1000).utc.strftime("%H:%M:%S") %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</table>
|
||||||
|
<br>
|
||||||
|
<p><%= t('thumbnails') %>:</p>
|
||||||
|
<% @recording[:previews].each do |preview| %>
|
||||||
|
<img style = "display:inline;" src = "<%= preview[:url] %>" alt = "<%= preview[:alt] %>">
|
||||||
|
<% end %>
|
||||||
<p><%= t('.phrase2') %></p>
|
<p><%= t('.phrase2') %></p>
|
||||||
<p style="text-align:center;"><%= link_to(@recording[:playbacks][0][:url], @recording[:playbacks][0][:url]) %></p>
|
<p style="text-align:center;"><%= link_to(@recording[:playbacks][0][:url], @recording[:playbacks][0][:url]) %></p>
|
||||||
<p><%= t('.phrase3_html') %></p>
|
<p><%= t('.phrase3_html') %></p>
|
||||||
|
|
|
@ -141,6 +141,12 @@ en-US:
|
||||||
length_value: "%{value} minutes"
|
length_value: "%{value} minutes"
|
||||||
started: Started
|
started: Started
|
||||||
users: Users
|
users: Users
|
||||||
|
user_table:
|
||||||
|
user: User
|
||||||
|
role: Role
|
||||||
|
join: Join
|
||||||
|
left: Leave
|
||||||
|
duration: Duration
|
||||||
participants: Users
|
participants: Users
|
||||||
past_recordings: Past Recordings
|
past_recordings: Past Recordings
|
||||||
preferences: Preferences
|
preferences: Preferences
|
||||||
|
|
|
@ -48,6 +48,32 @@ def getParticipantsInfo(events_xml)
|
||||||
participants_info
|
participants_info
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Gets the join and leave times for each user, as well as total duration of stay.
|
||||||
|
def get_duration_info(events_xml)
|
||||||
|
BigBlueButton.logger.info("Task: Getting duration information.")
|
||||||
|
doc = Nokogiri::XML(File.open(events_xml))
|
||||||
|
user_data = {}
|
||||||
|
first_event_time = BigBlueButton::Events.first_event_timestamp(events_xml)
|
||||||
|
timestamp = doc.at_xpath('/recording')['meeting_id'].split('-')[1].to_i
|
||||||
|
joinEvents = doc.xpath('/recording/event[@module="PARTICIPANT" and @eventname="ParticipantJoinEvent"]')
|
||||||
|
leftEvents = doc.xpath('/recording/event[@module="PARTICIPANT" and @eventname="ParticipantLeftEvent"]')
|
||||||
|
# This should never occur, but just in case.
|
||||||
|
return {'error' => 'inequal number of join/left events.'} if joinEvents.length != leftEvents.length
|
||||||
|
joinEvents.each do |join|
|
||||||
|
uID = join.xpath('externalUserId').text
|
||||||
|
user_data[uID] = {}
|
||||||
|
user_data[uID]['name'] = join.xpath('name').text
|
||||||
|
user_data[uID]['join'] = join['timestamp'].to_i - first_event_time + timestamp
|
||||||
|
user_data[uID]['role'] = join.xpath('role').text
|
||||||
|
end
|
||||||
|
leftEvents.each do |left|
|
||||||
|
uID = left.xpath('userId').text.split('_')[0]
|
||||||
|
user_data[uID]['left'] = left['timestamp'].to_i - first_event_time + timestamp
|
||||||
|
user_data[uID]['duration'] = user_data[uID]['left'] - user_data[uID]['join']
|
||||||
|
end
|
||||||
|
user_data
|
||||||
|
end
|
||||||
|
|
||||||
logger = Logger.new("/var/log/bigbluebutton/post_process.log", 'weekly')
|
logger = Logger.new("/var/log/bigbluebutton/post_process.log", 'weekly')
|
||||||
logger.level = Logger::INFO
|
logger.level = Logger::INFO
|
||||||
BigBlueButton.logger = logger
|
BigBlueButton.logger = logger
|
||||||
|
@ -69,6 +95,7 @@ begin
|
||||||
BigBlueButton.logger.info("Making callback for recording ready notification")
|
BigBlueButton.logger.info("Making callback for recording ready notification")
|
||||||
|
|
||||||
participants_info = getParticipantsInfo(events_xml)
|
participants_info = getParticipantsInfo(events_xml)
|
||||||
|
duration_info = get_duration_info(events_xml)
|
||||||
|
|
||||||
props = JavaProperties::Properties.new("/var/lib/tomcat7/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties")
|
props = JavaProperties::Properties.new("/var/lib/tomcat7/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties")
|
||||||
secret = props[:securitySalt]
|
secret = props[:securitySalt]
|
||||||
|
@ -81,7 +108,8 @@ begin
|
||||||
"payload":{
|
"payload":{
|
||||||
"metadata": meeting_metadata,
|
"metadata": meeting_metadata,
|
||||||
"meeting_id": meeting_id,
|
"meeting_id": meeting_id,
|
||||||
"participants": participants_info
|
"participants": participants_info,
|
||||||
|
"duration": duration_info
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
payload = {
|
payload = {
|
||||||
|
|
Loading…
Reference in New Issue