@koi-design/callkit 1.0.24-beta.3 → 1.0.24-beta.30

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 CHANGED
@@ -100,6 +100,10 @@ declare const KitEvent: {
100
100
  * Server initiated call
101
101
  */
102
102
  KIT_INVITE: string;
103
+ /**
104
+ * Server outgoing initiated call
105
+ */
106
+ KIT_OUTGOING_INVITE: string;
103
107
  /**
104
108
  * Connecting
105
109
  */
@@ -140,6 +144,10 @@ declare const KitEvent: {
140
144
  * User status change
141
145
  */
142
146
  USER_STATUS_CHANGE: string;
147
+ CONNECT_EVENT: string;
148
+ SIP_REGISTERER_EVENT: string;
149
+ SIP_SESSION_EVENT: string;
150
+ USER_STATUS_CHANGE_STEP: string;
143
151
  };
144
152
  declare const SocketSendEvent: {
145
153
  /**
@@ -174,21 +182,45 @@ declare const SocketSendEvent: {
174
182
  * End
175
183
  */
176
184
  END: string;
185
+ /**
186
+ * AGENT_TRANSFER
187
+ */
188
+ AGENT_TRANSFER: string;
189
+ /**
190
+ * AGENT_TRANSFER
191
+ */
192
+ HANG_UP_REASON: string;
193
+ ACK: string;
177
194
  };
178
195
  declare const EncryptionMethod: {
179
196
  NONE: string;
180
197
  INTERNAL: string;
181
198
  };
182
199
  type EncryptionMethodType = (typeof EncryptionMethod)[keyof typeof EncryptionMethod];
200
+ declare const LogGatherEnum: {
201
+ ENABLE: number;
202
+ DISABLE: number;
203
+ };
204
+ type LogGatherEnumType = (typeof LogGatherEnum)[keyof typeof LogGatherEnum];
183
205
  declare const CallSourceType: {
184
206
  phoneNum: number;
185
207
  workOrderId: number;
186
208
  };
187
209
 
188
210
  type LoggerLevel = 'debug' | 'log' | 'warn' | 'error' | 'silent';
211
+ declare const LogDataEnum: {
212
+ readonly SIP: "sip";
213
+ readonly INCALL: "incall";
214
+ readonly AJAX: "ajax";
215
+ readonly ERROR: "error";
216
+ readonly RECONNECT: "reconnect";
217
+ readonly ALL: "all";
218
+ };
219
+ type LogDataType = (typeof LogDataEnum)[keyof typeof LogDataEnum];
189
220
  declare class Logger {
190
221
  prefix: string;
191
222
  level: LoggerLevel;
223
+ logData: Record<LogDataType, any[]>;
192
224
  private callKit;
193
225
  constructor(callKit: CallKit, level?: LoggerLevel);
194
226
  setLevel(level: LoggerLevel): void;
@@ -196,6 +228,7 @@ declare class Logger {
196
228
  log(msg: any, extra?: Object): void;
197
229
  warn(msg: any, extra?: Object): void;
198
230
  error(msg: any, extra?: any): void;
231
+ addLogData(type: LogDataType, data: any): void;
199
232
  output(color: string): (msg: any, extra?: Object) => void;
200
233
  }
201
234
 
@@ -222,12 +255,16 @@ declare class Socket {
222
255
  private reconnectAttempts;
223
256
  constructor(callKit: CallKit);
224
257
  init(): void;
258
+ setRecivedClose(status: boolean): void;
259
+ private reconnect;
225
260
  private connect;
226
261
  private onOpen;
227
262
  private onClose;
228
263
  private onError;
264
+ private confirmAck;
229
265
  private onMessage;
230
266
  send(event: SocketSendEventType, message?: any): void;
267
+ sendMessage(event: SocketSendEventType, message?: any): Promise<void>;
231
268
  /**
232
269
  * Attempt to close socket, need to wait for server confirmation
233
270
  * @returns
@@ -277,6 +314,7 @@ interface IConfig {
277
314
  iceInfo: string[];
278
315
  iceGatheringTimeout: number;
279
316
  encryptionMethod: EncryptionMethodType;
317
+ logGather: LogGatherEnumType;
280
318
  };
281
319
  isAutoUpdateUserStatus: boolean;
282
320
  }
@@ -290,6 +328,7 @@ declare class Config {
290
328
  reset: () => void;
291
329
  validate: () => boolean;
292
330
  isLogin: () => boolean;
331
+ isLogGatherEnable: () => boolean;
293
332
  check(): boolean;
294
333
  }
295
334
 
@@ -304,7 +343,8 @@ declare class Connect {
304
343
  mediaStream?: MediaStream;
305
344
  userAgent?: UserAgent;
306
345
  registerer?: Registerer;
307
- sipConnected: boolean;
346
+ lastOptionsUpdateTime: number;
347
+ observeOptionsHeartbeatHandler: ReturnType<typeof setTimeout> | null;
308
348
  /**
309
349
  * Whether it's an outgoing call
310
350
  */
@@ -313,6 +353,7 @@ declare class Connect {
313
353
  * Whether it's an active hangup
314
354
  */
315
355
  isUnprompted: boolean;
356
+ private reconnectConfig;
316
357
  /**
317
358
  * Whether registered
318
359
  * @param
@@ -356,7 +397,11 @@ declare class Connect {
356
397
  * @returns
357
398
  */
358
399
  isInit(): boolean;
400
+ isExecuting(): boolean;
401
+ clearObserveOptionsHeartbeatInterval(): void;
359
402
  register(): Promise<void>;
403
+ reconnect(): Promise<void>;
404
+ stop(): Promise<void>;
360
405
  unregister(): Promise<void>;
361
406
  call(callback: Function): Promise<void>;
362
407
  /**
@@ -393,13 +438,16 @@ declare class Connect {
393
438
  setMute(mute: boolean): Promise<void>;
394
439
  mute(): Promise<void>;
395
440
  unmute(): Promise<void>;
396
- refer(referTo: string, options?: any): Promise<void>;
441
+ refer(referTo: string, extra?: any): Promise<void>;
397
442
  }
398
443
 
399
444
  declare class User {
400
445
  private callKit;
401
446
  userStatus: number;
447
+ userChangeStatusExecuting: boolean;
402
448
  constructor(callKit: CallKit);
449
+ setUserChangeStatusExecuting(state: boolean): void;
450
+ getUserChangeStatusExecuting(): boolean;
403
451
  /**
404
452
  *
405
453
  * @param status logout(1, "unregistered"), idle(2, "free"), break(3, "nap"), busy(4, "busy")
@@ -410,6 +458,7 @@ declare class User {
410
458
  * @param status
411
459
  */
412
460
  updateUserStatus(status: number): Promise<void>;
461
+ sendHangUpReason(data: any): Promise<void>;
413
462
  }
414
463
 
415
464
  interface CallKitConfig {
@@ -448,6 +497,7 @@ declare class CallKit {
448
497
  refer(uri: string, options?: any): Promise<void>;
449
498
  register(): Promise<void>;
450
499
  unregister(): Promise<void>;
500
+ stop(): Promise<void>;
451
501
  hangup(): Promise<void>;
452
502
  hold(): void;
453
503
  unhold(): void;