Method: BigBlueButton::BigBlueButtonApi#create_meeting

Defined in:
lib/bigbluebutton_api.rb

#create_meeting(meeting_name, meeting_id, options = {}, modules = nil) ⇒ Object

Creates a new meeting. Returns the hash with the response or throws BigBlueButtonException on failure.

meeting_name (string)

Name for the meeting

meeting_id (string, integer)

Unique identifier for the meeting

options (Hash)

Hash with optional parameters. The accepted parameters are: moderatorPW (string, int), attendeePW (string, int), welcome (string), dialNumber (int), logoutURL (string), maxParticipants (int), voiceBridge (int), record (boolean), duration (int) and “meta” parameters (usually strings). If a parameter passed in the hash is not supported it will simply be discarded. For details about each see BBB API docs.

modules (BigBlueButtonModules)

Configuration for the modules. The modules are sent as an xml and the request will use an HTTP POST instead of GET. Currently only the “presentation” module is available. Only used for version > 0.8. See usage examples below.

Example

options = { :moderatorPW => "123", :attendeePW => "321", :welcome => "Welcome here!",
            :dialNumber => 5190909090, :logoutURL => "http://mconf.org", :maxParticipants => 25,
            :voiceBridge => 76543, :record => "true", :duration => 0, :meta_category => "Remote Class" }
create_meeting("My Meeting", "my-meeting", options)

Example with modules (see BigBlueButtonModules docs for more)

modules = BigBlueButton::BigBlueButtonModules.new
modules.add_presentation(:url, "http://www.samplepdf.com/sample.pdf")
modules.add_presentation(:url, "http://www.samplepdf.com/sample2.pdf")
modules.add_presentation(:file, "presentations/class01.ppt")
modules.add_presentation(:base64, "JVBERi0xLjQKJ....[clipped here]....0CiUlRU9GCg==", "first-class.pdf")
create_meeting("My Meeting", "my-meeting", nil, modules)

Example response for 0.7

On successful creation:

{
 :returncode => true, :meetingID => "test",
 :attendeePW => "1234", :moderatorPW => "4321", :hasBeenForciblyEnded => false,
 :messageKey => "", :message => ""
}

Meeting that was forcibly ended:

{
 :returncode => true, :meetingID => "test",
 :attendeePW => "1234", :moderatorPW => "4321", :hasBeenForciblyEnded => true,
 :messageKey => "duplicateWarning",
 :message => "This conference was already in existence and may currently be in progress."
}

Example response for 0.8

{
 :returncode => true, :meetingID => "Test", :createTime => 1308591802,
 :attendeePW => "1234", :moderatorPW => "4321", :hasBeenForciblyEnded => false,
 :messageKey => "", :message => ""
}


123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/bigbluebutton_api.rb', line 123

def create_meeting(meeting_name, meeting_id, options={}, modules=nil)
  valid_options = [:moderatorPW, :attendeePW, :welcome, :maxParticipants,
                   :dialNumber, :voiceBridge, :webVoice, :logoutURL]

  selected_opt = options.clone
  if @version >= "0.8"
    # v0.8 added "record", "duration" and "meta_" parameters
    valid_options += [:record, :duration]
    selected_opt.reject!{ |k,v| !valid_options.include?(k) and !(k.to_s =~ /^meta_.*$/) }
    selected_opt[:record] = selected_opt[:record].to_s if selected_opt.has_key?(:record)
  else
    selected_opt.reject!{ |k,v| !valid_options.include?(k) }
  end
  params = { :name => meeting_name, :meetingID => meeting_id }.merge(selected_opt)

  # with modules we send a post request (only for >= 0.8)
  if modules and @version >= "0.8"
    response = send_api_request(:create, params, modules.to_xml)
  else
    response = send_api_request(:create, params)
  end

  formatter = BigBlueButtonFormatter.new(response)
  formatter.to_string(:meetingID)
  formatter.to_string(:moderatorPW)
  formatter.to_string(:attendeePW)
  formatter.to_boolean(:hasBeenForciblyEnded)
  if @version >= "0.8"
    formatter.to_int(:createTime)
  end

  response
end