@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.mjs
CHANGED
|
@@ -840,7 +840,7 @@ var Connect = class {
|
|
|
840
840
|
/**
|
|
841
841
|
* Whether registered
|
|
842
842
|
*/
|
|
843
|
-
|
|
843
|
+
isRegister = false;
|
|
844
844
|
constructor(callKit) {
|
|
845
845
|
this.callKit = callKit;
|
|
846
846
|
const { reconnect = {} } = this.callKit.config.getConfig();
|
|
@@ -880,6 +880,7 @@ var Connect = class {
|
|
|
880
880
|
});
|
|
881
881
|
}
|
|
882
882
|
}
|
|
883
|
+
this.callKit.config.reset();
|
|
883
884
|
this.setConnectStatus(CallStatus.init);
|
|
884
885
|
this.clearObserveOptionsHeartbeatInterval();
|
|
885
886
|
}
|
|
@@ -922,11 +923,23 @@ var Connect = class {
|
|
|
922
923
|
return this.connectStatus === CallStatus.ringing;
|
|
923
924
|
}
|
|
924
925
|
/**
|
|
925
|
-
*
|
|
926
|
+
* isHolding
|
|
926
927
|
*/
|
|
927
928
|
isHolding() {
|
|
928
929
|
return this.connectStatus === CallStatus.holding;
|
|
929
930
|
}
|
|
931
|
+
/**
|
|
932
|
+
* isRegistered
|
|
933
|
+
*/
|
|
934
|
+
isRegistered() {
|
|
935
|
+
return this.isRegister;
|
|
936
|
+
}
|
|
937
|
+
/**
|
|
938
|
+
* isMute
|
|
939
|
+
*/
|
|
940
|
+
isMuted() {
|
|
941
|
+
return this.isMute;
|
|
942
|
+
}
|
|
930
943
|
/**
|
|
931
944
|
* Call ended, call not started
|
|
932
945
|
* @returns
|
|
@@ -955,7 +968,7 @@ var Connect = class {
|
|
|
955
968
|
}
|
|
956
969
|
async register() {
|
|
957
970
|
if (this.connectStatus !== CallStatus.init) {
|
|
958
|
-
if (this.isRegistered) {
|
|
971
|
+
if (this.isRegistered()) {
|
|
959
972
|
this.callKit.logger.warn("connectStatus is registered", {
|
|
960
973
|
caller: "Connect.register",
|
|
961
974
|
content: {
|
|
@@ -1091,14 +1104,14 @@ var Connect = class {
|
|
|
1091
1104
|
type: "SIP",
|
|
1092
1105
|
content: {
|
|
1093
1106
|
registererState: state,
|
|
1094
|
-
isRegistered: this.isRegistered
|
|
1107
|
+
isRegistered: this.isRegistered()
|
|
1095
1108
|
}
|
|
1096
1109
|
});
|
|
1097
1110
|
this.setRegister(false);
|
|
1098
1111
|
this.setConnectStatus(CallStatus.init);
|
|
1099
1112
|
this.callKit.trigger(KitEvent.SIP_REGISTERER_EVENT, {
|
|
1100
1113
|
registererState: state,
|
|
1101
|
-
isRegistered: this.isRegistered
|
|
1114
|
+
isRegistered: this.isRegistered()
|
|
1102
1115
|
});
|
|
1103
1116
|
break;
|
|
1104
1117
|
case RegistererState.Registered:
|
|
@@ -1107,13 +1120,13 @@ var Connect = class {
|
|
|
1107
1120
|
type: "SIP",
|
|
1108
1121
|
content: {
|
|
1109
1122
|
registererState: state,
|
|
1110
|
-
isRegistered: this.isRegistered
|
|
1123
|
+
isRegistered: this.isRegistered()
|
|
1111
1124
|
}
|
|
1112
1125
|
});
|
|
1113
1126
|
this.setRegister(true);
|
|
1114
1127
|
this.callKit.trigger(KitEvent.SIP_REGISTERER_EVENT, {
|
|
1115
1128
|
registererState: state,
|
|
1116
|
-
isRegistered: this.isRegistered
|
|
1129
|
+
isRegistered: this.isRegistered()
|
|
1117
1130
|
});
|
|
1118
1131
|
break;
|
|
1119
1132
|
case RegistererState.Terminated:
|
|
@@ -1122,13 +1135,13 @@ var Connect = class {
|
|
|
1122
1135
|
type: "SIP",
|
|
1123
1136
|
content: {
|
|
1124
1137
|
registererState: state,
|
|
1125
|
-
isRegistered: this.isRegistered
|
|
1138
|
+
isRegistered: this.isRegistered()
|
|
1126
1139
|
}
|
|
1127
1140
|
});
|
|
1128
1141
|
this.setRegister(false);
|
|
1129
1142
|
this.setConnectStatus(CallStatus.init);
|
|
1130
1143
|
this.callKit.trigger(KitEvent.SIP_REGISTERER_EVENT, {
|
|
1131
|
-
isRegistered: this.isRegistered,
|
|
1144
|
+
isRegistered: this.isRegistered(),
|
|
1132
1145
|
registererState: state
|
|
1133
1146
|
});
|
|
1134
1147
|
break;
|
|
@@ -1137,14 +1150,14 @@ var Connect = class {
|
|
|
1137
1150
|
caller: "Connect.register.registererStateChange",
|
|
1138
1151
|
type: "SIP",
|
|
1139
1152
|
content: {
|
|
1140
|
-
isRegistered: this.isRegistered,
|
|
1153
|
+
isRegistered: this.isRegistered(),
|
|
1141
1154
|
registererState: state
|
|
1142
1155
|
}
|
|
1143
1156
|
});
|
|
1144
1157
|
this.setRegister(false);
|
|
1145
1158
|
this.setConnectStatus(CallStatus.init);
|
|
1146
1159
|
this.callKit.trigger(KitEvent.SIP_REGISTERER_EVENT, {
|
|
1147
|
-
isRegistered: this.isRegistered,
|
|
1160
|
+
isRegistered: this.isRegistered(),
|
|
1148
1161
|
registererState: state
|
|
1149
1162
|
});
|
|
1150
1163
|
break;
|
|
@@ -1159,7 +1172,7 @@ var Connect = class {
|
|
|
1159
1172
|
caller: "Connect.register.onInvite",
|
|
1160
1173
|
content: {
|
|
1161
1174
|
invite,
|
|
1162
|
-
isRegistered: this.isRegistered
|
|
1175
|
+
isRegistered: this.isRegistered()
|
|
1163
1176
|
}
|
|
1164
1177
|
});
|
|
1165
1178
|
this.currentSession = invite;
|
|
@@ -1179,7 +1192,7 @@ var Connect = class {
|
|
|
1179
1192
|
this.setConnectStatus(CallStatus.ringing);
|
|
1180
1193
|
this.callKit.trigger(KitEvent.SIP_SESSION_EVENT, {
|
|
1181
1194
|
sessionState: state,
|
|
1182
|
-
isRegistered: this.isRegistered
|
|
1195
|
+
isRegistered: this.isRegistered()
|
|
1183
1196
|
});
|
|
1184
1197
|
break;
|
|
1185
1198
|
case SessionState.Established:
|
|
@@ -1193,14 +1206,14 @@ var Connect = class {
|
|
|
1193
1206
|
this.callKit.connect.setConnectStatus(CallStatus.calling);
|
|
1194
1207
|
this.callKit.trigger(KitEvent.SIP_SESSION_EVENT, {
|
|
1195
1208
|
sessionState: state,
|
|
1196
|
-
isRegistered: this.isRegistered
|
|
1209
|
+
isRegistered: this.isRegistered()
|
|
1197
1210
|
});
|
|
1198
1211
|
setupRemoteMedia(this.currentSession);
|
|
1199
1212
|
break;
|
|
1200
1213
|
case SessionState.Terminating:
|
|
1201
1214
|
this.callKit.trigger(KitEvent.SIP_SESSION_EVENT, {
|
|
1202
1215
|
sessionState: state,
|
|
1203
|
-
isRegistered: this.isRegistered
|
|
1216
|
+
isRegistered: this.isRegistered()
|
|
1204
1217
|
});
|
|
1205
1218
|
break;
|
|
1206
1219
|
case SessionState.Terminated:
|
|
@@ -1221,7 +1234,7 @@ var Connect = class {
|
|
|
1221
1234
|
this.isUnprompted = false;
|
|
1222
1235
|
this.callKit.trigger(KitEvent.SIP_SESSION_EVENT, {
|
|
1223
1236
|
sessionState: state,
|
|
1224
|
-
isRegistered: this.isRegistered
|
|
1237
|
+
isRegistered: this.isRegistered()
|
|
1225
1238
|
});
|
|
1226
1239
|
break;
|
|
1227
1240
|
default:
|
|
@@ -1408,11 +1421,10 @@ var Connect = class {
|
|
|
1408
1421
|
caller: "Connect.unregister",
|
|
1409
1422
|
type: "SIP",
|
|
1410
1423
|
content: {
|
|
1411
|
-
isRegistered: this.isRegistered
|
|
1412
|
-
registerer: this.registerer
|
|
1424
|
+
isRegistered: this.isRegistered()
|
|
1413
1425
|
}
|
|
1414
1426
|
});
|
|
1415
|
-
if (!this.isRegistered || !this.registerer) {
|
|
1427
|
+
if (!this.isRegistered() || !this.registerer) {
|
|
1416
1428
|
this.callKit.logger.warn("No registerer to unregister.", {
|
|
1417
1429
|
caller: "Connect.unregister",
|
|
1418
1430
|
type: "SIP",
|
|
@@ -1442,7 +1454,7 @@ var Connect = class {
|
|
|
1442
1454
|
}
|
|
1443
1455
|
});
|
|
1444
1456
|
this.isOutgoing = true;
|
|
1445
|
-
if (!this.isRegistered) {
|
|
1457
|
+
if (!this.isRegistered()) {
|
|
1446
1458
|
await this.register();
|
|
1447
1459
|
}
|
|
1448
1460
|
this.setConnectStatus(CallStatus.connecting);
|
|
@@ -1462,7 +1474,7 @@ var Connect = class {
|
|
|
1462
1474
|
register
|
|
1463
1475
|
}
|
|
1464
1476
|
});
|
|
1465
|
-
this.
|
|
1477
|
+
this.isRegister = register;
|
|
1466
1478
|
this.callKit.trigger(KitEvent.KIT_REGISTER_CHANGE, register);
|
|
1467
1479
|
}
|
|
1468
1480
|
/**
|
|
@@ -2024,7 +2036,6 @@ var Socket = class {
|
|
|
2024
2036
|
errCode: ErrorCode.SOCKET_CONNECT_ERROR
|
|
2025
2037
|
}
|
|
2026
2038
|
});
|
|
2027
|
-
this.callKit.config.reset();
|
|
2028
2039
|
this.callKit.reset();
|
|
2029
2040
|
return;
|
|
2030
2041
|
}
|
|
@@ -2131,7 +2142,7 @@ var Socket = class {
|
|
|
2131
2142
|
* 重置 socket 连接和所有状态
|
|
2132
2143
|
* @param isWaitConfirm Whether need to wait for close confirmation
|
|
2133
2144
|
*/
|
|
2134
|
-
async reset(
|
|
2145
|
+
async reset() {
|
|
2135
2146
|
if (this.pingTimer) {
|
|
2136
2147
|
clearInterval(this.pingTimer);
|
|
2137
2148
|
this.pingTimer = void 0;
|
|
@@ -2143,9 +2154,7 @@ var Socket = class {
|
|
|
2143
2154
|
this.callKit.logger.info("Closing socket connection", {
|
|
2144
2155
|
caller: "Socket.reset",
|
|
2145
2156
|
type: "INCALL",
|
|
2146
|
-
content: {
|
|
2147
|
-
isWaitConfirm
|
|
2148
|
-
}
|
|
2157
|
+
content: {}
|
|
2149
2158
|
});
|
|
2150
2159
|
this.ws.close();
|
|
2151
2160
|
this.isConnected = false;
|
|
@@ -2317,8 +2326,8 @@ var CallKit = class {
|
|
|
2317
2326
|
}
|
|
2318
2327
|
}
|
|
2319
2328
|
await this.hangup();
|
|
2320
|
-
this.socket.reset(false);
|
|
2321
2329
|
this.connect.reset();
|
|
2330
|
+
this.socket.reset();
|
|
2322
2331
|
this.config.reset();
|
|
2323
2332
|
this.trigger(KitEvent.KIT_LOGIN_CHANGE, false);
|
|
2324
2333
|
}
|