npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@tsgwarp/warp-voice-sdk

v0.1.2

Published

Twilio Voice JS SDK v2-compatible browser calling adapter for TSG WARP. Verify the features your app uses before migration.

Readme

@tsgwarp/warp-voice-sdk — Twilio Voice JS migration adapter

This adapter provides a Twilio-shaped Device and Call over TSG WARP browser calling. Change the frontend import and the backend token route, then test the methods your app uses. Only the methods marked implemented below are supported; a successful build does not prove two-way audio or feature parity for your application.

Under the hood it drives WARP's production browser-calling engine (@tsgwarp/webrtc: SIP-over-WSS to the WARP SBC, per-session ephemeral credentials, TURN) — the same stack behind the WARP portal softphone. Your app never sees any of that.


Line 1 — the frontend import

Install it with npm install @tsgwarp/warp-voice-sdk after checking the published version.

- import { Device } from '@twilio/voice-sdk';
+ import { Device } from '@tsgwarp/warp-voice-sdk';

(Script-tag apps: load dist/warp-voice-sdk.umd.js — it also installs window.Twilio.Device if Twilio isn't already defined, so legacy new Twilio.Device(...) code works.)

Line 2 — the backend token route

Your app already has a route that returns { token } for the SDK. Point its internals at WARP:

// before: twilio.jwt.AccessToken + VoiceGrant ...
// after:
app.get('/token', async (req, res) => {
  const r = await fetch(
    `https://api.warp.tsgglobal.net/v1/connections/${WARP_CONNECTION_ID}/tokens`,
    {
      method: 'POST',
      headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${WARP_API_KEY}` },
      body: JSON.stringify({ ttl_seconds: 3600 }),
    },
  );
  const warp = await r.json(); // { identity, password, sip_domain, wss, ice, expires_in, caller_id }
  res.json({ token: JSON.stringify(warp) }); // ← keep the { token } shape your frontend expects
});

For the implemented methods, the frontend keeps the same Device/Call pattern:

const { token } = await (await fetch('/token')).json();
const device = new Device(token);
device.on('incoming', (call) => call.accept());
await device.register();

const call = await device.connect({ params: { To: '+15551234567' } });
call.on('accept', () => console.log('connected'));
call.on('disconnect', () => console.log('ended'));
call.sendDigits('1');
call.mute(true);
call.disconnect();

WARP_CONNECTION_ID is a WebRTC Connection on your WARP account (POST /v1/connections { name, type: "webrtc" }); WARP_API_KEY is a server-side API key (POST /v1/api-keys). The browser never holds the API key — only the short-lived per-session credential, exactly like a Twilio access token. Optional: pass caller_id_e164 in the token mint to set the outbound caller ID per user/agent session.

The token response includes short-lived TURN/STUN settings. Pass the complete WARP response through the existing { token } field; the browser does not need a separate ICE request.


What's implemented vs stubbed

| Twilio surface | Status | |---|---| | new Device(token, options), register(), unregister(), updateToken(), destroy(), disconnectAll(), device.calls, device.state, Device.isSupported | implemented | | Device events: registered, registering, unregistered, incoming, error, tokenWillExpire, destroyed | implemented | | device.connect({ params: { To } }) → Call | implemented (auto-registers first if needed) | | Call: accept, disconnect, reject, ignore, mute, isMuted, sendDigits, status(), getLocalStream(), getRemoteStream(), parameters (From/To/CallSid), events accept/disconnect/cancel/reject/ringing/error/mute | implemented (CallSid = the SIP Call-ID — the same ID you can search in WARP CDRs/PCAPs) | | device.audio: output/input device lists, speakerDevices.set, setInputDevice (live-call mic switch), deviceChange event | implemented | | Call.hold (not in Twilio JS SDK, but present here) | bonus via the underlying engine | | Insights/Preflight (runPreflight, postFeedback), volume meters | stub (warn once, no-op). WARP has call records and on-demand SIP signaling captures, without audio. | | edge, codecPreferences, built-in sounds/ringtones | stub (warn once) — single WARP edge + TURN; browser leg negotiates Opus/PCMU, the WARP gateway bridges to the carrier | | Token = Twilio AccessToken JWT | n/a — the token is WARP's envelope passed through your existing { token } field (JSON string, base64-JSON, or the raw object all accepted) |

device.connect({ params }) currently uses To for outbound routing. Twilio sends other custom parameters to the customer's TwiML application; WARP has no equivalent application callback yet. Do not assume those parameters reach a server-side handler. TwiML, status callbacks, conferences, Insights/Preflight, and Call Message Events need separate compatibility work if your app uses them.

Notes

  • Incoming calls ring while the page is open and registered — the same constraint as the Twilio JS SDK (their docs: browsers don't reliably receive background calls).
  • Tokens are short-TTL. Handle device.on('tokenWillExpire', ...) by fetching /token again and calling device.updateToken(token) — identical to the Twilio pattern.
  • Customer downloads are limited to their own SIP signaling leg. They contain no RTP/audio or carrier leg. For an outbound call, GET /v1/cdr/{id}/carrier-responses returns codes and phrases from known carrier endpoints when a matching capture exists. TSG NOC can inspect both signaling legs. Capture availability is checked at lookup time and is not guaranteed for every call.
  • Outbound and inbound calls with two-way audio passed the admin SDK pilot on 2026-10-02. The durable SBC image was rolled afterward; post-roll audio, customer-token minting, mute, receiving-side DTMF, and renewal across token expiry still need customer-path proof.
  • Build: npm install && npm run build → dist/warp-voice-sdk.{esm.js,cjs,umd.js}.