@zhaokun/cti 1.4.5 → 1.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +144 -72
- package/latest/index.html +316 -295
- package/latest/zhaokun.cti.min.js +2 -2
- package/package.json +1 -5
package/latest/index.html
CHANGED
|
@@ -1,156 +1,270 @@
|
|
|
1
1
|
<!doctype html>
|
|
2
|
-
<html lang="
|
|
2
|
+
<html lang="zh-CN">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
-
<title>
|
|
6
|
+
<title>CTI-SDK 调试</title>
|
|
7
7
|
<style>
|
|
8
|
-
|
|
8
|
+
* {
|
|
9
|
+
margin: 0;
|
|
10
|
+
padding: 0;
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
}
|
|
9
13
|
body {
|
|
10
|
-
font
|
|
14
|
+
font:
|
|
15
|
+
14px/1.8 -apple-system,
|
|
16
|
+
sans-serif;
|
|
17
|
+
padding: 20px 30px;
|
|
18
|
+
}
|
|
19
|
+
h1 {
|
|
20
|
+
font-size: 16px;
|
|
21
|
+
margin-bottom: 20px;
|
|
22
|
+
}
|
|
23
|
+
.section {
|
|
24
|
+
margin-bottom: 14px;
|
|
25
|
+
}
|
|
26
|
+
.section-title {
|
|
27
|
+
font-size: 12px;
|
|
28
|
+
color: #999;
|
|
29
|
+
margin-bottom: 6px;
|
|
30
|
+
}
|
|
31
|
+
.row {
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
gap: 8px;
|
|
35
|
+
margin-bottom: 8px;
|
|
36
|
+
flex-wrap: wrap;
|
|
37
|
+
}
|
|
38
|
+
.row label {
|
|
39
|
+
width: 90px;
|
|
40
|
+
color: #555;
|
|
41
|
+
}
|
|
42
|
+
input[type="text"],
|
|
43
|
+
select {
|
|
44
|
+
height: 30px;
|
|
45
|
+
padding: 0 8px;
|
|
46
|
+
border: 1px solid #ccc;
|
|
47
|
+
border-radius: 3px;
|
|
48
|
+
font-size: 13px;
|
|
49
|
+
}
|
|
50
|
+
input[type="text"]:focus,
|
|
51
|
+
select:focus {
|
|
52
|
+
outline: none;
|
|
53
|
+
border-color: #666;
|
|
11
54
|
}
|
|
12
|
-
|
|
13
|
-
|
|
55
|
+
button {
|
|
56
|
+
height: 30px;
|
|
57
|
+
padding: 0 12px;
|
|
58
|
+
border: 1px solid #ccc;
|
|
59
|
+
border-radius: 3px;
|
|
60
|
+
font-size: 13px;
|
|
61
|
+
background: #fff;
|
|
62
|
+
cursor: pointer;
|
|
14
63
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
margin: 4px 0;
|
|
64
|
+
button:hover {
|
|
65
|
+
background: #f5f5f5;
|
|
18
66
|
}
|
|
19
|
-
.
|
|
20
|
-
|
|
21
|
-
|
|
67
|
+
.time {
|
|
68
|
+
color: #333;
|
|
69
|
+
font-weight: 600;
|
|
22
70
|
}
|
|
23
71
|
.status-success {
|
|
24
|
-
color: #
|
|
72
|
+
color: #52c41a;
|
|
25
73
|
}
|
|
26
74
|
.status-error {
|
|
27
|
-
color: #
|
|
75
|
+
color: #f5222d;
|
|
76
|
+
}
|
|
77
|
+
.info {
|
|
78
|
+
font-size: 12px;
|
|
79
|
+
color: #888;
|
|
80
|
+
margin-top: 4px;
|
|
81
|
+
}
|
|
82
|
+
.tips {
|
|
83
|
+
margin-top: 20px;
|
|
84
|
+
font-size: 12px;
|
|
85
|
+
color: #f5222d;
|
|
86
|
+
}
|
|
87
|
+
.tips p {
|
|
88
|
+
margin: 2px 0;
|
|
89
|
+
}
|
|
90
|
+
hr {
|
|
91
|
+
border: none;
|
|
92
|
+
border-top: 1px solid #eee;
|
|
93
|
+
margin: 14px 0;
|
|
28
94
|
}
|
|
29
95
|
</style>
|
|
30
96
|
</head>
|
|
31
97
|
<body>
|
|
32
|
-
<div
|
|
33
|
-
<
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
<
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
<div class="item">
|
|
54
|
-
<input type="text" placeholder="手机号或分机号" id="callInput" value="">
|
|
55
|
-
<button id="call">呼叫</button>
|
|
56
|
-
<button id="hangup">挂断</button>
|
|
57
|
-
<button id="regionInfo">号码归属地</button>
|
|
58
|
-
</div>
|
|
59
|
-
<div class="item">
|
|
60
|
-
<select id="keyupSelect" style="width: 150px">
|
|
61
|
-
<option value="1">按键1</option>
|
|
62
|
-
<option value="2">按键2</option>
|
|
63
|
-
<option value="3">按键3</option>
|
|
64
|
-
<option value="4">按键4</option>
|
|
65
|
-
<option value="5">按键5</option>
|
|
66
|
-
<option value="6">按键6</option>
|
|
67
|
-
<option value="7">按键7</option>
|
|
68
|
-
<option value="8">按键8</option>
|
|
69
|
-
<option value="9">按键9</option>
|
|
70
|
-
<option value="0">按键0</option>
|
|
71
|
-
<option value="*">按键*</option>
|
|
72
|
-
<option value="#">按键#</option>
|
|
73
|
-
</select>
|
|
74
|
-
<button id="keyup">DTMF</button>
|
|
75
|
-
</div>
|
|
76
|
-
<div class="item">
|
|
77
|
-
<input type="text" placeholder="手机号或分机号" id="threeInput" value="">
|
|
78
|
-
<button id="threeWayStart">开始三方</button>
|
|
79
|
-
<button id="threeWayCancel">取消三方</button>
|
|
98
|
+
<div style="max-width: 800px; margin: 0 auto">
|
|
99
|
+
<h1>CTI-SDK 调试</h1>
|
|
100
|
+
|
|
101
|
+
<!-- 配置 -->
|
|
102
|
+
<div class="section">
|
|
103
|
+
<div class="section-title">配置</div>
|
|
104
|
+
<div class="row">
|
|
105
|
+
<label>Token</label><input type="text" id="configToken" value="" style="flex: 1" placeholder="接口获取的 toekn">
|
|
106
|
+
</div>
|
|
107
|
+
<div class="row">
|
|
108
|
+
<label>Agent</label><input type="text" id="configAgent" value="" style="width: 320px" placeholder="四位分机号 如3340">
|
|
109
|
+
</div>
|
|
110
|
+
<div class="row">
|
|
111
|
+
<label>Account</label><input type="text" id="configAccount" value="" style="width: 320px" placeholder="C开头的9位数字账号 如C10003340">
|
|
112
|
+
</div>
|
|
113
|
+
<div class="row">
|
|
114
|
+
<label>Socket</label><input type="text" id="configSocket" value="" style="width: 320px" placeholder="ws(s)://example.com">
|
|
115
|
+
</div>
|
|
116
|
+
<div class="row">
|
|
117
|
+
<label>AI降噪路径</label><input type="text" id="configAiDenoisePath" value="" style="width: 320px" placeholder="https://your-server.com/denoiser.wasm 需托管到自己服务器">
|
|
118
|
+
</div>
|
|
80
119
|
</div>
|
|
81
120
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
<
|
|
85
|
-
<
|
|
86
|
-
|
|
121
|
+
<!-- 坐席 -->
|
|
122
|
+
<div class="section">
|
|
123
|
+
<div class="section-title">坐席</div>
|
|
124
|
+
<div class="row">
|
|
125
|
+
<button id="checkin">签入</button>
|
|
126
|
+
<button id="logout">签出</button>
|
|
127
|
+
<select id="statusSelect">
|
|
128
|
+
<option value="1">在线</option>
|
|
129
|
+
<option value="2">忙碌</option>
|
|
130
|
+
<option value="3">小休</option>
|
|
131
|
+
<option value="4" disabled="disabled">振铃</option>
|
|
132
|
+
<option value="5" disabled="disabled">通话</option>
|
|
133
|
+
<option value="6" disabled="disabled">保持</option>
|
|
134
|
+
<option value="7" disabled="disabled">后处理</option>
|
|
135
|
+
</select>
|
|
136
|
+
|
|
137
|
+
<span class="time" id="onlinetime">00:00:00</span>
|
|
138
|
+
</div>
|
|
87
139
|
</div>
|
|
88
140
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
<
|
|
141
|
+
<!-- 中继 -->
|
|
142
|
+
<div class="section">
|
|
143
|
+
<div class="section-title">中继号码</div>
|
|
144
|
+
<div class="row">
|
|
145
|
+
<button id="relayList">获取中继号码</button>
|
|
146
|
+
<select id="relaySelect" style="min-width: 180px"></select>
|
|
147
|
+
</div>
|
|
92
148
|
</div>
|
|
93
149
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
<
|
|
97
|
-
<
|
|
150
|
+
<!-- 呼叫 -->
|
|
151
|
+
<div class="section">
|
|
152
|
+
<div class="section-title">呼叫</div>
|
|
153
|
+
<div class="row">
|
|
154
|
+
<input type="text" placeholder="手机号或分机号" id="callInput" style="width: 160px">
|
|
155
|
+
<button id="call">呼叫</button>
|
|
156
|
+
<button id="hangup">挂断</button>
|
|
157
|
+
<button id="regionInfo">归属地</button>
|
|
158
|
+
</div>
|
|
98
159
|
</div>
|
|
99
160
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
<
|
|
103
|
-
<
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
161
|
+
<!-- DTMF -->
|
|
162
|
+
<div class="section">
|
|
163
|
+
<div class="section-title">DTMF</div>
|
|
164
|
+
<div class="row">
|
|
165
|
+
<select id="dtmfSelect">
|
|
166
|
+
<option value="1">1</option>
|
|
167
|
+
<option value="2">2</option>
|
|
168
|
+
<option value="3">3</option>
|
|
169
|
+
<option value="4">4</option>
|
|
170
|
+
<option value="5">5</option>
|
|
171
|
+
<option value="6">6</option>
|
|
172
|
+
<option value="7">7</option>
|
|
173
|
+
<option value="8">8</option>
|
|
174
|
+
<option value="9">9</option>
|
|
175
|
+
<option value="0">0</option>
|
|
176
|
+
<option value="*">*</option>
|
|
177
|
+
<option value="#">#</option>
|
|
178
|
+
</select>
|
|
179
|
+
<button id="dtmfSend">发送</button>
|
|
180
|
+
</div>
|
|
107
181
|
</div>
|
|
108
182
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
183
|
+
<!-- 三方 -->
|
|
184
|
+
<div class="section">
|
|
185
|
+
<div class="section-title">三方</div>
|
|
186
|
+
<div class="row">
|
|
187
|
+
<input type="text" placeholder="手机号或分机号" id="threeInput" style="width: 160px">
|
|
188
|
+
<button id="threeWayStart">开始</button>
|
|
189
|
+
<button id="threeWayCancel">取消</button>
|
|
190
|
+
</div>
|
|
113
191
|
</div>
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
192
|
+
|
|
193
|
+
<!-- 询问 -->
|
|
194
|
+
<div class="section">
|
|
195
|
+
<div class="section-title">询问</div>
|
|
196
|
+
<div class="row">
|
|
197
|
+
<input type="text" placeholder="手机号或分机号" id="consultInput" style="width: 160px">
|
|
198
|
+
<button id="consultStart">开始</button>
|
|
199
|
+
<button id="consultCancel">取消</button>
|
|
200
|
+
<button id="consultTransfer">确定转接</button>
|
|
201
|
+
</div>
|
|
124
202
|
</div>
|
|
125
|
-
|
|
126
|
-
|
|
203
|
+
|
|
204
|
+
<!-- 转接 -->
|
|
205
|
+
<div class="section">
|
|
206
|
+
<div class="section-title">转接</div>
|
|
207
|
+
<div class="row">
|
|
208
|
+
<input type="text" placeholder="手机号或分机号" id="transferInput" style="width: 160px">
|
|
209
|
+
<button id="transfer">转接</button>
|
|
210
|
+
</div>
|
|
211
|
+
<div class="row">
|
|
212
|
+
<button id="queueList">获取队列</button>
|
|
213
|
+
<select id="queueSelect" style="min-width: 140px"></select>
|
|
214
|
+
<button id="transferQueue">转到队列</button>
|
|
215
|
+
</div>
|
|
127
216
|
</div>
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
<
|
|
217
|
+
|
|
218
|
+
<!-- 通话控制 -->
|
|
219
|
+
<div class="section">
|
|
220
|
+
<div class="section-title">通话</div>
|
|
221
|
+
<div class="row">
|
|
222
|
+
<button id="answer">接听</button>
|
|
223
|
+
<button id="mobileAnswerStart">手机接听</button>
|
|
224
|
+
<button id="mobileAnswerClose">取消手机接听</button>
|
|
225
|
+
<button id="hold">保持</button>
|
|
226
|
+
<button id="unhold">解除保持</button>
|
|
227
|
+
<button id="grade">评价</button>
|
|
228
|
+
</div>
|
|
132
229
|
</div>
|
|
133
230
|
|
|
134
|
-
|
|
135
|
-
|
|
231
|
+
<!-- 设备 -->
|
|
232
|
+
<div class="section">
|
|
233
|
+
<div class="section-title">设备</div>
|
|
234
|
+
<div class="row">
|
|
235
|
+
<button id="getDefaultMedia">媒体设备</button>
|
|
236
|
+
<button id="checkMkf">麦克风检测</button>
|
|
237
|
+
<button id="getSystemInfo">系统信息</button>
|
|
238
|
+
<button id="getPhoneInfo">话机信息</button>
|
|
239
|
+
</div>
|
|
240
|
+
<div class="info">
|
|
241
|
+
麦克风: <span id="inputDevice">-</span> | 扬声器:
|
|
242
|
+
<span id="outputDevice">-</span> | 状态: <span id="micStatus">-</span>
|
|
243
|
+
</div>
|
|
244
|
+
<div class="info">
|
|
245
|
+
浏览器: <span id="browserInfo">-</span> | WebRTC:
|
|
246
|
+
<span id="webrtcInfo">-</span> | WebSocket:
|
|
247
|
+
<span id="socketInfo">-</span>
|
|
248
|
+
</div>
|
|
136
249
|
</div>
|
|
137
250
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
<
|
|
251
|
+
<!-- 其他 -->
|
|
252
|
+
<div class="section">
|
|
253
|
+
<div class="section-title">其他</div>
|
|
254
|
+
<div class="row">
|
|
255
|
+
<button id="flowList">流程列表</button>
|
|
256
|
+
<select id="flowListSelect" style="min-width: 140px"></select>
|
|
257
|
+
<button id="flow">执行</button>
|
|
258
|
+
<button id="customHandle">自定义发送</button>
|
|
259
|
+
<button id="aiDenoiseOpen">降噪开</button>
|
|
260
|
+
<button id="aiDenoiseClose">降噪关</button>
|
|
261
|
+
</div>
|
|
141
262
|
</div>
|
|
142
|
-
</div>
|
|
143
263
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
80版本及以上的浏览器,建议安装最新版本的浏览器以支持更多功能。
|
|
149
|
-
</p>
|
|
150
|
-
<p class="tip-item">
|
|
151
|
-
2. 请使用 HTTPS 协议来部署前端页面(开发时可以用
|
|
152
|
-
localhost),否则会因为浏览器限制无法正常通话。
|
|
153
|
-
</p>
|
|
264
|
+
<div class="tips">
|
|
265
|
+
<p>1. 支持 Chrome 56+、Edge 80+,建议最新版本。</p>
|
|
266
|
+
<p>2. 需 HTTPS 部署(开发可用 localhost)。</p>
|
|
267
|
+
</div>
|
|
154
268
|
</div>
|
|
155
269
|
</body>
|
|
156
270
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
|
|
@@ -158,26 +272,46 @@
|
|
|
158
272
|
|
|
159
273
|
<script>
|
|
160
274
|
var content = null
|
|
275
|
+
var configFields = [
|
|
276
|
+
"configToken",
|
|
277
|
+
"configAgent",
|
|
278
|
+
"configAccount",
|
|
279
|
+
"configSocket",
|
|
280
|
+
"configAiDenoisePath",
|
|
281
|
+
]
|
|
282
|
+
|
|
283
|
+
// 从 localStorage 恢复
|
|
284
|
+
configFields.forEach(function (id) {
|
|
285
|
+
var saved = localStorage.getItem(id)
|
|
286
|
+
if (saved) document.getElementById(id).value = saved
|
|
287
|
+
})
|
|
288
|
+
|
|
289
|
+
// 输入时保存到 localStorage
|
|
290
|
+
configFields.forEach(function (id) {
|
|
291
|
+
document.getElementById(id).addEventListener("input", function () {
|
|
292
|
+
localStorage.setItem(id, this.value)
|
|
293
|
+
})
|
|
294
|
+
})
|
|
295
|
+
|
|
296
|
+
//
|
|
297
|
+
init()
|
|
298
|
+
//
|
|
161
299
|
function init() {
|
|
162
|
-
// 实例化成功后会自动签入 调用
|
|
163
300
|
content = new zhaokunCTI({
|
|
164
|
-
webrtc: true,
|
|
165
|
-
token: "",
|
|
166
|
-
agent: "",
|
|
167
|
-
account: "",
|
|
168
|
-
socket: "",
|
|
169
|
-
aiDenoise: false,
|
|
170
|
-
aiDenoisePath: "",
|
|
171
|
-
env: "",
|
|
301
|
+
webrtc: true,
|
|
302
|
+
token: document.getElementById("configToken").value,
|
|
303
|
+
agent: document.getElementById("configAgent").value,
|
|
304
|
+
account: document.getElementById("configAccount").value,
|
|
305
|
+
socket: document.getElementById("configSocket").value,
|
|
306
|
+
aiDenoise: false,
|
|
307
|
+
aiDenoisePath: document.getElementById("configAiDenoisePath").value,
|
|
308
|
+
env: "debug",
|
|
172
309
|
})
|
|
173
310
|
|
|
174
|
-
// content.onmessage(function (obj) {
|
|
175
|
-
// console.log("收到数据2", obj)
|
|
176
|
-
// })
|
|
177
311
|
content.onmessage(function (obj) {
|
|
178
312
|
console.log("收到数据", obj)
|
|
179
|
-
const type = obj.type
|
|
180
|
-
const data = obj.data
|
|
313
|
+
const type = obj.type
|
|
314
|
+
const data = obj.data
|
|
181
315
|
|
|
182
316
|
if (type === "RelayList") {
|
|
183
317
|
setRelayList(data)
|
|
@@ -190,49 +324,28 @@
|
|
|
190
324
|
}
|
|
191
325
|
})
|
|
192
326
|
|
|
193
|
-
// socket 连接成功
|
|
194
327
|
content.onopen(function (e) {
|
|
195
328
|
console.log("onopen", e)
|
|
196
329
|
})
|
|
197
|
-
// content.onopen(function (e) {
|
|
198
|
-
// console.log("onopen2", e)
|
|
199
|
-
// })
|
|
200
330
|
|
|
201
|
-
// 获取在线时间
|
|
202
331
|
content.onlinetime(function (time) {
|
|
203
|
-
// console.log("onlinetime", time)
|
|
204
332
|
$("#onlinetime").html(time)
|
|
205
333
|
})
|
|
334
|
+
|
|
206
335
|
content.onaidenoise(function (data) {
|
|
207
|
-
|
|
208
|
-
console.log("降噪状态:", data) // data.status true / false
|
|
209
|
-
})
|
|
210
|
-
// content.onlinetime(function (time) {
|
|
211
|
-
// console.log("onlinetime2", time)
|
|
212
|
-
// })
|
|
213
|
-
content.onpermission(function (permission) {
|
|
214
|
-
// console.log("onpermission", permission)
|
|
336
|
+
console.log("降噪状态:", data)
|
|
215
337
|
})
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
// socket 连接错误
|
|
338
|
+
|
|
339
|
+
content.onpermission(function (permission) {})
|
|
340
|
+
|
|
220
341
|
content.onerror(function (e) {
|
|
221
342
|
console.log("onerror", e)
|
|
222
343
|
})
|
|
223
|
-
// content.onerror(function (e) {
|
|
224
|
-
// console.log("onerror2", e)
|
|
225
|
-
// })
|
|
226
344
|
|
|
227
|
-
// socket 连接断开
|
|
228
345
|
content.onclose(function (e) {
|
|
229
346
|
console.log("onclose", e)
|
|
230
347
|
})
|
|
231
|
-
// content.onclose(function (e) {
|
|
232
|
-
// console.log("onclose2", e)
|
|
233
|
-
// })
|
|
234
348
|
|
|
235
|
-
// 错误事件
|
|
236
349
|
content.error(function (e) {
|
|
237
350
|
console.log("error", e)
|
|
238
351
|
})
|
|
@@ -240,44 +353,33 @@
|
|
|
240
353
|
content.agent.start()
|
|
241
354
|
}
|
|
242
355
|
|
|
243
|
-
init()
|
|
244
|
-
|
|
245
356
|
function setFlowList(lists) {
|
|
246
|
-
// 获取 select 元素
|
|
247
357
|
const select = $("#flowListSelect")
|
|
248
|
-
// 清空 select 中的内容
|
|
249
358
|
select.empty()
|
|
250
|
-
// 遍历数据并生成 option
|
|
251
359
|
lists.forEach(function (item) {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
360
|
+
select.append(
|
|
361
|
+
`<option value="${item.id}">${item.title || "未命名"}</option>`
|
|
362
|
+
)
|
|
255
363
|
})
|
|
256
364
|
}
|
|
257
365
|
|
|
258
366
|
function setQueueList(lists) {
|
|
259
|
-
// 获取 select 元素
|
|
260
367
|
const select = $("#queueSelect")
|
|
261
|
-
// 清空 select 中的内容
|
|
262
368
|
select.empty()
|
|
263
|
-
// 遍历数据并生成 option
|
|
264
369
|
lists.forEach(function (item) {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
370
|
+
select.append(
|
|
371
|
+
`<option value="${item.id}">${item.title || "未命名"}</option>`
|
|
372
|
+
)
|
|
268
373
|
})
|
|
269
374
|
}
|
|
270
375
|
|
|
271
376
|
function setRelayList(lists) {
|
|
272
|
-
// 获取 select 元素
|
|
273
377
|
const select = $("#relaySelect")
|
|
274
|
-
// 清空 select 中的内容
|
|
275
378
|
select.empty()
|
|
276
|
-
// 遍历数据并生成 option
|
|
277
379
|
lists.forEach(function (item) {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
380
|
+
select.append(
|
|
381
|
+
`<option value="${item.relayNumber}">${item.relayNumber} - ${item.relayName || "未命名"}</option>`
|
|
382
|
+
)
|
|
281
383
|
})
|
|
282
384
|
}
|
|
283
385
|
|
|
@@ -287,239 +389,158 @@
|
|
|
287
389
|
$("#aiDenoiseClose").click(() => {
|
|
288
390
|
content.tool.setAiDenoise(false)
|
|
289
391
|
})
|
|
290
|
-
|
|
291
392
|
$("#hold").click(() => {
|
|
292
|
-
// 保持
|
|
293
393
|
content.agent.hold()
|
|
294
394
|
})
|
|
295
|
-
|
|
296
395
|
$("#unhold").click(() => {
|
|
297
|
-
// 取消保持
|
|
298
396
|
content.agent.unhold()
|
|
299
397
|
})
|
|
300
398
|
|
|
301
399
|
$("#mobileAnswerStart").click(() => {
|
|
302
|
-
// 开启手机接听
|
|
303
400
|
content.agent.mobileAnswer({
|
|
304
401
|
status: 1,
|
|
305
|
-
relayNumber: $("#relaySelect").val(),
|
|
402
|
+
relayNumber: $("#relaySelect").val(),
|
|
306
403
|
})
|
|
307
404
|
})
|
|
308
|
-
|
|
309
405
|
$("#mobileAnswerClose").click(() => {
|
|
310
|
-
// 取消手机接听
|
|
311
406
|
content.agent.mobileAnswer({
|
|
312
407
|
status: 0,
|
|
313
|
-
relayNumber: $("#relaySelect").val(),
|
|
408
|
+
relayNumber: $("#relaySelect").val(),
|
|
314
409
|
})
|
|
315
410
|
})
|
|
316
411
|
|
|
317
412
|
$("#transfer").click(() => {
|
|
318
|
-
// 转接
|
|
319
413
|
content.agent.transfer({
|
|
320
|
-
customer: $("#transferInput").val(),
|
|
321
|
-
relayNumber: $("#relaySelect").val(),
|
|
414
|
+
customer: $("#transferInput").val(),
|
|
415
|
+
relayNumber: $("#relaySelect").val(),
|
|
322
416
|
})
|
|
323
417
|
})
|
|
324
|
-
|
|
325
418
|
$("#transferQueue").click(() => {
|
|
326
|
-
// 转到队列(技能组)
|
|
327
419
|
content.agent.transferQueue($("#queueSelect").val())
|
|
328
420
|
})
|
|
329
421
|
|
|
330
422
|
$("#consultStart").click(() => {
|
|
331
|
-
// 询问开始
|
|
332
423
|
content.agent.consultStart({
|
|
333
|
-
customer: $("#consultInput").val(),
|
|
334
|
-
relayNumber: $("#relaySelect").val(),
|
|
424
|
+
customer: $("#consultInput").val(),
|
|
425
|
+
relayNumber: $("#relaySelect").val(),
|
|
335
426
|
})
|
|
336
427
|
})
|
|
337
|
-
|
|
338
428
|
$("#consultCancel").click(() => {
|
|
339
|
-
// 询问取消
|
|
340
429
|
content.agent.consultCancel()
|
|
341
430
|
})
|
|
342
|
-
|
|
343
431
|
$("#consultTransfer").click(() => {
|
|
344
|
-
// 询问确定
|
|
345
432
|
content.agent.consultTransfer()
|
|
346
433
|
})
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
// dtmf
|
|
350
|
-
content.agent.keyup($("#keyupSelect").val())
|
|
434
|
+
$("#dtmfSend").click(function () {
|
|
435
|
+
content.agent.keyup($("#dtmfSelect").val())
|
|
351
436
|
})
|
|
352
|
-
|
|
353
|
-
$("#status").click(() => {
|
|
354
|
-
// 状态修改
|
|
437
|
+
$("#statusSelect").change(() => {
|
|
355
438
|
content.agent.status($("#statusSelect").val())
|
|
356
439
|
})
|
|
357
440
|
|
|
358
441
|
$("#threeWayStart").click(() => {
|
|
359
|
-
// 三方开始
|
|
360
442
|
content.agent.threeWayStart({
|
|
361
|
-
customer: $("#threeInput").val(),
|
|
362
|
-
relayNumber: $("#relaySelect").val(),
|
|
443
|
+
customer: $("#threeInput").val(),
|
|
444
|
+
relayNumber: $("#relaySelect").val(),
|
|
363
445
|
})
|
|
364
446
|
})
|
|
365
|
-
|
|
366
447
|
$("#threeWayCancel").click(() => {
|
|
367
|
-
// 取消三方
|
|
368
448
|
content.agent.threeWayCancel()
|
|
369
449
|
})
|
|
370
|
-
|
|
371
450
|
$("#grade").click(() => {
|
|
372
|
-
// 评价
|
|
373
451
|
content.agent.grade()
|
|
374
452
|
})
|
|
375
|
-
|
|
453
|
+
|
|
376
454
|
$("#getPhoneInfo").click(async () => {
|
|
377
455
|
const res = await content.agent.getPhoneInfo()
|
|
378
456
|
console.log("getPhoneInfo", res)
|
|
379
457
|
})
|
|
380
|
-
|
|
381
458
|
$("#flowList").click(async () => {
|
|
382
459
|
await content.agent.flowList()
|
|
383
460
|
})
|
|
384
461
|
$("#flow").click(async () => {
|
|
385
462
|
await content.agent.flow($("#flowListSelect").val())
|
|
386
463
|
})
|
|
387
|
-
|
|
464
|
+
|
|
388
465
|
$("#getSystemInfo").click(async () => {
|
|
389
|
-
// 测试
|
|
390
466
|
const res = await content.tool.getSystemInfo()
|
|
391
|
-
console.log(res)
|
|
392
467
|
if (res.code === 200) {
|
|
393
468
|
const { browser, support } = res.data
|
|
394
|
-
$("#browserInfo").text(
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
$("#webrtcInfo")
|
|
402
|
-
.text(`否`)
|
|
403
|
-
.removeClass("status-success")
|
|
404
|
-
.addClass("status-error")
|
|
405
|
-
}
|
|
406
|
-
if (support.websocket) {
|
|
407
|
-
$("#socketInfo")
|
|
408
|
-
.text(`是`)
|
|
409
|
-
.removeClass("status-error")
|
|
410
|
-
.addClass("status-success")
|
|
411
|
-
} else {
|
|
412
|
-
$("#socketInfo")
|
|
413
|
-
.text(`否`)
|
|
414
|
-
.removeClass("status-success")
|
|
415
|
-
.addClass("status-error")
|
|
416
|
-
}
|
|
469
|
+
$("#browserInfo").text(`${browser.name} ${browser.version}`)
|
|
470
|
+
$("#webrtcInfo")
|
|
471
|
+
.text(support.webrtc ? "支持" : "不支持")
|
|
472
|
+
.attr("class", support.webrtc ? "status-success" : "status-error")
|
|
473
|
+
$("#socketInfo")
|
|
474
|
+
.text(support.websocket ? "支持" : "不支持")
|
|
475
|
+
.attr("class", support.websocket ? "status-success" : "status-error")
|
|
417
476
|
}
|
|
418
477
|
})
|
|
419
478
|
|
|
420
479
|
$("#getDefaultMedia").click(async () => {
|
|
421
|
-
// 测试
|
|
422
480
|
const res = await content.tool.getDefaultMedia()
|
|
423
|
-
|
|
424
481
|
if (res.code === 200) {
|
|
425
|
-
$("#outputDevice")
|
|
426
|
-
.text(`${res.data.output.label}`)
|
|
427
|
-
.removeClass("status-error")
|
|
428
|
-
.addClass("status-success")
|
|
429
482
|
$("#inputDevice")
|
|
430
|
-
.text(
|
|
431
|
-
.
|
|
432
|
-
.addClass("status-success")
|
|
433
|
-
} else {
|
|
483
|
+
.text(res.data.input.label)
|
|
484
|
+
.attr("class", "status-success")
|
|
434
485
|
$("#outputDevice")
|
|
435
|
-
.text(
|
|
436
|
-
.
|
|
437
|
-
|
|
438
|
-
$("#inputDevice")
|
|
439
|
-
|
|
440
|
-
.removeClass("status-success")
|
|
441
|
-
.addClass("status-error")
|
|
486
|
+
.text(res.data.output.label)
|
|
487
|
+
.attr("class", "status-success")
|
|
488
|
+
} else {
|
|
489
|
+
$("#inputDevice").text("获取失败").attr("class", "status-error")
|
|
490
|
+
$("#outputDevice").text("获取失败").attr("class", "status-error")
|
|
442
491
|
}
|
|
443
492
|
})
|
|
444
493
|
|
|
445
494
|
$("#checkMkf").click(async () => {
|
|
446
495
|
const res = await content.tool.checkMicrophoneStatus()
|
|
447
|
-
console.log(res)
|
|
448
496
|
if (res.code === 200) {
|
|
449
|
-
$("#micStatus")
|
|
450
|
-
.text(res.message)
|
|
451
|
-
.removeClass("status-error")
|
|
452
|
-
.addClass("status-success")
|
|
497
|
+
$("#micStatus").text(res.message).attr("class", "status-success")
|
|
453
498
|
} else {
|
|
454
|
-
$("#micStatus")
|
|
455
|
-
.text(res.message)
|
|
456
|
-
.removeClass("status-success")
|
|
457
|
-
.addClass("status-error")
|
|
499
|
+
$("#micStatus").text(res.message).attr("class", "status-error")
|
|
458
500
|
}
|
|
459
501
|
})
|
|
502
|
+
|
|
460
503
|
$("#relayList").click(() => {
|
|
461
|
-
// 主叫号码(中继号)列表
|
|
462
504
|
content.agent.relayList()
|
|
463
505
|
})
|
|
464
|
-
|
|
465
506
|
$("#queueList").click(() => {
|
|
466
|
-
// 队列(技能组)列表
|
|
467
507
|
content.agent.queueList()
|
|
468
508
|
})
|
|
469
|
-
|
|
470
509
|
$("#checkin").click(() => {
|
|
471
|
-
// 签入
|
|
472
510
|
init()
|
|
473
511
|
})
|
|
474
|
-
|
|
475
512
|
$("#logout").click(() => {
|
|
476
|
-
// 签出
|
|
477
513
|
content.agent.logout()
|
|
478
514
|
})
|
|
479
|
-
|
|
480
515
|
$("#hangup").click(() => {
|
|
481
|
-
// 挂机
|
|
482
516
|
content.agent.hangup()
|
|
483
517
|
})
|
|
484
|
-
|
|
485
518
|
$("#regionInfo").click(() => {
|
|
486
|
-
// 号码归属地
|
|
487
519
|
content.agent.regionInfo($("#callInput").val())
|
|
488
520
|
})
|
|
489
521
|
|
|
490
522
|
$("#callInput").on("keypress", function (event) {
|
|
491
523
|
if (event.which === 13) {
|
|
492
|
-
// 呼叫
|
|
493
524
|
content.agent.call({
|
|
494
|
-
customer: $("#callInput").val(),
|
|
495
|
-
relayNumber: $("#relaySelect").val(),
|
|
496
|
-
custom: "",
|
|
525
|
+
customer: $("#callInput").val(),
|
|
526
|
+
relayNumber: $("#relaySelect").val(),
|
|
527
|
+
custom: "",
|
|
497
528
|
})
|
|
498
529
|
}
|
|
499
530
|
})
|
|
500
531
|
|
|
501
532
|
$("#answer").click(() => {
|
|
502
|
-
// 呼入接听
|
|
503
533
|
content.agent.answer()
|
|
504
534
|
})
|
|
505
|
-
|
|
506
535
|
$("#call").click(() => {
|
|
507
|
-
// 呼叫
|
|
508
536
|
content.agent.call({
|
|
509
|
-
customer: $("#callInput").val(),
|
|
510
|
-
relayNumber: $("#relaySelect").val(),
|
|
511
|
-
custom: "",
|
|
537
|
+
customer: $("#callInput").val(),
|
|
538
|
+
relayNumber: $("#relaySelect").val(),
|
|
539
|
+
custom: "",
|
|
512
540
|
})
|
|
513
541
|
})
|
|
514
|
-
|
|
515
542
|
$("#customHandle").click(() => {
|
|
516
|
-
content.custom.handle({
|
|
517
|
-
type: "test",
|
|
518
|
-
data: { abc: "123" },
|
|
519
|
-
})
|
|
543
|
+
content.custom.handle({ type: "test", data: { abc: "123" } })
|
|
520
544
|
})
|
|
521
|
-
$("#getSystemInfo").trigger("click")
|
|
522
|
-
$("#checkMkf").trigger("click")
|
|
523
|
-
$("#getDefaultMedia").trigger("click")
|
|
524
545
|
</script>
|
|
525
546
|
</html>
|