/* * This script handles the generation of a guest user who then generates a call id * for the party room which is being created. It then puts the relevant information * into the database to present in other pages. * * @author Melih Onvural melih@tokbox.com */ if (isset($_POST['submit'])) { require_once 'SDK/TokBoxCall.php'; require_once 'SDK/TokBoxUser.php'; require_once 'Site_Config.php'; @($subject = trim($_POST['subject'])); if (!isset($subject) || strlen($subject) == 0) { $subject = "Open Chat"; } $inList = isset($_POST['inList']) ? 1 : 0; try { $userObj = TokBoxUser::createGuest(); //generates a guest user who is needed to generate a call $callid = TokBoxCall::createCall($userObj, true); //generates a persistent (hence the true) call id $dbConn = @mysql_connect(Site_Config::DB_HOST, Site_Config::DB_USER, Site_Config::DB_PASSWORD) or die(mysql_error()); mysql_select_db(Site_Config::DB_DATABASE, $dbConn) or die(mysql_error()); $query = "INSERT INTO calls(callid, subject, created, list) VALUES('{$callid}', '{$subject}', NOW(), '{$inList}')"; mysql_query($query, $dbConn) or die(mysql_error()); } catch (Exception $e) { trigger_error($e->getMessage()); } } header("Location:" . Site_Config::VIDEO_CALL_ROOM . "?callid=" . $callid);
<title>TokBox API | Call Widget Sample Application</title> <script src="SDK/js/TokBoxScript.js"></script> </head> <body> <div id="callbox"> <?php require_once 'Site_Config.php'; require_once 'SDK/TokBoxCall.php'; require_once 'SDK/TokBoxUser.php'; try { $userObj = TokBoxUser::createGuest(); $jabberId = $userObj->getJabberId(); $secret = $userObj->getSecret(); $callId = TokBoxCall::createCall($userObj); //guest access to a call $inviteId = TokBoxCall::generateInvite($userObj, Site_Config::CALLEE_JABBERID, $callId); } catch (Exception $e) { echo $e->getMessage(); } ?> <object type="application/x-shockwave-flash" data="http://sandbox.tokbox.com/vc/<?php echo $callId; ?> " width="500" height="350" id="tbx_call"> <param name="movie" value="http://sandbox.tokbox.com/vc/<?php echo $callId; ?> " /> <param name="allowFullScreen" value="true" />
<?php require_once '../SDK/TokBoxCall.php'; require_once '../SDK/TokBoxUser.php'; try { $userObj = TokBoxUser::createGuest(); $callid = TokBoxCall::createCall($userObj); //guest access to a call $callUrl = TokBoxCall::generateLink($callid); //generate call URL } catch (Exception $e) { echo $e->getMessage(); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>Testing Call Embed as Guest</title> </head> <body> <?php //print out URL, and embed code echo "<a href=\"{$callUrl}\">{$callUrl}</a><br/>"; echo TokBoxCall::generateEmbedCode($callid, "425", "320", "../SDK/js/swfobject.js"); ?> </body> </html>
</head> <body> <div id="callbox"> <?php require_once 'Site_Config.php'; require_once 'SDK/TokBoxCall.php'; require_once 'SDK/TokBoxUser.php'; try { $userObj = TokBoxUser::createGuest(); $jabberId = $userObj->getJabberId(); $secret = $userObj->getSecret(); $callId = TokBoxCall::createCall($userObj); //guest access to a call $inviteId = TokBoxCall::generateInvite($userObj, Site_Config::CALLEE_JABBERID, $callId); } catch (Exception $e) { echo $e->getMessage(); } //print out URL, and embed code echo TokBoxCall::generateEmbedCode($callId); ?> </div> <div id="inviteRow"> <form> <?php echo "\t\t<input type=\"button\" name=\"inviteUser\" value=\"" . Site_Config::CALLEE_DISPLAYNAME . "\" onClick=\"sendInvite('" . Site_Config::CALLEE_USERID . "','" . Site_Config::CALLEE_DISPLAYNAME . "','" . Site_Config::CALLEE_JABBERID . "','" . $inviteId . "');\">\n"; ?> </form> </div> </body> </html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>Sample Application - TokBox Developer API - Call Generator</title> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> <?php require_once 'SDK/TokBoxCall.php'; if (isset($_GET['callid'])) { $callId = $_GET['callid']; $htmlCode = TokBoxCall::generateEmbedCode($callId, $width = "800", $height = "600"); //This will generate the code necessary to embed the call widget onto your site. The call id is pulled from the GET parameter, which is passed in from index.php echo $htmlCode; } else { echo "<h2>This video room is no longer active. You can create a new room <here></h2>"; } ?> </body> </html>
//guest access to a call $jid = $userObj->getJabberId(); $userid = substr($jid, 0, strpos($jid, '@')); $inviteid = TokBoxCall::generateInvite($userObj, $callid, "*****@*****.**"); } catch (Exception $e) { echo "Please report this error:" . $e->getMessage() . " to an administrator"; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>Proctor 1</title> <script type="text/javascript" src="js/TokBoxScript.js"></script> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript"> $(document).ready(function() { setTimeout("sendInvite('565954','Student for Proctor 1','*****@*****.**', '<?php echo $inviteid; ?> ');", 10000); }); </script> </head> <body> <?php echo TokBoxCall::generateEmbedCode($callid, 600, 450, 'js/swfobject.js'); ?> </body> </html>