@koi-design/callkit 2.2.0-beta.3 → 2.3.0-beta.1

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.
@@ -3237,7 +3237,7 @@ var WebCall = (() => {
3237
3237
  const res = await this.post({
3238
3238
  url: "/auth/agentUser/login",
3239
3239
  method: "post",
3240
- data: { ...params, browserVersion: navigator.userAgent }
3240
+ data: params
3241
3241
  });
3242
3242
  return res;
3243
3243
  } finally {
@@ -3720,6 +3720,12 @@ var WebCall = (() => {
3720
3720
  phoneNum: 1,
3721
3721
  workOrderId: 2
3722
3722
  };
3723
+ var PhoneTypeEnum = {
3724
+ SIP: 0,
3725
+ TEL: 1,
3726
+ OUT: 2,
3727
+ SP: 5
3728
+ };
3723
3729
  var trackLogsDefaultConfig = {
3724
3730
  enabled: false,
3725
3731
  interval: 5e3,
@@ -3883,7 +3889,7 @@ var WebCall = (() => {
3883
3889
  // package.json
3884
3890
  var package_default = {
3885
3891
  name: "@koi-design/callkit",
3886
- version: "2.2.0-beta.3",
3892
+ version: "2.3.0-beta.1",
3887
3893
  description: "callkit",
3888
3894
  author: "koi",
3889
3895
  license: "ISC",
@@ -3960,6 +3966,7 @@ var WebCall = (() => {
3960
3966
  password: "",
3961
3967
  encryptionPassword: EncryptionMethod.INTERNAL,
3962
3968
  sourceType: CallSourceType.phoneNum,
3969
+ phoneType: PhoneTypeEnum.SIP,
3963
3970
  // Extension number
3964
3971
  extno: "",
3965
3972
  workOrderId: "",
@@ -4003,6 +4010,7 @@ var WebCall = (() => {
4003
4010
  encryptionPassword: "",
4004
4011
  userPart: "",
4005
4012
  sourceType: CallSourceType.phoneNum,
4013
+ phoneType: PhoneTypeEnum.SIP,
4006
4014
  extno: "",
4007
4015
  workOrderId: "",
4008
4016
  agentId: "",
@@ -19909,13 +19917,6 @@ ${log}` : log;
19909
19917
  get reconnectConfig() {
19910
19918
  return this.callKit.config.getReconnectConfig("incall");
19911
19919
  }
19912
- get pingInterval() {
19913
- const { keepaliveInterval } = this.callKit.config.getConfig().userInfo;
19914
- if (Number.isInteger(keepaliveInterval) && keepaliveInterval > 0) {
19915
- return keepaliveInterval * 1e3;
19916
- }
19917
- return this.reconnectConfig.pingInterval;
19918
- }
19919
19920
  isConnected() {
19920
19921
  return this.connectAuthState.isConnected;
19921
19922
  }
@@ -20209,7 +20210,7 @@ ${log}` : log;
20209
20210
  return;
20210
20211
  }
20211
20212
  const { userInfo, version } = this.callKit.config.getConfig();
20212
- const { sessionId, extno, agentId } = userInfo;
20213
+ const { sessionId, extno, agentId, phoneType } = userInfo;
20213
20214
  if (!sessionId) {
20214
20215
  this.callKit.logger.error("sessionId is empty", {
20215
20216
  caller: "Socket.send",
@@ -20229,6 +20230,7 @@ ${log}` : log;
20229
20230
  if (SocketSendEvent.CALL === event) {
20230
20231
  msg.phoneNum = extno;
20231
20232
  msg.agentId = agentId;
20233
+ msg.phoneType = phoneType;
20232
20234
  if (message?.sourceType === CallSourceType.phoneNum) {
20233
20235
  delete msg.workOrderId;
20234
20236
  } else if (message?.sourceType === CallSourceType.workOrderId) {
@@ -20250,8 +20252,8 @@ ${log}` : log;
20250
20252
  return;
20251
20253
  this.send(SocketSendEvent.PING);
20252
20254
  const now = Date.now();
20253
- const { pingTimeout } = this.reconnectConfig;
20254
- if (now - this.lastPingTime > this.pingInterval + pingTimeout) {
20255
+ const { pingInterval, pingTimeout } = this.reconnectConfig;
20256
+ if (now - this.lastPingTime > pingInterval + pingTimeout) {
20255
20257
  this.callKit.logger.warn("Ping timeout not connected", {
20256
20258
  caller: "Socket.ping",
20257
20259
  type: "INCALL",
@@ -20269,9 +20271,10 @@ ${log}` : log;
20269
20271
  if (this.pingTimer) {
20270
20272
  clearInterval(this.pingTimer);
20271
20273
  }
20274
+ const { pingInterval } = this.reconnectConfig;
20272
20275
  this.pingTimer = setInterval(() => {
20273
20276
  this.ping();
20274
- }, this.pingInterval);
20277
+ }, pingInterval);
20275
20278
  }
20276
20279
  /**
20277
20280
  * reset socket connection and all states
@@ -20417,7 +20420,6 @@ ${log}` : log;
20417
20420
  content: {
20418
20421
  username,
20419
20422
  password,
20420
- ua: navigator.userAgent,
20421
20423
  encryptionMethod,
20422
20424
  encryptionPassword
20423
20425
  }
@@ -20435,7 +20437,6 @@ ${log}` : log;
20435
20437
  password: encryptionPassword,
20436
20438
  timestamp: Date.now()
20437
20439
  });
20438
- console.log("user", user);
20439
20440
  if (user) {
20440
20441
  this.config.setConfig("userInfo", {
20441
20442
  wsUrl: `wss://${user.wsUrl}`,
@@ -20452,7 +20453,7 @@ ${log}` : log;
20452
20453
  iceInfo: user.iceInfo,
20453
20454
  iceGatheringTimeout: user.iceGatheringTimeout,
20454
20455
  logGather: user.logGather,
20455
- keepaliveInterval: user.keepaliveInterval,
20456
+ phoneType: user.phoneType,
20456
20457
  // encryptionType is in extra
20457
20458
  ...extra
20458
20459
  });