@koi-design/callkit 2.0.0-beta.2 → 2.0.0-beta.3
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 +11 -3
- package/dist/index.global.js +36 -27
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +36 -27
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +36 -27
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -2
package/dist/index.d.ts
CHANGED
|
@@ -267,7 +267,7 @@ declare class Socket {
|
|
|
267
267
|
* 重置 socket 连接和所有状态
|
|
268
268
|
* @param isWaitConfirm Whether need to wait for close confirmation
|
|
269
269
|
*/
|
|
270
|
-
reset(
|
|
270
|
+
reset(): Promise<void>;
|
|
271
271
|
private attemptReconnect;
|
|
272
272
|
}
|
|
273
273
|
|
|
@@ -355,7 +355,7 @@ declare class Connect {
|
|
|
355
355
|
/**
|
|
356
356
|
* Whether registered
|
|
357
357
|
*/
|
|
358
|
-
|
|
358
|
+
private isRegister;
|
|
359
359
|
constructor(callKit: CallKit);
|
|
360
360
|
reset(): void;
|
|
361
361
|
private getAduioReference;
|
|
@@ -375,9 +375,17 @@ declare class Connect {
|
|
|
375
375
|
*/
|
|
376
376
|
isRinging(): boolean;
|
|
377
377
|
/**
|
|
378
|
-
*
|
|
378
|
+
* isHolding
|
|
379
379
|
*/
|
|
380
380
|
isHolding(): boolean;
|
|
381
|
+
/**
|
|
382
|
+
* isRegistered
|
|
383
|
+
*/
|
|
384
|
+
isRegistered(): boolean;
|
|
385
|
+
/**
|
|
386
|
+
* isMute
|
|
387
|
+
*/
|
|
388
|
+
isMuted(): boolean;
|
|
381
389
|
/**
|
|
382
390
|
* Call ended, call not started
|
|
383
391
|
* @returns
|
package/dist/index.global.js
CHANGED
|
@@ -18432,7 +18432,7 @@ var WebCall = (() => {
|
|
|
18432
18432
|
/**
|
|
18433
18433
|
* Whether registered
|
|
18434
18434
|
*/
|
|
18435
|
-
|
|
18435
|
+
isRegister = false;
|
|
18436
18436
|
constructor(callKit) {
|
|
18437
18437
|
this.callKit = callKit;
|
|
18438
18438
|
const { reconnect = {} } = this.callKit.config.getConfig();
|
|
@@ -18472,6 +18472,7 @@ var WebCall = (() => {
|
|
|
18472
18472
|
});
|
|
18473
18473
|
}
|
|
18474
18474
|
}
|
|
18475
|
+
this.callKit.config.reset();
|
|
18475
18476
|
this.setConnectStatus(CallStatus.init);
|
|
18476
18477
|
this.clearObserveOptionsHeartbeatInterval();
|
|
18477
18478
|
}
|
|
@@ -18514,11 +18515,23 @@ var WebCall = (() => {
|
|
|
18514
18515
|
return this.connectStatus === CallStatus.ringing;
|
|
18515
18516
|
}
|
|
18516
18517
|
/**
|
|
18517
|
-
*
|
|
18518
|
+
* isHolding
|
|
18518
18519
|
*/
|
|
18519
18520
|
isHolding() {
|
|
18520
18521
|
return this.connectStatus === CallStatus.holding;
|
|
18521
18522
|
}
|
|
18523
|
+
/**
|
|
18524
|
+
* isRegistered
|
|
18525
|
+
*/
|
|
18526
|
+
isRegistered() {
|
|
18527
|
+
return this.isRegister;
|
|
18528
|
+
}
|
|
18529
|
+
/**
|
|
18530
|
+
* isMute
|
|
18531
|
+
*/
|
|
18532
|
+
isMuted() {
|
|
18533
|
+
return this.isMute;
|
|
18534
|
+
}
|
|
18522
18535
|
/**
|
|
18523
18536
|
* Call ended, call not started
|
|
18524
18537
|
* @returns
|
|
@@ -18547,7 +18560,7 @@ var WebCall = (() => {
|
|
|
18547
18560
|
}
|
|
18548
18561
|
async register() {
|
|
18549
18562
|
if (this.connectStatus !== CallStatus.init) {
|
|
18550
|
-
if (this.isRegistered) {
|
|
18563
|
+
if (this.isRegistered()) {
|
|
18551
18564
|
this.callKit.logger.warn("connectStatus is registered", {
|
|
18552
18565
|
caller: "Connect.register",
|
|
18553
18566
|
content: {
|
|
@@ -18683,14 +18696,14 @@ var WebCall = (() => {
|
|
|
18683
18696
|
type: "SIP",
|
|
18684
18697
|
content: {
|
|
18685
18698
|
registererState: state,
|
|
18686
|
-
isRegistered: this.isRegistered
|
|
18699
|
+
isRegistered: this.isRegistered()
|
|
18687
18700
|
}
|
|
18688
18701
|
});
|
|
18689
18702
|
this.setRegister(false);
|
|
18690
18703
|
this.setConnectStatus(CallStatus.init);
|
|
18691
18704
|
this.callKit.trigger(KitEvent.SIP_REGISTERER_EVENT, {
|
|
18692
18705
|
registererState: state,
|
|
18693
|
-
isRegistered: this.isRegistered
|
|
18706
|
+
isRegistered: this.isRegistered()
|
|
18694
18707
|
});
|
|
18695
18708
|
break;
|
|
18696
18709
|
case RegistererState.Registered:
|
|
@@ -18699,13 +18712,13 @@ var WebCall = (() => {
|
|
|
18699
18712
|
type: "SIP",
|
|
18700
18713
|
content: {
|
|
18701
18714
|
registererState: state,
|
|
18702
|
-
isRegistered: this.isRegistered
|
|
18715
|
+
isRegistered: this.isRegistered()
|
|
18703
18716
|
}
|
|
18704
18717
|
});
|
|
18705
18718
|
this.setRegister(true);
|
|
18706
18719
|
this.callKit.trigger(KitEvent.SIP_REGISTERER_EVENT, {
|
|
18707
18720
|
registererState: state,
|
|
18708
|
-
isRegistered: this.isRegistered
|
|
18721
|
+
isRegistered: this.isRegistered()
|
|
18709
18722
|
});
|
|
18710
18723
|
break;
|
|
18711
18724
|
case RegistererState.Terminated:
|
|
@@ -18714,13 +18727,13 @@ var WebCall = (() => {
|
|
|
18714
18727
|
type: "SIP",
|
|
18715
18728
|
content: {
|
|
18716
18729
|
registererState: state,
|
|
18717
|
-
isRegistered: this.isRegistered
|
|
18730
|
+
isRegistered: this.isRegistered()
|
|
18718
18731
|
}
|
|
18719
18732
|
});
|
|
18720
18733
|
this.setRegister(false);
|
|
18721
18734
|
this.setConnectStatus(CallStatus.init);
|
|
18722
18735
|
this.callKit.trigger(KitEvent.SIP_REGISTERER_EVENT, {
|
|
18723
|
-
isRegistered: this.isRegistered,
|
|
18736
|
+
isRegistered: this.isRegistered(),
|
|
18724
18737
|
registererState: state
|
|
18725
18738
|
});
|
|
18726
18739
|
break;
|
|
@@ -18729,14 +18742,14 @@ var WebCall = (() => {
|
|
|
18729
18742
|
caller: "Connect.register.registererStateChange",
|
|
18730
18743
|
type: "SIP",
|
|
18731
18744
|
content: {
|
|
18732
|
-
isRegistered: this.isRegistered,
|
|
18745
|
+
isRegistered: this.isRegistered(),
|
|
18733
18746
|
registererState: state
|
|
18734
18747
|
}
|
|
18735
18748
|
});
|
|
18736
18749
|
this.setRegister(false);
|
|
18737
18750
|
this.setConnectStatus(CallStatus.init);
|
|
18738
18751
|
this.callKit.trigger(KitEvent.SIP_REGISTERER_EVENT, {
|
|
18739
|
-
isRegistered: this.isRegistered,
|
|
18752
|
+
isRegistered: this.isRegistered(),
|
|
18740
18753
|
registererState: state
|
|
18741
18754
|
});
|
|
18742
18755
|
break;
|
|
@@ -18751,7 +18764,7 @@ var WebCall = (() => {
|
|
|
18751
18764
|
caller: "Connect.register.onInvite",
|
|
18752
18765
|
content: {
|
|
18753
18766
|
invite,
|
|
18754
|
-
isRegistered: this.isRegistered
|
|
18767
|
+
isRegistered: this.isRegistered()
|
|
18755
18768
|
}
|
|
18756
18769
|
});
|
|
18757
18770
|
this.currentSession = invite;
|
|
@@ -18771,7 +18784,7 @@ var WebCall = (() => {
|
|
|
18771
18784
|
this.setConnectStatus(CallStatus.ringing);
|
|
18772
18785
|
this.callKit.trigger(KitEvent.SIP_SESSION_EVENT, {
|
|
18773
18786
|
sessionState: state,
|
|
18774
|
-
isRegistered: this.isRegistered
|
|
18787
|
+
isRegistered: this.isRegistered()
|
|
18775
18788
|
});
|
|
18776
18789
|
break;
|
|
18777
18790
|
case SessionState2.Established:
|
|
@@ -18785,14 +18798,14 @@ var WebCall = (() => {
|
|
|
18785
18798
|
this.callKit.connect.setConnectStatus(CallStatus.calling);
|
|
18786
18799
|
this.callKit.trigger(KitEvent.SIP_SESSION_EVENT, {
|
|
18787
18800
|
sessionState: state,
|
|
18788
|
-
isRegistered: this.isRegistered
|
|
18801
|
+
isRegistered: this.isRegistered()
|
|
18789
18802
|
});
|
|
18790
18803
|
setupRemoteMedia(this.currentSession);
|
|
18791
18804
|
break;
|
|
18792
18805
|
case SessionState2.Terminating:
|
|
18793
18806
|
this.callKit.trigger(KitEvent.SIP_SESSION_EVENT, {
|
|
18794
18807
|
sessionState: state,
|
|
18795
|
-
isRegistered: this.isRegistered
|
|
18808
|
+
isRegistered: this.isRegistered()
|
|
18796
18809
|
});
|
|
18797
18810
|
break;
|
|
18798
18811
|
case SessionState2.Terminated:
|
|
@@ -18813,7 +18826,7 @@ var WebCall = (() => {
|
|
|
18813
18826
|
this.isUnprompted = false;
|
|
18814
18827
|
this.callKit.trigger(KitEvent.SIP_SESSION_EVENT, {
|
|
18815
18828
|
sessionState: state,
|
|
18816
|
-
isRegistered: this.isRegistered
|
|
18829
|
+
isRegistered: this.isRegistered()
|
|
18817
18830
|
});
|
|
18818
18831
|
break;
|
|
18819
18832
|
default:
|
|
@@ -19000,11 +19013,10 @@ var WebCall = (() => {
|
|
|
19000
19013
|
caller: "Connect.unregister",
|
|
19001
19014
|
type: "SIP",
|
|
19002
19015
|
content: {
|
|
19003
|
-
isRegistered: this.isRegistered
|
|
19004
|
-
registerer: this.registerer
|
|
19016
|
+
isRegistered: this.isRegistered()
|
|
19005
19017
|
}
|
|
19006
19018
|
});
|
|
19007
|
-
if (!this.isRegistered || !this.registerer) {
|
|
19019
|
+
if (!this.isRegistered() || !this.registerer) {
|
|
19008
19020
|
this.callKit.logger.warn("No registerer to unregister.", {
|
|
19009
19021
|
caller: "Connect.unregister",
|
|
19010
19022
|
type: "SIP",
|
|
@@ -19034,7 +19046,7 @@ var WebCall = (() => {
|
|
|
19034
19046
|
}
|
|
19035
19047
|
});
|
|
19036
19048
|
this.isOutgoing = true;
|
|
19037
|
-
if (!this.isRegistered) {
|
|
19049
|
+
if (!this.isRegistered()) {
|
|
19038
19050
|
await this.register();
|
|
19039
19051
|
}
|
|
19040
19052
|
this.setConnectStatus(CallStatus.connecting);
|
|
@@ -19054,7 +19066,7 @@ var WebCall = (() => {
|
|
|
19054
19066
|
register
|
|
19055
19067
|
}
|
|
19056
19068
|
});
|
|
19057
|
-
this.
|
|
19069
|
+
this.isRegister = register;
|
|
19058
19070
|
this.callKit.trigger(KitEvent.KIT_REGISTER_CHANGE, register);
|
|
19059
19071
|
}
|
|
19060
19072
|
/**
|
|
@@ -19616,7 +19628,6 @@ var WebCall = (() => {
|
|
|
19616
19628
|
errCode: ErrorCode.SOCKET_CONNECT_ERROR
|
|
19617
19629
|
}
|
|
19618
19630
|
});
|
|
19619
|
-
this.callKit.config.reset();
|
|
19620
19631
|
this.callKit.reset();
|
|
19621
19632
|
return;
|
|
19622
19633
|
}
|
|
@@ -19723,7 +19734,7 @@ var WebCall = (() => {
|
|
|
19723
19734
|
* 重置 socket 连接和所有状态
|
|
19724
19735
|
* @param isWaitConfirm Whether need to wait for close confirmation
|
|
19725
19736
|
*/
|
|
19726
|
-
async reset(
|
|
19737
|
+
async reset() {
|
|
19727
19738
|
if (this.pingTimer) {
|
|
19728
19739
|
clearInterval(this.pingTimer);
|
|
19729
19740
|
this.pingTimer = void 0;
|
|
@@ -19735,9 +19746,7 @@ var WebCall = (() => {
|
|
|
19735
19746
|
this.callKit.logger.info("Closing socket connection", {
|
|
19736
19747
|
caller: "Socket.reset",
|
|
19737
19748
|
type: "INCALL",
|
|
19738
|
-
content: {
|
|
19739
|
-
isWaitConfirm
|
|
19740
|
-
}
|
|
19749
|
+
content: {}
|
|
19741
19750
|
});
|
|
19742
19751
|
this.ws.close();
|
|
19743
19752
|
this.isConnected = false;
|
|
@@ -19909,8 +19918,8 @@ var WebCall = (() => {
|
|
|
19909
19918
|
}
|
|
19910
19919
|
}
|
|
19911
19920
|
await this.hangup();
|
|
19912
|
-
this.socket.reset(false);
|
|
19913
19921
|
this.connect.reset();
|
|
19922
|
+
this.socket.reset();
|
|
19914
19923
|
this.config.reset();
|
|
19915
19924
|
this.trigger(KitEvent.KIT_LOGIN_CHANGE, false);
|
|
19916
19925
|
}
|