ソースを参照

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

Julio 7 年 前
コミット
fd572ef684
2 ファイル変更46 行追加44 行削除
  1. 39 41
      plugin/bbb/lib/bbb.lib.php
  2. 7 3
      plugin/bbb/start.php

+ 39 - 41
plugin/bbb/lib/bbb.lib.php

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

+ 7 - 3
plugin/bbb/start.php

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