@aws/connect-rtc-js

中文文档
1.3.4发布于 2026/09/05Apache-2.0CommonJS近 30 天下载 4.3万

Amazon Connect softphone library

原始使用文档
文档目录5 节
  1. Usage
  2. Prebuilt releases
  3. Working with GitHub registry for Omnissa
  4. Build your own
  5. Amazon Connect StreamJS integration

Build Status

Amazon Connect connect-rtc-js

connect-rtc.js provides softphone support to AmazonConnect customers when they choose to directly integrate with AmazonConnect API and not using AmazonConnect web application. It implements Amazon Connect WebRTC signaling protocol and integrates with browser WebRTC APIs to provide a simple contact session interface which can be integrated with Amazon Connect StreamJS seemlessly.

Usage

Prebuilt releases

In the gh-pages branch prebuilt ready to use files can be downloaded/linked directly.

Working with GitHub registry for Omnissa

Ensure this step is followed before running npm install

Please refer to this GitHub article to authenticate your project and use our public registry.

You will need to create a github token and either authenticate directly or use/create an .npmrc file within your project. An example .npmrc file is as follows:

@euc-releases:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=<GITHUB_TOKEN>

Build your own

  1. Install latest LTS version of NodeJS
  2. Install Grunt
  3. git clone https://github.com/aws/connect-rtc-js.git
  4. cd connect-rtc-js
  5. npm install
  6. To build:
    1. grunt
    2. Find build artifacts in out directory
  7. To run unit tests:
    1. npm test
  8. To run demo page:
    1. grunt demo
    2. Open the URL printed out by connect task, it looks like "Started connect web server on https://localhost:9943"
    3. Click demo folder

Amazon Connect StreamJS integration

In a typical amazon-connect-streams integration, connect-rtc-js is not required on parent page. Softphone call handling is done by embedded CCP.

However the following steps could further customize softphone experience.

  1. Load connect-rtc-js along with amazon-connect-streams on parent page
  2. Following amazon-connect-streams instructions to initialize CCP
  3. Replace the softphone parameter (within the second parameter of connect.core.initCCP()) with allowFramedSoftphone: false This would stop embedded CCP from handling softphone call
  4. Add this line after initCCP connect.core.initSoftphoneManager({allowFramedSoftphone: true}); This would allow your page to handle softphone call with the connect-rtc-js loaded by your page. allowFramedSoftphone is necessary if your page also lives in a frame, otherwise you can remove that parameter.
  5. Add this HTML element to your web page <audio id="remote-audio" autoplay></audio> amazon-connect-streams library will look for this element and inject it into connect-rtc-js so that connect-rtc-js can play downstream audio through this element.
  6. Customize it (some ideas below)
    • Customize audio device for remote-audio element
    • Look at all the documented APIs in RtcSession class, modify softphone.js as you need
    • Revert step 4, add your own glue layer between amazon-connect-streams and connect-rtc-js (use softphone.js as a template)

版本与发布记录

@aws/connect-rtc-js 共发布 4 个版本,首次发布于 2026/06/13;过去 12 个月发布了 4 个版本。

版本发布日期距今
1.3.4latest2026/09/052 个月前
1.3.32026/08/222 个月前
1.3.22026/06/194 个月前
1.2.42026/06/134 个月前

关于 @aws/connect-rtc-js 的常见问题

@aws/connect-rtc-js 是什么?

Amazon Connect softphone library

如何安装 @aws/connect-rtc-js?

在项目目录运行 npm install @aws/connect-rtc-js,或使用 pnpm add / yarn add / bun add。

@aws/connect-rtc-js 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/aws__connect-rtc-js 是否存在。

@aws/connect-rtc-js 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@aws/connect-rtc-js 需要什么版本的 Node.js?

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

@aws/connect-rtc-js 可以商用吗?

@aws/connect-rtc-js 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@aws/connect-rtc-js 的下载量有多少?

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

@aws/connect-rtc-js 还在维护吗?

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