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

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
@@ -491,7 +491,7 @@ declare class CallKit {
491
491
  constructor(options: ConfigEntity);
492
492
  login(username: string, password: string, extra?: {
493
493
  [key: string]: any;
494
- }): Promise<void>;
494
+ }): Promise<unknown>;
495
495
  logout(): Promise<void>;
496
496
  call(extno?: string | number, options?: CallOptions): Promise<void>;
497
497
  refer(uri: string, options?: any): Promise<void>;
@@ -3879,6 +3879,7 @@ var WebCall = (() => {
3879
3879
  };
3880
3880
  var ConnectEvent = {
3881
3881
  SIP_CONNECT_ERROR: "SIP_CONNECT_ERROR",
3882
+ SIP_RECONNECT_START: "SIP_RECONNECT_START",
3882
3883
  SIP_RECONNECT_ERROR: "SIP_RECONNECT_ERROR",
3883
3884
  SIP_RECONNECT_SUCCESS: "SIP_RECONNECT_SUCCESS",
3884
3885
  SIP_RECONNECTING: "SIP_RECONNECTING",
@@ -18887,7 +18888,7 @@ var WebCall = (() => {
18887
18888
  }
18888
18889
  };
18889
18890
  that.clearObserveOptionsHeartbeatInterval();
18890
- setInterval(() => {
18891
+ that.observeOptionsHeartbeatHandler = setInterval(() => {
18891
18892
  if (that.lastOptionsUpdateTime !== 0) {
18892
18893
  const now = (/* @__PURE__ */ new Date()).getTime();
18893
18894
  const diff = now - that.lastOptionsUpdateTime;
@@ -18930,6 +18931,7 @@ var WebCall = (() => {
18930
18931
  this.callKit.logger.debug("registerer stateChange Initial");
18931
18932
  this.setRegister(false);
18932
18933
  this.setConnectStatus(CallStatus.init);
18934
+ this.callKit.user.setUserStatus(UserStatus.offline);
18933
18935
  this.callKit.trigger(
18934
18936
  KitEvent.SIP_REGISTERER_EVENT,
18935
18937
  SipRegistererEvent.Initial
@@ -19926,29 +19928,33 @@ var WebCall = (() => {
19926
19928
  }).catch((err) => {
19927
19929
  this.logger.error(err, { errCode: ErrorCode.API_USER_LOGIN_ERROR });
19928
19930
  });
19929
- if (user) {
19930
- this.config.setConfig("userInfo", {
19931
- wsUrl: `wss://${user.wsUrl}`,
19932
- sessionId: user.sessionId,
19933
- username,
19934
- password: encryptionPassword,
19935
- encryptionPassword,
19936
- agentId: user.agentId,
19937
- fsUserId: user.fsUserId,
19938
- userPart: user.userPart,
19939
- fsPassword: user.fsPassword,
19940
- fsIp: user.fsIp,
19941
- fsPort: user.fsPort,
19942
- iceInfo: user.iceInfo,
19943
- iceGatheringTimeout: user.iceGatheringTimeout,
19944
- logGather: user.logGather,
19945
- // encryptionType is in extra
19946
- ...extra
19947
- });
19948
- this.socket.init();
19949
- this.trigger(KitEvent.KIT_LOGIN_CHANGE, true);
19950
- this.user.setUserStatus(UserStatus.offline);
19951
- }
19931
+ const loginPromiseDone = await new Promise((resolve) => {
19932
+ if (user) {
19933
+ this.config.setConfig("userInfo", {
19934
+ wsUrl: `wss://${user.wsUrl}`,
19935
+ sessionId: user.sessionId,
19936
+ username,
19937
+ password: encryptionPassword,
19938
+ encryptionPassword,
19939
+ agentId: user.agentId,
19940
+ fsUserId: user.fsUserId,
19941
+ userPart: user.userPart,
19942
+ fsPassword: user.fsPassword,
19943
+ fsIp: user.fsIp,
19944
+ fsPort: user.fsPort,
19945
+ iceInfo: user.iceInfo,
19946
+ iceGatheringTimeout: user.iceGatheringTimeout,
19947
+ logGather: user.logGather,
19948
+ // encryptionType is in extra
19949
+ ...extra
19950
+ });
19951
+ this.socket.init();
19952
+ this.trigger(KitEvent.KIT_LOGIN_CHANGE, true);
19953
+ this.user.setUserStatus(UserStatus.offline);
19954
+ }
19955
+ resolve(true);
19956
+ });
19957
+ return loginPromiseDone;
19952
19958
  }
19953
19959
  async logout() {
19954
19960
  if (!this.config.check())