Install the Vonage Video API server SDK for your language (e.g., @vonage/video for Node.js) and initialize it with your API key and API secret from the Vonage Dashboard.
Call opentok.createSession() (or the equivalent method in your SDK) with options such as mediaMode: 'routed' for server-mediated SFU routing or 'relayed' for peer-to-peer; a routed session is required for multi-party calls and server-side recording.
Store the returned sessionId persistently (e.g., in a database); a session represents a persistent communication context and its ID is used by all participants joining the same conversation.
Generate a token for each participant by calling opentok.generateToken(sessionId, { role: 'publisher', expireTime: <unix timestamp>, data: '<metadata string>' }); role can be 'subscriber', 'publisher', or 'moderator'.
Return the sessionId and token to your client application; the client initializes the OT (OpenTok) SDK with OT.initSession(apiKey, sessionId) and then calls session.connect(token, callback).
For security, generate a new token for each participant connection attempt rather than caching tokens; tokens expire after the duration set at creation (default 24 hours after generation).
Known gotchas
A 'relayed' session falls back to a TURN server when P2P fails but does not support more than two participants in pure P2P mode; use 'routed' for any multi-party scenario.
Tokens for the moderator role can force-disconnect other participants and stop streams; do not issue moderator tokens to untrusted clients.
The Vonage Video API (formerly TokBox / OpenTok) is undergoing migration to the newer Vonage API platform; verify which SDK version aligns with your account's API credentials, as older OpenTok credentials and newer Vonage credentials use different authentication flows.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp