@koi-design/callkit 2.0.0-beta.2 → 2.0.0-beta.4

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
@@ -39,6 +39,8 @@ declare class Call {
39
39
  callEnd(isUnprompted?: boolean, isError?: boolean): Promise<void>;
40
40
  callHold(): Promise<void>;
41
41
  callUnhold(): Promise<void>;
42
+ callMute(): Promise<void>;
43
+ callUnmute(): Promise<void>;
42
44
  }
43
45
 
44
46
  declare const CallStatus: {
@@ -50,10 +52,6 @@ declare const CallStatus: {
50
52
  * Connecting
51
53
  */
52
54
  connecting: number;
53
- /**
54
- * Call on hold
55
- */
56
- holding: number;
57
55
  /**
58
56
  * Ringing
59
57
  */
@@ -173,6 +171,14 @@ declare const SocketSendEvent: {
173
171
  * Unhold
174
172
  */
175
173
  UNHOLD: string;
174
+ /**
175
+ * Mute
176
+ */
177
+ MUTE: string;
178
+ /**
179
+ * Unmute
180
+ */
181
+ UNMUTE: string;
176
182
  /**
177
183
  * Call
178
184
  */
@@ -267,7 +273,7 @@ declare class Socket {
267
273
  * 重置 socket 连接和所有状态
268
274
  * @param isWaitConfirm Whether need to wait for close confirmation
269
275
  */
270
- reset(isWaitConfirm?: boolean): Promise<void>;
276
+ reset(): Promise<void>;
271
277
  private attemptReconnect;
272
278
  }
273
279
 
@@ -351,11 +357,15 @@ declare class Connect {
351
357
  /**
352
358
  * Whether muted
353
359
  */
354
- isMute: boolean;
360
+ private isMute;
355
361
  /**
356
362
  * Whether registered
357
363
  */
358
- isRegistered: boolean;
364
+ private isRegister;
365
+ /**
366
+ * Whether holding
367
+ */
368
+ private isHold;
359
369
  constructor(callKit: CallKit);
360
370
  reset(): void;
361
371
  private getAduioReference;
@@ -375,9 +385,17 @@ declare class Connect {
375
385
  */
376
386
  isRinging(): boolean;
377
387
  /**
378
- *
388
+ * isHolding
379
389
  */
380
390
  isHolding(): boolean;
391
+ /**
392
+ * isRegistered
393
+ */
394
+ isRegistered(): boolean;
395
+ /**
396
+ * isMute
397
+ */
398
+ isMuted(): boolean;
381
399
  /**
382
400
  * Call ended, call not started
383
401
  * @returns
@@ -416,17 +434,8 @@ declare class Connect {
416
434
  */
417
435
  getRemoteMediaStream(session: any): any;
418
436
  setupRemoteMedia(session: any): void;
419
- /**
420
- * Update hold
421
- * @param hold
422
- */
423
- setHoldStatus(hold: boolean): void;
424
437
  setHold(hold: boolean): Promise<void>;
425
- hold(): Promise<void>;
426
- unhold(): Promise<void>;
427
438
  setMute(mute: boolean): Promise<void>;
428
- mute(): Promise<void>;
429
- unmute(): Promise<void>;
430
439
  refer(referTo: string, extra?: any): Promise<void>;
431
440
  }
432
441
 
@@ -469,6 +478,8 @@ declare class CallKit {
469
478
  hangup(): Promise<void>;
470
479
  hold(): void;
471
480
  unhold(): void;
481
+ mute(): void;
482
+ unmute(): void;
472
483
  /**
473
484
  * set userstatus
474
485
  * @param status
@@ -3310,10 +3310,10 @@ var WebCall = (() => {
3310
3310
  * Connecting
3311
3311
  */
3312
3312
  connecting: 2,
3313
- /**
3314
- * Call on hold
3315
- */
3316
- holding: 3,
3313
+ // /**
3314
+ // * Call on hold
3315
+ // */
3316
+ // holding: 3,
3317
3317
  /**
3318
3318
  * Ringing
3319
3319
  */
@@ -3530,6 +3530,14 @@ var WebCall = (() => {
3530
3530
  * Unhold
3531
3531
  */
3532
3532
  UNHOLD: "AGENT_UN_HOLD",
3533
+ /**
3534
+ * Mute
3535
+ */
3536
+ MUTE: "AGENT_MUTE",
3537
+ /**
3538
+ * Unmute
3539
+ */
3540
+ UNMUTE: "AGENT_UN_MUTE",
3533
3541
  /**
3534
3542
  * Call
3535
3543
  */
@@ -3704,28 +3712,58 @@ var WebCall = (() => {
3704
3712
  this.callKit.logger.warn("Current state cannot be held", {
3705
3713
  caller: "Call.callHold",
3706
3714
  content: {
3715
+ isHold: this.callKit.connect.isHolding(),
3707
3716
  isCalling: this.callKit.connect.isCalling()
3708
3717
  }
3709
3718
  });
3710
3719
  return;
3711
3720
  }
3712
- this.callKit.socket.send(SocketSendEvent.HOLD);
3713
- this.callKit.connect.setConnectStatus(CallStatus.holding);
3721
+ this.callKit.connect.setHold(true);
3714
3722
  }
3715
3723
  async callUnhold() {
3716
3724
  if (!this.callKit.config.check())
3717
3725
  return;
3718
- if (!this.callKit.connect.isHolding()) {
3726
+ if (!this.callKit.connect.isCalling()) {
3719
3727
  this.callKit.logger.warn("Current state cannot unhold", {
3720
3728
  caller: "Call.callUnhold",
3721
3729
  content: {
3722
- isHolding: this.callKit.connect.isHolding()
3730
+ isHold: this.callKit.connect.isHolding(),
3731
+ isCalling: this.callKit.connect.isCalling()
3732
+ }
3733
+ });
3734
+ return;
3735
+ }
3736
+ this.callKit.connect.setHold(true);
3737
+ }
3738
+ async callMute() {
3739
+ if (!this.callKit.config.check())
3740
+ return;
3741
+ if (!this.callKit.connect.isCalling()) {
3742
+ this.callKit.logger.warn("Current state cannot be muted", {
3743
+ caller: "Call.callMute",
3744
+ content: {
3745
+ isMuted: this.callKit.connect.isMuted(),
3746
+ isCalling: this.callKit.connect.isCalling()
3747
+ }
3748
+ });
3749
+ return;
3750
+ }
3751
+ this.callKit.connect.setMute(true);
3752
+ }
3753
+ async callUnmute() {
3754
+ if (!this.callKit.config.check())
3755
+ return;
3756
+ if (!this.callKit.connect.isCalling()) {
3757
+ this.callKit.logger.warn("Current state cannot be unmuted", {
3758
+ caller: "Call.callUnmute",
3759
+ content: {
3760
+ isMuted: this.callKit.connect.isMuted(),
3761
+ isCalling: this.callKit.connect.isCalling()
3723
3762
  }
3724
3763
  });
3725
3764
  return;
3726
3765
  }
3727
- this.callKit.socket.send(SocketSendEvent.UNHOLD);
3728
- this.callKit.connect.setConnectStatus(CallStatus.calling);
3766
+ this.callKit.connect.setMute(false);
3729
3767
  }
3730
3768
  };
3731
3769
 
@@ -18432,7 +18470,11 @@ var WebCall = (() => {
18432
18470
  /**
18433
18471
  * Whether registered
18434
18472
  */
18435
- isRegistered = false;
18473
+ isRegister = false;
18474
+ /**
18475
+ * Whether holding
18476
+ */
18477
+ isHold = false;
18436
18478
  constructor(callKit) {
18437
18479
  this.callKit = callKit;
18438
18480
  const { reconnect = {} } = this.callKit.config.getConfig();
@@ -18443,7 +18485,7 @@ var WebCall = (() => {
18443
18485
  }
18444
18486
  reset() {
18445
18487
  if (this.isHolding()) {
18446
- this.setHoldStatus(false);
18488
+ this.setHold(false);
18447
18489
  }
18448
18490
  if (this.connectStatus !== CallStatus.init) {
18449
18491
  this.setConnectStatus(CallStatus.init);
@@ -18472,6 +18514,7 @@ var WebCall = (() => {
18472
18514
  });
18473
18515
  }
18474
18516
  }
18517
+ this.callKit.config.reset();
18475
18518
  this.setConnectStatus(CallStatus.init);
18476
18519
  this.clearObserveOptionsHeartbeatInterval();
18477
18520
  }
@@ -18514,10 +18557,22 @@ var WebCall = (() => {
18514
18557
  return this.connectStatus === CallStatus.ringing;
18515
18558
  }
18516
18559
  /**
18517
- *
18560
+ * isHolding
18518
18561
  */
18519
18562
  isHolding() {
18520
- return this.connectStatus === CallStatus.holding;
18563
+ return this.isHold;
18564
+ }
18565
+ /**
18566
+ * isRegistered
18567
+ */
18568
+ isRegistered() {
18569
+ return this.isRegister;
18570
+ }
18571
+ /**
18572
+ * isMute
18573
+ */
18574
+ isMuted() {
18575
+ return this.isMute;
18521
18576
  }
18522
18577
  /**
18523
18578
  * Call ended, call not started
@@ -18547,7 +18602,7 @@ var WebCall = (() => {
18547
18602
  }
18548
18603
  async register() {
18549
18604
  if (this.connectStatus !== CallStatus.init) {
18550
- if (this.isRegistered) {
18605
+ if (this.isRegistered()) {
18551
18606
  this.callKit.logger.warn("connectStatus is registered", {
18552
18607
  caller: "Connect.register",
18553
18608
  content: {
@@ -18683,14 +18738,14 @@ var WebCall = (() => {
18683
18738
  type: "SIP",
18684
18739
  content: {
18685
18740
  registererState: state,
18686
- isRegistered: this.isRegistered
18741
+ isRegistered: this.isRegistered()
18687
18742
  }
18688
18743
  });
18689
18744
  this.setRegister(false);
18690
18745
  this.setConnectStatus(CallStatus.init);
18691
18746
  this.callKit.trigger(KitEvent.SIP_REGISTERER_EVENT, {
18692
18747
  registererState: state,
18693
- isRegistered: this.isRegistered
18748
+ isRegistered: this.isRegistered()
18694
18749
  });
18695
18750
  break;
18696
18751
  case RegistererState.Registered:
@@ -18699,14 +18754,10 @@ var WebCall = (() => {
18699
18754
  type: "SIP",
18700
18755
  content: {
18701
18756
  registererState: state,
18702
- isRegistered: this.isRegistered
18757
+ isRegistered: this.isRegistered()
18703
18758
  }
18704
18759
  });
18705
18760
  this.setRegister(true);
18706
- this.callKit.trigger(KitEvent.SIP_REGISTERER_EVENT, {
18707
- registererState: state,
18708
- isRegistered: this.isRegistered
18709
- });
18710
18761
  break;
18711
18762
  case RegistererState.Terminated:
18712
18763
  this.callKit.logger.info("registerer stateChange Terminated", {
@@ -18714,31 +18765,23 @@ var WebCall = (() => {
18714
18765
  type: "SIP",
18715
18766
  content: {
18716
18767
  registererState: state,
18717
- isRegistered: this.isRegistered
18768
+ isRegistered: this.isRegistered()
18718
18769
  }
18719
18770
  });
18720
18771
  this.setRegister(false);
18721
18772
  this.setConnectStatus(CallStatus.init);
18722
- this.callKit.trigger(KitEvent.SIP_REGISTERER_EVENT, {
18723
- isRegistered: this.isRegistered,
18724
- registererState: state
18725
- });
18726
18773
  break;
18727
18774
  case RegistererState.Unregistered:
18728
18775
  this.callKit.logger.info("registerer stateChange Unregistered", {
18729
18776
  caller: "Connect.register.registererStateChange",
18730
18777
  type: "SIP",
18731
18778
  content: {
18732
- isRegistered: this.isRegistered,
18779
+ isRegistered: this.isRegistered(),
18733
18780
  registererState: state
18734
18781
  }
18735
18782
  });
18736
18783
  this.setRegister(false);
18737
18784
  this.setConnectStatus(CallStatus.init);
18738
- this.callKit.trigger(KitEvent.SIP_REGISTERER_EVENT, {
18739
- isRegistered: this.isRegistered,
18740
- registererState: state
18741
- });
18742
18785
  break;
18743
18786
  default:
18744
18787
  break;
@@ -18751,7 +18794,7 @@ var WebCall = (() => {
18751
18794
  caller: "Connect.register.onInvite",
18752
18795
  content: {
18753
18796
  invite,
18754
- isRegistered: this.isRegistered
18797
+ isRegistered: this.isRegistered()
18755
18798
  }
18756
18799
  });
18757
18800
  this.currentSession = invite;
@@ -18771,7 +18814,7 @@ var WebCall = (() => {
18771
18814
  this.setConnectStatus(CallStatus.ringing);
18772
18815
  this.callKit.trigger(KitEvent.SIP_SESSION_EVENT, {
18773
18816
  sessionState: state,
18774
- isRegistered: this.isRegistered
18817
+ isRegistered: this.isRegistered()
18775
18818
  });
18776
18819
  break;
18777
18820
  case SessionState2.Established:
@@ -18785,14 +18828,14 @@ var WebCall = (() => {
18785
18828
  this.callKit.connect.setConnectStatus(CallStatus.calling);
18786
18829
  this.callKit.trigger(KitEvent.SIP_SESSION_EVENT, {
18787
18830
  sessionState: state,
18788
- isRegistered: this.isRegistered
18831
+ isRegistered: this.isRegistered()
18789
18832
  });
18790
18833
  setupRemoteMedia(this.currentSession);
18791
18834
  break;
18792
18835
  case SessionState2.Terminating:
18793
18836
  this.callKit.trigger(KitEvent.SIP_SESSION_EVENT, {
18794
18837
  sessionState: state,
18795
- isRegistered: this.isRegistered
18838
+ isRegistered: this.isRegistered()
18796
18839
  });
18797
18840
  break;
18798
18841
  case SessionState2.Terminated:
@@ -18813,7 +18856,7 @@ var WebCall = (() => {
18813
18856
  this.isUnprompted = false;
18814
18857
  this.callKit.trigger(KitEvent.SIP_SESSION_EVENT, {
18815
18858
  sessionState: state,
18816
- isRegistered: this.isRegistered
18859
+ isRegistered: this.isRegistered()
18817
18860
  });
18818
18861
  break;
18819
18862
  default:
@@ -19000,11 +19043,10 @@ var WebCall = (() => {
19000
19043
  caller: "Connect.unregister",
19001
19044
  type: "SIP",
19002
19045
  content: {
19003
- isRegistered: this.isRegistered,
19004
- registerer: this.registerer
19046
+ isRegistered: this.isRegistered()
19005
19047
  }
19006
19048
  });
19007
- if (!this.isRegistered || !this.registerer) {
19049
+ if (!this.isRegistered() || !this.registerer) {
19008
19050
  this.callKit.logger.warn("No registerer to unregister.", {
19009
19051
  caller: "Connect.unregister",
19010
19052
  type: "SIP",
@@ -19034,7 +19076,7 @@ var WebCall = (() => {
19034
19076
  }
19035
19077
  });
19036
19078
  this.isOutgoing = true;
19037
- if (!this.isRegistered) {
19079
+ if (!this.isRegistered()) {
19038
19080
  await this.register();
19039
19081
  }
19040
19082
  this.setConnectStatus(CallStatus.connecting);
@@ -19054,7 +19096,7 @@ var WebCall = (() => {
19054
19096
  register
19055
19097
  }
19056
19098
  });
19057
- this.isRegistered = register;
19099
+ this.isRegister = register;
19058
19100
  this.callKit.trigger(KitEvent.KIT_REGISTER_CHANGE, register);
19059
19101
  }
19060
19102
  /**
@@ -19193,133 +19235,102 @@ var WebCall = (() => {
19193
19235
  });
19194
19236
  }
19195
19237
  }
19196
- /**
19197
- * Update hold
19198
- * @param hold
19199
- */
19200
- setHoldStatus(hold) {
19201
- this.callKit.logger.info("connect setHold", {
19202
- caller: "Connect.setHoldStatus",
19203
- type: "SIP",
19204
- content: {
19205
- hold
19206
- }
19207
- });
19208
- this.callKit.trigger(KitEvent.KIT_SET_HOLD, hold);
19209
- }
19210
19238
  async setHold(hold) {
19211
- this.setHoldStatus(hold);
19212
- }
19213
- async hold() {
19214
- this.callKit.logger.info("connect hold", {
19215
- caller: "Connect.hold",
19216
- type: "SIP",
19217
- content: {
19218
- hold: true
19219
- }
19220
- });
19221
- if (this.connectStatus !== CallStatus.calling || !this.currentSession) {
19222
- this.callKit.logger.error("Current status is not in call", {
19223
- caller: "Connect.hold",
19239
+ if (this.isHold === hold) {
19240
+ this.callKit.logger.warn("Already holding", {
19241
+ caller: "Connect.setHold",
19224
19242
  type: "SIP",
19225
19243
  content: {
19226
- errCode: ErrorCode.WEBRTC_HOLE_STATUS_ERROR
19244
+ isHold: this.isHold
19227
19245
  }
19228
19246
  });
19247
+ return;
19229
19248
  }
19230
- }
19231
- async unhold() {
19232
- this.callKit.logger.info("connect unhold", {
19233
- caller: "Connect.unhold",
19249
+ this.callKit.socket.send(
19250
+ hold ? SocketSendEvent.HOLD : SocketSendEvent.UNHOLD
19251
+ );
19252
+ this.isHold = hold;
19253
+ this.callKit.logger.info("connect setHold", {
19254
+ caller: "Connect.setHold",
19234
19255
  type: "SIP",
19235
19256
  content: {
19236
- hold: false
19257
+ hold
19237
19258
  }
19238
19259
  });
19260
+ this.callKit.trigger(KitEvent.KIT_SET_HOLD, hold);
19239
19261
  }
19262
+ // /**
19263
+ // * Set mute
19264
+ // * @param mute Whether to mute
19265
+ // * @deprecated just send socket event to server to mute or unmute
19266
+ // */
19267
+ // async setMute(mute: boolean) {
19268
+ // this.callKit.logger.info('connect setMute', {
19269
+ // caller: 'Connect.setMute',
19270
+ // type: 'SIP',
19271
+ // content: {
19272
+ // mute
19273
+ // }
19274
+ // });
19275
+ // if (!this.currentSession) {
19276
+ // this.callKit.logger.error('No active session', {
19277
+ // caller: 'Connect.setMute',
19278
+ // type: 'SIP',
19279
+ // content: {
19280
+ // errCode: ErrorCode.WEBRTC_MUTE_STATUS_ERROR
19281
+ // }
19282
+ // });
19283
+ // this.callKit.reset();
19284
+ // return;
19285
+ // }
19286
+ // try {
19287
+ // // Get SessionDescriptionHandler
19288
+ // const sdh = this.currentSession.sessionDescriptionHandler;
19289
+ // if (!sdh || !('peerConnection' in sdh)) {
19290
+ // throw new Error('Invalid session description handler');
19291
+ // }
19292
+ // // Get PeerConnection
19293
+ // const pc = (sdh as any).peerConnection as RTCPeerConnection;
19294
+ // // Get local audio track and set status
19295
+ // const audioSender = pc
19296
+ // .getSenders()
19297
+ // .find((sender) => sender.track?.kind === 'audio');
19298
+ // if (audioSender && audioSender.track) {
19299
+ // audioSender.track.enabled = !mute;
19300
+ // // Update status and trigger event
19301
+ // this.isMute = mute;
19302
+ // this.callKit.trigger(KitEvent.KIT_SET_MUTE, mute);
19303
+ // } else {
19304
+ // throw new Error('No audio track found');
19305
+ // }
19306
+ // } catch (error) {
19307
+ // this.callKit.logger.error('Failed to set mute state', {
19308
+ // caller: 'Connect.setMute',
19309
+ // type: 'SIP',
19310
+ // content: {
19311
+ // err: error.message,
19312
+ // errCode: ErrorCode.WEBRTC_MUTE_ERROR
19313
+ // }
19314
+ // });
19315
+ // }
19316
+ // }
19240
19317
  async setMute(mute) {
19241
- this.callKit.logger.info("connect setMute", {
19242
- caller: "Connect.setMute",
19243
- type: "SIP",
19244
- content: {
19245
- mute
19246
- }
19247
- });
19248
- if (!this.currentSession) {
19249
- this.callKit.logger.error("No active session", {
19250
- caller: "Connect.setMute",
19251
- type: "SIP",
19252
- content: {
19253
- errCode: ErrorCode.WEBRTC_MUTE_STATUS_ERROR
19254
- }
19255
- });
19256
- this.callKit.reset();
19257
- return;
19258
- }
19259
- try {
19260
- const sdh = this.currentSession.sessionDescriptionHandler;
19261
- if (!sdh || !("peerConnection" in sdh)) {
19262
- throw new Error("Invalid session description handler");
19263
- }
19264
- const pc = sdh.peerConnection;
19265
- const audioSender = pc.getSenders().find((sender) => sender.track?.kind === "audio");
19266
- if (audioSender && audioSender.track) {
19267
- audioSender.track.enabled = !mute;
19268
- this.isMute = mute;
19269
- this.callKit.trigger(KitEvent.KIT_SET_MUTE, mute);
19270
- } else {
19271
- throw new Error("No audio track found");
19272
- }
19273
- } catch (error) {
19274
- this.callKit.logger.error("Failed to set mute state", {
19318
+ if (this.isMute === mute) {
19319
+ this.callKit.logger.warn("Already muted", {
19275
19320
  caller: "Connect.setMute",
19276
19321
  type: "SIP",
19277
19322
  content: {
19278
- err: error.message,
19279
- errCode: ErrorCode.WEBRTC_MUTE_ERROR
19280
- }
19281
- });
19282
- }
19283
- }
19284
- async mute() {
19285
- this.callKit.logger.info("connect mute", {
19286
- caller: "Connect.mute",
19287
- type: "SIP",
19288
- content: {
19289
- mute: true
19290
- }
19291
- });
19292
- if (this.connectStatus !== CallStatus.calling || !this.currentSession) {
19293
- this.callKit.logger.warn("Current status is not in call", {
19294
- caller: "Connect.mute",
19295
- type: "SIP",
19296
- content: {
19297
- errCode: ErrorCode.WEBRTC_MUTE_STATUS_ERROR
19323
+ isCalling: this.isCalling(),
19324
+ isMuted: this.isMuted()
19298
19325
  }
19299
19326
  });
19300
19327
  return;
19301
19328
  }
19302
- await this.setMute(true);
19303
- }
19304
- async unmute() {
19305
- this.callKit.logger.info("connect unmute", {
19306
- caller: "Connect.unmute",
19307
- type: "SIP",
19308
- content: {
19309
- mute: false
19310
- }
19311
- });
19312
- if (this.connectStatus !== CallStatus.calling || !this.currentSession) {
19313
- this.callKit.logger.warn("Current status is not in call", {
19314
- caller: "Connect.unmute",
19315
- type: "SIP",
19316
- content: {
19317
- errCode: ErrorCode.WEBRTC_MUTE_STATUS_ERROR
19318
- }
19319
- });
19320
- return;
19321
- }
19322
- await this.setMute(false);
19329
+ this.callKit.socket.send(
19330
+ mute ? SocketSendEvent.MUTE : SocketSendEvent.UNMUTE
19331
+ );
19332
+ this.isMute = mute;
19333
+ this.callKit.trigger(KitEvent.KIT_SET_MUTE, mute);
19323
19334
  }
19324
19335
  async refer(referTo, extra) {
19325
19336
  this.callKit.logger.info("connect refer", {
@@ -19616,7 +19627,6 @@ var WebCall = (() => {
19616
19627
  errCode: ErrorCode.SOCKET_CONNECT_ERROR
19617
19628
  }
19618
19629
  });
19619
- this.callKit.config.reset();
19620
19630
  this.callKit.reset();
19621
19631
  return;
19622
19632
  }
@@ -19723,7 +19733,7 @@ var WebCall = (() => {
19723
19733
  * 重置 socket 连接和所有状态
19724
19734
  * @param isWaitConfirm Whether need to wait for close confirmation
19725
19735
  */
19726
- async reset(isWaitConfirm = true) {
19736
+ async reset() {
19727
19737
  if (this.pingTimer) {
19728
19738
  clearInterval(this.pingTimer);
19729
19739
  this.pingTimer = void 0;
@@ -19735,9 +19745,7 @@ var WebCall = (() => {
19735
19745
  this.callKit.logger.info("Closing socket connection", {
19736
19746
  caller: "Socket.reset",
19737
19747
  type: "INCALL",
19738
- content: {
19739
- isWaitConfirm
19740
- }
19748
+ content: {}
19741
19749
  });
19742
19750
  this.ws.close();
19743
19751
  this.isConnected = false;
@@ -19909,8 +19917,8 @@ var WebCall = (() => {
19909
19917
  }
19910
19918
  }
19911
19919
  await this.hangup();
19912
- this.socket.reset(false);
19913
19920
  this.connect.reset();
19921
+ this.socket.reset();
19914
19922
  this.config.reset();
19915
19923
  this.trigger(KitEvent.KIT_LOGIN_CHANGE, false);
19916
19924
  }
@@ -20022,6 +20030,28 @@ var WebCall = (() => {
20022
20030
  });
20023
20031
  this.callCenter.callUnhold();
20024
20032
  }
20033
+ mute() {
20034
+ if (!this.config.check())
20035
+ return;
20036
+ this.logger.info("mute", {
20037
+ caller: "CallKit.mute",
20038
+ content: {
20039
+ connectStatus: this.connect.connectStatus
20040
+ }
20041
+ });
20042
+ this.callCenter.callMute();
20043
+ }
20044
+ unmute() {
20045
+ if (!this.config.check())
20046
+ return;
20047
+ this.logger.info("unmute", {
20048
+ caller: "CallKit.unmute",
20049
+ content: {
20050
+ connectStatus: this.connect.connectStatus
20051
+ }
20052
+ });
20053
+ this.callCenter.callUnmute();
20054
+ }
20025
20055
  /**
20026
20056
  * set userstatus
20027
20057
  * @param status