diff --git a/labs/bbb-api-php/Read Me.txt b/labs/bbb-api-php-legacy/Read Me.txt similarity index 100% rename from labs/bbb-api-php/Read Me.txt rename to labs/bbb-api-php-legacy/Read Me.txt diff --git a/labs/bbb-api-php/bbb_api.php b/labs/bbb-api-php-legacy/bbb_api.php similarity index 100% rename from labs/bbb-api-php/bbb_api.php rename to labs/bbb-api-php-legacy/bbb_api.php diff --git a/labs/bbb-api-php/bbb_api_conf.php b/labs/bbb-api-php-legacy/bbb_api_conf.php similarity index 100% rename from labs/bbb-api-php/bbb_api_conf.php rename to labs/bbb-api-php-legacy/bbb_api_conf.php diff --git a/labs/bbb-api-php/check.php b/labs/bbb-api-php-legacy/check.php similarity index 100% rename from labs/bbb-api-php/check.php rename to labs/bbb-api-php-legacy/check.php diff --git a/labs/bbb-api-php/demo1.php b/labs/bbb-api-php-legacy/demo1.php similarity index 100% rename from labs/bbb-api-php/demo1.php rename to labs/bbb-api-php-legacy/demo1.php diff --git a/labs/bbb-api-php/demo2.php b/labs/bbb-api-php-legacy/demo2.php similarity index 100% rename from labs/bbb-api-php/demo2.php rename to labs/bbb-api-php-legacy/demo2.php diff --git a/labs/bbb-api-php/demo3.php b/labs/bbb-api-php-legacy/demo3.php similarity index 100% rename from labs/bbb-api-php/demo3.php rename to labs/bbb-api-php-legacy/demo3.php diff --git a/labs/bbb-api-php/demo4.js b/labs/bbb-api-php-legacy/demo4.js similarity index 100% rename from labs/bbb-api-php/demo4.js rename to labs/bbb-api-php-legacy/demo4.js diff --git a/labs/bbb-api-php/demo4.php b/labs/bbb-api-php-legacy/demo4.php similarity index 100% rename from labs/bbb-api-php/demo4.php rename to labs/bbb-api-php-legacy/demo4.php diff --git a/labs/bbb-api-php/demo4_helper.php b/labs/bbb-api-php-legacy/demo4_helper.php similarity index 100% rename from labs/bbb-api-php/demo4_helper.php rename to labs/bbb-api-php-legacy/demo4_helper.php diff --git a/labs/bbb-api-php/demo5.php b/labs/bbb-api-php-legacy/demo5.php similarity index 100% rename from labs/bbb-api-php/demo5.php rename to labs/bbb-api-php-legacy/demo5.php diff --git a/labs/bbb-api-php/demo_footer.php b/labs/bbb-api-php-legacy/demo_footer.php similarity index 100% rename from labs/bbb-api-php/demo_footer.php rename to labs/bbb-api-php-legacy/demo_footer.php diff --git a/labs/bbb-api-php/demo_header.php b/labs/bbb-api-php-legacy/demo_header.php similarity index 100% rename from labs/bbb-api-php/demo_header.php rename to labs/bbb-api-php-legacy/demo_header.php diff --git a/labs/bbb-api-php/heartbeat.js b/labs/bbb-api-php-legacy/heartbeat.js similarity index 100% rename from labs/bbb-api-php/heartbeat.js rename to labs/bbb-api-php-legacy/heartbeat.js diff --git a/labs/bbb-api-php/jquery.js b/labs/bbb-api-php-legacy/jquery.js similarity index 100% rename from labs/bbb-api-php/jquery.js rename to labs/bbb-api-php-legacy/jquery.js diff --git a/labs/bbb-api-php/jquery.xml2json.js b/labs/bbb-api-php-legacy/jquery.xml2json.js similarity index 100% rename from labs/bbb-api-php/jquery.xml2json.js rename to labs/bbb-api-php-legacy/jquery.xml2json.js diff --git a/labs/bbb-api-php/md5.js b/labs/bbb-api-php-legacy/md5.js similarity index 100% rename from labs/bbb-api-php/md5.js rename to labs/bbb-api-php-legacy/md5.js diff --git a/labs/bbb-api-php/polling.gif b/labs/bbb-api-php-legacy/polling.gif similarity index 100% rename from labs/bbb-api-php/polling.gif rename to labs/bbb-api-php-legacy/polling.gif diff --git a/labs/bbb-api-php/.gitignore b/labs/bbb-api-php/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..496ee2ca6a2f08396a4076fe43dedf3dc0da8b6d --- /dev/null +++ b/labs/bbb-api-php/.gitignore @@ -0,0 +1 @@ +.DS_Store \ No newline at end of file diff --git a/labs/bbb-api-php/README b/labs/bbb-api-php/README new file mode 100644 index 0000000000000000000000000000000000000000..fcb85d8757628199c9d43f298d265cbccc36fa50 --- /dev/null +++ b/labs/bbb-api-php/README @@ -0,0 +1 @@ +Stick the entire /bbb-api-php directory somewhere that you can host php web files. Then browse to the index page for configuration and usage instructions. \ No newline at end of file diff --git a/labs/bbb-api-php/assets/ajax-loader.gif b/labs/bbb-api-php/assets/ajax-loader.gif new file mode 100644 index 0000000000000000000000000000000000000000..c97ec6ea9739a68e25637c0aa4adaaea05e3e4ca Binary files /dev/null and b/labs/bbb-api-php/assets/ajax-loader.gif differ diff --git a/labs/bbb-api-php/css/main.css b/labs/bbb-api-php/css/main.css new file mode 100644 index 0000000000000000000000000000000000000000..936ab52465a27c0f43202c447719bca614ed8176 --- /dev/null +++ b/labs/bbb-api-php/css/main.css @@ -0,0 +1,18 @@ +body {font-family:Arial,Helvetica,sans-serif;} +dl dt {font-weight:bold;margin-bottom:10px;} +dl dd {margin-bottom:20px;} +p {color:#666;} +ul {margin-left:30px;padding-left:0;list-style-type:none;} +li {margin-bottom:5px;} +a {color:#3678c1;} +h3 {border-bottom:1px solid #666;padding-bottom:5px;margin-top:30px;} + +#main {width:960px;margin: 0 auto;} +#status {background-color:#fff;border: solid 1px #ccc;padding:20px;text-align:center;} +#TOC {float:right;margin-left:20px;margin-bottom:20px;padding:0px;padding-left:0;border:1px solid #ccc;width:300px;} +#tocheader {background-color:#666;color:white;padding:10px;font-weight:bold;} + +.method {padding-left:20px;background-color:#d7ffd9;border:1px solid #97e59b;margin-top:0px;} +.methodname {font-weight:bold;color:#000;} +.example {padding-left:40px;padding-right:40px; background-color:#fff;border:1px solid #ccc;} +.code {background-color:#eee;padding:20px;border:1px solid #ccc;} \ No newline at end of file diff --git a/labs/bbb-api-php/examples/createMeeting.php b/labs/bbb-api-php/examples/createMeeting.php new file mode 100644 index 0000000000000000000000000000000000000000..eaf62de0fdeaf53e5631c7e7dc5c6c134e98ee76 --- /dev/null +++ b/labs/bbb-api-php/examples/createMeeting.php @@ -0,0 +1,61 @@ +<?php + +/* _____ PHP Big Blue Button API Usage ______ +* by Peter Mentzer peter@petermentzerdesign.com +* Use, modify and distribute however you like. +*/ + +// Require the bbb-api file: +require_once('../includes/bbb-api.php'); + + +// Instatiate the BBB class: +$bbb = new BigBlueButton(); + +/* ___________ CREATE MEETING w/ OPTIONS ______ */ +/* +*/ +$creationParams = array( + 'meetingId' => '1234', // REQUIRED + 'meetingName' => 'Test Meeting Name', // REQUIRED + 'attendeePw' => 'ap', // Match this value in getJoinMeetingURL() to join as attendee. + 'moderatorPw' => 'mp', // Match this value in getJoinMeetingURL() to join as moderator. + 'welcomeMsg' => '', // ''= use default. Change to customize. + 'dialNumber' => '', // The main number to call into. Optional. + 'voiceBridge' => '', // PIN to join voice. Optional. + 'webVoice' => '', // Alphanumeric to join voice. Optional. + 'logoutUrl' => '', // Default in bigbluebutton.properties. Optional. + 'maxParticipants' => '-1', // Optional. -1 = unlimitted. Not supported in BBB. [number] + 'record' => 'false', // New. 'true' will tell BBB to record the meeting. + 'duration' => '0', // Default = 0 which means no set duration in minutes. [number] + //'meta_category' => '', // Use to pass additional info to BBB server. See API docs. +); + +// Create the meeting and get back a response: +$itsAllGood = true; +try {$result = $bbb->createMeetingWithXmlResponseArray($creationParams);} + catch (Exception $e) { + echo 'Caught exception: ', $e->getMessage(), "\n"; + $itsAllGood = false; + } + +if ($itsAllGood == true) { + // If it's all good, then we've interfaced with our BBB php api OK: + if ($result == null) { + // If we get a null response, then we're not getting any XML back from BBB. + echo "Failed to get any response. Maybe we can't contact the BBB server."; + } + else { + // We got an XML response, so let's see what it says: + print_r($result); + if ($result['returncode'] == 'SUCCESS') { + // Then do stuff ... + echo "<p>Meeting succesfullly created.</p>"; + } + else { + echo "<p>Meeting creation failed.</p>"; + } + } +} + +?> \ No newline at end of file diff --git a/labs/bbb-api-php/examples/createRecordedMeeting.php b/labs/bbb-api-php/examples/createRecordedMeeting.php new file mode 100644 index 0000000000000000000000000000000000000000..507b34a0c9f275fc50e9955192bbe204458f95f2 --- /dev/null +++ b/labs/bbb-api-php/examples/createRecordedMeeting.php @@ -0,0 +1,61 @@ +<?php + +/* _____ PHP Big Blue Button API Usage ______ +* by Peter Mentzer peter@petermentzerdesign.com +* Use, modify and distribute however you like. +*/ + +// Require the bbb-api file: +require_once('../includes/bbb-api.php'); + + +// Instatiate the BBB class: +$bbb = new BigBlueButton(); + +/* ___________ CREATE MEETING w/ OPTIONS ______ */ +/* +*/ +$creationParams = array( + 'meetingId' => '12345', // REQUIRED + 'meetingName' => 'Test Recorded Meeting Name', // REQUIRED + 'attendeePw' => 'ap', // Match this value in getJoinMeetingURL() to join as attendee. + 'moderatorPw' => 'mp', // Match this value in getJoinMeetingURL() to join as moderator. + 'welcomeMsg' => '', // ''= use default. Change to customize. + 'dialNumber' => '', // The main number to call into. Optional. + 'voiceBridge' => '', // PIN to join voice. Optional. + 'webVoice' => '', // Alphanumeric to join voice. Optional. + 'logoutUrl' => '', // Default in bigbluebutton.properties. Optional. + 'maxParticipants' => '-1', // Optional. -1 = unlimitted. Not supported in BBB. [number] + 'record' => 'true', // New. 'true' will tell BBB to record the meeting. + 'duration' => '5', // Default = 0 which means no set duration in minutes. [number] + //'meta_category' => '', // Use to pass additional info to BBB server. See API docs. +); + +// Create the meeting and get back a response: +$itsAllGood = true; +try {$result = $bbb->createMeetingWithXmlResponseArray($creationParams);} + catch (Exception $e) { + echo 'Caught exception: ', $e->getMessage(), "\n"; + $itsAllGood = false; + } + +if ($itsAllGood == true) { + // If it's all good, then we've interfaced with our BBB php api OK: + if ($result == null) { + // If we get a null response, then we're not getting any XML back from BBB. + echo "Failed to get any response. Maybe we can't contact the BBB server."; + } + else { + // We got an XML response, so let's see what it says: + print_r($result); + if ($result['returncode'] == 'SUCCESS') { + // Then do stuff ... + echo "<p>Meeting succesfullly created.</p>"; + } + else { + echo "<p>Meeting creation failed.</p>"; + } + } +} + +?> \ No newline at end of file diff --git a/labs/bbb-api-php/examples/deleteRecordings.php b/labs/bbb-api-php/examples/deleteRecordings.php new file mode 100644 index 0000000000000000000000000000000000000000..6ab4ab22f965f94f3fab93dc31fc92c9678089af --- /dev/null +++ b/labs/bbb-api-php/examples/deleteRecordings.php @@ -0,0 +1,43 @@ +<?php + +/* _____ PHP Big Blue Button API Usage ______ +* by Peter Mentzer peter@petermentzerdesign.com +* Use, modify and distribute however you like. +*/ + +// Require the bbb-api file: +require_once('../includes/bbb-api.php'); + + +// Instatiate the BBB class: +$bbb = new BigBlueButton(); + +/* ___________ DELETE RECORDINGS ______ */ +/* Pass a recordId to delete a recording. +*/ + +$recordingParams = array( + /* + * NOTE: Set the recordId below to a valid id after you have created a recorded meeting, + * and received back a real recordID back from your BBB server using the + * getRecordingsWithXmlResponseArray method. + */ + + // REQUIRED - We have to know which recording: + 'recordId' => '8cb2237d0679ca88db6464eac60da96345513964-1333379469215', + +); + +// Delete the meeting: +$itsAllGood = true; +try {$result = $bbb->deleteRecordingsWithXmlResponseArray($recordingParams);} + catch (Exception $e) { + echo 'Caught exception: ', $e->getMessage(), "\n"; + $itsAllGood = false; + } + +if ($itsAllGood == true) { + //Output results to see what we're getting: + print_r($result); +} +?> \ No newline at end of file diff --git a/labs/bbb-api-php/examples/endMeeting.php b/labs/bbb-api-php/examples/endMeeting.php new file mode 100644 index 0000000000000000000000000000000000000000..b1b147e8c6ae3ea57bf6b497cf95b56cc711e463 --- /dev/null +++ b/labs/bbb-api-php/examples/endMeeting.php @@ -0,0 +1,50 @@ +<?php + +/* _____ PHP Big Blue Button API Usage ______ +* by Peter Mentzer peter@petermentzerdesign.com +* Use, modify and distribute however you like. +*/ + +// Require the bbb-api file: +require_once('../includes/bbb-api.php'); + +// Instatiate the BBB class: +$bbb = new BigBlueButton(); + +/* ___________ END A MEETING ______ */ +/* Determine the meeting to end via meetingId and end it. +*/ + +$endParams = array( + 'meetingId' => '1234', // REQUIRED - We have to know which meeting to end. + 'password' => 'mp', // REQUIRED - Must match moderator pass for meeting. + +); + +// Get the URL to end a meeting: +$itsAllGood = true; +try {$result = $bbb->endMeetingWithXmlResponseArray($endParams);} + catch (Exception $e) { + echo 'Caught exception: ', $e->getMessage(), "\n"; + $itsAllGood = false; + } + + if ($itsAllGood == true) { + // If it's all good, then we've interfaced with our BBB php api OK: + if ($result == null) { + // If we get a null response, then we're not getting any XML back from BBB. + echo "Failed to get any response. Maybe we can't contact the BBB server."; + } + else { + // We got an XML response, so let's see what it says: + print_r($result); + if ($result['returncode'] == 'SUCCESS') { + // Then do stuff ... + echo "<p>Meeting succesfullly ended.</p>"; + } + else { + echo "<p>Failed to end meeting.</p>"; + } + } + } +?> \ No newline at end of file diff --git a/labs/bbb-api-php/examples/getJoinMeetingUrlAttendee.php b/labs/bbb-api-php/examples/getJoinMeetingUrlAttendee.php new file mode 100644 index 0000000000000000000000000000000000000000..05642c6c1424f073516e6a365dba13aa1b27ea29 --- /dev/null +++ b/labs/bbb-api-php/examples/getJoinMeetingUrlAttendee.php @@ -0,0 +1,40 @@ +<?php + +/* _____ PHP Big Blue Button API Usage ______ +* by Peter Mentzer peter@petermentzerdesign.com +* Use, modify and distribute however you like. +*/ + +// Require the bbb-api file: +require_once('../includes/bbb-api.php'); + + +// Instatiate the BBB class: +$bbb = new BigBlueButton(); + +/* ___________ JOIN MEETING w/ OPTIONS ______ */ +/* Determine the meeting to join via meetingId and join it. +*/ + +$joinParams = array( + 'meetingId' => '1234', // REQUIRED - We have to know which meeting to join. + 'username' => 'Test Attendee', // REQUIRED - The user display name that will show in the BBB meeting. + 'password' => 'ap', // REQUIRED - Must match either attendee or moderator pass for meeting. + 'createTime' => '', // OPTIONAL - string + 'userId' => '', // OPTIONAL - string + 'webVoiceConf' => '' // OPTIONAL - string +); + +// Get the URL to join meeting: +$itsAllGood = true; +try {$result = $bbb->getJoinMeetingURL($joinParams);} + catch (Exception $e) { + echo 'Caught exception: ', $e->getMessage(), "\n"; + $itsAllGood = false; + } + +if ($itsAllGood == true) { + //Output results to see what we're getting: + print_r($result); +} +?> \ No newline at end of file diff --git a/labs/bbb-api-php/examples/getJoinMeetingUrlModerator.php b/labs/bbb-api-php/examples/getJoinMeetingUrlModerator.php new file mode 100644 index 0000000000000000000000000000000000000000..dc0de99588eff87c615fc4796a436a36f323386c --- /dev/null +++ b/labs/bbb-api-php/examples/getJoinMeetingUrlModerator.php @@ -0,0 +1,40 @@ +<?php + +/* _____ PHP Big Blue Button API Usage ______ +* by Peter Mentzer peter@petermentzerdesign.com +* Use, modify and distribute however you like. +*/ + +// Require the bbb-api file: +require_once('../includes/bbb-api.php'); + + +// Instatiate the BBB class: +$bbb = new BigBlueButton(); + +/* ___________ JOIN MEETING w/ OPTIONS ______ */ +/* Determine the meeting to join via meetingId and join it. +*/ + +$joinParams = array( + 'meetingId' => '1234', // REQUIRED - We have to know which meeting to join. + 'username' => 'Test Moderator', // REQUIRED - The user display name that will show in the BBB meeting. + 'password' => 'mp', // REQUIRED - Must match either attendee or moderator pass for meeting. + 'createTime' => '', // OPTIONAL - string + 'userId' => '', // OPTIONAL - string + 'webVoiceConf' => '' // OPTIONAL - string +); + +// Get the URL to join meeting: +$itsAllGood = true; +try {$result = $bbb->getJoinMeetingURL($joinParams);} + catch (Exception $e) { + echo 'Caught exception: ', $e->getMessage(), "\n"; + $itsAllGood = false; + } + +if ($itsAllGood == true) { + //Output results to see what we're getting: + print_r($result); +} +?> \ No newline at end of file diff --git a/labs/bbb-api-php/examples/getJoinMeetingUrlModeratorRecord.php b/labs/bbb-api-php/examples/getJoinMeetingUrlModeratorRecord.php new file mode 100644 index 0000000000000000000000000000000000000000..3adbfd0ac693105da8883e851b6978299032f8fd --- /dev/null +++ b/labs/bbb-api-php/examples/getJoinMeetingUrlModeratorRecord.php @@ -0,0 +1,40 @@ +<?php + +/* _____ PHP Big Blue Button API Usage ______ +* by Peter Mentzer peter@petermentzerdesign.com +* Use, modify and distribute however you like. +*/ + +// Require the bbb-api file: +require_once('../includes/bbb-api.php'); + + +// Instatiate the BBB class: +$bbb = new BigBlueButton(); + +/* ___________ JOIN MEETING w/ OPTIONS ______ */ +/* Determine the meeting to join via meetingId and join it. +*/ + +$joinParams = array( + 'meetingId' => '12345', // REQUIRED - We have to know which meeting to join. + 'username' => 'Test Moderator', // REQUIRED - The user display name that will show in the BBB meeting. + 'password' => 'mp', // REQUIRED - Must match either attendee or moderator pass for meeting. + 'createTime' => '', // OPTIONAL - string + 'userId' => '', // OPTIONAL - string + 'webVoiceConf' => '' // OPTIONAL - string +); + +// Get the URL to join meeting: +$itsAllGood = true; +try {$result = $bbb->getJoinMeetingURL($joinParams);} + catch (Exception $e) { + echo 'Caught exception: ', $e->getMessage(), "\n"; + $itsAllGood = false; + } + +if ($itsAllGood == true) { + //Output results to see what we're getting: + print_r($result); +} +?> \ No newline at end of file diff --git a/labs/bbb-api-php/examples/getMeetingInfo.php b/labs/bbb-api-php/examples/getMeetingInfo.php new file mode 100644 index 0000000000000000000000000000000000000000..9d8dd9fe6264f7b680f20919d6e5154c01386ccf --- /dev/null +++ b/labs/bbb-api-php/examples/getMeetingInfo.php @@ -0,0 +1,51 @@ +<?php + +/* _____ PHP Big Blue Button API Usage ______ +* by Peter Mentzer peter@petermentzerdesign.com +* Use, modify and distribute however you like. +*/ + +// Require the bbb-api file: +require_once('../includes/bbb-api.php'); + + +// Instatiate the BBB class: +$bbb = new BigBlueButton(); + +/* ___________ GET MEETING INFO ______ */ +/* Get meeting info based on meeting id. +*/ + +$infoParams = array( + 'meetingId' => '1234', // REQUIRED - We have to know which meeting. + 'password' => 'mp', // REQUIRED - Must match moderator pass for meeting. + +); + +// Now get meeting info and display it: +$itsAllGood = true; +try {$result = $bbb->getMeetingInfoWithXmlResponseArray($infoParams);} + catch (Exception $e) { + echo 'Caught exception: ', $e->getMessage(), "\n"; + $itsAllGood = false; + } + + if ($itsAllGood == true) { + // If it's all good, then we've interfaced with our BBB php api OK: + if ($result == null) { + // If we get a null response, then we're not getting any XML back from BBB. + echo "Failed to get any response. Maybe we can't contact the BBB server."; + } + else { + // We got an XML response, so let's see what it says: + var_dump($result); + if (!isset($result['messageKey'])) { + // Then do stuff ... + echo "<p>Meeting info was found on the server.</p>"; + } + else { + echo "<p>Failed to get meeting info.</p>"; + } + } + } +?> \ No newline at end of file diff --git a/labs/bbb-api-php/examples/getMeetings.php b/labs/bbb-api-php/examples/getMeetings.php new file mode 100644 index 0000000000000000000000000000000000000000..afe88b4fca12c660bb41c768414b8aaa4e8bc386 --- /dev/null +++ b/labs/bbb-api-php/examples/getMeetings.php @@ -0,0 +1,53 @@ +<?php + +/* _____ PHP Big Blue Button API Usage ______ +* by Peter Mentzer peter@petermentzerdesign.com +* Use, modify and distribute however you like. +*/ + +// Require the bbb-api file: +require_once('../includes/bbb-api.php'); + +// Instatiate the BBB class: +$bbb = new BigBlueButton(); + +/* ___________ GET MEETINGS FROM BBB SERVER ______ */ +/* +*/ + +/* +---DEBUG - useful for manually checking the raw xml results. +$test = $bbb->getGetMeetingsUrl(); +echo $test; + ---END DEBUG +*/ + +$itsAllGood = true; +try {$result = $bbb->getMeetingsWithXmlResponseArray();} + catch (Exception $e) { + echo 'Caught exception: ', $e->getMessage(), "\n"; + $itsAllGood = false; + } + +if ($itsAllGood == true) { + // If it's all good, then we've interfaced with our BBB php api OK: + if ($result == null) { + // If we get a null response, then we're not getting any XML back from BBB. + echo "Failed to get any response. Maybe we can't contact the BBB server."; + } + else { + // We got an XML response, so let's see what it says: + if ($result['returncode'] == 'SUCCESS') { + // Then do stuff ... + echo "<p>We got some meeting info from BBB:</p>"; + // You can parse this array how you like. For now we just do this: + print_r($result); + } + else { + echo "<p>We didn't get a success response. Instead we got this:</p>"; + print_r($result); + } + } +} + +?> \ No newline at end of file diff --git a/labs/bbb-api-php/examples/getRecordings.php b/labs/bbb-api-php/examples/getRecordings.php new file mode 100644 index 0000000000000000000000000000000000000000..b1b4591d0bfb4d1eb8fd9b695367f944446aafee --- /dev/null +++ b/labs/bbb-api-php/examples/getRecordings.php @@ -0,0 +1,50 @@ +<?php + +/* _____ PHP Big Blue Button API Usage ______ +* by Peter Mentzer peter@petermentzerdesign.com +* Use, modify and distribute however you like. +*/ + +// Require the bbb-api file: +require_once('../includes/bbb-api.php'); + + +// Instatiate the BBB class: +$bbb = new BigBlueButton(); + +/* ___________ GET RECORDINGS INFO ______ */ +/* Get recordings info based on optional meeting id, or all. +*/ + +$recordingsParams = array( + 'meetingId' => '', // OPTIONAL - comma separate if multiples + +); + +// Now get recordings info and display it: +$itsAllGood = true; +try {$result = $bbb->getRecordingsWithXmlResponseArray($recordingsParams);} + catch (Exception $e) { + echo 'Caught exception: ', $e->getMessage(), "\n"; + $itsAllGood = false; + } + + if ($itsAllGood == true) { + // If it's all good, then we've interfaced with our BBB php api OK: + if ($result == null) { + // If we get a null response, then we're not getting any XML back from BBB. + echo "Failed to get any response. Maybe we can't contact the BBB server."; + } + else { + // We got an XML response, so let's see what it says: + var_dump($result); + if ($result['returncode'] == 'SUCCESS') { + // Then do stuff ... + echo "<p>Meeting info was found on the server.</p>"; + } + else { + echo "<p>Failed to get meeting info.</p>"; + } + } + } +?> \ No newline at end of file diff --git a/labs/bbb-api-php/examples/isMeetingRunning.php b/labs/bbb-api-php/examples/isMeetingRunning.php new file mode 100644 index 0000000000000000000000000000000000000000..fa9475a1bc979e48ab0980ed79804e31187bec3d --- /dev/null +++ b/labs/bbb-api-php/examples/isMeetingRunning.php @@ -0,0 +1,33 @@ +<?php + +/* _____ PHP Big Blue Button API Usage ______ +* by Peter Mentzer peter@petermentzerdesign.com +* Use, modify and distribute however you like. +*/ + +// Require the bbb-api file: +require_once('../includes/bbb-api.php'); + + +// Instatiate the BBB class: +$bbb = new BigBlueButton(); + +/* ___________ IS MEETING RUNNING? ______ */ +/* Pass a meetingId to see if the meeting is currently running. +*/ + +$meetingId = '1234'; + +// Get the URL to join meeting: +$itsAllGood = true; +try {$result = $bbb->isMeetingRunningWithXmlResponseArray($meetingId);} + catch (Exception $e) { + echo 'Caught exception: ', $e->getMessage(), "\n"; + $itsAllGood = false; + } + +if ($itsAllGood == true) { + //Output results to see what we're getting: + print_r($result); +} +?> \ No newline at end of file diff --git a/labs/bbb-api-php/examples/joinIfRunning.php b/labs/bbb-api-php/examples/joinIfRunning.php new file mode 100644 index 0000000000000000000000000000000000000000..a8e3a8689189e34dda81d5fdbe9d860a96548374 --- /dev/null +++ b/labs/bbb-api-php/examples/joinIfRunning.php @@ -0,0 +1,89 @@ +<!DOCTYPE html> +<head> + <meta http-equiv="Content-type" content="text/html; charset=utf-8"> + <title>joinIfRunning</title> + <link type="text/css" rel="stylesheet" href="../css/main.css"> + <script type="text/javascript" charset="utf-8"> + if(window.top==window) { + // you're not in a frame so you reload the site + window.setTimeout('location.reload()', 10000); //reloads after 10 seconds + } else { + //you're inside a frame, so you stop reloading + } + </script> +</head> + +<body id="joinifrunning" onload=""> +<div id="main"> + <h1>Attempting to Join...</h1> + + <?php + /* _____ PHP Big Blue Button API Usage ______ + * by Peter Mentzer peter@petermentzerdesign.com + * Use, modify and distribute however you like. + */ + + // Require the bbb-api file: + require_once('../includes/bbb-api.php'); + $bbb = new BigBlueButton(); + $meetingId = '1234'; + $itsAllGood = true; + try {$result = $bbb->isMeetingRunningWithXmlResponseArray($meetingId);} + catch (Exception $e) { + echo 'Caught exception: ', $e->getMessage(), "\n"; + $itsAllGood = false; + } + if ($itsAllGood == true) { + //Output results to see what we're getting: + //print_r($result); + $status = $result['running']; + //echo "<p style='color:red;'>".$status."</p>"; + + $holdMessage = ' + <div id="status"> + <p>Your meeting has not yet started. Waiting for a moderator to start the meeting...</p> + <img src="../assets/ajax-loader.gif" alt="...contacting server..." /> + <p>You will be connected as soon as the meeting starts.</p> + </div> + '; + + // The meeting is not running yet so hold your horses: + if ($status == 'false') { + echo $holdMessage; + } + else { + //Here we redirect the user to the joinUrl. + // For now we output this: + echo "...User would be redirected to the meeting now at:"; + + $joinParams = array( + 'meetingId' => '1234', // REQUIRED - We have to know which meeting to join. + 'username' => 'Test Attendee', // REQUIRED - The user display name that will show in the BBB meeting. + 'password' => 'ap', // REQUIRED - Must match either attendee or moderator pass for meeting. + 'createTime' => '', // OPTIONAL - string + 'userId' => '', // OPTIONAL - string + 'webVoiceConf' => '' // OPTIONAL - string + ); + + // Get the URL to join meeting: + $allGood = true; + try {$result = $bbb->getJoinMeetingURL($joinParams);} + catch (Exception $e) { + echo 'Caught exception: ', $e->getMessage(), "\n"; + $allGood = false; + } + + if ($allGood == true) { + //Output resulting URL. Send user there... + echo "<p>".$result."</p>"; + } + } + } + ?> + + + + + +</div> +</body> \ No newline at end of file diff --git a/labs/bbb-api-php/examples/publishRecordings.php b/labs/bbb-api-php/examples/publishRecordings.php new file mode 100644 index 0000000000000000000000000000000000000000..815cc019af15cca3accfaa083470d03cdf64ac83 --- /dev/null +++ b/labs/bbb-api-php/examples/publishRecordings.php @@ -0,0 +1,44 @@ +<?php + +/* _____ PHP Big Blue Button API Usage ______ +* by Peter Mentzer peter@petermentzerdesign.com +* Use, modify and distribute however you like. +*/ + +// Require the bbb-api file: +require_once('../includes/bbb-api.php'); + + +// Instatiate the BBB class: +$bbb = new BigBlueButton(); + +/* ___________ PUBLISH RECORDINGS ______ */ +/* Pass a recordId and true/false to publish or unpublish a recording. +*/ + +$recordingParams = array( + /* + * NOTE: Set the recordId below to a valid id after you have created a recorded meeting, + * and received back a real recordID back from your BBB server using the + * getRecordingsWithXmlResponseArray method. + */ + + // REQUIRED - We have to know which recording: + 'recordId' => '8cb2237d0679ca88db6464eac60da96345513964-1333379469215', + 'publish' => 'true', // REQUIRED - To publish or not to publish. + +); + +// Now do it: +$itsAllGood = true; +try {$result = $bbb->publishRecordingsWithXmlResponseArray($recordingParams);} + catch (Exception $e) { + echo 'Caught exception: ', $e->getMessage(), "\n"; + $itsAllGood = false; + } + +if ($itsAllGood == true) { + //Output results to see what we're getting: + print_r($result); +} +?> \ No newline at end of file diff --git a/labs/bbb-api-php/includes/bbb-api.php b/labs/bbb-api-php/includes/bbb-api.php new file mode 100644 index 0000000000000000000000000000000000000000..2bc6322cefbb18141c66818fc5a17e0c93612a34 --- /dev/null +++ b/labs/bbb-api-php/includes/bbb-api.php @@ -0,0 +1,577 @@ +<?php +/* +Copyright 2010 Blindside Networks + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Versions: + 1.0 -- Initial version written by DJP + (email: djp [a t ] architectes DOT .org) + 1.1 -- Updated by Omar Shammas and Sebastian Schneider + (email : omar DOT shammas [a t ] g m ail DOT com) + (email : seb DOT sschneider [ a t ] g m ail DOT com) + 1.2 -- Updated by Omar Shammas + (email : omar DOT shammas [a t ] g m ail DOT com) + 1.3 -- Refactored by Peter Mentzer + (email : peter@petermentzerdesign.com) + - This update will BREAK your external existing code if + you've used the previous versions <= 1.2 already so: + -- update your external code to use new method names if needed + -- update your external code to pass new parameters to methods + - Working example of joinIfRunning.php now included + - Added support for BBB 0.8b recordings + - Now using Zend coding, naming and style conventions + - Refactored methods to accept standardized parameters & match BBB API structure + -- See included samples for usage examples +*/ + +/* _______________________________________________________________________*/ + +/* get the config values */ +require_once "config.php"; + +class BigBlueButton { + + private $_securitySalt; + private $_bbbServerBaseUrl; + + /* ___________ General Methods for the BigBlueButton Class __________ */ + + function __construct() { + /* + Establish just our basic elements in the constructor: + */ + // BASE CONFIGS - set these for your BBB server in config.php and they will + // simply flow in here via the constants: + $this->_securitySalt = CONFIG_SECURITY_SALT; + $this->_bbbServerBaseUrl = CONFIG_SERVER_BASE_URL; + } + + private function _processXmlResponse($url){ + /* + A private utility method used by other public methods to process XML responses. + */ + if (extension_loaded('curl')) { + $ch = curl_init() or die ( curl_error() ); + $timeout = 10; + curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt( $ch, CURLOPT_URL, $url ); + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); + curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout); + $data = curl_exec( $ch ); + curl_close( $ch ); + + if($data) + return (new SimpleXMLElement($data)); + else + return false; + } + return (simplexml_load_file($url)); + } + + private function _requiredParam($param) { + /* Process required params and throw errors if we don't get values */ + if ((isset($param)) && ($param != '')) { + return $param; + } + elseif (!isset($param)) { + throw new Exception('Missing parameter.'); + } + else { + throw new Exception(''.$param.' is required.'); + } + } + + private function _optionalParam($param) { + /* Pass most optional params through as set value, or set to '' */ + /* Don't know if we'll use this one, but let's build it in case. */ + if ((isset($param)) && ($param != '')) { + return $param; + } + else { + $param = ''; + return $param; + } + } + + /* __________________ BBB ADMINISTRATION METHODS _________________ */ + /* The methods in the following section support the following categories of the BBB API: + -- create + -- join + -- end + */ + + public function getCreateMeetingUrl($creationParams) { + /* + USAGE: + (see $creationParams array in createMeetingArray method.) + */ + $this->_meetingId = $this->_requiredParam($creationParams['meetingId']); + $this->_meetingName = $this->_requiredParam($creationParams['meetingName']); + // Set up the basic creation URL: + $creationUrl = $this->_bbbServerBaseUrl."api/create?"; + // Add params: + $params = + 'name='.urlencode($this->_meetingName). + '&meetingID='.urlencode($this->_meetingId). + '&attendeePW='.urlencode($creationParams['attendeePw']). + '&moderatorPW='.urlencode($creationParams['moderatorPw']). + '&dialNumber='.urlencode($creationParams['dialNumber']). + '&voiceBridge='.urlencode($creationParams['voiceBridge']). + '&webVoice='.urlencode($creationParams['webVoice']). + '&logoutURL='.urlencode($creationParams['logoutUrl']). + '&maxParticipants='.urlencode($creationParams['maxParticipants']). + '&record='.urlencode($creationParams['record']). + '&duration='.urlencode($creationParams['duration']). + //'&meta_category='.urlencode($creationParams['meta_category']); + $welcomeMessage = $creationParams['welcomeMsg']; + if(trim($welcomeMessage)) + $params .= '&welcome='.urlencode($welcomeMessage); + // Return the complete URL: + return ( $creationUrl.$params.'&checksum='.sha1("create".$params.$this->_securitySalt) ); + } + + public function createMeetingWithXmlResponseArray($creationParams) { + /* + USAGE: + $creationParams = array( + 'name' => 'Meeting Name', -- A name for the meeting (or username) + 'meetingId' => '1234', -- A unique id for the meeting + 'attendeePw' => 'ap', -- Set to 'ap' and use 'ap' to join = no user pass required. + 'moderatorPw' => 'mp', -- Set to 'mp' and use 'mp' to join = no user pass required. + 'welcomeMsg' => '', -- ''= use default. Change to customize. + 'dialNumber' => '', -- The main number to call into. Optional. + 'voiceBridge' => '', -- PIN to join voice. Optional. + 'webVoice' => '', -- Alphanumeric to join voice. Optional. + 'logoutUrl' => '', -- Default in bigbluebutton.properties. Optional. + 'maxParticipants' => '-1', -- Optional. -1 = unlimitted. Not supported in BBB. [number] + 'record' => 'false', -- New. 'true' will tell BBB to record the meeting. + 'duration' => '0', -- Default = 0 which means no set duration in minutes. [number] + 'meta_category' => '', -- Use to pass additional info to BBB server. See API docs to enable. + ); + */ + $xml = $this->_processXmlResponse($this->getCreateMeetingURL($creationParams)); + + if($xml) { + if($xml->meetingID) + return array( + 'returncode' => $xml->returncode, + 'message' => $xml->message, + 'messageKey' => $xml->messageKey, + 'meetingId' => $xml->meetingID, + 'attendeePw' => $xml->attendeePW, + 'moderatorPw' => $xml->moderatorPW, + 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded, + 'createTime' => $xml->createTime + ); + else + return array( + 'returncode' => $xml->returncode, + 'message' => $xml->message, + 'messageKey' => $xml->messageKey + ); + } + else { + return null; + } + } + + public function getJoinMeetingURL($joinParams) { + /* + NOTE: At this point, we don't use a corresponding joinMeetingWithXmlResponse here because the API + doesn't respond on success, but you can still code that method if you need it. Or, you can take the URL + that's returned from this method and simply send your users off to that URL in your code. + USAGE: + $joinParams = array( + 'meetingId' => '1234', -- REQUIRED - A unique id for the meeting + 'username' => 'Jane Doe', -- REQUIRED - The name that will display for the user in the meeting + 'password' => 'ap', -- REQUIRED - The attendee or moderator password, depending on what's passed here + 'createTime' => '', -- OPTIONAL - string. Leave blank ('') unless you set this correctly. + 'userID' => '', -- OPTIONAL - string + 'webVoiceConf' => '' -- OPTIONAL - string + ); + */ + $this->_meetingId = $this->_requiredParam($joinParams['meetingId']); + $this->_username = $this->_requiredParam($joinParams['username']); + $this->_password = $this->_requiredParam($joinParams['password']); + // Establish the basic join URL: + $joinUrl = $this->_bbbServerBaseUrl."api/join?"; + // Add parameters to the URL: + $params = + 'meetingID='.urlencode($this->_meetingId). + '&fullName='.urlencode($this->_username). + '&password='.urlencode($this->_password). + '&userID='.urlencode($joinParams['userId']). + '&webVoiceConf='.urlencode($joinParams['webVoiceConf']); + // Only use createTime if we really want to use it. If it's '', then don't pass it: + if (((isset($joinParams['createTime'])) && ($joinParams['createTime'] != ''))) { + $params .= '&createTime='.urlencode($joinParams['createTime']); + } + // Return the URL: + return ($joinUrl.$params.'&checksum='.sha1("join".$params.$this->_securitySalt)); + } + + public function getEndMeetingURL($endParams) { + /* USAGE: + $endParams = array ( + 'meetingId' => '1234', -- REQUIRED - The unique id for the meeting + 'password' => 'mp' -- REQUIRED - The moderator password for the meeting + ); + */ + $this->_meetingId = $this->_requiredParam($endParams['meetingId']); + $this->_password = $this->_requiredParam($endParams['password']); + $endUrl = $this->_bbbServerBaseUrl."api/end?"; + $params = + 'meetingID='.urlencode($this->_meetingId). + '&password='.urlencode($this->_password); + return ($endUrl.$params.'&checksum='.sha1("end".$params.$this->_securitySalt)); + } + + public function endMeetingWithXmlResponseArray($endParams) { + /* USAGE: + $endParams = array ( + 'meetingId' => '1234', -- REQUIRED - The unique id for the meeting + 'password' => 'mp' -- REQUIRED - The moderator password for the meeting + ); + */ + $xml = $this->_processXmlResponse($this->getEndMeetingURL($endParams)); + if($xml) { + return array( + 'returncode' => $xml->returncode, + 'message' => $xml->message, + 'messageKey' => $xml->messageKey + ); + } + else { + return null; + } + + } + + /* __________________ BBB MONITORING METHODS _________________ */ + /* The methods in the following section support the following categories of the BBB API: + -- isMeetingRunning + -- getMeetings + -- getMeetingInfo + */ + + public function getIsMeetingRunningUrl($meetingId) { + /* USAGE: + $meetingId = '1234' -- REQUIRED - The unique id for the meeting + */ + $this->_meetingId = $this->_requiredParam($meetingId); + $runningUrl = $this->_bbbServerBaseUrl."api/isMeetingRunning?"; + $params = + 'meetingID='.urlencode($this->_meetingId); + return ($runningUrl.$params.'&checksum='.sha1("isMeetingRunning".$params.$this->_securitySalt)); + } + + public function isMeetingRunningWithXmlResponseArray($meetingId) { + /* USAGE: + $meetingId = '1234' -- REQUIRED - The unique id for the meeting + */ + $xml = $this->_processXmlResponse($this->getIsMeetingRunningUrl($meetingId)); + if($xml) { + return array( + 'returncode' => $xml->returncode, + 'running' => $xml->running // -- Returns true/false. + ); + } + else { + return null; + } + + } + + public function getGetMeetingsUrl() { + /* Simply formulate the getMeetings URL + We do this in a separate function so we have the option to just get this + URL and print it if we want for some reason. + */ + $getMeetingsUrl = $this->_bbbServerBaseUrl."api/getMeetings?checksum=".sha1("getMeetings".$this->_securitySalt); + return $getMeetingsUrl; + } + + public function getMeetingsWithXmlResponseArray() { + /* USAGE: + We don't need to pass any parameters with this one, so we just send the query URL off to BBB + and then handle the results that we get in the XML response. + */ + $xml = $this->_processXmlResponse($this->getGetMeetingsUrl()); + if($xml) { + // If we don't get a success code, stop processing and return just the returncode: + if ($xml->returncode != 'SUCCESS') { + $result = array( + 'returncode' => $xml->returncode + ); + return $result; + } + elseif ($xml->messageKey == 'noMeetings') { + /* No meetings on server, so return just this info: */ + $result = array( + 'returncode' => $xml->returncode, + 'messageKey' => $xml->messageKey, + 'message' => $xml->message + ); + return $result; + } + else { + // In this case, we have success and meetings. First return general response: + $result = array( + 'returncode' => $xml->returncode, + 'messageKey' => $xml->messageKey, + 'message' => $xml->message + ); + // Then interate through meeting results and return them as part of the array: + foreach ($xml->meetings->meeting as $m) { + $result[] = array( + 'meetingId' => $m->meetingID, + 'meetingName' => $m->meetingName, + 'createTime' => $m->createTime, + 'attendeePw' => $m->attendeePW, + 'moderatorPw' => $m->moderatorPW, + 'hasBeenForciblyEnded' => $m->hasBeenForciblyEnded, + 'running' => $m->running + ); + } + return $result; + } + } + else { + return null; + } + + } + + public function getMeetingInfoUrl($infoParams) { + /* USAGE: + $infoParams = array( + 'meetingId' => '1234', -- REQUIRED - The unique id for the meeting + 'password' => 'mp' -- REQUIRED - The moderator password for the meeting + ); + */ + $this->_meetingId = $this->_requiredParam($infoParams['meetingId']); + $this->_password = $this->_requiredParam($infoParams['password']); + $infoUrl = $this->_bbbServerBaseUrl."api/getMeetingInfo?"; + $params = + 'meetingID='.urlencode($this->_meetingId). + '&password='.urlencode($this->_password); + return ($infoUrl.$params.'&checksum='.sha1("getMeetingInfo".$params.$this->_securitySalt)); + } + + public function getMeetingInfoWithXmlResponseArray($infoParams) { + /* USAGE: + $infoParams = array( + 'meetingId' => '1234', -- REQUIRED - The unique id for the meeting + 'password' => 'mp' -- REQUIRED - The moderator password for the meeting + ); + */ + $xml = $this->_processXmlResponse($this->getMeetingInfoUrl($infoParams)); + if($xml) { + // If we don't get a success code or messageKey, find out why: + if (($xml->returncode != 'SUCCESS') || ($xml->messageKey == null)) { + $result = array( + 'returncode' => $xml->returncode, + 'messageKey' => $xml->messageKey, + 'message' => $xml->message + ); + return $result; + } + else { + // In this case, we have success and meeting info: + $result = array( + 'returncode' => $xml->returncode, + 'meetingName' => $xml->meetingName, + 'meetingId' => $xml->meetingID, + 'createTime' => $xml->createTime, + 'voiceBridge' => $xml->voiceBridge, + 'attendeePw' => $xml->attendeePW, + 'moderatorPw' => $xml->moderatorPW, + 'running' => $xml->running, + 'recording' => $xml->recording, + 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded, + 'startTime' => $xml->startTime, + 'endTime' => $xml->endTime, + 'participantCount' => $xml->participantCount, + 'maxUsers' => $xml->maxUsers, + 'moderatorCount' => $xml->moderatorCount, + ); + // Then interate through attendee results and return them as part of the array: + foreach ($xml->attendees->attendee as $a) { + $result[] = array( + 'userId' => $a->userID, + 'fullName' => $a->fullName, + 'role' => $a->role + ); + } + return $result; + } + } + else { + return null; + } + + } + + /* __________________ BBB RECORDING METHODS _________________ */ + /* The methods in the following section support the following categories of the BBB API: + -- getRecordings + -- publishRecordings + -- deleteRecordings + */ + + public function getRecordingsUrl($recordingParams) { + /* USAGE: + $recordingParams = array( + 'meetingId' => '1234', -- OPTIONAL - comma separate if multiple ids + ); + */ + $recordingsUrl = $this->_bbbServerBaseUrl."api/getRecordings?"; + $params = + 'meetingID='.urlencode($recordingParams['meetingId']); + return ($recordingsUrl.$params.'&checksum='.sha1("getRecordings".$params.$this->_securitySalt)); + + } + + public function getRecordingsWithXmlResponseArray($recordingParams) { + /* USAGE: + $recordingParams = array( + 'meetingId' => '1234', -- OPTIONAL - comma separate if multiple ids + ); + NOTE: 'duration' DOES work when creating a meeting, so if you set duration + when creating a meeting, it will kick users out after the duration. Should + probably be required in user code when 'recording' is set to true. + */ + $xml = $this->_processXmlResponse($this->getRecordingsUrl($recordingParams)); + if($xml) { + // If we don't get a success code or messageKey, find out why: + if (($xml->returncode != 'SUCCESS') || ($xml->messageKey == null)) { + $result = array( + 'returncode' => $xml->returncode, + 'messageKey' => $xml->messageKey, + 'message' => $xml->message + ); + return $result; + } + else { + // In this case, we have success and recording info: + $result = array( + 'returncode' => $xml->returncode, + 'messageKey' => $xml->messageKey, + 'message' => $xml->message + ); + + foreach ($xml->recordings->recording as $r) { + $result[] = array( + 'recordId' => $r->recordID, + 'meetingId' => $r->meetingID, + 'name' => $r->name, + 'published' => $r->published, + 'startTime' => $r->startTime, + 'endTime' => $r->endTime, + 'playbackFormatType' => $r->playback->format->type, + 'playbackFormatUrl' => $r->playback->format->url, + 'playbackFormatLength' => $r->playback->format->length, + 'metadataTitle' => $r->metadata->title, + 'metadataSubject' => $r->metadata->subject, + 'metadataDescription' => $r->metadata->description, + 'metadataCreator' => $r->metadata->creator, + 'metadataContributor' => $r->metadata->contributor, + 'metadataLanguage' => $r->metadata->language, + // Add more here as needed for your app depending on your + // use of metadata when creating recordings. + ); + } + return $result; + } + } + else { + return null; + } + } + + public function getPublishRecordingsUrl($recordingParams) { + /* USAGE: + $recordingParams = array( + 'recordId' => '1234', -- REQUIRED - comma separate if multiple ids + 'publish' => 'true', -- REQUIRED - boolean: true/false + ); + */ + $recordingsUrl = $this->_bbbServerBaseUrl."api/publishRecordings?"; + $params = + 'recordID='.urlencode($recordingParams['recordId']). + '&publish='.urlencode($recordingParams['publish']); + return ($recordingsUrl.$params.'&checksum='.sha1("publishRecordings".$params.$this->_securitySalt)); + + } + + public function publishRecordingsWithXmlResponseArray($recordingParams) { + /* USAGE: + $recordingParams = array( + 'recordId' => '1234', -- REQUIRED - comma separate if multiple ids + 'publish' => 'true', -- REQUIRED - boolean: true/false + ); + */ + $xml = $this->_processXmlResponse($this->getPublishRecordingsUrl($recordingParams)); + if($xml) { + return array( + 'returncode' => $xml->returncode, + 'published' => $xml->published // -- Returns true/false. + ); + } + else { + return null; + } + + + } + + public function getDeleteRecordingsUrl($recordingParams) { + /* USAGE: + $recordingParams = array( + 'recordId' => '1234', -- REQUIRED - comma separate if multiple ids + ); + */ + $recordingsUrl = $this->_bbbServerBaseUrl."api/deleteRecordings?"; + $params = + 'recordID='.urlencode($recordingParams['recordId']); + return ($recordingsUrl.$params.'&checksum='.sha1("deleteRecordings".$params.$this->_securitySalt)); + } + + public function deleteRecordingsWithXmlResponseArray($recordingParams) { + /* USAGE: + $recordingParams = array( + 'recordId' => '1234', -- REQUIRED - comma separate if multiple ids + ); + */ + + $xml = $this->_processXmlResponse($this->getDeleteRecordingsUrl($recordingParams)); + if($xml) { + return array( + 'returncode' => $xml->returncode, + 'deleted' => $xml->deleted // -- Returns true/false. + ); + } + else { + return null; + } + + } + + + +} // END OF BIGBLUEBUTTON CLASS + +?> \ No newline at end of file diff --git a/labs/bbb-api-php/includes/config.php b/labs/bbb-api-php/includes/config.php new file mode 100644 index 0000000000000000000000000000000000000000..bcb2dde80bb1424a5d02c58af799cb50a25f7cbe --- /dev/null +++ b/labs/bbb-api-php/includes/config.php @@ -0,0 +1,9 @@ +<?php +// BASE CONFIGS (set these to match the values from your BBB server) +/* Public test server values from Blind Side Networks: +url: http://test-install.blindsidenetworks.com/bigbluebutton/ +salt: 8cd8ef52e8e101574e400365b55e11a6 +*/ +define("CONFIG_SECURITY_SALT", "8cd8ef52e8e101574e400365b55e11a6"); +define("CONFIG_SERVER_BASE_URL", "http://test-install.blindsidenetworks.com/bigbluebutton/"); +?> \ No newline at end of file diff --git a/labs/bbb-api-php/index.php b/labs/bbb-api-php/index.php new file mode 100644 index 0000000000000000000000000000000000000000..c4b116c77d9cd86c71eeca87170650eb4ea12c8f --- /dev/null +++ b/labs/bbb-api-php/index.php @@ -0,0 +1,207 @@ +<html> +<head> + <meta http-equiv="Content-type" content="text/html; charset=utf-8"> + <title>bbb-api-php</title> + <link type="text/css" rel="stylesheet" href="css/main.css"> +</head> + +<body id="index" onload=""> +<div id="main"> +<h1>PHP API Examples for Big Blue Button</h1> +<p>This page includes basic documentation, and links to sample pages that use the Big Blue Button API via a PHP bridge. You can read this page and also inspect the included files to see how it works. Original documentation for the base Big Blue Button API itself can be found at the following URL:</p><p><a href="http://code.google.com/p/bigbluebutton/wiki/API">http://code.google.com/p/bigbluebutton/wiki/API</a></p> + +<div id="TOC"> +<div id="tocheader">Table of Contents</div> +<ul> +<li><b>Administration Methods</b></li> + <ul> + <li><a href="#createameeting">Create a Meeting</a></li> + <li><a href="#joinameeting">Join a Meeting</a></li> + <li><a href="#endameeting">End a Meeting</a></li> + </ul> +<li><b>Monitoring Methods</b></li> + <ul> + <li><a href="#ismeetingrunning">Is Meeting Running</a></li> + <li><a href="#getmeetings">Get Meetings</a></li> + <li><a href="#getmeetinginfo">Get Meeting Info</a></li> + </ul> +<li><b>Recording Methods</b></li> + <ul> + <li><a href="#getrecordings">Get Recordings</a></li> + <li><a href="#publishrecordings">Publish Recordings</a></li> + <li><a href="#deleterecordings">Delete Recordings</a></li> + </ul> +</ul> +</div> + +<h2>Install and Configuration</h2> +<dl> +<dt>Install</dt><dd>Stick the entire <b>/bbb-api-php</b> directory somewhere that you can host php web files. You need to enable the 'allow_url_fopen' to 'On' in your php.ini file so these examples can work. Simply add/replace to your php.ini file: allow_url_fopen = On.</dd> +<dt>Configuration</dt><dd>Define your Big Blue Button server URL and SALT in the configuration file located at <b>/bbb-api-php/includes/config.php</b>.</dd> +<dt>Usage and Customization</dt><dd>After defining your BBB server URL and SALT in the config file, read this page and click on the links to the examples for each method below. You can either modify the included files directly until they do what you need, or you can create your own custom app using the code in these examples to get started.</dd> +<dt>Web Framework Integration</dt><dd>You can integrate this code into a web framework like Zend Framework. Just stick the /includes/bbb-api.php file in Zend's library directory so it is included in your app. You can put then move the BBB server URL and SALT values into your app's config file and call those values from the bbb-api.php file. Last, add logic like you see in the examples below into your controllers and forms.</dd> +</dl> + +<h2>Big Blue Button PHP API Usage</h2> + +<h3>Administration Methods</h3> +<dl> + +<a name="createameeting"> </a> +<dt>Create a Meeting</dt> +<dd> +<div class="method"><p>METHOD: <span class="methodname">createMeetingWithXmlResponseArray($creationParams)</span></p></div> +<p>To create a meeting, require the bbb-api.php file, then instatiate the BigBlueButton class in your code.</p> +<div class="code"><pre> +require_once('../includes/bbb-api.php'); //Make this match your actual path the bbb-api.php file. +$bbb = new BigBlueButton(); +</pre></div> +<p>Set your meeting values in the creationParams array. (You'll probably grab these from a user-submitted form in real life.) Note that meetingId and meetingName are required. The rest are optional. In the example below, we set attendeePw to be "pw" and moderatorPw to be "mp". This facilititates accessing information about this meeting later by passing matching values. In real code, you'd use PHP to generate random values for those passwords and then store them in your code to access later.</p> +<div class="code"><pre> +$creationParams = array( + 'meetingId' => '1234', // REQUIRED + 'meetingName' => 'Test Meeting Name', // REQUIRED + 'attendeePw' => 'ap', // Match this value in getJoinMeetingURL() to join as attendee. + 'moderatorPw' => 'mp', // Match this value in getJoinMeetingURL() to join as moderator. + 'welcomeMsg' => '', // ''= use default. Change to customize. + 'dialNumber' => '', // The main number to call into. Optional. + 'voiceBridge' => '', // PIN to join voice. Optional. + 'webVoice' => '', // Alphanumeric to join voice. Optional. + 'logoutUrl' => '', // Default in bigbluebutton.properties. Optional. + 'maxParticipants' => '-1', // Optional. -1 = unlimitted. Not supported in BBB. [number] + 'record' => 'false', // New. 'true' will tell BBB to record the meeting. + 'duration' => '0', // Default = 0 which means no set duration in minutes. [number] + //'meta_category' => '', // Use to pass additional info to BBB server. See API docs. +); +</pre></div> +<p>Finally, create the meeting by calling the createMeetingWithXmlResponse method and passing it your desired parameters that you set up in the creationParams array. $result will be an array that contains the XML response from your Big Blue Button server.</p> +<div class="code"><pre> +$result = $bbb->createMeetingWithXmlResponseArray($creationParams); +</pre></div> +<p>That's it. As you can see in the examples, you can add additional code to handle errors and exceptions or do other things as needed. The rest of the methods work basically the same way. You can view the source in the examples or in the bbb-api.php file to see which parameters to pass to the methods.</p> +<div class="example"> +<p><b>Try it out</b>: <a href="examples/createMeeting.php">Create a meeting</a> with a meetingId of '1234' and a meetingName of 'Test Meeting Name' now.</p> +<p><b>Learn more</b>: Read the source code in <b>examples/createMeeting.php</b>.</p> +</div> +</dd> + + +<a name="joinameeting"> </a> +<dt>Join a Meeting</dt> +<dd> +<div class="method"><p>METHOD: <span class="methodname">getJoinMeetingURL($joinParams)</span></p></div> +<p>Note that this method does not return an XML response from the BBB server. Instead it returns the URL that people can use to join a meeting. You can send this URL to people in an email, or write your code to automatically redirect them there depending on your needs.</p> +<p>Note that when testing, you must create the '1234' meeting using the createMeetingWithXmlResponseArray method above before you can successfully join it.</p> +<div class="example"> +<p><b>Try it out</b>:<br /><a href="examples/getJoinMeetingUrlModerator.php">Get the URL</a> to join a meeting with a meetingId of '1234' as a Moderator now.<br /> +<a href="examples/getJoinMeetingUrlAttendee.php">Get the URL</a> to join a meeting with a meetingId of '1234' as an Attendee now.</p> +<p><b>Learn more</b>: Read the source code in <b>examples/getJoinMeetingUrlModerator.php</b> and <br /> <b>examples/getJoinMeetingUrlModerator.php</b>.</p> +<p><b>Bonus</b>: <a href="examples/joinIfRunning.php">Join only once running</a> a meeting with a meetingId of '1234' as an Attendee now. This page shows one way to keep the user on a spinner page until the meeting is started by the moderator. You can inspect the code in <b>/bbb-api-php/examples/joinIfRunning.php</b> to learn more about this.</p> +</div> +</dd> + + +<a name="endameeting"> </a> +<dt>End a Meeting</dt> +<dd> +<div class="method"><p>METHOD: <span class="methodname">endMeetingWithXmlResponseArray($endParams)</span></p></div> +<p>Note that when testing, you must create and start (join as moderator) the '1234' meeting using the methods listed above before you can successfully end it.</p> +<div class="example"> +<p><b>Try it out</b>: <a href="examples/endMeeting.php">End a meeting</a> with a meetingId of '1234' now.</p> +<p><b>Learn more</b>: Read the source code in <b>/bbb-api-php/examples/endMeeting.php</b>.</p> +</div> +</dd> + +</dl> + + +<h3>Monitoring Methods</h3> +<dl> + +<a name="ismeetingrunning"> </a> +<dt>Is Meeting Running</dt> +<dd> +<div class="method"><p>METHOD: <span class="methodname">isMeetingRunningWithXmlResponseArray($meetingId)</span></p></div> +<p>This method will return whether the meeting is currently running or not.</p> +<div class="example"> +<p><b>Try it out</b>: <a href="examples/isMeetingRunning.php">Determine if meeting is running</a> for a meeting with a meetingId of '1234' now.</p> +<p><b>Learn more</b>: Read the source code in <b>examples/isMeetingRunning.php</b>.</p> +</div> +</dd> + +<a name="getmeetings"> </a> +<dt>Get Meetings</dt> +<dd> +<div class="method"><p>METHOD: <span class="methodname">getMeetingsWithXmlResponseArray()</span></p></div> +<p>This method will retrieve a list of current meetings on the BBB server.</p> +<div class="example"> +<p><b>Try it out</b>: <a href="examples/getMeetings.php">Get all meetings</a> now.</p> +<p><b>Learn more</b>: Read the source code in <b>examples/getMeetings.php</b>.</p> +</div> +</dd> + +<a name="getmeetinginfo"> </a> +<dt>Get Meeting Info</dt> +<dd> +<div class="method"><p>METHOD: <span class="methodname">getMeetingInfoWithXmlResponseArray($infoParams)</span></p></div> +<p>This method will return information about a meeting.</p> +<div class="example"> +<p><b>Try it out</b>: <a href="examples/getMeetingInfo.php">Get meeting info</a> for a meeting with a meetingId of '1234' now.</p> +<p><b>Learn more</b>: Read the source code in <b>examples/getMeetingInfo.php</b>.</p> +</div> +</dd> + + +</dl> + +<h3>Recording Methods</h3> +<p><b>Convenience pages for recording</b>: <a href="examples/createRecordedMeeting.php">Create a meeting</a> with 'record' set to 'true' now. This will create a 5 minute long meeting that will be recorded once you <a href="examples/getJoinMeetingUrlModeratorRecord.php">join into it as moderator and let it run</a>. (The meeting will stop after 5 minutes.). The meetingId for this recorded meeting will be <b>'12345'</b>. Once recorded, you can use the methods below to test your results. To get success with publish and delete methods, you'll need to get back a valid recordID using the getRecordingsWithXmlResponseArray() method first, and then add the recordID to the example pages for publishing and deleting recordings. +<dl> + +<a name="getrecordings"> </a> +<dt>Get Recordings</dt> +<dd> +<div class="method"><p>METHOD: <span class="methodname">getRecordingsWithXmlResponseArray($recordingParams)</span></p></div> +<p>This method will return information for specific recordings if you pass it one or more comma separated meetingIds. By default, with no meetingIds, it will list all recordings.</p> +<div class="example"> +<p><b>Try it out</b>: <a href="examples/getRecordings.php">Get all recordings</a> now.</p> +<p><b>Learn more</b>: Read the source code in <b>examples/getRecordings.php</b>.</p> +</div> +</dd> + +<a name="publishrecordings"> </a> +<dt>Publish Recordings</dt> +<dd> +<div class="method"><p>METHOD: <span class="methodname">publishRecordingsWithXmlResponseArray($recordingParams)</span></p></div> +<p>This method publishes/unpublishes recordings.</p> +<div class="example"> +<p><b>Try it out</b>: <a href="examples/publishRecordings.php">Publish recordings</a> now. (Note that you must get a valid recordID from getRecordingsWithXmlResponseArray() and enter it as the <b>$recordingParams['recordId']</b> value in <b>examples/publishRecordings.php</b> in order to get success here. The default recordID that ships in that page won't work on your server.)</p> +<p><b>Learn more</b>: Read the source code in <b>examples/publishRecordings.php</b>.</p> +</div> +</dd> + +<a name="deleterecordings"> </a> +<dt>Delete Recordings</dt> +<dd> +<div class="method"><p>METHOD: <span class="methodname">deleteRecordingsWithXmlResponseArray($recordingParams)</span></p></div> +<p>This method deletes recordings.</p> +<div class="example"> +<p><b>Try it out</b>: <a href="examples/deleteRecordings.php">Delete recordings</a> now. (Note that you must get a valid recordID from getRecordingsWithXmlResponseArray() and enter it as the <b>$recordingParams['recordId']</b> value in <b>examples/deleteRecordings.php</b> in order to get success here. The default recordID that ships in that page won't work on your server.)</p> +<p><b>Learn more</b>: Read the source code in <b>examples/deleteRecordings.php</b>.</p> +</div> +</dd> + + +</dl> + +<p> </p> +<p> </p> +<p> </p> +<p> </p> +<p> </p> +<p> </p> +<p> </p> + +</div> +</body> +</html> \ No newline at end of file