0.1.5 • Published 7 years ago

oneyun-sipclient-desktop-js-sdk v0.1.5

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

JS SDK Version

SIP 客户端的 JS SDK

准备

安装

npm install oneyun-sipclient-desktop-js-sdk --save-dev

使用 CMD

import JsClient from 'oneyun-sipclient-desktop-js-sdk'
let Client = new jsClient('ws://localhost:2000/')

已用 UMD 包装,因此它们可以直接用作 AMD 模块

使用 AMD

// 引入文件
<script src="./node_modules/oneyun-sipclient-desktop-js-sdk/dist/oneyun-client-js.js"> </script>

// 创建实例
var Client = new OneYunJsSipClient('ws://localhost:2000/')

接口

方法参数说明
answer应答
hangup挂断
minimize窗口最小化
show窗口最大化
getCurrentVolume获取当前振声器
getCurrentMicroVolume获取当前麦克风
setVolume{int} volume设置当前振声器音量 0-100
setMicroVolume{Int} volume设置当前麦克风音量 0-100
setAccount{string} user, {string} password, {string} domain, {unit} timeout设置 SIP 账户信息

用法

Client.answer()
Client.hangup()
Client.getCurrentVolume()
Client.setVolume(20)
Client.setAccount('100001888888','123456','sip.oneyun.com',300);

响应 & 事件

// 成功返回
{"jsonrpc":"2.0","result":"","id":1}
// 收到事件
{"jsonrpc":"2.0","result": {"events": "hangup"},"id":1}

// 失败返回
{"jsonrpc":"2.0","result":"失败原因","id":1}

事件列表

事件说明
"hangup"挂断事件
"answer"来电事件
"calling"通话中事件

需要注意的是,这里的结果返回是在websocket 回调中获取

Client.ws.onmessage = function (callback) {
  ...callback
};

查看案例

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago