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