@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.
- package/dist/index.d.ts +604 -596
- package/dist/index.global.js +17 -16
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +17 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -72,7 +72,7 @@ var Api = class {
|
|
|
72
72
|
const res = await this.post({
|
|
73
73
|
url: "/auth/agentUser/login",
|
|
74
74
|
method: "post",
|
|
75
|
-
data:
|
|
75
|
+
data: params
|
|
76
76
|
});
|
|
77
77
|
return res;
|
|
78
78
|
} finally {
|
|
@@ -555,6 +555,12 @@ var CallSourceType = {
|
|
|
555
555
|
phoneNum: 1,
|
|
556
556
|
workOrderId: 2
|
|
557
557
|
};
|
|
558
|
+
var PhoneTypeEnum = {
|
|
559
|
+
SIP: 0,
|
|
560
|
+
TEL: 1,
|
|
561
|
+
OUT: 2,
|
|
562
|
+
SP: 5
|
|
563
|
+
};
|
|
558
564
|
var trackLogsDefaultConfig = {
|
|
559
565
|
enabled: false,
|
|
560
566
|
interval: 5e3,
|
|
@@ -718,7 +724,7 @@ var Call = class {
|
|
|
718
724
|
// package.json
|
|
719
725
|
var package_default = {
|
|
720
726
|
name: "@koi-design/callkit",
|
|
721
|
-
version: "2.
|
|
727
|
+
version: "2.3.0-beta.1",
|
|
722
728
|
description: "callkit",
|
|
723
729
|
author: "koi",
|
|
724
730
|
license: "ISC",
|
|
@@ -795,6 +801,7 @@ var Config = class {
|
|
|
795
801
|
password: "",
|
|
796
802
|
encryptionPassword: EncryptionMethod.INTERNAL,
|
|
797
803
|
sourceType: CallSourceType.phoneNum,
|
|
804
|
+
phoneType: PhoneTypeEnum.SIP,
|
|
798
805
|
// Extension number
|
|
799
806
|
extno: "",
|
|
800
807
|
workOrderId: "",
|
|
@@ -838,6 +845,7 @@ var Config = class {
|
|
|
838
845
|
encryptionPassword: "",
|
|
839
846
|
userPart: "",
|
|
840
847
|
sourceType: CallSourceType.phoneNum,
|
|
848
|
+
phoneType: PhoneTypeEnum.SIP,
|
|
841
849
|
extno: "",
|
|
842
850
|
workOrderId: "",
|
|
843
851
|
agentId: "",
|
|
@@ -16744,13 +16752,6 @@ var Socket = class {
|
|
|
16744
16752
|
get reconnectConfig() {
|
|
16745
16753
|
return this.callKit.config.getReconnectConfig("incall");
|
|
16746
16754
|
}
|
|
16747
|
-
get pingInterval() {
|
|
16748
|
-
const { keepaliveInterval } = this.callKit.config.getConfig().userInfo;
|
|
16749
|
-
if (Number.isInteger(keepaliveInterval) && keepaliveInterval > 0) {
|
|
16750
|
-
return keepaliveInterval * 1e3;
|
|
16751
|
-
}
|
|
16752
|
-
return this.reconnectConfig.pingInterval;
|
|
16753
|
-
}
|
|
16754
16755
|
isConnected() {
|
|
16755
16756
|
return this.connectAuthState.isConnected;
|
|
16756
16757
|
}
|
|
@@ -17044,7 +17045,7 @@ var Socket = class {
|
|
|
17044
17045
|
return;
|
|
17045
17046
|
}
|
|
17046
17047
|
const { userInfo, version } = this.callKit.config.getConfig();
|
|
17047
|
-
const { sessionId, extno, agentId } = userInfo;
|
|
17048
|
+
const { sessionId, extno, agentId, phoneType } = userInfo;
|
|
17048
17049
|
if (!sessionId) {
|
|
17049
17050
|
this.callKit.logger.error("sessionId is empty", {
|
|
17050
17051
|
caller: "Socket.send",
|
|
@@ -17064,6 +17065,7 @@ var Socket = class {
|
|
|
17064
17065
|
if (SocketSendEvent.CALL === event) {
|
|
17065
17066
|
msg.phoneNum = extno;
|
|
17066
17067
|
msg.agentId = agentId;
|
|
17068
|
+
msg.phoneType = phoneType;
|
|
17067
17069
|
if (message?.sourceType === CallSourceType.phoneNum) {
|
|
17068
17070
|
delete msg.workOrderId;
|
|
17069
17071
|
} else if (message?.sourceType === CallSourceType.workOrderId) {
|
|
@@ -17085,8 +17087,8 @@ var Socket = class {
|
|
|
17085
17087
|
return;
|
|
17086
17088
|
this.send(SocketSendEvent.PING);
|
|
17087
17089
|
const now = Date.now();
|
|
17088
|
-
const { pingTimeout } = this.reconnectConfig;
|
|
17089
|
-
if (now - this.lastPingTime >
|
|
17090
|
+
const { pingInterval, pingTimeout } = this.reconnectConfig;
|
|
17091
|
+
if (now - this.lastPingTime > pingInterval + pingTimeout) {
|
|
17090
17092
|
this.callKit.logger.warn("Ping timeout not connected", {
|
|
17091
17093
|
caller: "Socket.ping",
|
|
17092
17094
|
type: "INCALL",
|
|
@@ -17104,9 +17106,10 @@ var Socket = class {
|
|
|
17104
17106
|
if (this.pingTimer) {
|
|
17105
17107
|
clearInterval(this.pingTimer);
|
|
17106
17108
|
}
|
|
17109
|
+
const { pingInterval } = this.reconnectConfig;
|
|
17107
17110
|
this.pingTimer = setInterval(() => {
|
|
17108
17111
|
this.ping();
|
|
17109
|
-
},
|
|
17112
|
+
}, pingInterval);
|
|
17110
17113
|
}
|
|
17111
17114
|
/**
|
|
17112
17115
|
* reset socket connection and all states
|
|
@@ -17252,7 +17255,6 @@ var CallKit = class {
|
|
|
17252
17255
|
content: {
|
|
17253
17256
|
username,
|
|
17254
17257
|
password,
|
|
17255
|
-
ua: navigator.userAgent,
|
|
17256
17258
|
encryptionMethod,
|
|
17257
17259
|
encryptionPassword
|
|
17258
17260
|
}
|
|
@@ -17270,7 +17272,6 @@ var CallKit = class {
|
|
|
17270
17272
|
password: encryptionPassword,
|
|
17271
17273
|
timestamp: Date.now()
|
|
17272
17274
|
});
|
|
17273
|
-
console.log("user", user);
|
|
17274
17275
|
if (user) {
|
|
17275
17276
|
this.config.setConfig("userInfo", {
|
|
17276
17277
|
wsUrl: `wss://${user.wsUrl}`,
|
|
@@ -17287,7 +17288,7 @@ var CallKit = class {
|
|
|
17287
17288
|
iceInfo: user.iceInfo,
|
|
17288
17289
|
iceGatheringTimeout: user.iceGatheringTimeout,
|
|
17289
17290
|
logGather: user.logGather,
|
|
17290
|
-
|
|
17291
|
+
phoneType: user.phoneType,
|
|
17291
17292
|
// encryptionType is in extra
|
|
17292
17293
|
...extra
|
|
17293
17294
|
});
|