ue-softphone-sdk 2.0.3 → 2.1.0
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/.gitlab-ci.yml +3 -0
- package/Dockerfile +15 -0
- package/dist/index.d.ts +0 -2
- package/dist/new-index.d.ts +199 -0
- package/dist/ue-softphone-sdk.js +1 -1
- package/new-rollup.config.mjs +20 -0
- package/nginx.conf +56 -0
- package/package.json +9 -1
- package/src/index.ts +3 -3
- package/src/new-index.ts +2864 -0
package/src/new-index.ts
ADDED
|
@@ -0,0 +1,2864 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: cuixuecheng
|
|
3
|
+
* @Date: 2023-02-21 18:40:21
|
|
4
|
+
* @LastEditors: 杨钰宸
|
|
5
|
+
* @LastEditTime: 2023-08-03 10:01:36
|
|
6
|
+
* @Description:
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
// @ts-ignore: Unreachable code error
|
|
10
|
+
/**package.json 版本号 */
|
|
11
|
+
// @ts-ignore: Unreachable code error
|
|
12
|
+
// import { Parameters } from './grammar/parameters.js'
|
|
13
|
+
import WebPhoneSdk from "./webPhoneSdk";
|
|
14
|
+
import { AUDIO_FORBIDDEN, DENIED, NOT_OPEN_AUDIO } from "./config";
|
|
15
|
+
|
|
16
|
+
import { Base64 } from "js-base64";
|
|
17
|
+
import md5 from "js-md5";
|
|
18
|
+
import { JSEncrypt } from "jsencrypt";
|
|
19
|
+
|
|
20
|
+
type DebugType = "trace" | "debug" | "log" | "warn" | "error" | "all";
|
|
21
|
+
type ExtenType = "PSTN" | "SIP" | "WEBRTC";
|
|
22
|
+
|
|
23
|
+
interface AudioInfo {
|
|
24
|
+
notOpenAudioMsg: string;
|
|
25
|
+
notOpenAudioCode: number;
|
|
26
|
+
notOpenAudioMsgEn: string;
|
|
27
|
+
forbiddenAudioMsg: string;
|
|
28
|
+
forbiddenAudioCode: number;
|
|
29
|
+
forbiddenAudioMsgEn: string;
|
|
30
|
+
}
|
|
31
|
+
interface InitOptions {
|
|
32
|
+
accountId?: string;
|
|
33
|
+
agentNumber?: string;
|
|
34
|
+
password?: string;
|
|
35
|
+
loginType?: ExtenType;
|
|
36
|
+
debug?: DebugType | DebugType[] | boolean;
|
|
37
|
+
success?: Function;
|
|
38
|
+
error?: Function;
|
|
39
|
+
server?: string;
|
|
40
|
+
audioInfo?: AudioInfo; // 麦克风相关提示
|
|
41
|
+
// dependencies?: any;
|
|
42
|
+
// loginStatus?: string;
|
|
43
|
+
// signAuth?: any;
|
|
44
|
+
// hasMonitor?: boolean;
|
|
45
|
+
// sdkMonitorType?: any;
|
|
46
|
+
// isStrongHint?: Boolean; // 是否强提示
|
|
47
|
+
}
|
|
48
|
+
// interface SocketMonitorOptions {
|
|
49
|
+
// transport: String;
|
|
50
|
+
// logintoken: String;
|
|
51
|
+
// sessionid: String;
|
|
52
|
+
// sdkMonitorUrl: String;
|
|
53
|
+
// sdkMonitorType?: any;
|
|
54
|
+
// }
|
|
55
|
+
// interface SocketOptions {
|
|
56
|
+
// namespace: String;
|
|
57
|
+
// phoneBarSdkIp: String;
|
|
58
|
+
// phoneBarSdkPort: String;
|
|
59
|
+
// sdkUrl: String;
|
|
60
|
+
// }
|
|
61
|
+
|
|
62
|
+
interface OnCallEventParams {
|
|
63
|
+
success?: Function;
|
|
64
|
+
message?: Function;
|
|
65
|
+
error?: Function;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
interface DialoutParams {
|
|
69
|
+
agentNumber?: String;
|
|
70
|
+
accountId: String;
|
|
71
|
+
agentId: String;
|
|
72
|
+
loginType?: String;
|
|
73
|
+
customerNumber: String;
|
|
74
|
+
agentTimeout?: String;
|
|
75
|
+
customerTimeout?: String;
|
|
76
|
+
agentDisNumber?: String;
|
|
77
|
+
customerDisNumber?: String;
|
|
78
|
+
extras?: any;
|
|
79
|
+
success?: Function;
|
|
80
|
+
fail?: Function;
|
|
81
|
+
// group?: string;
|
|
82
|
+
// groupRule?: Number;
|
|
83
|
+
// groupareaCode?: String;
|
|
84
|
+
// encryptionAlgorithm?: String;
|
|
85
|
+
// encryptionFields?: String;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
interface HangupParams {
|
|
89
|
+
success?: Function;
|
|
90
|
+
fail?: Function;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
interface HoldOrUnHoldParams {
|
|
94
|
+
type: String;
|
|
95
|
+
success?: Function;
|
|
96
|
+
fail?: Function;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
interface MuteOrUnMuteParams {
|
|
100
|
+
type: String;
|
|
101
|
+
direction: String;
|
|
102
|
+
success?: Function;
|
|
103
|
+
fail?: Function;
|
|
104
|
+
}
|
|
105
|
+
interface TransferParams {
|
|
106
|
+
mode: String;
|
|
107
|
+
number: String;
|
|
108
|
+
agentNumber?: String;
|
|
109
|
+
success?: Function;
|
|
110
|
+
fail?: Function;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
interface UpdateLoginTypeParams {
|
|
114
|
+
loginType: ExtenType;
|
|
115
|
+
loginNumber?: String;
|
|
116
|
+
success?: Function;
|
|
117
|
+
fail?: Function;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
interface GetAgentPhoneBarParams {
|
|
121
|
+
success?: Function;
|
|
122
|
+
fail?: Function;
|
|
123
|
+
}
|
|
124
|
+
interface GetQueueOnlineAgentsParams {
|
|
125
|
+
success?: Function;
|
|
126
|
+
fail?: Function;
|
|
127
|
+
}
|
|
128
|
+
interface getIvrListParams {
|
|
129
|
+
success?: Function;
|
|
130
|
+
fail?: Function;
|
|
131
|
+
types: string[];
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
interface AgentOnlineParams {
|
|
135
|
+
success?: Function;
|
|
136
|
+
fail?: Function;
|
|
137
|
+
loginType?: String;
|
|
138
|
+
loginStatus?: String;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
interface AgentOfflineParams {
|
|
142
|
+
success?: Function;
|
|
143
|
+
fail?: Function;
|
|
144
|
+
toAnswerOffline?: String;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
interface UpdateAgentStatusParams {
|
|
148
|
+
stateNumber: String;
|
|
149
|
+
success?: Function;
|
|
150
|
+
fail?: Function;
|
|
151
|
+
}
|
|
152
|
+
interface consultParams {
|
|
153
|
+
mode: String;
|
|
154
|
+
number: String;
|
|
155
|
+
agentNumber: String;
|
|
156
|
+
success?: Function;
|
|
157
|
+
fail?: Function;
|
|
158
|
+
}
|
|
159
|
+
interface cancleConsultParams {
|
|
160
|
+
agentNumber: String;
|
|
161
|
+
success?: Function;
|
|
162
|
+
fail?: Function;
|
|
163
|
+
}
|
|
164
|
+
interface stopConsultParams {
|
|
165
|
+
success?: Function;
|
|
166
|
+
fail?: Function;
|
|
167
|
+
}
|
|
168
|
+
interface resumeConsultParams {
|
|
169
|
+
agentNumber: String;
|
|
170
|
+
success?: Function;
|
|
171
|
+
fail?: Function;
|
|
172
|
+
}
|
|
173
|
+
interface consultTransferParams {
|
|
174
|
+
agentNumber: String;
|
|
175
|
+
success?: Function;
|
|
176
|
+
fail?: Function;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
interface threeWayCallParams {
|
|
180
|
+
agentNumber: String;
|
|
181
|
+
success?: Function;
|
|
182
|
+
fail?: Function;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
interface satisfactionParams {
|
|
186
|
+
type: String;
|
|
187
|
+
success?: Function;
|
|
188
|
+
fail?: Function;
|
|
189
|
+
}
|
|
190
|
+
interface meetingParams {
|
|
191
|
+
number: String;
|
|
192
|
+
success?: Function;
|
|
193
|
+
fail?: Function;
|
|
194
|
+
}
|
|
195
|
+
interface listenParams {
|
|
196
|
+
agentNumber: String;
|
|
197
|
+
success?: Function;
|
|
198
|
+
fail?: Function;
|
|
199
|
+
}
|
|
200
|
+
interface lootParams {
|
|
201
|
+
agentNumber: String;
|
|
202
|
+
success?: Function;
|
|
203
|
+
fail?: Function;
|
|
204
|
+
}
|
|
205
|
+
interface whisperParams {
|
|
206
|
+
agentNumber: String;
|
|
207
|
+
success?: Function;
|
|
208
|
+
fail?: Function;
|
|
209
|
+
}
|
|
210
|
+
interface forcedHangupParams {
|
|
211
|
+
agentNumber: String;
|
|
212
|
+
success?: Function;
|
|
213
|
+
fail?: Function;
|
|
214
|
+
}
|
|
215
|
+
interface signinParams {
|
|
216
|
+
agentNumber: String;
|
|
217
|
+
loginType: String;
|
|
218
|
+
success?: Function;
|
|
219
|
+
fail?: Function;
|
|
220
|
+
}
|
|
221
|
+
interface signoutParams {
|
|
222
|
+
agentNumber: String;
|
|
223
|
+
success?: Function;
|
|
224
|
+
fail?: Function;
|
|
225
|
+
}
|
|
226
|
+
interface breakinParams {
|
|
227
|
+
agentNumber: String;
|
|
228
|
+
success?: Function;
|
|
229
|
+
fail?: Function;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
class ueWebsocket {
|
|
233
|
+
private ws: any;
|
|
234
|
+
constructor(server: string, proto: any) {
|
|
235
|
+
//@ts-ignore
|
|
236
|
+
this.ws = window.io.connect(`wss://${server}`, proto);
|
|
237
|
+
}
|
|
238
|
+
public on(type: string, callback: Function) {
|
|
239
|
+
if (type === "connect") {
|
|
240
|
+
this.ws.on(type, callback);
|
|
241
|
+
}
|
|
242
|
+
if (type === "error") {
|
|
243
|
+
this.ws.on("connect_error", callback);
|
|
244
|
+
this.ws.on("error", callback);
|
|
245
|
+
this.ws.on("disconnect", callback);
|
|
246
|
+
this.ws.on("reconnect_failed", callback);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
if (type === "message") {
|
|
250
|
+
this.ws.on("call", callback);
|
|
251
|
+
// this.ws.on("commonEvent", callback);
|
|
252
|
+
// this.ws.on("monitor", callback);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
public emit(type: string, params: any, callback: Function) {
|
|
256
|
+
this.ws.emit(type, params, callback);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
public disconnect() {
|
|
260
|
+
this.ws.disconnect();
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export default class ueSoftphone {
|
|
265
|
+
static ueTimer: any; // 监控里面的定时器
|
|
266
|
+
static loginToken: String | undefined;
|
|
267
|
+
static agentInfo: any;
|
|
268
|
+
static initOptions: InitOptions;
|
|
269
|
+
static webPhone: any;
|
|
270
|
+
static callApiUrl: String = "https://app.useasy.cn/api";
|
|
271
|
+
static agentextras: any;
|
|
272
|
+
static Socketinstance: any = null;
|
|
273
|
+
// static MonitorSocketinstance: any = null;
|
|
274
|
+
static noop(): void {}
|
|
275
|
+
static debug: (msg: any) => void;
|
|
276
|
+
static log: (msg: any) => void;
|
|
277
|
+
static warn: (msg: any) => void;
|
|
278
|
+
static error: (msg: any) => void;
|
|
279
|
+
static trace: (msg: any) => void;
|
|
280
|
+
static newWebSocket: (server: string, proto: any) => any;
|
|
281
|
+
static request: (server: string, proto: any) => any;
|
|
282
|
+
|
|
283
|
+
private attachEventCallbacks: any;
|
|
284
|
+
// private attachMonitorEventCallbacks: any;
|
|
285
|
+
|
|
286
|
+
constructor(options: InitOptions = {}) {
|
|
287
|
+
options.error = typeof options.error == "function" ? options.error : ueSoftphone.noop;
|
|
288
|
+
options.success = typeof options.success == "function" ? options.success : ueSoftphone.noop;
|
|
289
|
+
// if (options.accountId === null || options.accountId === undefined) {
|
|
290
|
+
// options.error({message: "Invalid accountId"});
|
|
291
|
+
// return
|
|
292
|
+
// }
|
|
293
|
+
if (options.agentNumber === null || options.agentNumber === undefined) {
|
|
294
|
+
options.error({ message: "Invalid agentNumber" });
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
// if (options.password === null || options.password === undefined) {
|
|
298
|
+
// options.error({message: "Invalid password"});
|
|
299
|
+
// return
|
|
300
|
+
// }
|
|
301
|
+
|
|
302
|
+
if (options.loginType === null || options.loginType === undefined) {
|
|
303
|
+
options.loginType = "PSTN";
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
this.init(options);
|
|
307
|
+
}
|
|
308
|
+
private init(options: InitOptions = {}) {
|
|
309
|
+
ueSoftphone.trace = ueSoftphone.noop;
|
|
310
|
+
ueSoftphone.debug = ueSoftphone.noop;
|
|
311
|
+
ueSoftphone.log = ueSoftphone.noop;
|
|
312
|
+
ueSoftphone.warn = ueSoftphone.noop;
|
|
313
|
+
ueSoftphone.error = ueSoftphone.noop;
|
|
314
|
+
if (options.debug === true || options.debug === "all") {
|
|
315
|
+
// Enable all debugging levels
|
|
316
|
+
ueSoftphone.trace = console.trace.bind(console);
|
|
317
|
+
ueSoftphone.debug = console.debug.bind(console);
|
|
318
|
+
ueSoftphone.log = console.log.bind(console);
|
|
319
|
+
ueSoftphone.warn = console.warn.bind(console);
|
|
320
|
+
ueSoftphone.error = console.error.bind(console);
|
|
321
|
+
} else if (Array.isArray(options.debug)) {
|
|
322
|
+
for (var i in options.debug) {
|
|
323
|
+
var d = options.debug[i];
|
|
324
|
+
switch (d) {
|
|
325
|
+
case "trace":
|
|
326
|
+
ueSoftphone.trace = console.trace.bind(console);
|
|
327
|
+
break;
|
|
328
|
+
case "debug":
|
|
329
|
+
ueSoftphone.debug = console.debug.bind(console);
|
|
330
|
+
break;
|
|
331
|
+
case "log":
|
|
332
|
+
ueSoftphone.log = console.log.bind(console);
|
|
333
|
+
break;
|
|
334
|
+
case "warn":
|
|
335
|
+
ueSoftphone.warn = console.warn.bind(console);
|
|
336
|
+
break;
|
|
337
|
+
case "error":
|
|
338
|
+
ueSoftphone.error = console.error.bind(console);
|
|
339
|
+
break;
|
|
340
|
+
default:
|
|
341
|
+
console.error(
|
|
342
|
+
"Unknown debugging option '" +
|
|
343
|
+
d +
|
|
344
|
+
"' (supported: 'trace', 'debug', 'log', warn', 'error')"
|
|
345
|
+
);
|
|
346
|
+
break;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
ueSoftphone.log("Initializing library");
|
|
351
|
+
|
|
352
|
+
const usedDependencies =
|
|
353
|
+
// options.dependencies ||
|
|
354
|
+
ueSoftphone.useDefaultDependencies({
|
|
355
|
+
WebSocket: ueWebsocket
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
ueSoftphone.newWebSocket = usedDependencies.newWebSocket;
|
|
359
|
+
ueSoftphone.request = usedDependencies.request;
|
|
360
|
+
this.login(options);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
private async login(options: InitOptions) {
|
|
364
|
+
const server = options.server || ueSoftphone.callApiUrl;
|
|
365
|
+
const loginName = options.agentNumber + "@" + options.accountId;
|
|
366
|
+
const loginType = options.loginType;
|
|
367
|
+
// const signAuth = options.signAuth;
|
|
368
|
+
// const hasMonitor = options.hasMonitor || false; // 是否需要监控,若需要则会挂监控socket,并事件回吐给客户
|
|
369
|
+
let actionData = {
|
|
370
|
+
loginName: loginName,
|
|
371
|
+
loginType: loginType,
|
|
372
|
+
loginChannel: "SDK",
|
|
373
|
+
// signAuth: signAuth,
|
|
374
|
+
password: ""
|
|
375
|
+
};
|
|
376
|
+
// const isStrongHint = typeof options.isStrongHint === "boolean" ? options.isStrongHint : true;
|
|
377
|
+
const isStrongHint = true;
|
|
378
|
+
let audioObj;
|
|
379
|
+
if (loginType === "WEBRTC") {
|
|
380
|
+
try {
|
|
381
|
+
audioObj = (await this.openMediaAudio("请打开麦克风权限!", isStrongHint)) || {};
|
|
382
|
+
} catch (error) {
|
|
383
|
+
console.log(error);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
if (options.password) {
|
|
387
|
+
actionData.password = options.password as string; //md5(options.password as string)
|
|
388
|
+
}
|
|
389
|
+
// 登录前会获取pk密钥,进行加密之后,=》 login(loginToken等) =》loginInfo(user,account等)
|
|
390
|
+
ueSoftphone.request(server + "/platform/public/loginPre", {
|
|
391
|
+
verb: "GET",
|
|
392
|
+
success: (preInfo: any) => {
|
|
393
|
+
if (preInfo && preInfo.success && preInfo.data) {
|
|
394
|
+
// 获取密码加密公钥
|
|
395
|
+
const PUBLIC_KEY = decodeURIComponent(Base64.decode(preInfo.data.pk));
|
|
396
|
+
const encryptor = new JSEncrypt();
|
|
397
|
+
encryptor.setPublicKey(PUBLIC_KEY);
|
|
398
|
+
const md5Password = md5(actionData.password);
|
|
399
|
+
const rsaPassword: any = encryptor.encrypt(md5Password);
|
|
400
|
+
actionData.password = rsaPassword;
|
|
401
|
+
ueSoftphone.request(server + "/platform/public/login", {
|
|
402
|
+
verb: "POST",
|
|
403
|
+
body: actionData,
|
|
404
|
+
success: (res: any) => {
|
|
405
|
+
if (res.success) {
|
|
406
|
+
ueSoftphone.request(server + "/platform/action/loginInfo", {
|
|
407
|
+
verb: "GET",
|
|
408
|
+
loginToken: res.data.loginToken,
|
|
409
|
+
sessionId: res.data.sessionId,
|
|
410
|
+
success: (loginInfo: any) => {
|
|
411
|
+
if (loginInfo.success) {
|
|
412
|
+
if (loginInfo.data.agent) {
|
|
413
|
+
ueSoftphone.agentInfo = loginInfo.data.agent;
|
|
414
|
+
ueSoftphone.loginToken = loginInfo.data.loginToken;
|
|
415
|
+
ueSoftphone.initOptions = {
|
|
416
|
+
...options,
|
|
417
|
+
audioInfo: audioObj
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
// if (hasMonitor) { // 需要监控,挂载监控
|
|
421
|
+
// this.initMonitorAttachEvent(loginInfo.data.pushServer, loginInfo.data.agent)
|
|
422
|
+
// }
|
|
423
|
+
this.initAttachEvent(
|
|
424
|
+
server,
|
|
425
|
+
loginType,
|
|
426
|
+
loginInfo.data.pushServer,
|
|
427
|
+
loginInfo.data.agent
|
|
428
|
+
);
|
|
429
|
+
debugger;
|
|
430
|
+
if (loginType === "WEBRTC") {
|
|
431
|
+
this.getWebrtcInfo(server, options);
|
|
432
|
+
}
|
|
433
|
+
} else {
|
|
434
|
+
(options.error as Function)({
|
|
435
|
+
...loginInfo,
|
|
436
|
+
...audioObj
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
},
|
|
440
|
+
error: (error: any) => {
|
|
441
|
+
(options.error as Function)({
|
|
442
|
+
error,
|
|
443
|
+
...audioObj
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
});
|
|
447
|
+
} else {
|
|
448
|
+
(options.error as Function)({
|
|
449
|
+
...res,
|
|
450
|
+
...audioObj
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
},
|
|
454
|
+
error: (error: any) => {
|
|
455
|
+
(options.error as Function)({
|
|
456
|
+
error,
|
|
457
|
+
...audioObj
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
} else {
|
|
462
|
+
(options.error as Function)({
|
|
463
|
+
...preInfo,
|
|
464
|
+
...audioObj
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
},
|
|
468
|
+
error: (error: any) => {
|
|
469
|
+
(options.error as Function)({
|
|
470
|
+
error,
|
|
471
|
+
...audioObj
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
// static createMonitorEventHandle(callbacks: any = {}) {
|
|
478
|
+
// // 目前还没有socket,暂时不可用,地址瞎写的
|
|
479
|
+
// callbacks.success =
|
|
480
|
+
// typeof callbacks.success == "function" ? callbacks.success : ueSoftphone.noop;
|
|
481
|
+
// callbacks.error = typeof callbacks.error == "function" ? callbacks.error : ueSoftphone.noop;
|
|
482
|
+
// callbacks.message =
|
|
483
|
+
// typeof callbacks.message == "function" ? callbacks.message : ueSoftphone.noop;
|
|
484
|
+
// callbacks.server =
|
|
485
|
+
// callbacks.serve === null || callbacks.serve === undefined
|
|
486
|
+
// ? "ue-dev1.useasy.net"
|
|
487
|
+
// : callbacks.serve;
|
|
488
|
+
|
|
489
|
+
// if (callbacks.SocketOptions === null || callbacks.SocketOptions === undefined) {
|
|
490
|
+
// callbacks.SocketOptions = {};
|
|
491
|
+
// ueSoftphone.error({ message: "login response error!" });
|
|
492
|
+
// }
|
|
493
|
+
// this.MonitorSocketinstance = ueSoftphone.newWebSocket(
|
|
494
|
+
// callbacks.server,
|
|
495
|
+
// callbacks.SocketOptions
|
|
496
|
+
// );
|
|
497
|
+
// this.MonitorSocketinstance.on("connect", () => {
|
|
498
|
+
// callbacks.success("connect event serve success!");
|
|
499
|
+
// ueSoftphone.log("监控connect========");
|
|
500
|
+
// });
|
|
501
|
+
// this.MonitorSocketinstance.on("error", (error: string, fn: Function) => {
|
|
502
|
+
// callbacks.error({
|
|
503
|
+
// type: "socketError",
|
|
504
|
+
// error: error
|
|
505
|
+
// });
|
|
506
|
+
// if (fn && typeof fn === "function") {
|
|
507
|
+
// fn("error");
|
|
508
|
+
// }
|
|
509
|
+
// });
|
|
510
|
+
// this.MonitorSocketinstance.on("message", (event, m) => {
|
|
511
|
+
// callbacks.message(m);
|
|
512
|
+
// });
|
|
513
|
+
// if (callbacks.sdkMonitorType) {
|
|
514
|
+
// const sdkMonitorTypeArr = callbacks.sdkMonitorType || [];
|
|
515
|
+
// if (Array.isArray(sdkMonitorTypeArr)) {
|
|
516
|
+
// clearInterval(ueSoftphone.ueTimer);
|
|
517
|
+
// ueSoftphone.ueTimer = window.setInterval(() => {
|
|
518
|
+
// // category: summary: 概览数据, agent: 座席监控, queue: 技能组监控, trunkNumber: 服务号监控
|
|
519
|
+
// sdkMonitorTypeArr.forEach((item) => {
|
|
520
|
+
// this.MonitorSocketinstance.emit("monitor", "bizMonitor", { category: item });
|
|
521
|
+
// });
|
|
522
|
+
// }, 3000);
|
|
523
|
+
// }
|
|
524
|
+
// }
|
|
525
|
+
// }
|
|
526
|
+
|
|
527
|
+
static createEventHandle(callbacks: any = {}) {
|
|
528
|
+
callbacks.success =
|
|
529
|
+
typeof callbacks.success == "function" ? callbacks.success : ueSoftphone.noop;
|
|
530
|
+
callbacks.error = typeof callbacks.error == "function" ? callbacks.error : ueSoftphone.noop;
|
|
531
|
+
callbacks.message =
|
|
532
|
+
typeof callbacks.message == "function" ? callbacks.message : ueSoftphone.noop;
|
|
533
|
+
callbacks.server =
|
|
534
|
+
callbacks.serve === null || callbacks.serve === undefined
|
|
535
|
+
? "ws://152.136.72.209:3201/phoneBarGateway"
|
|
536
|
+
: callbacks.serve;
|
|
537
|
+
|
|
538
|
+
if (callbacks.SocketOptions === null || callbacks.SocketOptions === undefined) {
|
|
539
|
+
callbacks.SocketOptions = {};
|
|
540
|
+
ueSoftphone.error({ message: "login response error!" });
|
|
541
|
+
}
|
|
542
|
+
this.Socketinstance = ueSoftphone.newWebSocket(callbacks.server, callbacks.SocketOptions);
|
|
543
|
+
this.Socketinstance.on("connect", () => {
|
|
544
|
+
callbacks.success("connect event serve success!");
|
|
545
|
+
// (ueSoftphone.initOptions.success as Function)({
|
|
546
|
+
// agentNumber: ueSoftphone.agentInfo.agentNumber,
|
|
547
|
+
// agentName: ueSoftphone.agentInfo.agentName,
|
|
548
|
+
// mobile: ueSoftphone.agentInfo.mobile,
|
|
549
|
+
// sipNumber: ueSoftphone.agentInfo.sipNumber,
|
|
550
|
+
// loginStatus: ueSoftphone.agentInfo.loginStatus,
|
|
551
|
+
// loginType: ueSoftphone.agentInfo.loginType,
|
|
552
|
+
// restTime: ueSoftphone.agentInfo.restTime,
|
|
553
|
+
// toAnswerOffline: ueSoftphone.agentInfo.toAnswerOffline || '0',
|
|
554
|
+
// ...(ueSoftphone.initOptions.audioInfo || {})
|
|
555
|
+
// })
|
|
556
|
+
});
|
|
557
|
+
|
|
558
|
+
this.Socketinstance.on("error", (error: string, fn: Function) => {
|
|
559
|
+
callbacks.error({
|
|
560
|
+
type: "socketError",
|
|
561
|
+
error: error
|
|
562
|
+
});
|
|
563
|
+
if (fn && typeof fn === "function") {
|
|
564
|
+
fn("error");
|
|
565
|
+
}
|
|
566
|
+
});
|
|
567
|
+
|
|
568
|
+
this.Socketinstance.on("message", (event: any, fn: Function) => {
|
|
569
|
+
if (event.subType === "login" && event.data.eventType === "logout") {
|
|
570
|
+
this.Socketinstance.disconnect();
|
|
571
|
+
if (ueSoftphone.agentInfo.loginType === "WEBRTC") {
|
|
572
|
+
WebPhoneSdk.disconnect();
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
callbacks.message({
|
|
576
|
+
subtype: event.subType,
|
|
577
|
+
data: event.data
|
|
578
|
+
});
|
|
579
|
+
if (fn && typeof fn === "function") {
|
|
580
|
+
fn("success");
|
|
581
|
+
}
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
// 若是webrtc的方式,会获取webrtc相关信息,注册地址,注册密码等。
|
|
586
|
+
private getWebrtcInfo = (server: any, options: any) => {
|
|
587
|
+
ueSoftphone.request(server + "/call/api/sip/webrtc/config/query", {
|
|
588
|
+
verb: "GET",
|
|
589
|
+
loginToken: ueSoftphone.loginToken,
|
|
590
|
+
sessionId: ueSoftphone.agentInfo._id,
|
|
591
|
+
success: (webrtcInfo: any) => {
|
|
592
|
+
if (webrtcInfo.success && webrtcInfo.data) {
|
|
593
|
+
ueSoftphone.agentextras = webrtcInfo.data;
|
|
594
|
+
ueSoftphone.initWebrtcEvent(webrtcInfo.data);
|
|
595
|
+
} else {
|
|
596
|
+
(options.error as Function)({
|
|
597
|
+
...webrtcInfo
|
|
598
|
+
});
|
|
599
|
+
}
|
|
600
|
+
},
|
|
601
|
+
error: (error: any) => {
|
|
602
|
+
(options.error as Function)({
|
|
603
|
+
error
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
});
|
|
607
|
+
};
|
|
608
|
+
// 监控事件回调
|
|
609
|
+
// private initMonitorAttachEvent = (options: SocketMonitorOptions, userOptions: any) => {
|
|
610
|
+
// if (this.attachMonitorEventCallbacks) {
|
|
611
|
+
// this.attachMonitorEventCallbacks.serve = options.sdkMonitorUrl;
|
|
612
|
+
// // this.attachMonitorEventCallbacks.sdkMonitorType =
|
|
613
|
+
// // ueSoftphone.initOptions.sdkMonitorType || [];
|
|
614
|
+
// this.attachMonitorEventCallbacks.SocketOptions = {
|
|
615
|
+
// query: {
|
|
616
|
+
// transport: "websocket",
|
|
617
|
+
// sessionid: userOptions._id,
|
|
618
|
+
// logintoken: userOptions.loginToken
|
|
619
|
+
// },
|
|
620
|
+
// reconnectionDelay: 3000,
|
|
621
|
+
// "force new connection": true
|
|
622
|
+
// };
|
|
623
|
+
// ueSoftphone.createMonitorEventHandle(this.attachMonitorEventCallbacks);
|
|
624
|
+
// }
|
|
625
|
+
// };
|
|
626
|
+
// 电话条事件回调
|
|
627
|
+
private initAttachEvent = (server: any, loginType: string, options: any, userOptions: any) => {
|
|
628
|
+
if (this.attachEventCallbacks) {
|
|
629
|
+
// 每次创建链接的时候,要获取最新的ws token
|
|
630
|
+
ueSoftphone.request(server + "/platform/action/refreshWsToken", {
|
|
631
|
+
verb: "GET",
|
|
632
|
+
loginToken: ueSoftphone.loginToken,
|
|
633
|
+
sessionId: ueSoftphone.agentInfo._id,
|
|
634
|
+
success: (res: any) => {
|
|
635
|
+
if (res && res.data) {
|
|
636
|
+
let serverUrl = "";
|
|
637
|
+
options.forEach((item: any) => {
|
|
638
|
+
if (item.id === "KF") {
|
|
639
|
+
serverUrl = item.url;
|
|
640
|
+
}
|
|
641
|
+
});
|
|
642
|
+
this.attachEventCallbacks.serve = serverUrl;
|
|
643
|
+
this.attachEventCallbacks.SocketOptions = {
|
|
644
|
+
query: {
|
|
645
|
+
accountId: userOptions.accountId,
|
|
646
|
+
agentNumber: userOptions.agentNumber,
|
|
647
|
+
agentId: userOptions._id,
|
|
648
|
+
token: res.data.wsToken,
|
|
649
|
+
wsExtra: JSON.stringify({
|
|
650
|
+
loginType: loginType,
|
|
651
|
+
channelType: "SDK",
|
|
652
|
+
ability: ["call"]
|
|
653
|
+
}),
|
|
654
|
+
timestamp: res.data.timestamp,
|
|
655
|
+
clientType: 1
|
|
656
|
+
},
|
|
657
|
+
reconnectionDelay: 3000,
|
|
658
|
+
"force new connection": true,
|
|
659
|
+
transports: ["websocket"],
|
|
660
|
+
timeout: 5000
|
|
661
|
+
};
|
|
662
|
+
ueSoftphone.createEventHandle(this.attachEventCallbacks);
|
|
663
|
+
}
|
|
664
|
+
},
|
|
665
|
+
error: (error: any) => {
|
|
666
|
+
(options.error as Function)({
|
|
667
|
+
error
|
|
668
|
+
});
|
|
669
|
+
}
|
|
670
|
+
});
|
|
671
|
+
}
|
|
672
|
+
};
|
|
673
|
+
static useDefaultDependencies(deps: any) {
|
|
674
|
+
const f = (deps && deps.fetch) || fetch;
|
|
675
|
+
const p = (deps && deps.Promise) || Promise;
|
|
676
|
+
const socketCls = (deps && deps.WebSocket) || WebSocket;
|
|
677
|
+
return {
|
|
678
|
+
newWebSocket(server: string, proto: any) {
|
|
679
|
+
return new socketCls(server, proto);
|
|
680
|
+
},
|
|
681
|
+
// 封装公共请求
|
|
682
|
+
request(url: string, options: any) {
|
|
683
|
+
const fetchOptions: any = {
|
|
684
|
+
method: options.verb,
|
|
685
|
+
cache: "no-cache",
|
|
686
|
+
headers: {
|
|
687
|
+
"Content-Type": "application/json",
|
|
688
|
+
loginToken: options.loginToken || "",
|
|
689
|
+
sessionId: options.sessionId || "",
|
|
690
|
+
clienttype: 0
|
|
691
|
+
}
|
|
692
|
+
};
|
|
693
|
+
if (options.encryptionFields) {
|
|
694
|
+
// 如果参数中有加密字段,header中需要新增加密字段,下面uexxx可能要修改
|
|
695
|
+
fetchOptions.headers["ue-encryption-algorithm"] = options.encryptionAlgorithm || "aes";
|
|
696
|
+
fetchOptions.headers["ue-encryption-fields"] = options.encryptionFields;
|
|
697
|
+
}
|
|
698
|
+
if (options.withCredentials !== undefined) {
|
|
699
|
+
fetchOptions.credentials =
|
|
700
|
+
options.withCredentials === true
|
|
701
|
+
? "include"
|
|
702
|
+
: options.withCredentials
|
|
703
|
+
? options.withCredentials
|
|
704
|
+
: "omit";
|
|
705
|
+
}
|
|
706
|
+
if (options.body !== undefined) {
|
|
707
|
+
fetchOptions.body = JSON.stringify(options.body);
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
let fetching = f(url, fetchOptions).catch(function (error: any) {
|
|
711
|
+
return p.reject({
|
|
712
|
+
message: "Probably a network error, is the gateway down?",
|
|
713
|
+
error: error
|
|
714
|
+
});
|
|
715
|
+
});
|
|
716
|
+
|
|
717
|
+
if (options.timeout !== undefined) {
|
|
718
|
+
var timeout = new p((resolve: Function, reject: Function) => {
|
|
719
|
+
var timerId = window.setTimeout(function () {
|
|
720
|
+
clearTimeout(timerId);
|
|
721
|
+
options.error({ message: "Request timed out", timeout: options.timeout });
|
|
722
|
+
return reject({ message: "Request timed out", timeout: options.timeout });
|
|
723
|
+
}, options.timeout);
|
|
724
|
+
});
|
|
725
|
+
fetching = p.race([fetching, timeout]);
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
fetching
|
|
729
|
+
.then(function (response: any) {
|
|
730
|
+
if (response.ok) {
|
|
731
|
+
if (typeof options.success === typeof ueSoftphone.noop) {
|
|
732
|
+
return response
|
|
733
|
+
.json()
|
|
734
|
+
.then(function (parsed: any) {
|
|
735
|
+
options.success(parsed);
|
|
736
|
+
})
|
|
737
|
+
.catch(function (error: any) {
|
|
738
|
+
options.error({
|
|
739
|
+
message: "Failed to parse response body",
|
|
740
|
+
error: error,
|
|
741
|
+
response: response
|
|
742
|
+
});
|
|
743
|
+
return p.reject({
|
|
744
|
+
message: "Failed to parse response body",
|
|
745
|
+
error: error,
|
|
746
|
+
response: response
|
|
747
|
+
});
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
} else {
|
|
751
|
+
options.error({ message: "API call failed", response: response });
|
|
752
|
+
return p.reject({ message: "API call failed", response: response });
|
|
753
|
+
}
|
|
754
|
+
})
|
|
755
|
+
.catch(function (error: any) {
|
|
756
|
+
if (typeof options.error === typeof ueSoftphone.noop) {
|
|
757
|
+
options.error(error.message || "<< internal error >>", error);
|
|
758
|
+
}
|
|
759
|
+
});
|
|
760
|
+
return fetching;
|
|
761
|
+
}
|
|
762
|
+
};
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
// webrtc事件回调
|
|
766
|
+
private static initWebrtcEvent = (extras: any) => {
|
|
767
|
+
ueSoftphone.webPhone = new WebPhoneSdk({
|
|
768
|
+
server: extras.wssUrl,
|
|
769
|
+
sip: extras.sip,
|
|
770
|
+
secret: extras.password
|
|
771
|
+
});
|
|
772
|
+
ueSoftphone.webPhone.message = (res: any) => {
|
|
773
|
+
console.log(res);
|
|
774
|
+
};
|
|
775
|
+
};
|
|
776
|
+
// 若是webrtc的模式,会检测权限,弹窗让客户授权
|
|
777
|
+
private openMediaAudio = (failMsg: string, hasAlert: boolean) => {
|
|
778
|
+
const { mediaDevices, getUserMedia, webkitGetUserMedia, mozGetUserMedia, msGetUserMedia } =
|
|
779
|
+
navigator as any;
|
|
780
|
+
const userMedia: any = (
|
|
781
|
+
getUserMedia ||
|
|
782
|
+
webkitGetUserMedia ||
|
|
783
|
+
mozGetUserMedia ||
|
|
784
|
+
msGetUserMedia
|
|
785
|
+
).bind(navigator);
|
|
786
|
+
if (mediaDevices) {
|
|
787
|
+
return navigator.mediaDevices
|
|
788
|
+
.getUserMedia({
|
|
789
|
+
audio: true
|
|
790
|
+
})
|
|
791
|
+
.catch((err) => {
|
|
792
|
+
const isForbidden = err.message.includes(DENIED);
|
|
793
|
+
if (!hasAlert) {
|
|
794
|
+
return isForbidden ? AUDIO_FORBIDDEN : NOT_OPEN_AUDIO;
|
|
795
|
+
}
|
|
796
|
+
isForbidden && alert(AUDIO_FORBIDDEN.forbiddenAudioMsg);
|
|
797
|
+
failMsg && !isForbidden && alert(failMsg);
|
|
798
|
+
return isForbidden ? AUDIO_FORBIDDEN : NOT_OPEN_AUDIO;
|
|
799
|
+
});
|
|
800
|
+
}
|
|
801
|
+
return new Promise((resolve, reject) => {
|
|
802
|
+
if (userMedia) {
|
|
803
|
+
userMedia(
|
|
804
|
+
{ audio: true },
|
|
805
|
+
function onSuccess(stream) {
|
|
806
|
+
resolve(true);
|
|
807
|
+
},
|
|
808
|
+
function onError(error) {
|
|
809
|
+
if (hasAlert) {
|
|
810
|
+
failMsg && alert(failMsg);
|
|
811
|
+
}
|
|
812
|
+
reject(NOT_OPEN_AUDIO);
|
|
813
|
+
}
|
|
814
|
+
);
|
|
815
|
+
} else {
|
|
816
|
+
reject(NOT_OPEN_AUDIO);
|
|
817
|
+
}
|
|
818
|
+
});
|
|
819
|
+
};
|
|
820
|
+
|
|
821
|
+
public listenCallEvent = (callbacks: OnCallEventParams) => {
|
|
822
|
+
// 若客户对接的demo中无attachEventCallbacks回调,则无法接收到电话条的事件回吐
|
|
823
|
+
this.attachEventCallbacks = callbacks;
|
|
824
|
+
};
|
|
825
|
+
// public attachMonitorEvent = (callbacks: any) => {
|
|
826
|
+
// // 若客户对接的demo中无attachMonitorEventCallbacks回调,则无法接收到监控的事件回吐
|
|
827
|
+
// this.attachMonitorEventCallbacks = callbacks;
|
|
828
|
+
// };
|
|
829
|
+
|
|
830
|
+
public get agent() {
|
|
831
|
+
return this._agentApi();
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
public get webrtc() {
|
|
835
|
+
return this._webPhoneApi();
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
public get call() {
|
|
839
|
+
return this._callApi();
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
// public get monitorApi() {
|
|
843
|
+
// return this._monitorApi();
|
|
844
|
+
// }
|
|
845
|
+
|
|
846
|
+
private _callApi = () => {
|
|
847
|
+
let encryptionAlgorithm;
|
|
848
|
+
let encryptionFields;
|
|
849
|
+
const _this = this;
|
|
850
|
+
return {
|
|
851
|
+
// 外呼
|
|
852
|
+
async callout(params: DialoutParams) {
|
|
853
|
+
params.success =
|
|
854
|
+
params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
|
|
855
|
+
params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
|
|
856
|
+
if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
|
|
857
|
+
params.fail({
|
|
858
|
+
success: false,
|
|
859
|
+
message: "initialization not complete!"
|
|
860
|
+
});
|
|
861
|
+
return;
|
|
862
|
+
}
|
|
863
|
+
// if (params.encryptionAlgorithm) {
|
|
864
|
+
// encryptionAlgorithm = params.encryptionAlgorithm;
|
|
865
|
+
// }
|
|
866
|
+
// if (params.encryptionFields) {
|
|
867
|
+
// encryptionFields = params.encryptionFields;
|
|
868
|
+
// }
|
|
869
|
+
if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
|
|
870
|
+
params.fail({
|
|
871
|
+
success: false,
|
|
872
|
+
message: "initialization not complete!"
|
|
873
|
+
});
|
|
874
|
+
return;
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
if (params.customerNumber === null || params.customerNumber === undefined) {
|
|
878
|
+
params.fail({
|
|
879
|
+
success: false,
|
|
880
|
+
message: "Parameter customerNumber is required!"
|
|
881
|
+
});
|
|
882
|
+
return;
|
|
883
|
+
}
|
|
884
|
+
const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
|
|
885
|
+
const query: DialoutParams = {
|
|
886
|
+
customerNumber: params.customerNumber,
|
|
887
|
+
agentNumber: ueSoftphone.agentInfo.agentNumber,
|
|
888
|
+
accountId: ueSoftphone.agentInfo.accountId,
|
|
889
|
+
agentId: ueSoftphone.agentInfo._id,
|
|
890
|
+
loginType:
|
|
891
|
+
params.loginType || ueSoftphone.agentInfo.loginType || ueSoftphone.initOptions.loginType
|
|
892
|
+
};
|
|
893
|
+
if (params.agentTimeout) {
|
|
894
|
+
query.agentTimeout = params.agentTimeout;
|
|
895
|
+
}
|
|
896
|
+
if (params.customerTimeout) {
|
|
897
|
+
query.customerTimeout = params.customerTimeout;
|
|
898
|
+
}
|
|
899
|
+
if (params.agentDisNumber) {
|
|
900
|
+
query.agentDisNumber = params.agentDisNumber;
|
|
901
|
+
}
|
|
902
|
+
if (params.customerDisNumber) {
|
|
903
|
+
query.customerDisNumber = params.customerDisNumber;
|
|
904
|
+
}
|
|
905
|
+
if (params.extras) {
|
|
906
|
+
query.extras = params.extras;
|
|
907
|
+
}
|
|
908
|
+
// if (params.group) {
|
|
909
|
+
// query.group = params.group;
|
|
910
|
+
// }
|
|
911
|
+
// if (params.groupRule) {
|
|
912
|
+
// query.groupRule = params.groupRule;
|
|
913
|
+
// }
|
|
914
|
+
// if (params.groupareaCode) {
|
|
915
|
+
// query.groupareaCode = params.groupareaCode;
|
|
916
|
+
// }
|
|
917
|
+
const options = ueSoftphone.initOptions;
|
|
918
|
+
const isStrongHint = true;
|
|
919
|
+
// typeof options.isStrongHint === "boolean" ? options.isStrongHint : true;
|
|
920
|
+
let audioObj;
|
|
921
|
+
if (options.loginType === "WEBRTC") {
|
|
922
|
+
try {
|
|
923
|
+
audioObj = (await _this.openMediaAudio("请打开麦克风权限!", isStrongHint)) || {};
|
|
924
|
+
} catch (error) {
|
|
925
|
+
console.log(error);
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
ueSoftphone.request(server + "/call/api/call/call/out", {
|
|
929
|
+
verb: "POST",
|
|
930
|
+
body: query,
|
|
931
|
+
loginToken: ueSoftphone.loginToken,
|
|
932
|
+
sessionId: ueSoftphone.agentInfo._id,
|
|
933
|
+
encryptionAlgorithm,
|
|
934
|
+
encryptionFields,
|
|
935
|
+
success: (res: any) => {
|
|
936
|
+
if (res.success) {
|
|
937
|
+
(params.success as Function)({
|
|
938
|
+
success: true,
|
|
939
|
+
message: "callout success",
|
|
940
|
+
...audioObj
|
|
941
|
+
});
|
|
942
|
+
} else {
|
|
943
|
+
(params.fail as Function)({
|
|
944
|
+
success: false,
|
|
945
|
+
message: res.message,
|
|
946
|
+
code: res.code,
|
|
947
|
+
...audioObj
|
|
948
|
+
});
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
});
|
|
952
|
+
},
|
|
953
|
+
// 挂机
|
|
954
|
+
hangup(params: HangupParams) {
|
|
955
|
+
params.success =
|
|
956
|
+
params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
|
|
957
|
+
params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
|
|
958
|
+
|
|
959
|
+
if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
|
|
960
|
+
params.fail({
|
|
961
|
+
success: false,
|
|
962
|
+
message: "initialization not complete!"
|
|
963
|
+
});
|
|
964
|
+
return;
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
|
|
968
|
+
params.fail({
|
|
969
|
+
success: false,
|
|
970
|
+
message: "initialization not complete!"
|
|
971
|
+
});
|
|
972
|
+
return;
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
|
|
976
|
+
|
|
977
|
+
ueSoftphone.request(server + "/call/api/call/hangup", {
|
|
978
|
+
verb: "POST",
|
|
979
|
+
body: {},
|
|
980
|
+
loginToken: ueSoftphone.loginToken,
|
|
981
|
+
sessionId: ueSoftphone.agentInfo._id,
|
|
982
|
+
accountId: ueSoftphone.agentInfo.accountId,
|
|
983
|
+
encryptionAlgorithm,
|
|
984
|
+
encryptionFields,
|
|
985
|
+
success: (res: any) => {
|
|
986
|
+
if (res.success) {
|
|
987
|
+
(params.success as Function)({
|
|
988
|
+
success: true,
|
|
989
|
+
message: "hangup success",
|
|
990
|
+
data: res.data.response.data
|
|
991
|
+
});
|
|
992
|
+
} else {
|
|
993
|
+
(params.fail as Function)({
|
|
994
|
+
success: false,
|
|
995
|
+
message: res.message,
|
|
996
|
+
code: res.code
|
|
997
|
+
});
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
});
|
|
1001
|
+
},
|
|
1002
|
+
// 保持/取消保持
|
|
1003
|
+
holdOrUnHold(params: HoldOrUnHoldParams) {
|
|
1004
|
+
//保持 取消保持
|
|
1005
|
+
params.success =
|
|
1006
|
+
params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
|
|
1007
|
+
params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
|
|
1008
|
+
if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
|
|
1009
|
+
params.fail({
|
|
1010
|
+
success: false,
|
|
1011
|
+
message: "initialization not complete!"
|
|
1012
|
+
});
|
|
1013
|
+
return;
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
|
|
1017
|
+
params.fail({
|
|
1018
|
+
success: false,
|
|
1019
|
+
message: "initialization not complete!"
|
|
1020
|
+
});
|
|
1021
|
+
return;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
if (params.type === null || params.type === undefined) {
|
|
1025
|
+
params.fail({
|
|
1026
|
+
success: false,
|
|
1027
|
+
message: "Parameter type is required!"
|
|
1028
|
+
});
|
|
1029
|
+
return;
|
|
1030
|
+
}
|
|
1031
|
+
const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
|
|
1032
|
+
const query: HoldOrUnHoldParams = {
|
|
1033
|
+
type: params.type
|
|
1034
|
+
};
|
|
1035
|
+
ueSoftphone.request(server + "/call/api/call/hold", {
|
|
1036
|
+
verb: "POST",
|
|
1037
|
+
body: query,
|
|
1038
|
+
loginToken: ueSoftphone.loginToken,
|
|
1039
|
+
sessionId: ueSoftphone.agentInfo._id,
|
|
1040
|
+
accountId: ueSoftphone.agentInfo.accountId,
|
|
1041
|
+
encryptionAlgorithm,
|
|
1042
|
+
encryptionFields,
|
|
1043
|
+
success: (res: any) => {
|
|
1044
|
+
if (res.success) {
|
|
1045
|
+
(params.success as Function)({
|
|
1046
|
+
success: true,
|
|
1047
|
+
message: "holdOrUnHold success"
|
|
1048
|
+
});
|
|
1049
|
+
} else {
|
|
1050
|
+
(params.fail as Function)({
|
|
1051
|
+
success: false,
|
|
1052
|
+
message: res.message,
|
|
1053
|
+
code: res.code
|
|
1054
|
+
});
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
});
|
|
1058
|
+
},
|
|
1059
|
+
// 静音/取消静音
|
|
1060
|
+
muteOrUnMute(params: MuteOrUnMuteParams) {
|
|
1061
|
+
//静音 取消静音
|
|
1062
|
+
params.success =
|
|
1063
|
+
params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
|
|
1064
|
+
params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
|
|
1065
|
+
if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
|
|
1066
|
+
params.fail({
|
|
1067
|
+
success: false,
|
|
1068
|
+
message: "initialization not complete!"
|
|
1069
|
+
});
|
|
1070
|
+
return;
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
|
|
1074
|
+
params.fail({
|
|
1075
|
+
success: false,
|
|
1076
|
+
message: "initialization not complete!"
|
|
1077
|
+
});
|
|
1078
|
+
return;
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
if (params.type === null || params.type === undefined) {
|
|
1082
|
+
params.fail({
|
|
1083
|
+
success: false,
|
|
1084
|
+
message: "Parameter type is required!"
|
|
1085
|
+
});
|
|
1086
|
+
return;
|
|
1087
|
+
}
|
|
1088
|
+
const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
|
|
1089
|
+
const query: MuteOrUnMuteParams = {
|
|
1090
|
+
type: params.type,
|
|
1091
|
+
direction: params.direction || "all"
|
|
1092
|
+
};
|
|
1093
|
+
ueSoftphone.request(server + "/call/api/call/mute", {
|
|
1094
|
+
verb: "POST",
|
|
1095
|
+
body: query,
|
|
1096
|
+
loginToken: ueSoftphone.loginToken,
|
|
1097
|
+
sessionId: ueSoftphone.agentInfo._id,
|
|
1098
|
+
accountId: ueSoftphone.agentInfo.accountId,
|
|
1099
|
+
encryptionAlgorithm,
|
|
1100
|
+
encryptionFields,
|
|
1101
|
+
success: (res: any) => {
|
|
1102
|
+
if (res.success) {
|
|
1103
|
+
(params.success as Function)({
|
|
1104
|
+
success: true,
|
|
1105
|
+
message: "muteOrUnMute success"
|
|
1106
|
+
});
|
|
1107
|
+
} else {
|
|
1108
|
+
(params.fail as Function)({
|
|
1109
|
+
success: false,
|
|
1110
|
+
message: res.message,
|
|
1111
|
+
code: res.code
|
|
1112
|
+
});
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
});
|
|
1116
|
+
},
|
|
1117
|
+
// 转接
|
|
1118
|
+
transfer(params: TransferParams) {
|
|
1119
|
+
params.success =
|
|
1120
|
+
params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
|
|
1121
|
+
params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
|
|
1122
|
+
|
|
1123
|
+
if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
|
|
1124
|
+
params.fail({
|
|
1125
|
+
success: false,
|
|
1126
|
+
message: "initialization not complete!"
|
|
1127
|
+
});
|
|
1128
|
+
return;
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
|
|
1132
|
+
params.fail({
|
|
1133
|
+
success: false,
|
|
1134
|
+
message: "initialization not complete!"
|
|
1135
|
+
});
|
|
1136
|
+
return;
|
|
1137
|
+
}
|
|
1138
|
+
if (params.mode === null || params.mode === undefined) {
|
|
1139
|
+
params.fail({
|
|
1140
|
+
success: false,
|
|
1141
|
+
message: "Parameter mode is required!"
|
|
1142
|
+
});
|
|
1143
|
+
return;
|
|
1144
|
+
} else if (params.number === null || params.number === undefined) {
|
|
1145
|
+
params.fail({
|
|
1146
|
+
success: false,
|
|
1147
|
+
message: "Parameter number is required!"
|
|
1148
|
+
});
|
|
1149
|
+
return;
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
|
|
1153
|
+
|
|
1154
|
+
ueSoftphone.request(server + "/call/api/call/transfer", {
|
|
1155
|
+
verb: "POST",
|
|
1156
|
+
body: params,
|
|
1157
|
+
loginToken: ueSoftphone.loginToken,
|
|
1158
|
+
sessionId: ueSoftphone.agentInfo._id,
|
|
1159
|
+
accountId: ueSoftphone.agentInfo.accountId,
|
|
1160
|
+
encryptionAlgorithm,
|
|
1161
|
+
encryptionFields,
|
|
1162
|
+
success: (res: any) => {
|
|
1163
|
+
if (res.success) {
|
|
1164
|
+
(params.success as Function)({
|
|
1165
|
+
success: true,
|
|
1166
|
+
message: "transfer success",
|
|
1167
|
+
data: res.data.response.data
|
|
1168
|
+
});
|
|
1169
|
+
} else {
|
|
1170
|
+
(params.fail as Function)({
|
|
1171
|
+
success: false,
|
|
1172
|
+
message: res.message,
|
|
1173
|
+
code: res.code
|
|
1174
|
+
});
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
});
|
|
1178
|
+
},
|
|
1179
|
+
// 咨询
|
|
1180
|
+
consult(params: consultParams) {
|
|
1181
|
+
params.success =
|
|
1182
|
+
params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
|
|
1183
|
+
params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
|
|
1184
|
+
|
|
1185
|
+
if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
|
|
1186
|
+
params.fail({
|
|
1187
|
+
success: false,
|
|
1188
|
+
message: "initialization not complete!"
|
|
1189
|
+
});
|
|
1190
|
+
return;
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
|
|
1194
|
+
params.fail({
|
|
1195
|
+
success: false,
|
|
1196
|
+
message: "initialization not complete!"
|
|
1197
|
+
});
|
|
1198
|
+
return;
|
|
1199
|
+
}
|
|
1200
|
+
if (params.mode === null || params.mode === undefined) {
|
|
1201
|
+
params.fail({
|
|
1202
|
+
success: false,
|
|
1203
|
+
message: "Parameter mode is required!"
|
|
1204
|
+
});
|
|
1205
|
+
return;
|
|
1206
|
+
} else if (params.number === null || params.number === undefined) {
|
|
1207
|
+
params.fail({
|
|
1208
|
+
success: false,
|
|
1209
|
+
message: "Parameter number is required!"
|
|
1210
|
+
});
|
|
1211
|
+
return;
|
|
1212
|
+
} else if (params.agentNumber === null || params.agentNumber === undefined) {
|
|
1213
|
+
params.fail({
|
|
1214
|
+
success: false,
|
|
1215
|
+
message: "Parameter agentNumber is required!"
|
|
1216
|
+
});
|
|
1217
|
+
return;
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
|
|
1221
|
+
ueSoftphone.request(server + "/call/api/call/consult", {
|
|
1222
|
+
verb: "POST",
|
|
1223
|
+
body: params,
|
|
1224
|
+
loginToken: ueSoftphone.loginToken,
|
|
1225
|
+
sessionId: ueSoftphone.agentInfo._id,
|
|
1226
|
+
accountId: ueSoftphone.agentInfo.accountId,
|
|
1227
|
+
encryptionAlgorithm,
|
|
1228
|
+
encryptionFields,
|
|
1229
|
+
success: (res: any) => {
|
|
1230
|
+
if (res.success) {
|
|
1231
|
+
(params.success as Function)({
|
|
1232
|
+
success: true,
|
|
1233
|
+
message: "consult success",
|
|
1234
|
+
data: res.data.response.data
|
|
1235
|
+
});
|
|
1236
|
+
} else {
|
|
1237
|
+
(params.fail as Function)({
|
|
1238
|
+
success: false,
|
|
1239
|
+
message: res.message,
|
|
1240
|
+
code: res.code
|
|
1241
|
+
});
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
});
|
|
1245
|
+
},
|
|
1246
|
+
// 取消咨询
|
|
1247
|
+
cancelconsult(params: cancleConsultParams) {
|
|
1248
|
+
params.success =
|
|
1249
|
+
params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
|
|
1250
|
+
params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
|
|
1251
|
+
|
|
1252
|
+
if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
|
|
1253
|
+
params.fail({
|
|
1254
|
+
success: false,
|
|
1255
|
+
message: "initialization not complete!"
|
|
1256
|
+
});
|
|
1257
|
+
return;
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
|
|
1261
|
+
params.fail({
|
|
1262
|
+
success: false,
|
|
1263
|
+
message: "initialization not complete!"
|
|
1264
|
+
});
|
|
1265
|
+
return;
|
|
1266
|
+
}
|
|
1267
|
+
if (params.agentNumber === null || params.agentNumber === undefined) {
|
|
1268
|
+
params.fail({
|
|
1269
|
+
success: false,
|
|
1270
|
+
message: "Parameter agentNumber is required!"
|
|
1271
|
+
});
|
|
1272
|
+
return;
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
|
|
1276
|
+
|
|
1277
|
+
ueSoftphone.request(server + "/call/api/call/consult/cancel", {
|
|
1278
|
+
verb: "POST",
|
|
1279
|
+
body: params,
|
|
1280
|
+
loginToken: ueSoftphone.loginToken,
|
|
1281
|
+
sessionId: ueSoftphone.agentInfo._id,
|
|
1282
|
+
accountId: ueSoftphone.agentInfo.accountId,
|
|
1283
|
+
encryptionAlgorithm,
|
|
1284
|
+
encryptionFields,
|
|
1285
|
+
success: (res: any) => {
|
|
1286
|
+
if (res.success) {
|
|
1287
|
+
(params.success as Function)({
|
|
1288
|
+
success: true,
|
|
1289
|
+
message: "cancelconsult success",
|
|
1290
|
+
data: res.data.response.data
|
|
1291
|
+
});
|
|
1292
|
+
} else {
|
|
1293
|
+
(params.fail as Function)({
|
|
1294
|
+
success: false,
|
|
1295
|
+
message: res.message,
|
|
1296
|
+
code: res.code
|
|
1297
|
+
});
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
});
|
|
1301
|
+
},
|
|
1302
|
+
// 结束咨询
|
|
1303
|
+
endConsult(params: stopConsultParams) {
|
|
1304
|
+
params.success =
|
|
1305
|
+
params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
|
|
1306
|
+
params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
|
|
1307
|
+
|
|
1308
|
+
if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
|
|
1309
|
+
params.fail({
|
|
1310
|
+
success: false,
|
|
1311
|
+
message: "initialization not complete!"
|
|
1312
|
+
});
|
|
1313
|
+
return;
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
|
|
1317
|
+
params.fail({
|
|
1318
|
+
success: false,
|
|
1319
|
+
message: "initialization not complete!"
|
|
1320
|
+
});
|
|
1321
|
+
return;
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
|
|
1325
|
+
|
|
1326
|
+
ueSoftphone.request(server + "/call/api/call/consult/stop", {
|
|
1327
|
+
verb: "POST",
|
|
1328
|
+
body: params,
|
|
1329
|
+
loginToken: ueSoftphone.loginToken,
|
|
1330
|
+
sessionId: ueSoftphone.agentInfo._id,
|
|
1331
|
+
accountId: ueSoftphone.agentInfo.accountId,
|
|
1332
|
+
encryptionAlgorithm,
|
|
1333
|
+
encryptionFields,
|
|
1334
|
+
success: (res: any) => {
|
|
1335
|
+
if (res.success) {
|
|
1336
|
+
(params.success as Function)({
|
|
1337
|
+
success: true,
|
|
1338
|
+
message: "endConsult success",
|
|
1339
|
+
data: res.data.response.data
|
|
1340
|
+
});
|
|
1341
|
+
} else {
|
|
1342
|
+
(params.fail as Function)({
|
|
1343
|
+
success: false,
|
|
1344
|
+
message: res.message,
|
|
1345
|
+
code: res.code
|
|
1346
|
+
});
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
});
|
|
1350
|
+
},
|
|
1351
|
+
// 咨询接回
|
|
1352
|
+
callbackConsult(params: resumeConsultParams) {
|
|
1353
|
+
params.success =
|
|
1354
|
+
params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
|
|
1355
|
+
params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
|
|
1356
|
+
|
|
1357
|
+
if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
|
|
1358
|
+
params.fail({
|
|
1359
|
+
success: false,
|
|
1360
|
+
message: "initialization not complete!"
|
|
1361
|
+
});
|
|
1362
|
+
return;
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
|
|
1366
|
+
params.fail({
|
|
1367
|
+
success: false,
|
|
1368
|
+
message: "initialization not complete!"
|
|
1369
|
+
});
|
|
1370
|
+
return;
|
|
1371
|
+
}
|
|
1372
|
+
if (params.agentNumber === null || params.agentNumber === undefined) {
|
|
1373
|
+
params.fail({
|
|
1374
|
+
success: false,
|
|
1375
|
+
message: "Parameter agentNumber is required!"
|
|
1376
|
+
});
|
|
1377
|
+
return;
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
|
|
1381
|
+
|
|
1382
|
+
ueSoftphone.request(server + "/call/api/call/consult/resume", {
|
|
1383
|
+
verb: "POST",
|
|
1384
|
+
body: params,
|
|
1385
|
+
loginToken: ueSoftphone.loginToken,
|
|
1386
|
+
sessionId: ueSoftphone.agentInfo._id,
|
|
1387
|
+
accountId: ueSoftphone.agentInfo.accountId,
|
|
1388
|
+
encryptionAlgorithm,
|
|
1389
|
+
encryptionFields,
|
|
1390
|
+
success: (res: any) => {
|
|
1391
|
+
if (res.success) {
|
|
1392
|
+
(params.success as Function)({
|
|
1393
|
+
success: true,
|
|
1394
|
+
message: "resumeConsult success",
|
|
1395
|
+
data: res.data.response.data
|
|
1396
|
+
});
|
|
1397
|
+
} else {
|
|
1398
|
+
(params.fail as Function)({
|
|
1399
|
+
success: false,
|
|
1400
|
+
message: res.message,
|
|
1401
|
+
code: res.code
|
|
1402
|
+
});
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
});
|
|
1406
|
+
},
|
|
1407
|
+
// 咨询转接
|
|
1408
|
+
consultTransfer(params: consultTransferParams) {
|
|
1409
|
+
params.success =
|
|
1410
|
+
params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
|
|
1411
|
+
params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
|
|
1412
|
+
|
|
1413
|
+
if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
|
|
1414
|
+
params.fail({
|
|
1415
|
+
success: false,
|
|
1416
|
+
message: "initialization not complete!"
|
|
1417
|
+
});
|
|
1418
|
+
return;
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
|
|
1422
|
+
params.fail({
|
|
1423
|
+
success: false,
|
|
1424
|
+
message: "initialization not complete!"
|
|
1425
|
+
});
|
|
1426
|
+
return;
|
|
1427
|
+
}
|
|
1428
|
+
if (params.agentNumber === null || params.agentNumber === undefined) {
|
|
1429
|
+
params.fail({
|
|
1430
|
+
success: false,
|
|
1431
|
+
message: "Parameter agentNumber is required!"
|
|
1432
|
+
});
|
|
1433
|
+
return;
|
|
1434
|
+
}
|
|
1435
|
+
|
|
1436
|
+
const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
|
|
1437
|
+
|
|
1438
|
+
ueSoftphone.request(server + "/call/api/call/consult/transfer", {
|
|
1439
|
+
verb: "POST",
|
|
1440
|
+
body: params,
|
|
1441
|
+
loginToken: ueSoftphone.loginToken,
|
|
1442
|
+
sessionId: ueSoftphone.agentInfo._id,
|
|
1443
|
+
accountId: ueSoftphone.agentInfo.accountId,
|
|
1444
|
+
encryptionAlgorithm,
|
|
1445
|
+
encryptionFields,
|
|
1446
|
+
success: (res: any) => {
|
|
1447
|
+
if (res.success) {
|
|
1448
|
+
(params.success as Function)({
|
|
1449
|
+
success: true,
|
|
1450
|
+
message: "consultTransfer success",
|
|
1451
|
+
data: res.data.response.data
|
|
1452
|
+
});
|
|
1453
|
+
} else {
|
|
1454
|
+
(params.fail as Function)({
|
|
1455
|
+
success: false,
|
|
1456
|
+
message: res.message,
|
|
1457
|
+
code: res.code
|
|
1458
|
+
});
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1461
|
+
});
|
|
1462
|
+
},
|
|
1463
|
+
// 三方
|
|
1464
|
+
threeWayCall(params: threeWayCallParams) {
|
|
1465
|
+
params.success =
|
|
1466
|
+
params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
|
|
1467
|
+
params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
|
|
1468
|
+
|
|
1469
|
+
if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
|
|
1470
|
+
params.fail({
|
|
1471
|
+
success: false,
|
|
1472
|
+
message: "initialization not complete!"
|
|
1473
|
+
});
|
|
1474
|
+
return;
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1477
|
+
if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
|
|
1478
|
+
params.fail({
|
|
1479
|
+
success: false,
|
|
1480
|
+
message: "initialization not complete!"
|
|
1481
|
+
});
|
|
1482
|
+
return;
|
|
1483
|
+
}
|
|
1484
|
+
if (params.agentNumber === null || params.agentNumber === undefined) {
|
|
1485
|
+
params.fail({
|
|
1486
|
+
success: false,
|
|
1487
|
+
message: "Parameter agentNumber is required!"
|
|
1488
|
+
});
|
|
1489
|
+
return;
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1492
|
+
const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
|
|
1493
|
+
|
|
1494
|
+
ueSoftphone.request(server + "/call/api/call/threeway", {
|
|
1495
|
+
verb: "POST",
|
|
1496
|
+
body: params,
|
|
1497
|
+
loginToken: ueSoftphone.loginToken,
|
|
1498
|
+
sessionId: ueSoftphone.agentInfo._id,
|
|
1499
|
+
accountId: ueSoftphone.agentInfo.accountId,
|
|
1500
|
+
encryptionAlgorithm,
|
|
1501
|
+
encryptionFields,
|
|
1502
|
+
success: (res: any) => {
|
|
1503
|
+
if (res.success) {
|
|
1504
|
+
(params.success as Function)({
|
|
1505
|
+
success: true,
|
|
1506
|
+
message: "threeWayCall success",
|
|
1507
|
+
data: res.data.response.data
|
|
1508
|
+
});
|
|
1509
|
+
} else {
|
|
1510
|
+
(params.fail as Function)({
|
|
1511
|
+
success: false,
|
|
1512
|
+
message: res.message,
|
|
1513
|
+
code: res.code
|
|
1514
|
+
});
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
});
|
|
1518
|
+
},
|
|
1519
|
+
// 转满意度
|
|
1520
|
+
evaluate(params: satisfactionParams) {
|
|
1521
|
+
params.success =
|
|
1522
|
+
params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
|
|
1523
|
+
params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
|
|
1524
|
+
|
|
1525
|
+
if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
|
|
1526
|
+
params.fail({
|
|
1527
|
+
success: false,
|
|
1528
|
+
message: "initialization not complete!"
|
|
1529
|
+
});
|
|
1530
|
+
return;
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1533
|
+
if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
|
|
1534
|
+
params.fail({
|
|
1535
|
+
success: false,
|
|
1536
|
+
message: "initialization not complete!"
|
|
1537
|
+
});
|
|
1538
|
+
return;
|
|
1539
|
+
}
|
|
1540
|
+
if (params.type === null || params.type === undefined) {
|
|
1541
|
+
params.fail({
|
|
1542
|
+
success: false,
|
|
1543
|
+
message: "Parameter type is required!"
|
|
1544
|
+
});
|
|
1545
|
+
return;
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
|
|
1549
|
+
|
|
1550
|
+
ueSoftphone.request(server + "/call/api/call/evaluate", {
|
|
1551
|
+
verb: "POST",
|
|
1552
|
+
body: params,
|
|
1553
|
+
loginToken: ueSoftphone.loginToken,
|
|
1554
|
+
sessionId: ueSoftphone.agentInfo._id,
|
|
1555
|
+
accountId: ueSoftphone.agentInfo.accountId,
|
|
1556
|
+
encryptionAlgorithm,
|
|
1557
|
+
encryptionFields,
|
|
1558
|
+
success: (res: any) => {
|
|
1559
|
+
if (res.success) {
|
|
1560
|
+
(params.success as Function)({
|
|
1561
|
+
success: true,
|
|
1562
|
+
message: "evaluate success",
|
|
1563
|
+
data: res.data.response.data
|
|
1564
|
+
});
|
|
1565
|
+
} else {
|
|
1566
|
+
(params.fail as Function)({
|
|
1567
|
+
success: false,
|
|
1568
|
+
message: res.message,
|
|
1569
|
+
code: res.code
|
|
1570
|
+
});
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
});
|
|
1574
|
+
},
|
|
1575
|
+
meeting(params: meetingParams) {
|
|
1576
|
+
params.success =
|
|
1577
|
+
params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
|
|
1578
|
+
params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
|
|
1579
|
+
|
|
1580
|
+
if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
|
|
1581
|
+
params.fail({
|
|
1582
|
+
success: false,
|
|
1583
|
+
message: "initialization not complete!"
|
|
1584
|
+
});
|
|
1585
|
+
return;
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
|
|
1589
|
+
params.fail({
|
|
1590
|
+
success: false,
|
|
1591
|
+
message: "initialization not complete!"
|
|
1592
|
+
});
|
|
1593
|
+
return;
|
|
1594
|
+
}
|
|
1595
|
+
if (params.number === null || params.number === undefined) {
|
|
1596
|
+
params.fail({
|
|
1597
|
+
success: false,
|
|
1598
|
+
message: "Parameter number is required!"
|
|
1599
|
+
});
|
|
1600
|
+
return;
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
|
|
1604
|
+
|
|
1605
|
+
ueSoftphone.request(server + "/call/api/call/meeting", {
|
|
1606
|
+
verb: "POST",
|
|
1607
|
+
body: {
|
|
1608
|
+
meetingType: "phone",
|
|
1609
|
+
number: params.number
|
|
1610
|
+
},
|
|
1611
|
+
loginToken: ueSoftphone.loginToken,
|
|
1612
|
+
sessionId: ueSoftphone.agentInfo._id,
|
|
1613
|
+
accountId: ueSoftphone.agentInfo.accountId,
|
|
1614
|
+
encryptionAlgorithm,
|
|
1615
|
+
encryptionFields,
|
|
1616
|
+
success: (res: any) => {
|
|
1617
|
+
if (res.success) {
|
|
1618
|
+
(params.success as Function)({
|
|
1619
|
+
success: true,
|
|
1620
|
+
message: "meeting success",
|
|
1621
|
+
data: res.data.response.data
|
|
1622
|
+
});
|
|
1623
|
+
} else {
|
|
1624
|
+
(params.fail as Function)({
|
|
1625
|
+
success: false,
|
|
1626
|
+
message: res.message,
|
|
1627
|
+
code: res.code
|
|
1628
|
+
});
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1631
|
+
});
|
|
1632
|
+
}
|
|
1633
|
+
// listen(params: listenParams) {
|
|
1634
|
+
// params.success =
|
|
1635
|
+
// params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
|
|
1636
|
+
// params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
|
|
1637
|
+
|
|
1638
|
+
// if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
|
|
1639
|
+
// params.fail({
|
|
1640
|
+
// success: false,
|
|
1641
|
+
// message: "initialization not complete!"
|
|
1642
|
+
// });
|
|
1643
|
+
// return;
|
|
1644
|
+
// }
|
|
1645
|
+
|
|
1646
|
+
// if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
|
|
1647
|
+
// params.fail({
|
|
1648
|
+
// success: false,
|
|
1649
|
+
// message: "initialization not complete!"
|
|
1650
|
+
// });
|
|
1651
|
+
// return;
|
|
1652
|
+
// }
|
|
1653
|
+
// if (params.agentNumber === null || params.agentNumber === undefined) {
|
|
1654
|
+
// params.fail({
|
|
1655
|
+
// success: false,
|
|
1656
|
+
// message: "Parameter agentNumber is required!"
|
|
1657
|
+
// });
|
|
1658
|
+
// return;
|
|
1659
|
+
// }
|
|
1660
|
+
|
|
1661
|
+
// const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
|
|
1662
|
+
// ueSoftphone.request(server + "/call/sdk/v1/call/transfer/listen", {
|
|
1663
|
+
// verb: "POST",
|
|
1664
|
+
// body: params,
|
|
1665
|
+
// loginToken: ueSoftphone.loginToken,
|
|
1666
|
+
// sessionId: ueSoftphone.agentInfo._id,
|
|
1667
|
+
// accountId: ueSoftphone.agentInfo.accountId,
|
|
1668
|
+
// encryptionAlgorithm,
|
|
1669
|
+
// encryptionFields,
|
|
1670
|
+
// success: (res: any) => {
|
|
1671
|
+
// if (res.success) {
|
|
1672
|
+
// (params.success as Function)({
|
|
1673
|
+
// success: true,
|
|
1674
|
+
// message: "listen success",
|
|
1675
|
+
// data: res.data.response.data
|
|
1676
|
+
// });
|
|
1677
|
+
// } else {
|
|
1678
|
+
// (params.fail as Function)({
|
|
1679
|
+
// success: false,
|
|
1680
|
+
// message: res.message,
|
|
1681
|
+
// code: res.code
|
|
1682
|
+
// });
|
|
1683
|
+
// }
|
|
1684
|
+
// }
|
|
1685
|
+
// });
|
|
1686
|
+
// },
|
|
1687
|
+
// loot(params: lootParams) {
|
|
1688
|
+
// params.success =
|
|
1689
|
+
// params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
|
|
1690
|
+
// params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
|
|
1691
|
+
|
|
1692
|
+
// if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
|
|
1693
|
+
// params.fail({
|
|
1694
|
+
// success: false,
|
|
1695
|
+
// message: "initialization not complete!"
|
|
1696
|
+
// });
|
|
1697
|
+
// return;
|
|
1698
|
+
// }
|
|
1699
|
+
|
|
1700
|
+
// if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
|
|
1701
|
+
// params.fail({
|
|
1702
|
+
// success: false,
|
|
1703
|
+
// message: "initialization not complete!"
|
|
1704
|
+
// });
|
|
1705
|
+
// return;
|
|
1706
|
+
// }
|
|
1707
|
+
// if (params.agentNumber === null || params.agentNumber === undefined) {
|
|
1708
|
+
// params.fail({
|
|
1709
|
+
// success: false,
|
|
1710
|
+
// message: "Parameter agentNumber is required!"
|
|
1711
|
+
// });
|
|
1712
|
+
// return;
|
|
1713
|
+
// }
|
|
1714
|
+
|
|
1715
|
+
// const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
|
|
1716
|
+
|
|
1717
|
+
// ueSoftphone.request(server + "/call/sdk/v1/call/transfer/loot", {
|
|
1718
|
+
// verb: "POST",
|
|
1719
|
+
// body: params,
|
|
1720
|
+
// loginToken: ueSoftphone.loginToken,
|
|
1721
|
+
// sessionId: ueSoftphone.agentInfo._id,
|
|
1722
|
+
// accountId: ueSoftphone.agentInfo.accountId,
|
|
1723
|
+
// encryptionAlgorithm,
|
|
1724
|
+
// encryptionFields,
|
|
1725
|
+
// success: (res: any) => {
|
|
1726
|
+
// if (res.success) {
|
|
1727
|
+
// (params.success as Function)({
|
|
1728
|
+
// success: true,
|
|
1729
|
+
// message: "loot success",
|
|
1730
|
+
// data: res.data.response.data
|
|
1731
|
+
// });
|
|
1732
|
+
// } else {
|
|
1733
|
+
// (params.fail as Function)({
|
|
1734
|
+
// success: false,
|
|
1735
|
+
// message: res.message,
|
|
1736
|
+
// code: res.code
|
|
1737
|
+
// });
|
|
1738
|
+
// }
|
|
1739
|
+
// }
|
|
1740
|
+
// });
|
|
1741
|
+
// },
|
|
1742
|
+
// whisper(params: whisperParams) {
|
|
1743
|
+
// params.success =
|
|
1744
|
+
// params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
|
|
1745
|
+
// params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
|
|
1746
|
+
|
|
1747
|
+
// if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
|
|
1748
|
+
// params.fail({
|
|
1749
|
+
// success: false,
|
|
1750
|
+
// message: "initialization not complete!"
|
|
1751
|
+
// });
|
|
1752
|
+
// return;
|
|
1753
|
+
// }
|
|
1754
|
+
|
|
1755
|
+
// if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
|
|
1756
|
+
// params.fail({
|
|
1757
|
+
// success: false,
|
|
1758
|
+
// message: "initialization not complete!"
|
|
1759
|
+
// });
|
|
1760
|
+
// return;
|
|
1761
|
+
// }
|
|
1762
|
+
// if (params.agentNumber === null || params.agentNumber === undefined) {
|
|
1763
|
+
// params.fail({
|
|
1764
|
+
// success: false,
|
|
1765
|
+
// message: "Parameter agentNumber is required!"
|
|
1766
|
+
// });
|
|
1767
|
+
// return;
|
|
1768
|
+
// }
|
|
1769
|
+
|
|
1770
|
+
// const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
|
|
1771
|
+
|
|
1772
|
+
// ueSoftphone.request(server + "/call/sdk/v1/call/transfer/whisper", {
|
|
1773
|
+
// verb: "POST",
|
|
1774
|
+
// body: params,
|
|
1775
|
+
// loginToken: ueSoftphone.loginToken,
|
|
1776
|
+
// sessionId: ueSoftphone.agentInfo._id,
|
|
1777
|
+
// accountId: ueSoftphone.agentInfo.accountId,
|
|
1778
|
+
// encryptionAlgorithm,
|
|
1779
|
+
// encryptionFields,
|
|
1780
|
+
// success: (res: any) => {
|
|
1781
|
+
// if (res.success) {
|
|
1782
|
+
// (params.success as Function)({
|
|
1783
|
+
// success: true,
|
|
1784
|
+
// message: "whisper success",
|
|
1785
|
+
// data: res.data.response.data
|
|
1786
|
+
// });
|
|
1787
|
+
// } else {
|
|
1788
|
+
// (params.fail as Function)({
|
|
1789
|
+
// success: false,
|
|
1790
|
+
// message: res.message,
|
|
1791
|
+
// code: res.code
|
|
1792
|
+
// });
|
|
1793
|
+
// }
|
|
1794
|
+
// }
|
|
1795
|
+
// });
|
|
1796
|
+
// },
|
|
1797
|
+
// breakin(params: breakinParams) {
|
|
1798
|
+
// params.success =
|
|
1799
|
+
// params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
|
|
1800
|
+
// params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
|
|
1801
|
+
|
|
1802
|
+
// if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
|
|
1803
|
+
// params.fail({
|
|
1804
|
+
// success: false,
|
|
1805
|
+
// message: "initialization not complete!"
|
|
1806
|
+
// });
|
|
1807
|
+
// return;
|
|
1808
|
+
// }
|
|
1809
|
+
|
|
1810
|
+
// if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
|
|
1811
|
+
// params.fail({
|
|
1812
|
+
// success: false,
|
|
1813
|
+
// message: "initialization not complete!"
|
|
1814
|
+
// });
|
|
1815
|
+
// return;
|
|
1816
|
+
// }
|
|
1817
|
+
// if (params.agentNumber === null || params.agentNumber === undefined) {
|
|
1818
|
+
// params.fail({
|
|
1819
|
+
// success: false,
|
|
1820
|
+
// message: "Parameter agentNumber is required!"
|
|
1821
|
+
// });
|
|
1822
|
+
// return;
|
|
1823
|
+
// }
|
|
1824
|
+
|
|
1825
|
+
// const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
|
|
1826
|
+
|
|
1827
|
+
// ueSoftphone.request(server + "/call/sdk/v1/call/transfer/breakin", {
|
|
1828
|
+
// verb: "POST",
|
|
1829
|
+
// body: params,
|
|
1830
|
+
// loginToken: ueSoftphone.loginToken,
|
|
1831
|
+
// sessionId: ueSoftphone.agentInfo._id,
|
|
1832
|
+
// accountId: ueSoftphone.agentInfo.accountId,
|
|
1833
|
+
// encryptionAlgorithm,
|
|
1834
|
+
// encryptionFields,
|
|
1835
|
+
// success: (res: any) => {
|
|
1836
|
+
// if (res.success) {
|
|
1837
|
+
// (params.success as Function)({
|
|
1838
|
+
// success: true,
|
|
1839
|
+
// message: "breakin success",
|
|
1840
|
+
// data: res.data.response.data
|
|
1841
|
+
// });
|
|
1842
|
+
// } else {
|
|
1843
|
+
// (params.fail as Function)({
|
|
1844
|
+
// success: false,
|
|
1845
|
+
// message: res.message,
|
|
1846
|
+
// code: res.code
|
|
1847
|
+
// });
|
|
1848
|
+
// }
|
|
1849
|
+
// }
|
|
1850
|
+
// });
|
|
1851
|
+
// },
|
|
1852
|
+
// forcedHangup(params: forcedHangupParams) {
|
|
1853
|
+
// params.success =
|
|
1854
|
+
// params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
|
|
1855
|
+
// params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
|
|
1856
|
+
|
|
1857
|
+
// if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
|
|
1858
|
+
// params.fail({
|
|
1859
|
+
// success: false,
|
|
1860
|
+
// message: "initialization not complete!"
|
|
1861
|
+
// });
|
|
1862
|
+
// return;
|
|
1863
|
+
// }
|
|
1864
|
+
|
|
1865
|
+
// if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
|
|
1866
|
+
// params.fail({
|
|
1867
|
+
// success: false,
|
|
1868
|
+
// message: "initialization not complete!"
|
|
1869
|
+
// });
|
|
1870
|
+
// return;
|
|
1871
|
+
// }
|
|
1872
|
+
// if (params.agentNumber === null || params.agentNumber === undefined) {
|
|
1873
|
+
// params.fail({
|
|
1874
|
+
// success: false,
|
|
1875
|
+
// message: "Parameter agentNumber is required!"
|
|
1876
|
+
// });
|
|
1877
|
+
// return;
|
|
1878
|
+
// }
|
|
1879
|
+
|
|
1880
|
+
// const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
|
|
1881
|
+
|
|
1882
|
+
// ueSoftphone.request(server + "/call/sdk/v1/call/transfer/hangup", {
|
|
1883
|
+
// verb: "POST",
|
|
1884
|
+
// body: params,
|
|
1885
|
+
// loginToken: ueSoftphone.loginToken,
|
|
1886
|
+
// sessionId: ueSoftphone.agentInfo._id,
|
|
1887
|
+
// accountId: ueSoftphone.agentInfo.accountId,
|
|
1888
|
+
// encryptionAlgorithm,
|
|
1889
|
+
// encryptionFields,
|
|
1890
|
+
// success: (res: any) => {
|
|
1891
|
+
// if (res.success) {
|
|
1892
|
+
// (params.success as Function)({
|
|
1893
|
+
// success: true,
|
|
1894
|
+
// message: "forcedHangup success",
|
|
1895
|
+
// data: res.data.response.data
|
|
1896
|
+
// });
|
|
1897
|
+
// } else {
|
|
1898
|
+
// (params.fail as Function)({
|
|
1899
|
+
// success: false,
|
|
1900
|
+
// message: res.message,
|
|
1901
|
+
// code: res.code
|
|
1902
|
+
// });
|
|
1903
|
+
// }
|
|
1904
|
+
// }
|
|
1905
|
+
// });
|
|
1906
|
+
// },
|
|
1907
|
+
// signin(params: signinParams) {
|
|
1908
|
+
// params.success =
|
|
1909
|
+
// params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
|
|
1910
|
+
// params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
|
|
1911
|
+
|
|
1912
|
+
// if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
|
|
1913
|
+
// params.fail({
|
|
1914
|
+
// success: false,
|
|
1915
|
+
// message: "initialization not complete!"
|
|
1916
|
+
// });
|
|
1917
|
+
// return;
|
|
1918
|
+
// }
|
|
1919
|
+
|
|
1920
|
+
// if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
|
|
1921
|
+
// params.fail({
|
|
1922
|
+
// success: false,
|
|
1923
|
+
// message: "initialization not complete!"
|
|
1924
|
+
// });
|
|
1925
|
+
// return;
|
|
1926
|
+
// }
|
|
1927
|
+
// if (params.agentNumber === null || params.agentNumber === undefined) {
|
|
1928
|
+
// params.fail({
|
|
1929
|
+
// success: false,
|
|
1930
|
+
// message: "Parameter agentNumber is required!"
|
|
1931
|
+
// });
|
|
1932
|
+
// return;
|
|
1933
|
+
// }
|
|
1934
|
+
// if (params.loginType === null || params.loginType === undefined) {
|
|
1935
|
+
// params.fail({
|
|
1936
|
+
// success: false,
|
|
1937
|
+
// message: "Parameter loginType is required!"
|
|
1938
|
+
// });
|
|
1939
|
+
// return;
|
|
1940
|
+
// }
|
|
1941
|
+
|
|
1942
|
+
// const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
|
|
1943
|
+
|
|
1944
|
+
// ueSoftphone.request(server + "/call/sdk/v1/call/transfer/signin", {
|
|
1945
|
+
// verb: "POST",
|
|
1946
|
+
// body: params,
|
|
1947
|
+
// loginToken: ueSoftphone.loginToken,
|
|
1948
|
+
// sessionId: ueSoftphone.agentInfo._id,
|
|
1949
|
+
// accountId: ueSoftphone.agentInfo.accountId,
|
|
1950
|
+
// encryptionAlgorithm,
|
|
1951
|
+
// encryptionFields,
|
|
1952
|
+
// success: (res: any) => {
|
|
1953
|
+
// if (res.success) {
|
|
1954
|
+
// (params.success as Function)({
|
|
1955
|
+
// success: true,
|
|
1956
|
+
// message: "signin success",
|
|
1957
|
+
// data: res.data.response.data
|
|
1958
|
+
// });
|
|
1959
|
+
// } else {
|
|
1960
|
+
// (params.fail as Function)({
|
|
1961
|
+
// success: false,
|
|
1962
|
+
// message: res.message,
|
|
1963
|
+
// code: res.code
|
|
1964
|
+
// });
|
|
1965
|
+
// }
|
|
1966
|
+
// }
|
|
1967
|
+
// });
|
|
1968
|
+
// },
|
|
1969
|
+
// signout(params: signoutParams) {
|
|
1970
|
+
// params.success =
|
|
1971
|
+
// params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
|
|
1972
|
+
// params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
|
|
1973
|
+
|
|
1974
|
+
// if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
|
|
1975
|
+
// params.fail({
|
|
1976
|
+
// success: false,
|
|
1977
|
+
// message: "initialization not complete!"
|
|
1978
|
+
// });
|
|
1979
|
+
// return;
|
|
1980
|
+
// }
|
|
1981
|
+
|
|
1982
|
+
// if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
|
|
1983
|
+
// params.fail({
|
|
1984
|
+
// success: false,
|
|
1985
|
+
// message: "initialization not complete!"
|
|
1986
|
+
// });
|
|
1987
|
+
// return;
|
|
1988
|
+
// }
|
|
1989
|
+
// if (params.agentNumber === null || params.agentNumber === undefined) {
|
|
1990
|
+
// params.fail({
|
|
1991
|
+
// success: false,
|
|
1992
|
+
// message: "Parameter agentNumber is required!"
|
|
1993
|
+
// });
|
|
1994
|
+
// return;
|
|
1995
|
+
// }
|
|
1996
|
+
|
|
1997
|
+
// const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
|
|
1998
|
+
|
|
1999
|
+
// ueSoftphone.request(server + "/call/sdk/v1/call/transfer/signout", {
|
|
2000
|
+
// verb: "POST",
|
|
2001
|
+
// body: params,
|
|
2002
|
+
// loginToken: ueSoftphone.loginToken,
|
|
2003
|
+
// sessionId: ueSoftphone.agentInfo._id,
|
|
2004
|
+
// accountId: ueSoftphone.agentInfo.accountId,
|
|
2005
|
+
// encryptionAlgorithm,
|
|
2006
|
+
// encryptionFields,
|
|
2007
|
+
// success: (res: any) => {
|
|
2008
|
+
// if (res.success) {
|
|
2009
|
+
// (params.success as Function)({
|
|
2010
|
+
// success: true,
|
|
2011
|
+
// message: "signout success",
|
|
2012
|
+
// data: res.data.response.data
|
|
2013
|
+
// });
|
|
2014
|
+
// } else {
|
|
2015
|
+
// (params.fail as Function)({
|
|
2016
|
+
// success: false,
|
|
2017
|
+
// message: res.message,
|
|
2018
|
+
// code: res.code
|
|
2019
|
+
// });
|
|
2020
|
+
// }
|
|
2021
|
+
// }
|
|
2022
|
+
// });
|
|
2023
|
+
// }
|
|
2024
|
+
};
|
|
2025
|
+
};
|
|
2026
|
+
|
|
2027
|
+
private _agentApi = () => {
|
|
2028
|
+
const that = this;
|
|
2029
|
+
return {
|
|
2030
|
+
// 切换接听方式
|
|
2031
|
+
async switchLoginType(params: UpdateLoginTypeParams) {
|
|
2032
|
+
let loginNumber: any = null;
|
|
2033
|
+
params.success =
|
|
2034
|
+
params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
|
|
2035
|
+
params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
|
|
2036
|
+
if (params.loginType === null || params.loginType === undefined) {
|
|
2037
|
+
params.fail({
|
|
2038
|
+
success: false,
|
|
2039
|
+
message: "Parameter loginType is required!"
|
|
2040
|
+
});
|
|
2041
|
+
return;
|
|
2042
|
+
}
|
|
2043
|
+
if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
|
|
2044
|
+
params.fail({
|
|
2045
|
+
success: false,
|
|
2046
|
+
message: "initialization not complete!"
|
|
2047
|
+
});
|
|
2048
|
+
return;
|
|
2049
|
+
}
|
|
2050
|
+
if (params.loginNumber !== null && params.loginNumber !== undefined) {
|
|
2051
|
+
loginNumber = params.loginNumber;
|
|
2052
|
+
}
|
|
2053
|
+
if (params.loginType === "PSTN") {
|
|
2054
|
+
loginNumber = loginNumber ? loginNumber : ueSoftphone.agentInfo.mobile;
|
|
2055
|
+
if (!loginNumber) {
|
|
2056
|
+
alert("请给座席绑定手机号,或者传入号码参数!");
|
|
2057
|
+
params.fail({
|
|
2058
|
+
success: false,
|
|
2059
|
+
message: "Please bind your mobile number"
|
|
2060
|
+
});
|
|
2061
|
+
return;
|
|
2062
|
+
}
|
|
2063
|
+
}
|
|
2064
|
+
if (params.loginType === "SIP") {
|
|
2065
|
+
loginNumber = loginNumber ? loginNumber : ueSoftphone.agentInfo.sipNumber;
|
|
2066
|
+
}
|
|
2067
|
+
if (params.loginType === "WEBRTC") {
|
|
2068
|
+
loginNumber = ueSoftphone.agentInfo.webrtcSipNumber;
|
|
2069
|
+
}
|
|
2070
|
+
|
|
2071
|
+
if (loginNumber === null || loginNumber === undefined) {
|
|
2072
|
+
params.fail({
|
|
2073
|
+
success: false,
|
|
2074
|
+
message: "Please fill in the loginNumber field according to the document"
|
|
2075
|
+
});
|
|
2076
|
+
return;
|
|
2077
|
+
}
|
|
2078
|
+
const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
|
|
2079
|
+
const query: UpdateLoginTypeParams = {
|
|
2080
|
+
loginType: params.loginType,
|
|
2081
|
+
loginNumber: loginNumber
|
|
2082
|
+
};
|
|
2083
|
+
const options = ueSoftphone.initOptions;
|
|
2084
|
+
let audioObj;
|
|
2085
|
+
const isStrongHint = true;
|
|
2086
|
+
// typeof options.isStrongHint === "boolean" ? options.isStrongHint : true;
|
|
2087
|
+
if (params.loginType === "WEBRTC") {
|
|
2088
|
+
try {
|
|
2089
|
+
audioObj = (await that.openMediaAudio("请打开麦克风权限!", isStrongHint)) || {};
|
|
2090
|
+
} catch (error) {
|
|
2091
|
+
console.log(error);
|
|
2092
|
+
}
|
|
2093
|
+
}
|
|
2094
|
+
ueSoftphone.request(server + "/call/api/agent/v1/login-type/change", {
|
|
2095
|
+
verb: "POST",
|
|
2096
|
+
body: query,
|
|
2097
|
+
loginToken: ueSoftphone.loginToken,
|
|
2098
|
+
sessionId: ueSoftphone.agentInfo._id,
|
|
2099
|
+
accountId: ueSoftphone.agentInfo.accountId,
|
|
2100
|
+
success: async (res: any) => {
|
|
2101
|
+
if (res.success) {
|
|
2102
|
+
(params.success as Function)({
|
|
2103
|
+
success: true,
|
|
2104
|
+
message: "updateLoginType success",
|
|
2105
|
+
...audioObj
|
|
2106
|
+
});
|
|
2107
|
+
ueSoftphone.agentInfo.loginType = params.loginType;
|
|
2108
|
+
|
|
2109
|
+
if (params.loginType === "WEBRTC") {
|
|
2110
|
+
that._webPhoneApi().connect();
|
|
2111
|
+
} else if (params.loginType === "PSTN") {
|
|
2112
|
+
await ueSoftphone.request(server + "/platform/action/updateCallConfig", {
|
|
2113
|
+
verb: "POST",
|
|
2114
|
+
body: { agentCallConfig: {}, mobile: params.loginNumber! },
|
|
2115
|
+
loginToken: ueSoftphone.loginToken,
|
|
2116
|
+
sessionId: ueSoftphone.agentInfo._id,
|
|
2117
|
+
accountId: ueSoftphone.agentInfo.accountId
|
|
2118
|
+
});
|
|
2119
|
+
that._webPhoneApi().disconnect();
|
|
2120
|
+
} else {
|
|
2121
|
+
that._webPhoneApi().disconnect();
|
|
2122
|
+
}
|
|
2123
|
+
} else {
|
|
2124
|
+
(params.fail as Function)({
|
|
2125
|
+
success: false,
|
|
2126
|
+
message: res.message,
|
|
2127
|
+
code: res.code,
|
|
2128
|
+
...audioObj
|
|
2129
|
+
});
|
|
2130
|
+
}
|
|
2131
|
+
}
|
|
2132
|
+
});
|
|
2133
|
+
},
|
|
2134
|
+
// 获取电话条的所有状态
|
|
2135
|
+
findPhoneBarList(params: GetAgentPhoneBarParams) {
|
|
2136
|
+
params.success =
|
|
2137
|
+
params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
|
|
2138
|
+
params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
|
|
2139
|
+
if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
|
|
2140
|
+
params.fail({
|
|
2141
|
+
success: false,
|
|
2142
|
+
message: "initialization not complete!"
|
|
2143
|
+
});
|
|
2144
|
+
return;
|
|
2145
|
+
}
|
|
2146
|
+
const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
|
|
2147
|
+
ueSoftphone.request(server + "/call/api/phone/bar/all", {
|
|
2148
|
+
verb: "GET",
|
|
2149
|
+
loginToken: ueSoftphone.loginToken,
|
|
2150
|
+
sessionId: ueSoftphone.agentInfo._id,
|
|
2151
|
+
accountId: ueSoftphone.agentInfo.accountId,
|
|
2152
|
+
success: (res: any) => {
|
|
2153
|
+
if (res.success) {
|
|
2154
|
+
let dataList: any = [];
|
|
2155
|
+
res.data.forEach((event: { name: any; number: any }) => {
|
|
2156
|
+
const resEvent = { name: event.name, number: event.number };
|
|
2157
|
+
dataList.push(resEvent);
|
|
2158
|
+
});
|
|
2159
|
+
(params.success as Function)({
|
|
2160
|
+
success: true,
|
|
2161
|
+
data: dataList
|
|
2162
|
+
});
|
|
2163
|
+
} else {
|
|
2164
|
+
(params.fail as Function)({
|
|
2165
|
+
success: false,
|
|
2166
|
+
message: res.message,
|
|
2167
|
+
code: res.code
|
|
2168
|
+
});
|
|
2169
|
+
}
|
|
2170
|
+
}
|
|
2171
|
+
});
|
|
2172
|
+
},
|
|
2173
|
+
|
|
2174
|
+
// 更新座席的电话条状态
|
|
2175
|
+
switchPhoneBar(params: UpdateAgentStatusParams) {
|
|
2176
|
+
params.success =
|
|
2177
|
+
params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
|
|
2178
|
+
params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
|
|
2179
|
+
if (params.stateNumber === null || params.stateNumber === undefined) {
|
|
2180
|
+
params.fail({
|
|
2181
|
+
success: false,
|
|
2182
|
+
message: "Parameter stateNumber is required!"
|
|
2183
|
+
});
|
|
2184
|
+
return;
|
|
2185
|
+
}
|
|
2186
|
+
if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
|
|
2187
|
+
params.fail({
|
|
2188
|
+
success: false,
|
|
2189
|
+
message: "initialization not complete!"
|
|
2190
|
+
});
|
|
2191
|
+
return;
|
|
2192
|
+
}
|
|
2193
|
+
const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
|
|
2194
|
+
const query = {
|
|
2195
|
+
stateNumber: params.stateNumber,
|
|
2196
|
+
accountId: ueSoftphone.agentInfo.accountId,
|
|
2197
|
+
agentNumber: ueSoftphone.agentInfo.agentNumber
|
|
2198
|
+
};
|
|
2199
|
+
ueSoftphone.request(server + "/call/api/agent/status/switch", {
|
|
2200
|
+
verb: "POST",
|
|
2201
|
+
body: query,
|
|
2202
|
+
loginToken: ueSoftphone.loginToken,
|
|
2203
|
+
sessionId: ueSoftphone.agentInfo._id,
|
|
2204
|
+
success: (res: any) => {
|
|
2205
|
+
if (res.success) {
|
|
2206
|
+
(params.success as Function)({
|
|
2207
|
+
success: true
|
|
2208
|
+
});
|
|
2209
|
+
} else {
|
|
2210
|
+
(params.fail as Function)({
|
|
2211
|
+
success: false,
|
|
2212
|
+
message: res.message,
|
|
2213
|
+
code: res.code
|
|
2214
|
+
});
|
|
2215
|
+
}
|
|
2216
|
+
}
|
|
2217
|
+
});
|
|
2218
|
+
},
|
|
2219
|
+
// 退出登录
|
|
2220
|
+
logout(params: AgentOfflineParams) {
|
|
2221
|
+
params.success =
|
|
2222
|
+
params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
|
|
2223
|
+
params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
|
|
2224
|
+
if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
|
|
2225
|
+
params.fail({
|
|
2226
|
+
success: false,
|
|
2227
|
+
message: "initialization not complete!"
|
|
2228
|
+
});
|
|
2229
|
+
return;
|
|
2230
|
+
}
|
|
2231
|
+
if (params.toAnswerOffline === null || params.toAnswerOffline === undefined) {
|
|
2232
|
+
params.toAnswerOffline = "1";
|
|
2233
|
+
}
|
|
2234
|
+
const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
|
|
2235
|
+
const query = {
|
|
2236
|
+
toAnswerOffline: params.toAnswerOffline
|
|
2237
|
+
};
|
|
2238
|
+
ueSoftphone.request(server + "/call/api/sdk/agent/logout", {
|
|
2239
|
+
verb: "POST",
|
|
2240
|
+
body: query,
|
|
2241
|
+
loginToken: ueSoftphone.loginToken,
|
|
2242
|
+
sessionId: ueSoftphone.agentInfo._id,
|
|
2243
|
+
accountId: ueSoftphone.agentInfo.accountId,
|
|
2244
|
+
success: (res: any) => {
|
|
2245
|
+
if (res.success) {
|
|
2246
|
+
if (params) {
|
|
2247
|
+
ueSoftphone.Socketinstance.disconnect();
|
|
2248
|
+
// if (ueSoftphone.initOptions.hasMonitor) {
|
|
2249
|
+
// // 有监控的话,退出的时候,要把监控的socket也关掉
|
|
2250
|
+
// ueSoftphone.MonitorSocketinstance.disconnect();
|
|
2251
|
+
// clearInterval(ueSoftphone.ueTimer); // 清除定时器
|
|
2252
|
+
// }
|
|
2253
|
+
if (ueSoftphone.agentInfo.loginType === "WEBRTC") {
|
|
2254
|
+
WebPhoneSdk.disconnect();
|
|
2255
|
+
}
|
|
2256
|
+
(params.success as Function)({
|
|
2257
|
+
success: true
|
|
2258
|
+
});
|
|
2259
|
+
}
|
|
2260
|
+
} else {
|
|
2261
|
+
if (params) {
|
|
2262
|
+
(params.fail as Function)({
|
|
2263
|
+
success: false,
|
|
2264
|
+
message: res.message,
|
|
2265
|
+
code: res.code
|
|
2266
|
+
});
|
|
2267
|
+
}
|
|
2268
|
+
}
|
|
2269
|
+
}
|
|
2270
|
+
});
|
|
2271
|
+
},
|
|
2272
|
+
// 获取技能组中空闲的座席(用于转接和咨询)
|
|
2273
|
+
findIdleAgentsForQueue(params: GetQueueOnlineAgentsParams) {
|
|
2274
|
+
params.success =
|
|
2275
|
+
params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
|
|
2276
|
+
params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
|
|
2277
|
+
if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
|
|
2278
|
+
params.fail({
|
|
2279
|
+
success: false,
|
|
2280
|
+
message: "initialization not complete!"
|
|
2281
|
+
});
|
|
2282
|
+
return;
|
|
2283
|
+
}
|
|
2284
|
+
const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
|
|
2285
|
+
ueSoftphone.request(server + "/call/api/queue/acountFreeAgent/find", {
|
|
2286
|
+
verb: "POST",
|
|
2287
|
+
body: {},
|
|
2288
|
+
loginToken: ueSoftphone.loginToken,
|
|
2289
|
+
sessionId: ueSoftphone.agentInfo._id,
|
|
2290
|
+
accountId: ueSoftphone.agentInfo.accountId,
|
|
2291
|
+
success: (res: any) => {
|
|
2292
|
+
if (res.success) {
|
|
2293
|
+
if (params) {
|
|
2294
|
+
(params.success as Function)({
|
|
2295
|
+
success: true,
|
|
2296
|
+
dataList: res.data || []
|
|
2297
|
+
});
|
|
2298
|
+
}
|
|
2299
|
+
} else {
|
|
2300
|
+
if (params) {
|
|
2301
|
+
(params.fail as Function)({
|
|
2302
|
+
success: false,
|
|
2303
|
+
message: res.message,
|
|
2304
|
+
code: res.code
|
|
2305
|
+
});
|
|
2306
|
+
}
|
|
2307
|
+
}
|
|
2308
|
+
}
|
|
2309
|
+
});
|
|
2310
|
+
},
|
|
2311
|
+
// 切换sip接听方式的时候,拉取当前可绑定的sip号列表
|
|
2312
|
+
getAvailableSipNumberList(params: any) {
|
|
2313
|
+
params.success =
|
|
2314
|
+
params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
|
|
2315
|
+
params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
|
|
2316
|
+
if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
|
|
2317
|
+
params.fail({
|
|
2318
|
+
success: false,
|
|
2319
|
+
message: "initialization not complete!"
|
|
2320
|
+
});
|
|
2321
|
+
return;
|
|
2322
|
+
}
|
|
2323
|
+
const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
|
|
2324
|
+
ueSoftphone.request(server + "/call/api/sip/avaliable/query", {
|
|
2325
|
+
verb: "POST",
|
|
2326
|
+
body: {},
|
|
2327
|
+
loginToken: ueSoftphone.loginToken,
|
|
2328
|
+
sessionId: ueSoftphone.agentInfo._id,
|
|
2329
|
+
success: (res: any) => {
|
|
2330
|
+
if (res.success && res.data) {
|
|
2331
|
+
let dataList: any = [];
|
|
2332
|
+
res.data.forEach((event: { id: any; number: any }) => {
|
|
2333
|
+
const resEvent = {
|
|
2334
|
+
number: event.id,
|
|
2335
|
+
numberName: event.number
|
|
2336
|
+
};
|
|
2337
|
+
dataList.push(resEvent);
|
|
2338
|
+
});
|
|
2339
|
+
(params.success as Function)({
|
|
2340
|
+
success: true,
|
|
2341
|
+
data: dataList
|
|
2342
|
+
});
|
|
2343
|
+
} else {
|
|
2344
|
+
(params.fail as Function)({
|
|
2345
|
+
success: false,
|
|
2346
|
+
message: res.message,
|
|
2347
|
+
code: res.code
|
|
2348
|
+
});
|
|
2349
|
+
}
|
|
2350
|
+
}
|
|
2351
|
+
});
|
|
2352
|
+
}
|
|
2353
|
+
// // 设置离线接听(手机和sip话机方式可行)
|
|
2354
|
+
// setAnswerOffline(params: AgentOfflineParams) {
|
|
2355
|
+
// params.success =
|
|
2356
|
+
// params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
|
|
2357
|
+
// params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
|
|
2358
|
+
// if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
|
|
2359
|
+
// params.fail({
|
|
2360
|
+
// success: false,
|
|
2361
|
+
// message: "initialization not complete!"
|
|
2362
|
+
// });
|
|
2363
|
+
// return;
|
|
2364
|
+
// }
|
|
2365
|
+
// if (params.toAnswerOffline === null || params.toAnswerOffline === undefined) {
|
|
2366
|
+
// params.toAnswerOffline = "1";
|
|
2367
|
+
// }
|
|
2368
|
+
// const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
|
|
2369
|
+
// const query = {
|
|
2370
|
+
// toAnswerOffline: params.toAnswerOffline
|
|
2371
|
+
// };
|
|
2372
|
+
// ueSoftphone.request(server + "/call/sdk/v1/call/offline/answer", {
|
|
2373
|
+
// verb: "POST",
|
|
2374
|
+
// body: query,
|
|
2375
|
+
// loginToken: ueSoftphone.loginToken,
|
|
2376
|
+
// sessionId: ueSoftphone.agentInfo._id,
|
|
2377
|
+
// accountId: ueSoftphone.agentInfo.accountId,
|
|
2378
|
+
// success: (res: any) => {
|
|
2379
|
+
// if (res.success) {
|
|
2380
|
+
// if (params) {
|
|
2381
|
+
// (params.success as Function)({
|
|
2382
|
+
// success: true,
|
|
2383
|
+
// toAnswerOffline: params.toAnswerOffline
|
|
2384
|
+
// });
|
|
2385
|
+
// }
|
|
2386
|
+
// } else {
|
|
2387
|
+
// if (params) {
|
|
2388
|
+
// (params.fail as Function)({
|
|
2389
|
+
// success: false,
|
|
2390
|
+
// message: res.message,
|
|
2391
|
+
// code: res.code
|
|
2392
|
+
// });
|
|
2393
|
+
// }
|
|
2394
|
+
// }
|
|
2395
|
+
// }
|
|
2396
|
+
// });
|
|
2397
|
+
// },
|
|
2398
|
+
// // 获取IVR语音导航列表(用于转IVR的时候可选择转哪个ivr)
|
|
2399
|
+
// getIvrList(params: getIvrListParams) {
|
|
2400
|
+
// params.success =
|
|
2401
|
+
// params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
|
|
2402
|
+
// params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
|
|
2403
|
+
// if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
|
|
2404
|
+
// params.fail({
|
|
2405
|
+
// success: false,
|
|
2406
|
+
// message: "initialization not complete!"
|
|
2407
|
+
// });
|
|
2408
|
+
// return;
|
|
2409
|
+
// }
|
|
2410
|
+
// if (params.types === null || params.types === undefined) {
|
|
2411
|
+
// params.fail({
|
|
2412
|
+
// success: false,
|
|
2413
|
+
// message: "Parameter types is required!"
|
|
2414
|
+
// });
|
|
2415
|
+
// return;
|
|
2416
|
+
// }
|
|
2417
|
+
// const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
|
|
2418
|
+
// ueSoftphone.request(server + "/call/sdk/v1/call/general/query", {
|
|
2419
|
+
// verb: "POST",
|
|
2420
|
+
// body: params,
|
|
2421
|
+
// loginToken: ueSoftphone.loginToken,
|
|
2422
|
+
// sessionId: ueSoftphone.agentInfo._id,
|
|
2423
|
+
// accountId: ueSoftphone.agentInfo.accountId,
|
|
2424
|
+
// success: (res: any) => {
|
|
2425
|
+
// if (res.success) {
|
|
2426
|
+
// if (params) {
|
|
2427
|
+
// (params.success as Function)({
|
|
2428
|
+
// success: true,
|
|
2429
|
+
// dataList: res.data || []
|
|
2430
|
+
// });
|
|
2431
|
+
// }
|
|
2432
|
+
// } else {
|
|
2433
|
+
// if (params) {
|
|
2434
|
+
// (params.fail as Function)({
|
|
2435
|
+
// success: false,
|
|
2436
|
+
// message: res.message,
|
|
2437
|
+
// code: res.code
|
|
2438
|
+
// });
|
|
2439
|
+
// }
|
|
2440
|
+
// }
|
|
2441
|
+
// }
|
|
2442
|
+
// });
|
|
2443
|
+
// }
|
|
2444
|
+
};
|
|
2445
|
+
};
|
|
2446
|
+
public _webPhoneApi = () => {
|
|
2447
|
+
return {
|
|
2448
|
+
// 接听
|
|
2449
|
+
accept() {
|
|
2450
|
+
WebPhoneSdk.accept();
|
|
2451
|
+
},
|
|
2452
|
+
// 注册设备,链接webrtc
|
|
2453
|
+
connect() {
|
|
2454
|
+
if (!ueSoftphone.webPhone || !this.isConnected()) {
|
|
2455
|
+
ueSoftphone.initWebrtcEvent(ueSoftphone.agentextras);
|
|
2456
|
+
}
|
|
2457
|
+
},
|
|
2458
|
+
// 注销设备,跟webrtc断开链接
|
|
2459
|
+
disconnect() {
|
|
2460
|
+
if (ueSoftphone.webPhone && this.isConnected()) {
|
|
2461
|
+
WebPhoneSdk.disconnect();
|
|
2462
|
+
}
|
|
2463
|
+
},
|
|
2464
|
+
// 检测设备是否有链接上
|
|
2465
|
+
isConnected() {
|
|
2466
|
+
return WebPhoneSdk.isConnected();
|
|
2467
|
+
},
|
|
2468
|
+
// 发送DTMF 可与demo中的软电话拨号盘结合使用
|
|
2469
|
+
sendDTMF(tone: string) {
|
|
2470
|
+
WebPhoneSdk.sendDTMF(tone);
|
|
2471
|
+
}
|
|
2472
|
+
};
|
|
2473
|
+
};
|
|
2474
|
+
|
|
2475
|
+
// private _monitorApi = () => {
|
|
2476
|
+
// return {
|
|
2477
|
+
// // 监听
|
|
2478
|
+
// listen(params: listenParams) {
|
|
2479
|
+
// params.success =
|
|
2480
|
+
// params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
|
|
2481
|
+
// params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
|
|
2482
|
+
|
|
2483
|
+
// if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
|
|
2484
|
+
// params.fail({
|
|
2485
|
+
// success: false,
|
|
2486
|
+
// message: "initialization not complete!"
|
|
2487
|
+
// });
|
|
2488
|
+
// return;
|
|
2489
|
+
// }
|
|
2490
|
+
|
|
2491
|
+
// if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
|
|
2492
|
+
// params.fail({
|
|
2493
|
+
// success: false,
|
|
2494
|
+
// message: "initialization not complete!"
|
|
2495
|
+
// });
|
|
2496
|
+
// return;
|
|
2497
|
+
// }
|
|
2498
|
+
// if (params.agentNumber === null || params.agentNumber === undefined) {
|
|
2499
|
+
// params.fail({
|
|
2500
|
+
// success: false,
|
|
2501
|
+
// message: "Parameter agentNumber is required!"
|
|
2502
|
+
// });
|
|
2503
|
+
// return;
|
|
2504
|
+
// }
|
|
2505
|
+
|
|
2506
|
+
// const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
|
|
2507
|
+
|
|
2508
|
+
// ueSoftphone.request(server + "/call/sdk/v1/call/transfer/listen", {
|
|
2509
|
+
// verb: "POST",
|
|
2510
|
+
// body: params,
|
|
2511
|
+
// loginToken: ueSoftphone.loginToken,
|
|
2512
|
+
// sessionId: ueSoftphone.agentInfo._id,
|
|
2513
|
+
// accountId: ueSoftphone.agentInfo.accountId,
|
|
2514
|
+
// success: (res: any) => {
|
|
2515
|
+
// if (res.success) {
|
|
2516
|
+
// (params.success as Function)({
|
|
2517
|
+
// success: true,
|
|
2518
|
+
// message: "listen success",
|
|
2519
|
+
// data: res.data.response.data
|
|
2520
|
+
// });
|
|
2521
|
+
// } else {
|
|
2522
|
+
// (params.fail as Function)({
|
|
2523
|
+
// success: false,
|
|
2524
|
+
// message: res.message,
|
|
2525
|
+
// code: res.code
|
|
2526
|
+
// });
|
|
2527
|
+
// }
|
|
2528
|
+
// }
|
|
2529
|
+
// });
|
|
2530
|
+
// },
|
|
2531
|
+
// // 抢接
|
|
2532
|
+
// loot(params: lootParams) {
|
|
2533
|
+
// params.success =
|
|
2534
|
+
// params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
|
|
2535
|
+
// params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
|
|
2536
|
+
|
|
2537
|
+
// if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
|
|
2538
|
+
// params.fail({
|
|
2539
|
+
// success: false,
|
|
2540
|
+
// message: "initialization not complete!"
|
|
2541
|
+
// });
|
|
2542
|
+
// return;
|
|
2543
|
+
// }
|
|
2544
|
+
|
|
2545
|
+
// if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
|
|
2546
|
+
// params.fail({
|
|
2547
|
+
// success: false,
|
|
2548
|
+
// message: "initialization not complete!"
|
|
2549
|
+
// });
|
|
2550
|
+
// return;
|
|
2551
|
+
// }
|
|
2552
|
+
// if (params.agentNumber === null || params.agentNumber === undefined) {
|
|
2553
|
+
// params.fail({
|
|
2554
|
+
// success: false,
|
|
2555
|
+
// message: "Parameter agentNumber is required!"
|
|
2556
|
+
// });
|
|
2557
|
+
// return;
|
|
2558
|
+
// }
|
|
2559
|
+
|
|
2560
|
+
// const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
|
|
2561
|
+
|
|
2562
|
+
// ueSoftphone.request(server + "/call/sdk/v1/call/transfer/loot", {
|
|
2563
|
+
// verb: "POST",
|
|
2564
|
+
// body: params,
|
|
2565
|
+
// loginToken: ueSoftphone.loginToken,
|
|
2566
|
+
// sessionId: ueSoftphone.agentInfo._id,
|
|
2567
|
+
// accountId: ueSoftphone.agentInfo.accountId,
|
|
2568
|
+
// success: (res: any) => {
|
|
2569
|
+
// if (res.success) {
|
|
2570
|
+
// (params.success as Function)({
|
|
2571
|
+
// success: true,
|
|
2572
|
+
// message: "loot success",
|
|
2573
|
+
// data: res.data.response.data
|
|
2574
|
+
// });
|
|
2575
|
+
// } else {
|
|
2576
|
+
// (params.fail as Function)({
|
|
2577
|
+
// success: false,
|
|
2578
|
+
// message: res.message,
|
|
2579
|
+
// code: res.code
|
|
2580
|
+
// });
|
|
2581
|
+
// }
|
|
2582
|
+
// }
|
|
2583
|
+
// });
|
|
2584
|
+
// },
|
|
2585
|
+
// // 耳语
|
|
2586
|
+
// whisper(params: whisperParams) {
|
|
2587
|
+
// params.success =
|
|
2588
|
+
// params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
|
|
2589
|
+
// params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
|
|
2590
|
+
|
|
2591
|
+
// if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
|
|
2592
|
+
// params.fail({
|
|
2593
|
+
// success: false,
|
|
2594
|
+
// message: "initialization not complete!"
|
|
2595
|
+
// });
|
|
2596
|
+
// return;
|
|
2597
|
+
// }
|
|
2598
|
+
|
|
2599
|
+
// if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
|
|
2600
|
+
// params.fail({
|
|
2601
|
+
// success: false,
|
|
2602
|
+
// message: "initialization not complete!"
|
|
2603
|
+
// });
|
|
2604
|
+
// return;
|
|
2605
|
+
// }
|
|
2606
|
+
// if (params.agentNumber === null || params.agentNumber === undefined) {
|
|
2607
|
+
// params.fail({
|
|
2608
|
+
// success: false,
|
|
2609
|
+
// message: "Parameter agentNumber is required!"
|
|
2610
|
+
// });
|
|
2611
|
+
// return;
|
|
2612
|
+
// }
|
|
2613
|
+
|
|
2614
|
+
// const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
|
|
2615
|
+
|
|
2616
|
+
// ueSoftphone.request(server + "/call/sdk/v1/call/transfer/whisper", {
|
|
2617
|
+
// verb: "POST",
|
|
2618
|
+
// body: params,
|
|
2619
|
+
// loginToken: ueSoftphone.loginToken,
|
|
2620
|
+
// sessionId: ueSoftphone.agentInfo._id,
|
|
2621
|
+
// accountId: ueSoftphone.agentInfo.accountId,
|
|
2622
|
+
// success: (res: any) => {
|
|
2623
|
+
// if (res.success) {
|
|
2624
|
+
// (params.success as Function)({
|
|
2625
|
+
// success: true,
|
|
2626
|
+
// message: "whisper success",
|
|
2627
|
+
// data: res.data.response.data
|
|
2628
|
+
// });
|
|
2629
|
+
// } else {
|
|
2630
|
+
// (params.fail as Function)({
|
|
2631
|
+
// success: false,
|
|
2632
|
+
// message: res.message,
|
|
2633
|
+
// code: res.code
|
|
2634
|
+
// });
|
|
2635
|
+
// }
|
|
2636
|
+
// }
|
|
2637
|
+
// });
|
|
2638
|
+
// },
|
|
2639
|
+
// // 强插
|
|
2640
|
+
// breakin(params: breakinParams) {
|
|
2641
|
+
// params.success =
|
|
2642
|
+
// params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
|
|
2643
|
+
// params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
|
|
2644
|
+
|
|
2645
|
+
// if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
|
|
2646
|
+
// params.fail({
|
|
2647
|
+
// success: false,
|
|
2648
|
+
// message: "initialization not complete!"
|
|
2649
|
+
// });
|
|
2650
|
+
// return;
|
|
2651
|
+
// }
|
|
2652
|
+
|
|
2653
|
+
// if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
|
|
2654
|
+
// params.fail({
|
|
2655
|
+
// success: false,
|
|
2656
|
+
// message: "initialization not complete!"
|
|
2657
|
+
// });
|
|
2658
|
+
// return;
|
|
2659
|
+
// }
|
|
2660
|
+
// if (params.agentNumber === null || params.agentNumber === undefined) {
|
|
2661
|
+
// params.fail({
|
|
2662
|
+
// success: false,
|
|
2663
|
+
// message: "Parameter agentNumber is required!"
|
|
2664
|
+
// });
|
|
2665
|
+
// return;
|
|
2666
|
+
// }
|
|
2667
|
+
|
|
2668
|
+
// const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
|
|
2669
|
+
|
|
2670
|
+
// ueSoftphone.request(server + "/call/sdk/v1/call/transfer/breakin", {
|
|
2671
|
+
// verb: "POST",
|
|
2672
|
+
// body: params,
|
|
2673
|
+
// loginToken: ueSoftphone.loginToken,
|
|
2674
|
+
// sessionId: ueSoftphone.agentInfo._id,
|
|
2675
|
+
// accountId: ueSoftphone.agentInfo.accountId,
|
|
2676
|
+
// success: (res: any) => {
|
|
2677
|
+
// if (res.success) {
|
|
2678
|
+
// (params.success as Function)({
|
|
2679
|
+
// success: true,
|
|
2680
|
+
// message: "breakin success",
|
|
2681
|
+
// data: res.data.response.data
|
|
2682
|
+
// });
|
|
2683
|
+
// } else {
|
|
2684
|
+
// (params.fail as Function)({
|
|
2685
|
+
// success: false,
|
|
2686
|
+
// message: res.message,
|
|
2687
|
+
// code: res.code
|
|
2688
|
+
// });
|
|
2689
|
+
// }
|
|
2690
|
+
// }
|
|
2691
|
+
// });
|
|
2692
|
+
// },
|
|
2693
|
+
// // 强拆
|
|
2694
|
+
// forcedHangup(params: forcedHangupParams) {
|
|
2695
|
+
// params.success =
|
|
2696
|
+
// params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
|
|
2697
|
+
// params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
|
|
2698
|
+
|
|
2699
|
+
// if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
|
|
2700
|
+
// params.fail({
|
|
2701
|
+
// success: false,
|
|
2702
|
+
// message: "initialization not complete!"
|
|
2703
|
+
// });
|
|
2704
|
+
// return;
|
|
2705
|
+
// }
|
|
2706
|
+
|
|
2707
|
+
// if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
|
|
2708
|
+
// params.fail({
|
|
2709
|
+
// success: false,
|
|
2710
|
+
// message: "initialization not complete!"
|
|
2711
|
+
// });
|
|
2712
|
+
// return;
|
|
2713
|
+
// }
|
|
2714
|
+
// if (params.agentNumber === null || params.agentNumber === undefined) {
|
|
2715
|
+
// params.fail({
|
|
2716
|
+
// success: false,
|
|
2717
|
+
// message: "Parameter agentNumber is required!"
|
|
2718
|
+
// });
|
|
2719
|
+
// return;
|
|
2720
|
+
// }
|
|
2721
|
+
|
|
2722
|
+
// const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
|
|
2723
|
+
|
|
2724
|
+
// ueSoftphone.request(server + "/call/sdk/v1/call/transfer/hangup", {
|
|
2725
|
+
// verb: "POST",
|
|
2726
|
+
// body: params,
|
|
2727
|
+
// loginToken: ueSoftphone.loginToken,
|
|
2728
|
+
// sessionId: ueSoftphone.agentInfo._id,
|
|
2729
|
+
// accountId: ueSoftphone.agentInfo.accountId,
|
|
2730
|
+
// success: (res: any) => {
|
|
2731
|
+
// if (res.success) {
|
|
2732
|
+
// (params.success as Function)({
|
|
2733
|
+
// success: true,
|
|
2734
|
+
// message: "forcedHangup success",
|
|
2735
|
+
// data: res.data.response.data
|
|
2736
|
+
// });
|
|
2737
|
+
// } else {
|
|
2738
|
+
// (params.fail as Function)({
|
|
2739
|
+
// success: false,
|
|
2740
|
+
// message: res.message,
|
|
2741
|
+
// code: res.code
|
|
2742
|
+
// });
|
|
2743
|
+
// }
|
|
2744
|
+
// }
|
|
2745
|
+
// });
|
|
2746
|
+
// },
|
|
2747
|
+
// // 签入
|
|
2748
|
+
// signin(params: signinParams) {
|
|
2749
|
+
// params.success =
|
|
2750
|
+
// params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
|
|
2751
|
+
// params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
|
|
2752
|
+
|
|
2753
|
+
// if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
|
|
2754
|
+
// params.fail({
|
|
2755
|
+
// success: false,
|
|
2756
|
+
// message: "initialization not complete!"
|
|
2757
|
+
// });
|
|
2758
|
+
// return;
|
|
2759
|
+
// }
|
|
2760
|
+
|
|
2761
|
+
// if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
|
|
2762
|
+
// params.fail({
|
|
2763
|
+
// success: false,
|
|
2764
|
+
// message: "initialization not complete!"
|
|
2765
|
+
// });
|
|
2766
|
+
// return;
|
|
2767
|
+
// }
|
|
2768
|
+
// if (params.agentNumber === null || params.agentNumber === undefined) {
|
|
2769
|
+
// params.fail({
|
|
2770
|
+
// success: false,
|
|
2771
|
+
// message: "Parameter agentNumber is required!"
|
|
2772
|
+
// });
|
|
2773
|
+
// return;
|
|
2774
|
+
// }
|
|
2775
|
+
// if (params.loginType === null || params.loginType === undefined) {
|
|
2776
|
+
// params.fail({
|
|
2777
|
+
// success: false,
|
|
2778
|
+
// message: "Parameter loginType is required!"
|
|
2779
|
+
// });
|
|
2780
|
+
// return;
|
|
2781
|
+
// }
|
|
2782
|
+
|
|
2783
|
+
// const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
|
|
2784
|
+
|
|
2785
|
+
// ueSoftphone.request(server + "/call/sdk/v1/call/transfer/signin", {
|
|
2786
|
+
// verb: "POST",
|
|
2787
|
+
// body: params,
|
|
2788
|
+
// loginToken: ueSoftphone.loginToken,
|
|
2789
|
+
// sessionId: ueSoftphone.agentInfo._id,
|
|
2790
|
+
// accountId: ueSoftphone.agentInfo.accountId,
|
|
2791
|
+
// success: (res: any) => {
|
|
2792
|
+
// if (res.success) {
|
|
2793
|
+
// (params.success as Function)({
|
|
2794
|
+
// success: true,
|
|
2795
|
+
// message: "signin success",
|
|
2796
|
+
// data: res.data.response.data
|
|
2797
|
+
// });
|
|
2798
|
+
// } else {
|
|
2799
|
+
// (params.fail as Function)({
|
|
2800
|
+
// success: false,
|
|
2801
|
+
// message: res.message,
|
|
2802
|
+
// code: res.code
|
|
2803
|
+
// });
|
|
2804
|
+
// }
|
|
2805
|
+
// }
|
|
2806
|
+
// });
|
|
2807
|
+
// },
|
|
2808
|
+
// // 签出
|
|
2809
|
+
// signout(params: signoutParams) {
|
|
2810
|
+
// params.success =
|
|
2811
|
+
// params && typeof params.success == "function" ? params.success : ueSoftphone.noop;
|
|
2812
|
+
// params.fail = params && typeof params.fail == "function" ? params.fail : ueSoftphone.noop;
|
|
2813
|
+
|
|
2814
|
+
// if (ueSoftphone.loginToken === null || ueSoftphone.loginToken === undefined) {
|
|
2815
|
+
// params.fail({
|
|
2816
|
+
// success: false,
|
|
2817
|
+
// message: "initialization not complete!"
|
|
2818
|
+
// });
|
|
2819
|
+
// return;
|
|
2820
|
+
// }
|
|
2821
|
+
|
|
2822
|
+
// if (ueSoftphone.agentInfo === null || ueSoftphone.agentInfo === undefined) {
|
|
2823
|
+
// params.fail({
|
|
2824
|
+
// success: false,
|
|
2825
|
+
// message: "initialization not complete!"
|
|
2826
|
+
// });
|
|
2827
|
+
// return;
|
|
2828
|
+
// }
|
|
2829
|
+
// if (params.agentNumber === null || params.agentNumber === undefined) {
|
|
2830
|
+
// params.fail({
|
|
2831
|
+
// success: false,
|
|
2832
|
+
// message: "Parameter agentNumber is required!"
|
|
2833
|
+
// });
|
|
2834
|
+
// return;
|
|
2835
|
+
// }
|
|
2836
|
+
|
|
2837
|
+
// const server = ueSoftphone.initOptions.server || ueSoftphone.callApiUrl;
|
|
2838
|
+
|
|
2839
|
+
// ueSoftphone.request(server + "/call/sdk/v1/call/transfer/signout", {
|
|
2840
|
+
// verb: "POST",
|
|
2841
|
+
// body: params,
|
|
2842
|
+
// loginToken: ueSoftphone.loginToken,
|
|
2843
|
+
// sessionId: ueSoftphone.agentInfo._id,
|
|
2844
|
+
// accountId: ueSoftphone.agentInfo.accountId,
|
|
2845
|
+
// success: (res: any) => {
|
|
2846
|
+
// if (res.success) {
|
|
2847
|
+
// (params.success as Function)({
|
|
2848
|
+
// success: true,
|
|
2849
|
+
// message: "signout success",
|
|
2850
|
+
// data: res.data.response.data
|
|
2851
|
+
// });
|
|
2852
|
+
// } else {
|
|
2853
|
+
// (params.fail as Function)({
|
|
2854
|
+
// success: false,
|
|
2855
|
+
// message: res.message,
|
|
2856
|
+
// code: res.code
|
|
2857
|
+
// });
|
|
2858
|
+
// }
|
|
2859
|
+
// }
|
|
2860
|
+
// });
|
|
2861
|
+
// }
|
|
2862
|
+
// };
|
|
2863
|
+
// };
|
|
2864
|
+
}
|