You are here

function bbb_api_call in BigBlueButton 7

Connect to BBB API and return response.

Parameters

$params: Associative array of additional url parameters. See bbb_api_create().

$call: API call name. Possible values:

  • 'create'
  • 'isMeetingRunning'
  • 'endMeeting'
  • 'getMeetingInfo'

Return value

stdClass response or FALSE if BBB service is not available at given url.

4 calls to bbb_api_call()
bbb_api_create in includes/api.bbb.inc
Create Meeting (create)
bbb_api_endMeeting in includes/api.bbb.inc
bbb_api_getMeetingInfo in includes/api.bbb.inc
bbb_api_isMeetingRunning in includes/api.bbb.inc
Is meeting running (isMeetingRunning)

File

includes/api.bbb.inc, line 210
BigBlueButton - Enables universities and colleges to deliver a high-quality learning experience.

Code

function bbb_api_call($params, $call) {
  $query_string = bbb_api_generate_querystring($params, $call);
  $request = BIGBLUEBUTTON_BASE_URL . '/api/' . $call . '?' . $query_string;
  $xml = @simplexml_load_file($request);

  // If XML is available, parse the API response.
  if (!empty($xml)) {
    $response = bbb_api_parse_response($xml);

    // Check if request was successful.
    if (isset($response->returncode) && $response->returncode == 'SUCCESS') {

      // Everything is OK.
    }
    else {

      // If errors occured, log them.
      if (isset($response->message)) {
        watchdog('bigbluebutton', '%message', array(
          '%message' => $response->message,
        ), WATCHDOG_ERROR);
      }
      else {
        watchdog('bigbluebutton', 'BigBlueButton error. API call: %call. Request URL: %url', array(
          '%call' => $call,
          '%url' => $request,
        ), WATCHDOG_ERROR);
      }
    }
    return $response;
  }
  else {
    watchdog('bigbluebutton', 'BigBlueButton service not available. API call: %call. Request URL: %url', array(
      '%call' => $call,
      '%url' => $request,
    ), WATCHDOG_ERROR);
    return FALSE;
  }
}