@koi-design/callkit 1.0.26-beta.2 → 1.0.26
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/dist/index.d.ts +56 -35
- package/dist/index.global.js +1004 -345
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +725 -320
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +732 -321
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { AxiosRequestConfig } from 'axios';
|
|
2
1
|
import { Invitation, UserAgent, Registerer } from 'sip.js';
|
|
3
2
|
|
|
4
3
|
declare class Api {
|
|
@@ -11,6 +10,12 @@ declare class Api {
|
|
|
11
10
|
loginOut(params: {
|
|
12
11
|
sessionId: string;
|
|
13
12
|
}): Promise<any>;
|
|
13
|
+
/**
|
|
14
|
+
* @description sdkLog
|
|
15
|
+
* @param params
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
sdkLog(data: any): Promise<any>;
|
|
14
19
|
/**
|
|
15
20
|
*
|
|
16
21
|
* @param params agentId userStatus
|
|
@@ -18,9 +23,7 @@ declare class Api {
|
|
|
18
23
|
* @returns
|
|
19
24
|
*/
|
|
20
25
|
setUserStatus(params: any): Promise<any>;
|
|
21
|
-
measureRTT(config?: AxiosRequestConfig): Promise<any>;
|
|
22
26
|
private post;
|
|
23
|
-
private get;
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
declare class Call {
|
|
@@ -103,6 +106,10 @@ declare const KitEvent: {
|
|
|
103
106
|
* Server initiated call
|
|
104
107
|
*/
|
|
105
108
|
KIT_INVITE: string;
|
|
109
|
+
/**
|
|
110
|
+
* Server outgoing initiated call
|
|
111
|
+
*/
|
|
112
|
+
KIT_OUTGOING_INVITE: string;
|
|
106
113
|
/**
|
|
107
114
|
* Connecting
|
|
108
115
|
*/
|
|
@@ -143,14 +150,10 @@ declare const KitEvent: {
|
|
|
143
150
|
* User status change
|
|
144
151
|
*/
|
|
145
152
|
USER_STATUS_CHANGE: string;
|
|
146
|
-
/**
|
|
147
|
-
* SOCKET CONNECT EVENT
|
|
148
|
-
*/
|
|
149
153
|
CONNECT_EVENT: string;
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
NETWORK_EVENT: string;
|
|
154
|
+
SIP_REGISTERER_EVENT: string;
|
|
155
|
+
SIP_SESSION_EVENT: string;
|
|
156
|
+
USER_STATUS_CHANGE_STEP: string;
|
|
154
157
|
};
|
|
155
158
|
declare const SocketSendEvent: {
|
|
156
159
|
/**
|
|
@@ -193,28 +196,48 @@ declare const SocketSendEvent: {
|
|
|
193
196
|
* AGENT_TRANSFER
|
|
194
197
|
*/
|
|
195
198
|
HANG_UP_REASON: string;
|
|
199
|
+
ACK: string;
|
|
200
|
+
SDK_LOG: string;
|
|
196
201
|
};
|
|
197
202
|
declare const EncryptionMethod: {
|
|
198
203
|
NONE: string;
|
|
199
204
|
INTERNAL: string;
|
|
200
205
|
};
|
|
201
206
|
type EncryptionMethodType = (typeof EncryptionMethod)[keyof typeof EncryptionMethod];
|
|
207
|
+
declare const LogGatherEnum: {
|
|
208
|
+
ENABLE: number;
|
|
209
|
+
DISABLE: number;
|
|
210
|
+
};
|
|
211
|
+
type LogGatherEnumType = (typeof LogGatherEnum)[keyof typeof LogGatherEnum];
|
|
202
212
|
declare const CallSourceType: {
|
|
203
213
|
phoneNum: number;
|
|
204
214
|
workOrderId: number;
|
|
205
|
-
};
|
|
215
|
+
};
|
|
216
|
+
declare const LogDataEnum: {
|
|
217
|
+
readonly SIP: "sip";
|
|
218
|
+
readonly INCALL: "incall";
|
|
219
|
+
readonly AJAX: "ajax";
|
|
220
|
+
readonly ERROR: "error";
|
|
221
|
+
readonly RECONNECT: "reconnect";
|
|
222
|
+
readonly ALL: "all";
|
|
223
|
+
};
|
|
224
|
+
type LogDataType = (typeof LogDataEnum)[keyof typeof LogDataEnum];
|
|
206
225
|
|
|
207
226
|
type LoggerLevel = 'debug' | 'log' | 'warn' | 'error' | 'silent';
|
|
208
227
|
declare class Logger {
|
|
209
228
|
prefix: string;
|
|
210
229
|
level: LoggerLevel;
|
|
230
|
+
logData: Record<LogDataType, any[]>;
|
|
231
|
+
sendSdkLogData: any[];
|
|
211
232
|
private callKit;
|
|
212
233
|
constructor(callKit: CallKit, level?: LoggerLevel);
|
|
234
|
+
static formatStrLog(logObj: any): string;
|
|
213
235
|
setLevel(level: LoggerLevel): void;
|
|
214
236
|
debug(msg: any, extra?: Object): void;
|
|
215
237
|
log(msg: any, extra?: Object): void;
|
|
216
238
|
warn(msg: any, extra?: Object): void;
|
|
217
239
|
error(msg: any, extra?: any): void;
|
|
240
|
+
addLogData(type: LogDataType, data?: any): void;
|
|
218
241
|
output(color: string): (msg: any, extra?: Object) => void;
|
|
219
242
|
}
|
|
220
243
|
|
|
@@ -239,16 +262,15 @@ declare class Socket {
|
|
|
239
262
|
private reconnectTimer?;
|
|
240
263
|
private isReconnecting;
|
|
241
264
|
private reconnectAttempts;
|
|
242
|
-
closing: boolean;
|
|
243
265
|
constructor(callKit: CallKit);
|
|
244
266
|
init(): void;
|
|
245
|
-
|
|
246
|
-
gracefulClose(): void;
|
|
267
|
+
setRecivedClose(status: boolean): void;
|
|
247
268
|
private reconnect;
|
|
248
269
|
private connect;
|
|
249
270
|
private onOpen;
|
|
250
271
|
private onClose;
|
|
251
272
|
private onError;
|
|
273
|
+
private confirmAck;
|
|
252
274
|
private onMessage;
|
|
253
275
|
send(event: SocketSendEventType, message?: any): void;
|
|
254
276
|
sendMessage(event: SocketSendEventType, message?: any): Promise<void>;
|
|
@@ -267,22 +289,6 @@ declare class Socket {
|
|
|
267
289
|
private attemptReconnect;
|
|
268
290
|
}
|
|
269
291
|
|
|
270
|
-
interface MonitorConfig {
|
|
271
|
-
interval: number;
|
|
272
|
-
apiEndpoint: string;
|
|
273
|
-
}
|
|
274
|
-
declare class Monitor {
|
|
275
|
-
private callKit;
|
|
276
|
-
interval: number;
|
|
277
|
-
apiEndpoint: string;
|
|
278
|
-
monitorIntervalHandler: ReturnType<typeof setInterval> | null;
|
|
279
|
-
constructor(callKit: CallKit);
|
|
280
|
-
getEndPointPath: () => string;
|
|
281
|
-
measureRTT: () => Promise<void>;
|
|
282
|
-
stopRTTMonitoring(): void;
|
|
283
|
-
startRTTMonitoring(): void;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
292
|
interface WebrtcConstranis {
|
|
287
293
|
audio: {
|
|
288
294
|
autoGainControl?: boolean;
|
|
@@ -299,7 +305,6 @@ interface IConfig {
|
|
|
299
305
|
constrains: WebrtcConstranis;
|
|
300
306
|
socket: string;
|
|
301
307
|
reconnect?: SocketConfig;
|
|
302
|
-
monitor?: MonitorConfig;
|
|
303
308
|
userInfo: {
|
|
304
309
|
wsUrl: string;
|
|
305
310
|
sessionId: string;
|
|
@@ -318,6 +323,7 @@ interface IConfig {
|
|
|
318
323
|
iceInfo: string[];
|
|
319
324
|
iceGatheringTimeout: number;
|
|
320
325
|
encryptionMethod: EncryptionMethodType;
|
|
326
|
+
logGather: LogGatherEnumType;
|
|
321
327
|
};
|
|
322
328
|
isAutoUpdateUserStatus: boolean;
|
|
323
329
|
}
|
|
@@ -331,6 +337,7 @@ declare class Config {
|
|
|
331
337
|
reset: () => void;
|
|
332
338
|
validate: () => boolean;
|
|
333
339
|
isLogin: () => boolean;
|
|
340
|
+
isLogGatherEnable: () => boolean;
|
|
334
341
|
check(): boolean;
|
|
335
342
|
}
|
|
336
343
|
|
|
@@ -347,7 +354,6 @@ declare class Connect {
|
|
|
347
354
|
registerer?: Registerer;
|
|
348
355
|
lastOptionsUpdateTime: number;
|
|
349
356
|
observeOptionsHeartbeatHandler: ReturnType<typeof setTimeout> | null;
|
|
350
|
-
sipConnected: boolean;
|
|
351
357
|
/**
|
|
352
358
|
* Whether it's an outgoing call
|
|
353
359
|
*/
|
|
@@ -356,6 +362,7 @@ declare class Connect {
|
|
|
356
362
|
* Whether it's an active hangup
|
|
357
363
|
*/
|
|
358
364
|
isUnprompted: boolean;
|
|
365
|
+
isCurrentSessionInvited: boolean;
|
|
359
366
|
private reconnectConfig;
|
|
360
367
|
/**
|
|
361
368
|
* Whether registered
|
|
@@ -400,6 +407,7 @@ declare class Connect {
|
|
|
400
407
|
* @returns
|
|
401
408
|
*/
|
|
402
409
|
isInit(): boolean;
|
|
410
|
+
isExecuting(): boolean;
|
|
403
411
|
clearObserveOptionsHeartbeatInterval(): void;
|
|
404
412
|
register(): Promise<void>;
|
|
405
413
|
reconnect(): Promise<void>;
|
|
@@ -446,7 +454,17 @@ declare class Connect {
|
|
|
446
454
|
declare class User {
|
|
447
455
|
private callKit;
|
|
448
456
|
userStatus: number;
|
|
457
|
+
userChangeStatusExecuting: boolean;
|
|
449
458
|
constructor(callKit: CallKit);
|
|
459
|
+
setUserChangeStatusExecuting(state: boolean): void;
|
|
460
|
+
getUserChangeStatusExecuting(): boolean;
|
|
461
|
+
login(params: {
|
|
462
|
+
userName: string;
|
|
463
|
+
password: string;
|
|
464
|
+
}): Promise<any>;
|
|
465
|
+
loginOut(params: {
|
|
466
|
+
sessionId: string;
|
|
467
|
+
}): Promise<any>;
|
|
450
468
|
/**
|
|
451
469
|
*
|
|
452
470
|
* @param status logout(1, "unregistered"), idle(2, "free"), break(3, "nap"), busy(4, "busy")
|
|
@@ -457,6 +475,12 @@ declare class User {
|
|
|
457
475
|
* @param status
|
|
458
476
|
*/
|
|
459
477
|
updateUserStatus(status: number): Promise<void>;
|
|
478
|
+
/**
|
|
479
|
+
* @description sdkLog
|
|
480
|
+
* @param params
|
|
481
|
+
* @returns
|
|
482
|
+
*/
|
|
483
|
+
sendSdkLog(data: any): Promise<any>;
|
|
460
484
|
sendHangUpReason(data: any): Promise<void>;
|
|
461
485
|
}
|
|
462
486
|
|
|
@@ -486,7 +510,6 @@ declare class CallKit {
|
|
|
486
510
|
connect: Connect;
|
|
487
511
|
socket: Socket;
|
|
488
512
|
user: User;
|
|
489
|
-
monitor: Monitor;
|
|
490
513
|
listener: Listener[];
|
|
491
514
|
constructor(options: ConfigEntity);
|
|
492
515
|
login(username: string, password: string, extra?: {
|
|
@@ -505,8 +528,6 @@ declare class CallKit {
|
|
|
505
528
|
setSleep(): Promise<void>;
|
|
506
529
|
setBusy(): Promise<void>;
|
|
507
530
|
reset(): Promise<void>;
|
|
508
|
-
startRTTMonitoring(): void;
|
|
509
|
-
stopRTTMonitoring(): void;
|
|
510
531
|
on(event: kitEventType, callback: (...args: any[]) => void): void;
|
|
511
532
|
off(event: kitEventType, callback?: (...args: any[]) => void): void;
|
|
512
533
|
removeAllListeners(): void;
|