@dialstack/sdk-webrtc

中文文档
3.10.0发布于 2026/11/10MITTypeScriptESM + CJS零依赖近 30 天下载 1.4万

Headless WebRTC softphone core for the DialStack SDK — no React, no runtime dependencies

原始使用文档
文档目录6 节
  1. Install
  2. Usage
  3. Which package do I want?
  4. Building
  5. Documentation
  6. License

@dialstack/sdk-webrtc

Headless WebRTC softphone for the DialStack SDK.

  • No runtime dependencies. Nothing is installed alongside it, and nothing third-party is compiled into it. CI fails the build if that stops being true.
  • No React, no DOM UI. Use it from vanilla JS, Angular, Vue, Svelte, or any framework. React components live in @dialstack/sdk-react.

Install

npm install @dialstack/sdk-webrtc

That is the whole install: one package, nothing transitive.

Usage

import { DialStackPhone } from '@dialstack/sdk-webrtc';

const phone = new DialStackPhone({ token: userSessionToken });
await phone.connect();

phone.on('incoming', (call) => call.accept());

const call = await phone.call('+14155550123');
call.hangup();

It authenticates with a short-lived user-session token over a WebSocket, so it needs no initializer and no publishable key — unlike the REST-backed packages, which mint a client secret. Your backend issues the token; refresh it from onTokenExpiring.

Which package do I want?

You are buildingInstall
A softphone in any frameworkthis package alone
A React app with DialStack UI@dialstack/sdk-js + @dialstack/sdk-react
A plain HTML page@dialstack/sdk-js
A Node backend@dialstack/sdk-server

@dialstack/sdk-react depends on this package at an exact version, so a React app that also embeds the softphone gets one copy of the phone, not two.

Building

Plain tsc, no bundler — npm run build. Unbundled compilation is the point: it emits one output file per input with imports left intact, so no third-party code can be inlined and an empty dependencies field cannot drift from what the package actually needs.

Two consequences worth knowing before editing:

  • tsconfig.json uses moduleResolution: NodeNext, so relative imports in src/ must end in .js (e.g. from './phone.js'), naming the emitted sibling rather than the .ts source. Under Bundler resolution the emitted .d.ts files keep extensionless specifiers, which bundlers tolerate but Node's own ESM resolver does not — attw reports an internal resolution error for node16 consumers.
  • The package is ESM-only. attw reports CJSResolvesToESM for CommonJS consumers, who need a dynamic import(); that is expected and is why the rule is ignored in check:package.

Documentation

Full documentation: https://docs.dialstack.ai/sdks

License

MIT

版本与发布记录

@dialstack/sdk-webrtc 共发布 12 个版本,首次发布于 2026/08/10;过去 12 个月发布了 12 个版本。

版本发布日期距今
3.10.0latest2026/11/102 天前
3.9.02026/11/029 天前
3.8.02026/10/2616 天前
3.7.02026/10/1923 天前
3.6.02026/10/1230 天前
3.5.02026/10/051 个月前

其他发布通道:bootstrap → 2.1.0。

关于 @dialstack/sdk-webrtc 的常见问题

@dialstack/sdk-webrtc 是什么?

Headless WebRTC softphone core for the DialStack SDK — no React, no runtime dependencies

如何安装 @dialstack/sdk-webrtc?

在项目目录运行 npm install @dialstack/sdk-webrtc,或使用 pnpm add / yarn add / bun add。

@dialstack/sdk-webrtc 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@dialstack/sdk-webrtc 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@dialstack/sdk-webrtc 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@dialstack/sdk-webrtc 可以商用吗?

@dialstack/sdk-webrtc 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@dialstack/sdk-webrtc 的下载量有多少?

根据 npm 官方下载统计,@dialstack/sdk-webrtc 在 2026/10/12 – 2026/11/10 这 30 天内被下载 14,011 次,日均约 467 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@dialstack/sdk-webrtc 还在维护吗?

最新版本 3.10.0 发布于 2026/11/10(2 天前);至今共发布 12 个版本,其中过去 12 个月发布了 12 个;首次发布于 2026/08/10。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。