Fix BBB when creating a new meeting, remove loop. BT#13861

pull/2458/head
Julio 8 years ago
parent fcca8f3448
commit fd572ef684
  1. 40
      plugin/bbb/lib/bbb.lib.php
  2. 10
      plugin/bbb/start.php

@ -352,7 +352,6 @@ class bbb
// This setting currently limits the maximum conference duration, // This setting currently limits the maximum conference duration,
// to avoid lingering sessions on the video-conference server #6261 // to avoid lingering sessions on the video-conference server #6261
$duration = 300; $duration = 300;
$bbbParams = array( $bbbParams = array(
'meetingId' => $params['remote_id'], // REQUIRED 'meetingId' => $params['remote_id'], // REQUIRED
'meetingName' => $meetingName, // REQUIRED 'meetingName' => $meetingName, // REQUIRED
@ -392,8 +391,9 @@ class bbb
} }
} }
return $this->logoutUrl; return false;
} }
return false;
} }
/** /**
@ -482,8 +482,12 @@ class bbb
* @assert ('') === false * @assert ('') === false
* @assert ('abcdefghijklmnopqrstuvwxyzabcdefghijklmno') === false * @assert ('abcdefghijklmnopqrstuvwxyzabcdefghijklmno') === false
*/ */
public function joinMeeting($meetingName, $loop = false) public function joinMeeting($meetingName)
{ {
if ($this->debug) {
error_log("joinMeeting: $meetingName");
}
if (empty($meetingName)) { if (empty($meetingName)) {
return false; return false;
} }
@ -524,10 +528,15 @@ class bbb
// -- REQUIRED - The moderator password for the meeting // -- REQUIRED - The moderator password for the meeting
); );
$status = false;
$meetingInfoExists = false; $meetingInfoExists = false;
while ($status === false) {
$meetingIsRunningInfo = $this->getMeetingInfo($params); $meetingIsRunningInfo = $this->getMeetingInfo($params);
if ($this->debug) {
error_log('Searching meeting with params:');
error_log(print_r($params, 1));
error_log('Result:');
error_log(print_r($meetingIsRunningInfo, 1));
}
if ($meetingIsRunningInfo === false) { if ($meetingIsRunningInfo === false) {
// checking with the remote_id didn't work, so just in case and // checking with the remote_id didn't work, so just in case and
// to provide backwards support, check with the id // to provide backwards support, check with the id
@ -538,16 +547,17 @@ class bbb
// -- REQUIRED - The moderator password for the meeting // -- REQUIRED - The moderator password for the meeting
); );
$meetingIsRunningInfo = $this->getMeetingInfo($params); $meetingIsRunningInfo = $this->getMeetingInfo($params);
}
if ($this->debug) { if ($this->debug) {
error_log('Searching meetingId with params:')
error_log(print_r($params, 1));
error_log('Result:');
error_log(print_r($meetingIsRunningInfo, 1)); error_log(print_r($meetingIsRunningInfo, 1));
} }
}
if (strval($meetingIsRunningInfo['returncode']) == 'SUCCESS' && if (strval($meetingIsRunningInfo['returncode']) == 'SUCCESS' &&
isset($meetingIsRunningInfo['meetingName']) && isset($meetingIsRunningInfo['meetingName']) &&
!empty($meetingIsRunningInfo['meetingName']) !empty($meetingIsRunningInfo['meetingName'])
//strval($meetingIsRunningInfo['running']) == 'true'
) { ) {
$meetingInfoExists = true; $meetingInfoExists = true;
} }
@ -558,17 +568,7 @@ class bbb
); );
} }
if ($meetingInfoExists) { $url = false;
$status = true;
}
if ($loop) {
continue;
} else {
break;
}
}
if ($meetingInfoExists) { if ($meetingInfoExists) {
$joinParams = array( $joinParams = array(
'meetingId' => $meetingData['remote_id'], // -- REQUIRED - A unique id for the meeting 'meetingId' => $meetingData['remote_id'], // -- REQUIRED - A unique id for the meeting
@ -580,8 +580,6 @@ class bbb
); );
$url = $this->api->getJoinMeetingURL($joinParams); $url = $this->api->getJoinMeetingURL($joinParams);
$url = $this->protocol.$url; $url = $this->protocol.$url;
} else {
$url = $this->logoutUrl;
} }
if ($this->debug) { if ($this->debug) {
error_log("return url :".$url); error_log("return url :".$url);

@ -56,15 +56,19 @@ if ($bbb->pluginEnabled) {
$meetingParams = []; $meetingParams = [];
$meetingParams['meeting_name'] = $bbb->getCurrentVideoConferenceName(); $meetingParams['meeting_name'] = $bbb->getCurrentVideoConferenceName();
if ($bbb->meetingExists($meetingParams['meeting_name'])) { if ($bbb->meetingExists($meetingParams['meeting_name'])) {
$url = $bbb->joinMeeting($meetingParams['meeting_name']) ?: $bbb->createMeeting($meetingParams); $joinUrl = $bbb->joinMeeting($meetingParams['meeting_name']);
if ($joinUrl) {
$url = $joinUrl;
} else {
$url = $bbb->createMeeting($meetingParams);
}
} else { } else {
$url = $bbb->isConferenceManager() ? $bbb->createMeeting($meetingParams) : $bbb->getListingUrl(); $url = $bbb->isConferenceManager() ? $bbb->createMeeting($meetingParams) : $bbb->getListingUrl();
} }
$meetingInfo = $bbb->findMeetingByName($meetingParams['meeting_name']); $meetingInfo = $bbb->findMeetingByName($meetingParams['meeting_name']);
if (!empty($meetingInfo)) { if (!empty($meetingInfo) && $url) {
$bbb->saveParticipant($meetingInfo['id'], api_get_user_id()); $bbb->saveParticipant($meetingInfo['id'], api_get_user_id());
$bbb->redirectToBBB($url); $bbb->redirectToBBB($url);
} else { } else {

Loading…
Cancel
Save