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 🙏

© 2024 – Pkg Stats / Ryan Hefner

yb-xcti-sdk-v2

v0.1.3

Published

init

Downloads

13

Readme

ybcti-js-sdk-v2

使用

安装

通过npm进行安装

npm install yb-xcti-sdk-v2 -S

引用

// 在main.js文件中
import YBCTI from 'yb-xcti-sdk-v2';
Vue.use(YBCTI);
<!-- vue组件中 -->
<yb-cti />或 <yb-cti></yb-cti>

支持环境

  • 推荐使用chrome浏览器

开始

库加载后,会在全局注入一个实例对象window.ybcti,window.ybcti包含了初始化,坐席操作和事件监听方法。

初始化

初始化使用示例

window.ybcti.initCTI(params).then(res => {
  console.log(res)
}).catch(err => {
  console.log(err)// 0.0.4新增错误信息
})

参数对象params

参数 | 类型 | 是否必选 | 描述 | :-: | :-: | :-: | :-: | requestId | String | 是 | 请求ID channelId | String | 是 | 合作渠道 ID accessToken | String | 是 |客户端接入 Token account | String | 是 |用户标识 secretKey | String | 是 |密钥 environment | 'test'、'production' | 是 |环境(0.0.4新增)

返回字段说明

参数 | 类型 | 说明 | :-: | :-: | :-: |
code | Number | 结果码 | message | String | 返回结果描述 |

坐席操作

外呼

外呼使用示例

window.ybcti.callOut(params).then(res => {
  console.log(res)
}).catch(err => {
  console.log(err)// 0.0.4新增错误信息
})

参数对象params

参数 | 类型 | 是否必选 | 描述 | :-: | :-: | :-: | :-: | customId | String | 是 | 线索Id | callMode | Number | 是 | 1、 自动号码外呼(推荐)2、 使用上次呼叫号码呼叫 3、 兜底号码外呼 |

返回字段说明

参数 | 类型 | 说明 | :-: | :-: | :-: |
code | Number | 结果码 | message | String | 返回结果描述 | data | Object | callId params | Object | 外呼信息

挂断

挂断使用示例

window.ybcti.hangup().then(res => {
    console.log(res)
})

签出

window.ybcti.logout(params)

参数对象params

参数 | 类型 | 是否必选 | 描述 | :-: | :-: | :-: | :-: | logoutType | Number | 可选 | 签出类型 枚举值 1 : 完全退出 2:仅退出动态模式(默认) |

返回字段说明

参数 | 类型 | 说明 | :-: | :-: | :-: |
code | Number | 结果码 | message | String | 返回结果描述 |

事件

注意:必须开启all监听后才能开启对其他子事件的监听。

事件监听方法

/**
 * params  eventName/eventType
 * cb1     成功回调函数
 * cb2     错误回调函数
 */
window.ybcti.listenEvent(params, cb1, cb2)

事件使用示例,以 all 事件为例

<script>
  window.ybcti.listenEvent('all', (res) => {
    console.log(res)
    // phoneRingCalled
    // phoneConnect
  }, (err) => {
    console.log(err)
  })
</script>

事件表

顶层事件

eventName | 描述 | :-: | :-: |
all | 所有状态 | ws | ws连接状态 | phone | 电话状态 | agent | 坐席状态 | initstate | websocket重连更新状态 | ivr | ivr状态 | update | 更新状态 | error | 错误状态 |

phone子事件

eventName | 描述 | :-: | :-: |
phoneHangup | 通话完成 | phoneCallOut | 外呼中 | phoneRing | 来电振铃 | phoneConnect | 通话中 | phoneSelfConnect | 己方接通 | phoneConsultOut | 咨询外呼中 | phoneConsultConnect | 咨询接通 | phoneConsultBack | 咨询接回 | phoneConsultFail | 咨询未呼通 | phone3WaySuccess | 三方接通 | phone3WayBack | 三方接回 | phoneChanSPYSuccess | 监听成功 | phoneBreakinSuccess | 强插成功 | phoneTransferSuccess | 转接成功 | phoneInterceptSuccess | 拦截成功 | phoneTransfer | 电话转接 |

phoneRing子事件

eventName | 描述 | :-: | :-: |
phoneRingCalled | 被叫 | phoneRingQueue | 技能组分配来电 | phoneRingOutbound | 外呼来电 | phoneRingChanSPY | 监听来电 | phoneRingConsult | 咨询来电 | phoneRingAutoCall | 自动外呼来电 |

agent子事件

eventName | 描述 | :-: | :-: |
agentLogout | 被签出 | agentUnbusy | 空闲 | agentSysBusy | 忙碌 | agentSysUnbusy | 空闲 | agentSysOccupy | 系统占用 | agentSysAftDeal | 事后处理 |

update子事件

eventName | 描述 | :-: | :-: |
updateQueue | 技能组 | updateCaller | 主叫号码 |

error子事件

eventName | 描述 | 产生场景 | :-: | :-: | :-: |
errorLogoff | 强制退出 | 后台进行强制签出时会收到此事件 | errorUnbusy | 强制置闲 | 后台进行强制置闲时会收到此事件 | errorBusy | 强制置忙 | 后台进行强制置忙时会收到此事件 | forceLogoff | 超时退出 | 当签入类型为动态坐席时,websocket连接由于网络异常等原因断开连接超过1分钟后,此时服务端会认为此坐席已经签出,此时websocket再重新连接上后会收到此事件,但是SDK会自动进行重连并自动签入 |