<?php
session_start();
// Enable error reporting for debugging
error_reporting(E_ALL);
ini_set('display_errors', 1);
// Generate a simple token
$token = bin2hex(random_bytes(16)); // 32-character hex token
// Get channel name from POST data
$channel = $_POST['channel'] ?? 'default_channel';
// Store token and channel in session
$_SESSION['meeting_token'] = $token;
$_SESSION['meeting_channel'] = $channel;
// Return JSON response
header('Content-Type: application/json');
echo json_encode([
'success' => true,
'token' => $token,
'channel' => $channel
]);
exit();
?>