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

cti-js-sdk-v5

v1.0.4

Published

SDK for web phone development based on sip.js

Readme

安装

npm install cti-js-sdk-v5

初始化

配置项

| 参数 | 类型 | 说明 | 必填 | 举例 | | --- | --- | --- | --- | --- | | token | string | 从用户中心获取的 access_token | 是 | | agNo | string | 坐席工号 | 是 | 5470 | | from | int | 当前 websocket 所在端:1-app, 2-api, 4-web,默认 4 | 否 | 4 | | webrtc | bool | 是否启用 webrtc | 与 agentPhone 任选其一 | true | | agentPhone | string | 有特殊分机或 PSTN 签入时使用 | 与 webrtc 任选其一 | 5470 | | busy | bool | 登录后是否置忙,默认 false | 否 | true | | autoLogin | bool | 初始化后是否自动登录,默认 true | 否 | true | | allowMultiPage| bool | 是否允许多页签,默认 false,如果有多个页签签入同一个坐席的需求使用此参数 | 否 | true | | renderHtml | object | 是否渲染自带 UI,默认 null | 否 | {showLogoutBtn: true,showQueSum: true,diningRemind} | | check | bool| 是否带上监控检测功能,默认 false | 否 | true | | tokenCallBack | function | token过期时的回调 | 否 | |

renderHtml 配置说明

| 参数 | 类型 | 说明 | 必填 | 举例 | | --- | --- | --- | --- | --- | | domId | string | 电话条容器,默认 PHONE_BAR | PHONE_BAR | | showLogoutBtn | bool | 是否显示签出按钮,默认 true | 否 | false | | raiseHand | bool |是否开启小休举手功能,默认 true | 否 | false | | autoCall | bool | 是否开启预测式外呼,默认 true | 否 | false | | statusWarn | bool | 电话条异常状态检测,默认 true | 否 | false | | diningRemind | bool | | 是否开启就餐提醒功能,默认 true | 否 | false | | showQueSum | bool | 是否开启排队数展示功能,默认 true | 否 | false | | autoLogin | bool | 是否启用 webrtc,默认 true | 否 | false |

初始化

const cti = new CTIPlus(config);
cti.init().then(() => {
  console.log('初始化成功了');
});

示例

<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>电话条示例</title>
</head>
<body>
  <div id="PHONE_BAR"></div>
  <script>
    const cti = new CTIPlus({
      token: '',
      agNo: '',
      webrtc: true,
      busy: true,
      autoLogin: true,
      allowMultiPage: true,
      renderHtml: {
        showLogoutBtn: true,
        raiseHand: false,
        autoCall: false,
        statusWarn: true,
        diningRemind: false,
        showQueSum: false,
      },
      check: true,
      tokenCallBack:()=>{
        console.log('tokenCallBack 执行')
        cti.config.setState({token:access_token})
      }
    });

    cti.init().then(() => {
      cti.Event.add("all", function (res) {
        if (res.eventName === "phoneRingOutbound") {
        }
        if (res.eventName === "phone3WaySuccess") {
        }
      });
    });
  </script>
</body>
</html>

事件

如果我们想在前端监听从通信服务端推送过来的相关通话/坐席状态等事件,可以通过以下方式来处理

const cti = new CTIPlus(config);

cti.init().then(() => {
// 以下为事件代码新增
  cti.Event.add("all", function (res) {
    if (res.eventName === "phoneRingOutbound") {
    }

    if (res.eventName === "phone3WaySuccess") {
    }
  });
// 以上为事件代码
});