@koi-design/callkit 2.1.2 → 2.1.3-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.
- package/CHANGELOG.md +193 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.global.js +47 -12
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +47 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +47 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -681,7 +681,7 @@ var Call = class {
|
|
|
681
681
|
// package.json
|
|
682
682
|
var package_default = {
|
|
683
683
|
name: "@koi-design/callkit",
|
|
684
|
-
version: "2.1.
|
|
684
|
+
version: "2.1.3-beta.1",
|
|
685
685
|
description: "callkit",
|
|
686
686
|
author: "koi",
|
|
687
687
|
license: "ISC",
|
|
@@ -1990,16 +1990,9 @@ var Connect = class {
|
|
|
1990
1990
|
return;
|
|
1991
1991
|
try {
|
|
1992
1992
|
if (isUnprompted) {
|
|
1993
|
-
const
|
|
1994
|
-
if (
|
|
1995
|
-
|
|
1996
|
-
if (this.currentSession?.state !== SessionState.Terminated && this.currentSession?.state !== SessionState.Terminating) {
|
|
1997
|
-
this.currentSession.reject();
|
|
1998
|
-
}
|
|
1999
|
-
this.hasInvite = false;
|
|
2000
|
-
} else {
|
|
2001
|
-
await this.currentSession?.bye();
|
|
2002
|
-
}
|
|
1993
|
+
const shouldByeOrReject = this.isRinging() || this.isCalling() || this.isConnecting();
|
|
1994
|
+
if (shouldByeOrReject) {
|
|
1995
|
+
await this.terminateActiveCall();
|
|
2003
1996
|
}
|
|
2004
1997
|
}
|
|
2005
1998
|
closeStream(this.mediaStream);
|
|
@@ -2019,12 +2012,54 @@ var Connect = class {
|
|
|
2019
2012
|
type: "SIP",
|
|
2020
2013
|
content: {
|
|
2021
2014
|
connectStatus: this.connectStatus,
|
|
2015
|
+
sessionState: this.currentSession?.state,
|
|
2022
2016
|
isError,
|
|
2023
2017
|
isUnprompted
|
|
2024
2018
|
}
|
|
2025
2019
|
});
|
|
2026
2020
|
}
|
|
2027
2021
|
}
|
|
2022
|
+
/**
|
|
2023
|
+
* Terminate active call (connecting calling ringing)
|
|
2024
|
+
*/
|
|
2025
|
+
async terminateActiveCall() {
|
|
2026
|
+
if (this.hasInvite) {
|
|
2027
|
+
const canReject = this.currentSession?.state !== SessionState.Terminated && this.currentSession?.state !== SessionState.Terminating;
|
|
2028
|
+
if (canReject) {
|
|
2029
|
+
await this.currentSession.reject();
|
|
2030
|
+
}
|
|
2031
|
+
this.callKit.logger.info("Terminate active call: Invite reject", {
|
|
2032
|
+
caller: "Connect.terminateActiveCall",
|
|
2033
|
+
type: "SIP",
|
|
2034
|
+
content: {
|
|
2035
|
+
sessionState: this.currentSession.state
|
|
2036
|
+
}
|
|
2037
|
+
});
|
|
2038
|
+
this.hasInvite = false;
|
|
2039
|
+
return;
|
|
2040
|
+
}
|
|
2041
|
+
if (this.currentSession?.state === SessionState.Establishing) {
|
|
2042
|
+
this.callKit.logger.info("Rejecting session in Establishing state", {
|
|
2043
|
+
caller: "Connect.terminateActiveCall",
|
|
2044
|
+
type: "SIP",
|
|
2045
|
+
content: {
|
|
2046
|
+
sessionState: this.currentSession.state
|
|
2047
|
+
}
|
|
2048
|
+
});
|
|
2049
|
+
await this.currentSession.reject();
|
|
2050
|
+
return;
|
|
2051
|
+
}
|
|
2052
|
+
if (this.currentSession?.state === SessionState.Established) {
|
|
2053
|
+
this.callKit.logger.info("Sending BYE to established session", {
|
|
2054
|
+
caller: "Connect.terminateActiveCall",
|
|
2055
|
+
type: "SIP",
|
|
2056
|
+
content: {
|
|
2057
|
+
sessionState: this.currentSession.state
|
|
2058
|
+
}
|
|
2059
|
+
});
|
|
2060
|
+
await this.currentSession?.bye();
|
|
2061
|
+
}
|
|
2062
|
+
}
|
|
2028
2063
|
/**
|
|
2029
2064
|
* The remote media stream. Undefined if call not answered.
|
|
2030
2065
|
* @param session - Session to get the media stream from.
|
|
@@ -2887,7 +2922,7 @@ var CallKit = class {
|
|
|
2887
2922
|
connectStatus: this.connect.connectStatus
|
|
2888
2923
|
}
|
|
2889
2924
|
});
|
|
2890
|
-
if (!this.connect.isConnecting() && !this.connect.isRinging() && !this.connect.isCalling()
|
|
2925
|
+
if (!this.connect.isConnecting() && !this.connect.isRinging() && !this.connect.isCalling()) {
|
|
2891
2926
|
this.logger.warn("Currently not in a call", {
|
|
2892
2927
|
caller: "CallKit.hangup",
|
|
2893
2928
|
content: {
|