Generate and refresh Twilio Voice JS SDK access tokens for a browser-based softphone.
domain: twilio.com · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗
In-depth guide
Twilio Verify for teams leaving Authy — the full failure-mode walkthrough related to twilio.com, checked against official docs, with linked verified routes.
Steps
Server-side, build an AccessToken with a VoiceGrant (outgoingApplicationSid for outbound calls, incomingAllow for inbound) and an identity, then call toJwt().
Only Main or Standard API Keys can mint these tokens — Restricted API Keys are not supported.
Client-side, install @twilio/voice-sdk (renamed from the legacy twilio-client.js package) and instantiate new Device(token, options).
Listen for the Device tokenWillExpire event and fetch a fresh token from your server before it fires.
Call device.updateToken(newToken) to swap tokens without dropping an active call.
Known gotchas
Access tokens expire after a max of 24 hours regardless of requested TTL.
Each identity is capped at 10 concurrent Device registrations; the 11th evicts the oldest.
Pre-2.0 SDK named the call object Connection; the current SDK renamed it Call — don't mix old sample code.
Give your agent this knowledge — and 15,500+ more routes
One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp
Need this verified for your stack — or a route we don't have yet?