@koi-design/callkit 1.0.24-beta.9 → 1.0.25

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
@@ -1,3 +1,4 @@
1
+ import { AxiosRequestConfig } from 'axios';
1
2
  import { Invitation, UserAgent, Registerer } from 'sip.js';
2
3
 
3
4
  declare class Api {
@@ -17,7 +18,9 @@ declare class Api {
17
18
  * @returns
18
19
  */
19
20
  setUserStatus(params: any): Promise<any>;
21
+ measureRTT(config?: AxiosRequestConfig): Promise<any>;
20
22
  private post;
23
+ private get;
21
24
  }
22
25
 
23
26
  declare class Call {
@@ -140,6 +143,14 @@ declare const KitEvent: {
140
143
  * User status change
141
144
  */
142
145
  USER_STATUS_CHANGE: string;
146
+ /**
147
+ * SOCKET CONNECT EVENT
148
+ */
149
+ CONNECT_EVENT: string;
150
+ /**
151
+ * NETWORK EVENT
152
+ */
153
+ NETWORK_EVENT: string;
143
154
  };
144
155
  declare const SocketSendEvent: {
145
156
  /**
@@ -178,6 +189,10 @@ declare const SocketSendEvent: {
178
189
  * AGENT_TRANSFER
179
190
  */
180
191
  AGENT_TRANSFER: string;
192
+ /**
193
+ * AGENT_TRANSFER
194
+ */
195
+ HANG_UP_REASON: string;
181
196
  };
182
197
  declare const EncryptionMethod: {
183
198
  NONE: string;
@@ -224,8 +239,11 @@ declare class Socket {
224
239
  private reconnectTimer?;
225
240
  private isReconnecting;
226
241
  private reconnectAttempts;
242
+ closing: boolean;
227
243
  constructor(callKit: CallKit);
228
244
  init(): void;
245
+ close(code?: number, reason?: string): void;
246
+ gracefulClose(): void;
229
247
  private reconnect;
230
248
  private connect;
231
249
  private onOpen;
@@ -233,6 +251,7 @@ declare class Socket {
233
251
  private onError;
234
252
  private onMessage;
235
253
  send(event: SocketSendEventType, message?: any): void;
254
+ sendMessage(event: SocketSendEventType, message?: any): Promise<void>;
236
255
  /**
237
256
  * Attempt to close socket, need to wait for server confirmation
238
257
  * @returns
@@ -248,6 +267,22 @@ declare class Socket {
248
267
  private attemptReconnect;
249
268
  }
250
269
 
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
+
251
286
  interface WebrtcConstranis {
252
287
  audio: {
253
288
  autoGainControl?: boolean;
@@ -264,6 +299,7 @@ interface IConfig {
264
299
  constrains: WebrtcConstranis;
265
300
  socket: string;
266
301
  reconnect?: SocketConfig;
302
+ monitor?: MonitorConfig;
267
303
  userInfo: {
268
304
  wsUrl: string;
269
305
  sessionId: string;
@@ -309,6 +345,8 @@ declare class Connect {
309
345
  mediaStream?: MediaStream;
310
346
  userAgent?: UserAgent;
311
347
  registerer?: Registerer;
348
+ lastOptionsUpdateTime: number;
349
+ observeOptionsHeartbeatHandler: ReturnType<typeof setTimeout> | null;
312
350
  sipConnected: boolean;
313
351
  /**
314
352
  * Whether it's an outgoing call
@@ -318,6 +356,7 @@ declare class Connect {
318
356
  * Whether it's an active hangup
319
357
  */
320
358
  isUnprompted: boolean;
359
+ private reconnectConfig;
321
360
  /**
322
361
  * Whether registered
323
362
  * @param
@@ -361,7 +400,10 @@ declare class Connect {
361
400
  * @returns
362
401
  */
363
402
  isInit(): boolean;
403
+ clearObserveOptionsHeartbeatInterval(): void;
364
404
  register(): Promise<void>;
405
+ reconnect(): Promise<void>;
406
+ stop(): Promise<void>;
365
407
  unregister(): Promise<void>;
366
408
  call(callback: Function): Promise<void>;
367
409
  /**
@@ -444,7 +486,7 @@ declare class CallKit {
444
486
  connect: Connect;
445
487
  socket: Socket;
446
488
  user: User;
447
- reconnect?: SocketConfig;
489
+ monitor: Monitor;
448
490
  listener: Listener[];
449
491
  constructor(options: ConfigEntity);
450
492
  login(username: string, password: string, extra?: {
@@ -455,6 +497,7 @@ declare class CallKit {
455
497
  refer(uri: string, options?: any): Promise<void>;
456
498
  register(): Promise<void>;
457
499
  unregister(): Promise<void>;
500
+ stop(): Promise<void>;
458
501
  hangup(): Promise<void>;
459
502
  hold(): void;
460
503
  unhold(): void;
@@ -462,6 +505,8 @@ declare class CallKit {
462
505
  setSleep(): Promise<void>;
463
506
  setBusy(): Promise<void>;
464
507
  reset(): Promise<void>;
508
+ startRTTMonitoring(): void;
509
+ stopRTTMonitoring(): void;
465
510
  on(event: kitEventType, callback: (...args: any[]) => void): void;
466
511
  off(event: kitEventType, callback?: (...args: any[]) => void): void;
467
512
  removeAllListeners(): void;