Skip to content
Snippets Groups Projects
Commit 90e3c6e3 authored by jfederico's avatar jfederico
Browse files

Added script for recording ready notification

parent 494f9b34
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/ruby
# encoding: UTF-8
#
# 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/>.
#
require "trollop"
require 'net/http'
require "jwt"
require "java_properties"
require File.expand_path('../../../lib/recordandplayback', __FILE__)
logger = Logger.new("/var/log/bigbluebutton/post_publish.log", 'weekly' )
logger.level = Logger::INFO
BigBlueButton.logger = logger
opts = Trollop::options do
opt :meeting_id, "Meeting id to archive", :type => String
end
meeting_id = opts[:meeting_id]
processed_files = "/var/bigbluebutton/recording/process/presentation/#{meeting_id}"
meeting_metadata = BigBlueButton::Events.get_meeting_metadata("/var/bigbluebutton/recording/raw/#{meeting_id}/events.xml")
#
# Main code
#
BigBlueButton.logger.info("Recording Ready Notify for [#{meeting_id}] starts")
begin
callback_url = meeting_metadata["bbb-recording-ready-url"].value
unless callback_url.nil?
BigBlueButton.logger.info("Making callback for recording ready notification")
props = JavaProperties::Properties.new("/var/lib/tomcat7/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties")
secret = props[:securitySalt]
external_meeting_id = meeting_metadata["meetingId"].value
payload = { meeting_id: external_meeting_id, record_id: meeting_id }
payload_encoded = JWT.encode(payload, secret)
uri = URI.parse(callback_url)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
BigBlueButton.logger.info("Sending request to #{uri.scheme}://#{uri.host}#{uri.request_uri}")
request = Net::HTTP::Post.new(uri.request_uri)
request.set_form_data({ signed_parameters: payload_encoded })
response = http.request(request)
code = response.code.to_i
if code == 410
BigBlueButton.logger.info("Notified for deleted meeting: #{meeting_id}")
# TODO: should we automatically delete the recording here?
elsif code == 404
BigBlueButton.logger.info("404 error when notifying for recording: #{meeting_id}, ignoring")
elsif code < 200 || code >= 300
BigBlueButton.logger.info("Callback HTTP request failed: #{response.code} #{response.message} (code #{code})")
else
BigBlueButton.logger.info("Recording notifier successful: #{meeting_id} (code #{code})")
end
end
rescue => e
BigBlueButton.logger.info("Rescued")
BigBlueButton.logger.info(e.to_s)
end
BigBlueButton.logger.info("Recording Ready notify ends")
exit 0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment