bbb_api.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647
  1. <?php
  2. /*
  3. Copyright 2010 Blindside Networks
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  15. Versions:
  16. 1.0 -- Initial version written by DJP
  17. (email: djp [a t ] architectes DOT .org)
  18. 1.1 -- Updated by Omar Shammas and Sebastian Schneider
  19. (email : omar DOT shammas [a t ] g m ail DOT com)
  20. (email : seb DOT sschneider [ a t ] g m ail DOT com)
  21. 1.2 -- Updated by Omar Shammas
  22. (email : omar DOT shammas [a t ] g m ail DOT com)
  23. 1.3 -- Refactored by Peter Mentzer
  24. (email : peter@petermentzerdesign.com)
  25. - This update will BREAK your external existing code if
  26. you've used the previous versions <= 1.2 already so:
  27. -- update your external code to use new method names if needed
  28. -- update your external code to pass new parameters to methods
  29. - Working example of joinIfRunning.php now included
  30. - Added support for BBB 0.8b recordings
  31. - Now using Zend coding, naming and style conventions
  32. - Refactored methods to accept standardized parameters & match BBB API structure
  33. -- See included samples for usage examples
  34. */
  35. /* _______________________________________________________________________*/
  36. /* get the config values */
  37. //require_once "config.php";
  38. class BigBlueButtonBN {
  39. private $_securitySalt;
  40. private $_bbbServerBaseUrl;
  41. /* ___________ General Methods for the BigBlueButton Class __________ */
  42. function __construct() {
  43. /*
  44. Establish just our basic elements in the constructor:
  45. */
  46. // BASE CONFIGS - set these for your BBB server in config.php and they will
  47. // simply flow in here via the constants:
  48. $this->_securitySalt = CONFIG_SECURITY_SALT;
  49. $this->_bbbServerBaseUrl = CONFIG_SERVER_BASE_URL;
  50. }
  51. private function _processXmlResponse($url){
  52. /*
  53. A private utility method used by other public methods to process XML responses.
  54. */
  55. if (extension_loaded('curl')) {
  56. $ch = curl_init() or die ( curl_error($ch) );
  57. $timeout = 10;
  58. curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false);
  59. curl_setopt( $ch, CURLOPT_URL, $url );
  60. curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
  61. curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout);
  62. $data = curl_exec( $ch );
  63. curl_close( $ch );
  64. if($data)
  65. return (new SimpleXMLElement($data));
  66. else
  67. return false;
  68. }
  69. return (simplexml_load_file($url));
  70. }
  71. private function _requiredParam($param) {
  72. /* Process required params and throw errors if we don't get values */
  73. if ((isset($param)) && ($param != '')) {
  74. return $param;
  75. }
  76. elseif (!isset($param)) {
  77. throw new Exception('Missing parameter.');
  78. }
  79. else {
  80. throw new Exception(''.$param.' is required.');
  81. }
  82. }
  83. private function _optionalParam($param) {
  84. /* Pass most optional params through as set value, or set to '' */
  85. /* Don't know if we'll use this one, but let's build it in case. */
  86. if ((isset($param)) && ($param != '')) {
  87. return $param;
  88. }
  89. else {
  90. $param = '';
  91. return $param;
  92. }
  93. }
  94. /* __________________ BBB ADMINISTRATION METHODS _________________ */
  95. /* The methods in the following section support the following categories of the BBB API:
  96. -- create
  97. -- join
  98. -- end
  99. */
  100. public function getCreateMeetingUrl($creationParams) {
  101. /*
  102. USAGE:
  103. (see $creationParams array in createMeetingArray method.)
  104. */
  105. $this->_meetingId = $this->_requiredParam($creationParams['meetingId']);
  106. $this->_meetingName = $this->_requiredParam($creationParams['meetingName']);
  107. // Set up the basic creation URL:
  108. $creationUrl = $this->_bbbServerBaseUrl."api/create?";
  109. // Add params:
  110. $params =
  111. 'name='.urlencode($this->_meetingName).
  112. '&meetingID='.urlencode($this->_meetingId).
  113. '&attendeePW='.urlencode($creationParams['attendeePw']).
  114. '&moderatorPW='.urlencode($creationParams['moderatorPw']).
  115. '&dialNumber='.urlencode($creationParams['dialNumber']).
  116. '&voiceBridge='.urlencode($creationParams['voiceBridge']).
  117. '&webVoice='.urlencode($creationParams['webVoice']).
  118. '&logoutURL='.urlencode($creationParams['logoutUrl']).
  119. '&maxParticipants='.urlencode($creationParams['maxParticipants']).
  120. '&record='.urlencode($creationParams['record']).
  121. '&duration='.urlencode($creationParams['duration']);
  122. //'&meta_category='.urlencode($creationParams['meta_category']);
  123. $welcomeMessage = $creationParams['welcomeMsg'];
  124. if(trim($welcomeMessage))
  125. $params .= '&welcome='.urlencode($welcomeMessage);
  126. // Return the complete URL:
  127. return ( $creationUrl.$params.'&checksum='.sha1("create".$params.$this->_securitySalt) );
  128. }
  129. public function createMeetingWithXmlResponseArray($creationParams) {
  130. /*
  131. USAGE:
  132. $creationParams = array(
  133. 'name' => 'Meeting Name', -- A name for the meeting (or username)
  134. 'meetingId' => '1234', -- A unique id for the meeting
  135. 'attendeePw' => 'ap', -- Set to 'ap' and use 'ap' to join = no user pass required.
  136. 'moderatorPw' => 'mp', -- Set to 'mp' and use 'mp' to join = no user pass required.
  137. 'welcomeMsg' => '', -- ''= use default. Change to customize.
  138. 'dialNumber' => '', -- The main number to call into. Optional.
  139. 'voiceBridge' => '', -- 5 digits PIN to join voice. Required.
  140. 'webVoice' => '', -- Alphanumeric to join voice. Optional.
  141. 'logoutUrl' => '', -- Default in bigbluebutton.properties. Optional.
  142. 'maxParticipants' => '-1', -- Optional. -1 = unlimitted. Not supported in BBB. [number]
  143. 'record' => 'false', -- New. 'true' will tell BBB to record the meeting.
  144. 'duration' => '0', -- Default = 0 which means no set duration in minutes. [number]
  145. 'meta_category' => '', -- Use to pass additional info to BBB server. See API docs to enable.
  146. );
  147. */
  148. $xml = $this->_processXmlResponse($this->getCreateMeetingURL($creationParams));
  149. if ($xml) {
  150. if($xml->meetingID)
  151. return array(
  152. 'returncode' => $xml->returncode->__toString(),
  153. 'message' => $xml->message->__toString(),
  154. 'messageKey' => $xml->messageKey->__toString(),
  155. 'meetingId' => $xml->meetingID->__toString(),
  156. 'attendeePw' => $xml->attendeePW->__toString(),
  157. 'moderatorPw' => $xml->moderatorPW->__toString(),
  158. 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded->__toString(),
  159. 'createTime' => $xml->createTime->__toString()
  160. );
  161. else
  162. return array(
  163. 'returncode' => $xml->returncode->__toString(),
  164. 'message' => $xml->message->__toString(),
  165. 'messageKey' => $xml->messageKey->__toString()
  166. );
  167. }
  168. else {
  169. return null;
  170. }
  171. }
  172. public function getJoinMeetingURL($joinParams) {
  173. /*
  174. NOTE: At this point, we don't use a corresponding joinMeetingWithXmlResponse here because the API
  175. doesn't respond on success, but you can still code that method if you need it. Or, you can take the URL
  176. that's returned from this method and simply send your users off to that URL in your code.
  177. USAGE:
  178. $joinParams = array(
  179. 'meetingId' => '1234', -- REQUIRED - A unique id for the meeting
  180. 'username' => 'Jane Doe', -- REQUIRED - The name that will display for the user in the meeting
  181. 'password' => 'ap', -- REQUIRED - The attendee or moderator password, depending on what's passed here
  182. 'createTime' => '', -- OPTIONAL - string. Leave blank ('') unless you set this correctly.
  183. 'userID' => '', -- OPTIONAL - string
  184. 'webVoiceConf' => '' -- OPTIONAL - string
  185. );
  186. */
  187. $this->_meetingId = $this->_requiredParam($joinParams['meetingId']);
  188. $this->_username = $this->_requiredParam($joinParams['username']);
  189. $this->_password = $this->_requiredParam($joinParams['password']);
  190. // Establish the basic join URL:
  191. $joinUrl = $this->_bbbServerBaseUrl."api/join?";
  192. // Add parameters to the URL:
  193. $params =
  194. 'meetingID='.urlencode($this->_meetingId).
  195. '&fullName='.urlencode($this->_username).
  196. '&password='.urlencode($this->_password).
  197. '&userID='.urlencode($joinParams['userID']).
  198. '&webVoiceConf='.urlencode($joinParams['webVoiceConf']);
  199. // Only use createTime if we really want to use it. If it's '', then don't pass it:
  200. if (((isset($joinParams['createTime'])) && ($joinParams['createTime'] != ''))) {
  201. $params .= '&createTime='.urlencode($joinParams['createTime']);
  202. }
  203. if (isset($joinParams['interface']) && (int) $joinParams['interface'] === BBBPlugin::INTERFACE_HTML5) {
  204. $bbbHost = api_remove_trailing_slash(CONFIG_SERVER_URL_WITH_PROTOCOL);
  205. $params .= '&redirectClient=true&clientURL='.$bbbHost.'/html5client/join';
  206. }
  207. // Return the URL:
  208. $url = $joinUrl.$params.'&checksum='.sha1('join'.$params.$this->_securitySalt);
  209. return $url;
  210. }
  211. public function getEndMeetingURL($endParams) {
  212. /* USAGE:
  213. $endParams = array (
  214. 'meetingId' => '1234', -- REQUIRED - The unique id for the meeting
  215. 'password' => 'mp' -- REQUIRED - The moderator password for the meeting
  216. );
  217. */
  218. $this->_meetingId = $this->_requiredParam($endParams['meetingId']);
  219. $this->_password = $this->_requiredParam($endParams['password']);
  220. $endUrl = $this->_bbbServerBaseUrl."api/end?";
  221. $params =
  222. 'meetingID='.urlencode($this->_meetingId).
  223. '&password='.urlencode($this->_password);
  224. return ($endUrl.$params.'&checksum='.sha1("end".$params.$this->_securitySalt));
  225. }
  226. public function endMeetingWithXmlResponseArray($endParams) {
  227. /* USAGE:
  228. $endParams = array (
  229. 'meetingId' => '1234', -- REQUIRED - The unique id for the meeting
  230. 'password' => 'mp' -- REQUIRED - The moderator password for the meeting
  231. );
  232. */
  233. $xml = $this->_processXmlResponse($this->getEndMeetingURL($endParams));
  234. if ($xml) {
  235. return array(
  236. 'returncode' => $xml->returncode->__toString(),
  237. 'message' => $xml->message->__toString(),
  238. 'messageKey' => $xml->messageKey->__toString()
  239. );
  240. }
  241. else {
  242. return null;
  243. }
  244. }
  245. /* __________________ BBB MONITORING METHODS _________________ */
  246. /* The methods in the following section support the following categories of the BBB API:
  247. -- isMeetingRunning
  248. -- getMeetings
  249. -- getMeetingInfo
  250. */
  251. public function getIsMeetingRunningUrl($meetingId) {
  252. /* USAGE:
  253. $meetingId = '1234' -- REQUIRED - The unique id for the meeting
  254. */
  255. $this->_meetingId = $this->_requiredParam($meetingId);
  256. $runningUrl = $this->_bbbServerBaseUrl."api/isMeetingRunning?";
  257. $params =
  258. 'meetingID='.urlencode($this->_meetingId);
  259. return ($runningUrl.$params.'&checksum='.sha1("isMeetingRunning".$params.$this->_securitySalt));
  260. }
  261. public function isMeetingRunningWithXmlResponseArray($meetingId) {
  262. /* USAGE:
  263. $meetingId = '1234' -- REQUIRED - The unique id for the meeting
  264. */
  265. $xml = $this->_processXmlResponse($this->getIsMeetingRunningUrl($meetingId));
  266. if($xml) {
  267. return array(
  268. 'returncode' => $xml->returncode->__toString(),
  269. 'running' => $xml->running->__toString() // -- Returns true/false.
  270. );
  271. }
  272. else {
  273. return null;
  274. }
  275. }
  276. public function getGetMeetingsUrl() {
  277. /* Simply formulate the getMeetings URL
  278. We do this in a separate function so we have the option to just get this
  279. URL and print it if we want for some reason.
  280. */
  281. $getMeetingsUrl = $this->_bbbServerBaseUrl."api/getMeetings?checksum=".sha1("getMeetings".$this->_securitySalt);
  282. return $getMeetingsUrl;
  283. }
  284. public function getMeetingsWithXmlResponseArray() {
  285. /* USAGE:
  286. We don't need to pass any parameters with this one, so we just send the query URL off to BBB
  287. and then handle the results that we get in the XML response.
  288. */
  289. $xml = $this->_processXmlResponse($this->getGetMeetingsUrl());
  290. if($xml) {
  291. // If we don't get a success code, stop processing and return just the returncode:
  292. if ($xml->returncode != 'SUCCESS') {
  293. $result = array(
  294. 'returncode' => $xml->returncode->__toString()
  295. );
  296. return $result;
  297. }
  298. elseif ($xml->messageKey == 'noMeetings') {
  299. /* No meetings on server, so return just this info: */
  300. $result = array(
  301. 'returncode' => $xml->returncode->__toString(),
  302. 'messageKey' => $xml->messageKey->__toString(),
  303. 'message' => $xml->message->__toString()
  304. );
  305. return $result;
  306. }
  307. else {
  308. // In this case, we have success and meetings. First return general response:
  309. $result = array(
  310. 'returncode' => $xml->returncode->__toString(),
  311. 'messageKey' => $xml->messageKey->__toString(),
  312. 'message' => $xml->message->__toString()
  313. );
  314. // Then interate through meeting results and return them as part of the array:
  315. foreach ($xml->meetings->meeting as $m) {
  316. $result[] = array(
  317. 'meetingId' => $m->meetingID->__toString(),
  318. 'meetingName' => $m->meetingName->__toString(),
  319. 'createTime' => $m->createTime->__toString(),
  320. 'attendeePw' => $m->attendeePW->__toString(),
  321. 'moderatorPw' => $m->moderatorPW->__toString(),
  322. 'hasBeenForciblyEnded' => $m->hasBeenForciblyEnded->__toString(),
  323. 'running' => $m->running->__toString()
  324. );
  325. }
  326. return $result;
  327. }
  328. }
  329. else {
  330. return null;
  331. }
  332. }
  333. public function getMeetingInfoUrl($infoParams) {
  334. /* USAGE:
  335. $infoParams = array(
  336. 'meetingId' => '1234', -- REQUIRED - The unique id for the meeting
  337. 'password' => 'mp' -- REQUIRED - The moderator password for the meeting
  338. );
  339. */
  340. $this->_meetingId = $this->_requiredParam($infoParams['meetingId']);
  341. $this->_password = $this->_requiredParam($infoParams['password']);
  342. $infoUrl = $this->_bbbServerBaseUrl."api/getMeetingInfo?";
  343. $params =
  344. 'meetingID='.urlencode($this->_meetingId).
  345. '&password='.urlencode($this->_password);
  346. return ($infoUrl.$params.'&checksum='.sha1("getMeetingInfo".$params.$this->_securitySalt));
  347. }
  348. public function getMeetingInfoWithXmlResponseArray($infoParams) {
  349. /* USAGE:
  350. $infoParams = array(
  351. 'meetingId' => '1234', -- REQUIRED - The unique id for the meeting
  352. 'password' => 'mp' -- REQUIRED - The moderator password for the meeting
  353. );
  354. */
  355. $xml = $this->_processXmlResponse($this->getMeetingInfoUrl($infoParams));
  356. if($xml) {
  357. // If we don't get a success code or messageKey, find out why:
  358. if (($xml->returncode != 'SUCCESS') || ($xml->messageKey == null)) {
  359. $result = array(
  360. 'returncode' => $xml->returncode->__toString(),
  361. 'messageKey' => $xml->messageKey->__toString(),
  362. 'message' => $xml->message->__toString()
  363. );
  364. return $result;
  365. }
  366. else {
  367. // In this case, we have success and meeting info:
  368. $result = array(
  369. 'returncode' => $xml->returncode->__toString(),
  370. 'meetingName' => $xml->meetingName->__toString(),
  371. 'meetingId' => $xml->meetingID->__toString(),
  372. 'createTime' => $xml->createTime->__toString(),
  373. 'voiceBridge' => $xml->voiceBridge->__toString(),
  374. 'attendeePw' => $xml->attendeePW->__toString(),
  375. 'moderatorPw' => $xml->moderatorPW->__toString(),
  376. 'running' => $xml->running->__toString(),
  377. 'recording' => $xml->recording->__toString(),
  378. 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded->__toString(),
  379. 'startTime' => $xml->startTime->__toString(),
  380. 'endTime' => $xml->endTime->__toString(),
  381. 'participantCount' => $xml->participantCount->__toString(),
  382. 'maxUsers' => $xml->maxUsers->__toString(),
  383. 'moderatorCount' => $xml->moderatorCount->__toString(),
  384. );
  385. // Then interate through attendee results and return them as part of the array:
  386. foreach ($xml->attendees->attendee as $a) {
  387. $result[] = array(
  388. 'userId' => $a->userID->__toString(),
  389. 'fullName' => $a->fullName->__toString(),
  390. 'role' => $a->role->__toString()
  391. );
  392. }
  393. return $result;
  394. }
  395. }
  396. else {
  397. return null;
  398. }
  399. }
  400. /* __________________ BBB RECORDING METHODS _________________ */
  401. /* The methods in the following section support the following categories of the BBB API:
  402. -- getRecordings
  403. -- publishRecordings
  404. -- deleteRecordings
  405. */
  406. public function getRecordingsUrl($recordingParams) {
  407. /* USAGE:
  408. $recordingParams = array(
  409. 'meetingId' => '1234', -- OPTIONAL - comma separate if multiple ids
  410. );
  411. */
  412. $recordingsUrl = $this->_bbbServerBaseUrl."api/getRecordings?";
  413. $params = 'meetingID='.urlencode($recordingParams['meetingId']);
  414. return ($recordingsUrl.$params.'&checksum='.sha1("getRecordings".$params.$this->_securitySalt));
  415. }
  416. public function getRecordingsWithXmlResponseArray($recordingParams) {
  417. /* USAGE:
  418. $recordingParams = array(
  419. 'meetingId' => '1234', -- OPTIONAL - comma separate if multiple ids
  420. );
  421. NOTE: 'duration' DOES work when creating a meeting, so if you set duration
  422. when creating a meeting, it will kick users out after the duration. Should
  423. probably be required in user code when 'recording' is set to true.
  424. */
  425. $xml = $this->_processXmlResponse($this->getRecordingsUrl($recordingParams));
  426. if($xml) {
  427. // If we don't get a success code or messageKey, find out why:
  428. if (($xml->returncode != 'SUCCESS') || ($xml->messageKey == null)) {
  429. $result = array(
  430. 'returncode' => $xml->returncode->__toString(),
  431. 'messageKey' => $xml->messageKey->__toString(),
  432. 'message' => $xml->message->__toString()
  433. );
  434. return $result;
  435. }
  436. else {
  437. // In this case, we have success and recording info:
  438. $result = array(
  439. 'returncode' => $xml->returncode->__toString(),
  440. 'messageKey' => $xml->messageKey->__toString(),
  441. 'message' => $xml->message->__toString()
  442. );
  443. foreach ($xml->recordings->recording as $r) {
  444. $result[] = array(
  445. 'recordId' => $r->recordID->__toString(),
  446. 'meetingId' => $r->meetingID->__toString(),
  447. 'name' => $r->name->__toString(),
  448. 'published' => $r->published->__toString(),
  449. 'startTime' => $r->startTime->__toString(),
  450. 'endTime' => $r->endTime->__toString(),
  451. 'playbackFormatType' => $r->playback->format->type->__toString(),
  452. 'playbackFormatUrl' => $r->playback->format->url->__toString(),
  453. 'playbackFormatLength' => $r->playback->format->length->__toString(),
  454. 'metadataTitle' => $r->metadata->title->__toString(),
  455. 'metadataSubject' => $r->metadata->subject->__toString(),
  456. 'metadataDescription' => $r->metadata->description->__toString(),
  457. 'metadataCreator' => $r->metadata->creator->__toString(),
  458. 'metadataContributor' => $r->metadata->contributor->__toString(),
  459. 'metadataLanguage' => $r->metadata->language->__toString(),
  460. // Add more here as needed for your app depending on your
  461. // use of metadata when creating recordings.
  462. );
  463. }
  464. return $result;
  465. }
  466. }
  467. else {
  468. return null;
  469. }
  470. }
  471. /**
  472. * @param $array recordingParams
  473. *
  474. * @return array|null
  475. */
  476. public function getRecordings($recordingParams)
  477. {
  478. /* USAGE:
  479. $recordingParams = array(
  480. 'meetingId' => '1234', -- OPTIONAL - comma separate if multiple ids
  481. );
  482. NOTE: 'duration' DOES work when creating a meeting, so if you set duration
  483. when creating a meeting, it will kick users out after the duration. Should
  484. probably be required in user code when 'recording' is set to true.
  485. */
  486. $xml = $this->_processXmlResponse($this->getRecordingsUrl($recordingParams));
  487. if($xml) {
  488. // If we don't get a success code or messageKey, find out why:
  489. if (($xml->returncode != 'SUCCESS') || ($xml->messageKey == null)) {
  490. $result = array(
  491. 'returncode' => $xml->returncode->__toString(),
  492. 'messageKey' => $xml->messageKey->__toString(),
  493. 'message' => $xml->message->__toString()
  494. );
  495. return $result;
  496. }
  497. else {
  498. // In this case, we have success and recording info:
  499. $result = array(
  500. 'returncode' => $xml->returncode->__toString(),
  501. 'messageKey' => $xml->messageKey->__toString(),
  502. 'message' => $xml->message->__toString()
  503. );
  504. $result['records'] = [];
  505. if (!empty($xml->recordings->recording)) {
  506. foreach ($xml->recordings->recording as $r) {
  507. $result['records'][] = array(
  508. 'recordId' => $r->recordID->__toString(),
  509. 'meetingId' => $r->meetingID->__toString(),
  510. 'name' => $r->name->__toString(),
  511. 'published' => $r->published->__toString(),
  512. 'startTime' => $r->startTime->__toString(),
  513. 'endTime' => $r->endTime->__toString(),
  514. 'playbackFormatType' => $r->playback->format->type->__toString(),
  515. 'playbackFormatUrl' => $r->playback->format->url->__toString(),
  516. 'playbackFormatLength' => $r->playback->format->length->__toString(),
  517. 'metadataTitle' => $r->metadata->title->__toString(),
  518. 'metadataSubject' => $r->metadata->subject->__toString(),
  519. 'metadataDescription' => $r->metadata->description->__toString(),
  520. 'metadataCreator' => $r->metadata->creator->__toString(),
  521. 'metadataContributor' => $r->metadata->contributor->__toString(),
  522. 'metadataLanguage' => $r->metadata->language->__toString(),
  523. );
  524. }
  525. }
  526. return $result;
  527. }
  528. }
  529. return null;
  530. }
  531. public function getPublishRecordingsUrl($recordingParams) {
  532. /* USAGE:
  533. $recordingParams = array(
  534. 'recordId' => '1234', -- REQUIRED - comma separate if multiple ids
  535. 'publish' => 'true', -- REQUIRED - boolean: true/false
  536. );
  537. */
  538. $recordingsUrl = $this->_bbbServerBaseUrl."api/publishRecordings?";
  539. $params =
  540. 'recordID='.urlencode($recordingParams['recordId']).
  541. '&publish='.urlencode($recordingParams['publish']);
  542. return ($recordingsUrl.$params.'&checksum='.sha1("publishRecordings".$params.$this->_securitySalt));
  543. }
  544. public function publishRecordingsWithXmlResponseArray($recordingParams) {
  545. /* USAGE:
  546. $recordingParams = array(
  547. 'recordId' => '1234', -- REQUIRED - comma separate if multiple ids
  548. 'publish' => 'true', -- REQUIRED - boolean: true/false
  549. );
  550. */
  551. $xml = $this->_processXmlResponse($this->getPublishRecordingsUrl($recordingParams));
  552. if($xml) {
  553. return array(
  554. 'returncode' => $xml->returncode->__toString(),
  555. 'published' => $xml->published->__toString() // -- Returns true/false.
  556. );
  557. }
  558. else {
  559. return null;
  560. }
  561. }
  562. public function getDeleteRecordingsUrl($recordingParams) {
  563. /* USAGE:
  564. $recordingParams = array(
  565. 'recordId' => '1234', -- REQUIRED - comma separate if multiple ids
  566. );
  567. */
  568. $recordingsUrl = $this->_bbbServerBaseUrl."api/deleteRecordings?";
  569. $params =
  570. 'recordID='.urlencode($recordingParams['recordId']);
  571. return ($recordingsUrl.$params.'&checksum='.sha1("deleteRecordings".$params.$this->_securitySalt));
  572. }
  573. public function deleteRecordingsWithXmlResponseArray($recordingParams) {
  574. /* USAGE:
  575. $recordingParams = array(
  576. 'recordId' => '1234', -- REQUIRED - comma separate if multiple ids
  577. );
  578. */
  579. $xml = $this->_processXmlResponse($this->getDeleteRecordingsUrl($recordingParams));
  580. if($xml) {
  581. return array(
  582. 'returncode' => $xml->returncode->__toString(),
  583. 'deleted' => $xml->deleted->__toString() // -- Returns true/false.
  584. );
  585. }
  586. else {
  587. return null;
  588. }
  589. }
  590. } // END OF BIGBLUEBUTTON CLASS
  591. ?>