@koi-design/callkit 2.0.5-beta.7 → 2.0.5-beta.9

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/README.md CHANGED
@@ -201,7 +201,6 @@ interface CallKit {
201
201
  - `callIdChange` - Call ID change (param: string)
202
202
  - `holdChange` - Hold status change (param: boolean)
203
203
  - `muteChange` - Mute status change (param: boolean)
204
- - `userStatusChange` - User status change (param: status)
205
204
 
206
205
  #### Call Events
207
206
 
package/dist/index.d.ts CHANGED
@@ -436,6 +436,7 @@ declare class Connect {
436
436
  };
437
437
  private currentCallId;
438
438
  getCurrentCallId(): string | null;
439
+ setOutgoing(outgoing: boolean): void;
439
440
  setCallId(callId: string | null): void;
440
441
  reset(): Promise<void>;
441
442
  private getAduioReference;
@@ -3857,7 +3857,7 @@ var WebCall = (() => {
3857
3857
  // package.json
3858
3858
  var package_default = {
3859
3859
  name: "@koi-design/callkit",
3860
- version: "2.0.5-beta.7",
3860
+ version: "2.0.5-beta.8",
3861
3861
  description: "callkit",
3862
3862
  author: "koi",
3863
3863
  license: "ISC",
@@ -4144,16 +4144,22 @@ var WebCall = (() => {
4144
4144
  }
4145
4145
  catchLog(msg, extra, level) {
4146
4146
  const now = /* @__PURE__ */ new Date();
4147
+ const { enabled } = this.callKit.config.getTrackLogsConfig();
4148
+ const { userInfo } = this.callKit.config.getConfig();
4149
+ const content = {
4150
+ agentId: userInfo?.agentId,
4151
+ sessionId: userInfo?.sessionId,
4152
+ ...extra?.content ?? {}
4153
+ };
4147
4154
  const log = {
4148
4155
  timestamp: now.toLocaleString().replace("T", " ").replace(".000Z", ""),
4149
4156
  level,
4150
4157
  message: msg,
4151
4158
  caller: extra?.caller,
4152
4159
  type: extra?.type,
4153
- content: extra?.content ?? {}
4160
+ content
4154
4161
  };
4155
4162
  const logString = transformLog(log);
4156
- const { enabled } = this.callKit.config.getTrackLogsConfig();
4157
4163
  if (enabled) {
4158
4164
  this.pendingTrackLogs.push(logString);
4159
4165
  }
@@ -18658,6 +18664,17 @@ var WebCall = (() => {
18658
18664
  getCurrentCallId() {
18659
18665
  return this.currentCallId;
18660
18666
  }
18667
+ setOutgoing(outgoing) {
18668
+ if (this.isOutgoing === outgoing)
18669
+ return;
18670
+ this.callKit.logger.info("setOutgoing", {
18671
+ caller: "Connect.setOutgoing",
18672
+ content: {
18673
+ outgoing
18674
+ }
18675
+ });
18676
+ this.isOutgoing = outgoing;
18677
+ }
18661
18678
  setCallId(callId) {
18662
18679
  this.callKit.logger.info("setCallId", {
18663
18680
  caller: "Connect.setCallId",
@@ -18669,7 +18686,7 @@ var WebCall = (() => {
18669
18686
  this.callKit.trigger(KitEvent.KIT_CALL_ID_CHANGE, callId);
18670
18687
  }
18671
18688
  async reset() {
18672
- this.isOutgoing = false;
18689
+ this.setOutgoing(false);
18673
18690
  this.isUnprompted = false;
18674
18691
  this.hasInvite = false;
18675
18692
  if (this.isHolding()) {
@@ -19162,7 +19179,7 @@ var WebCall = (() => {
19162
19179
  },
19163
19180
  onDisconnect: (error) => {
19164
19181
  if (error) {
19165
- this.callKit.logger.info("SIP User Agent Disconnected with error", {
19182
+ this.callKit.logger.warn("SIP User Agent Disconnected with error", {
19166
19183
  caller: "Connect.register",
19167
19184
  type: "SIP",
19168
19185
  content: {
@@ -19172,7 +19189,7 @@ var WebCall = (() => {
19172
19189
  });
19173
19190
  this.startReconnectTimer();
19174
19191
  } else {
19175
- this.callKit.logger.info("SIP User Agent Disconnected", {
19192
+ this.callKit.logger.warn("SIP User Agent Disconnected", {
19176
19193
  caller: "Connect.register",
19177
19194
  type: "SIP",
19178
19195
  content: {}
@@ -19304,7 +19321,7 @@ var WebCall = (() => {
19304
19321
  callback
19305
19322
  }
19306
19323
  });
19307
- this.isOutgoing = true;
19324
+ this.setOutgoing(true);
19308
19325
  if (!this.isRegistered()) {
19309
19326
  await this.register();
19310
19327
  }
@@ -19361,7 +19378,7 @@ var WebCall = (() => {
19361
19378
  connectStatus: this.connectStatus
19362
19379
  }
19363
19380
  });
19364
- this.isOutgoing = false;
19381
+ this.setOutgoing(false);
19365
19382
  this.isUnprompted = isUnprompted;
19366
19383
  this.setHold(false);
19367
19384
  this.setMute(false);
@@ -19389,6 +19406,7 @@ var WebCall = (() => {
19389
19406
  }
19390
19407
  this.setConnectStatus(CallStatus.init);
19391
19408
  this.callKit.trigger(KitEvent.CALL_END, /* @__PURE__ */ new Date());
19409
+ this.setCallId(null);
19392
19410
  } catch (err) {
19393
19411
  this.callKit.trigger(KitEvent.CALL_END, /* @__PURE__ */ new Date());
19394
19412
  this.callKit.reset();