<html> <head> <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; ?>
/* * 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);
<?php require_once '../SDK/TokBoxCall.php'; require_once '../SDK/TokBoxUser.php'; require_once '../Test_Config.php'; try { $apiObj = TokBoxUser::createUser(Test_Config::TEST_JABBERID, Test_Config::TEST_ACCESS_SECRET); $callid = TokBoxCall::createCall($apiObj); //guest access to a call $callUrl = TokBoxCall::generateLink($callid); //generate call URL } catch (Exception $e) { echo $e->getMessage(); } //print out URL, and embed code echo "<a href=\"{$callUrl}\">{$callUrl}</a><br/>"; echo TokBoxCall::generateEmbedCode($callid, "425", "320", "../SDK/js/swfobject.js");