@koi-design/callkit 2.0.5-beta.4 → 2.0.5-beta.5
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 +156 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.global.js +78 -19
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +78 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +78 -19
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# v2.0.0
|
|
2
|
+
|
|
3
|
+
## Breaking Changes
|
|
4
|
+
|
|
5
|
+
- Removed user status, you can now maintain user status through events yourself
|
|
6
|
+
- Separated registered status
|
|
7
|
+
|
|
8
|
+
## What's Changed
|
|
9
|
+
|
|
10
|
+
- Refactored SIP reconnection and socket reconnection mechanism
|
|
11
|
+
- Separated call status from registered status, registered is now not associated with call status
|
|
12
|
+
- Optimized log output
|
|
13
|
+
- Optimized various details
|
|
14
|
+
|
|
15
|
+
# v1.0.24
|
|
16
|
+
|
|
17
|
+
## What's Changed
|
|
18
|
+
|
|
19
|
+
- Added socket disconnection event. Added socket reconnection mechanism and reconnection failure event.
|
|
20
|
+
|
|
21
|
+
# v1.0.23
|
|
22
|
+
|
|
23
|
+
## What's Changed
|
|
24
|
+
|
|
25
|
+
- login support encryptionMethod, The user can control whether to use internal encryption by setting a parameter.
|
|
26
|
+
|
|
27
|
+
# v1.0.22
|
|
28
|
+
|
|
29
|
+
## What's Changed
|
|
30
|
+
|
|
31
|
+
- Code optimization
|
|
32
|
+
|
|
33
|
+
# v1.0.21
|
|
34
|
+
|
|
35
|
+
## What's Changed
|
|
36
|
+
|
|
37
|
+
- Demo page, initialize CallKit address using production environment domain
|
|
38
|
+
|
|
39
|
+
# v1.0.20
|
|
40
|
+
|
|
41
|
+
## What's Changed
|
|
42
|
+
|
|
43
|
+
- Added isAutoUpdateUserStatus optimization to config, defaults to true if not configured
|
|
44
|
+
- User status changed: 1, "Offline"; 2, "Online"; 3, "Break"; 4, "In Call"; 5, "Training"; 6, "Processing"
|
|
45
|
+
- Added html3 incoming call popup html + css reference example
|
|
46
|
+
|
|
47
|
+
# v1.0.19
|
|
48
|
+
|
|
49
|
+
## What's Changed
|
|
50
|
+
|
|
51
|
+
- Added getInviteData to invite call invitation for data retrieval
|
|
52
|
+
|
|
53
|
+
# v1.0.18
|
|
54
|
+
|
|
55
|
+
## What's Changed
|
|
56
|
+
|
|
57
|
+
- Added iceGatheringTimeout parameter
|
|
58
|
+
|
|
59
|
+
# v1.0.17
|
|
60
|
+
|
|
61
|
+
## What's Changed
|
|
62
|
+
|
|
63
|
+
- Removed default handling for CALL_FAILED, currently requires user to handle actively
|
|
64
|
+
|
|
65
|
+
# v1.0.14
|
|
66
|
+
|
|
67
|
+
## What's Changed
|
|
68
|
+
|
|
69
|
+
- Added user object, updated user status overall calls user internal functions
|
|
70
|
+
- Added isAutoUpdateUserStatus to config to control whether user controls user status updates
|
|
71
|
+
|
|
72
|
+
# v1.0.12
|
|
73
|
+
|
|
74
|
+
## What's Changed
|
|
75
|
+
|
|
76
|
+
- Active hang up, user status adjusted to break
|
|
77
|
+
- Added AGENT_NO_ANSWER event
|
|
78
|
+
|
|
79
|
+
# v1.0.11
|
|
80
|
+
|
|
81
|
+
## What's Changed
|
|
82
|
+
|
|
83
|
+
- Optimized user status
|
|
84
|
+
|
|
85
|
+
Login - Status: Unregistered
|
|
86
|
+
|
|
87
|
+
Sign in - Status: Idle
|
|
88
|
+
|
|
89
|
+
Dial success (received event: CALL_SUCCESS) - Status: Busy
|
|
90
|
+
|
|
91
|
+
Dial failed (received event: CALL_FAILED) - Status: Idle
|
|
92
|
+
|
|
93
|
+
Customer no answer (received event: CUSTOMER_NO_ANSWER) - Status: Break
|
|
94
|
+
|
|
95
|
+
Customer hang up (received event: CUSTOMER_HANG_UP) - Status: Break
|
|
96
|
+
|
|
97
|
+
Agent hang up (sent event: AGENT_HANG_UP) - Status: Break
|
|
98
|
+
|
|
99
|
+
Agent error (received event: ERROR) - Status: Break
|
|
100
|
+
|
|
101
|
+
- Added isRegistered method
|
|
102
|
+
|
|
103
|
+
# v1.0.10
|
|
104
|
+
|
|
105
|
+
## What's Changed
|
|
106
|
+
|
|
107
|
+
- Agent pick up event: AGENT_PICK_UP
|
|
108
|
+
- Adjusted user status logic, login idle moved to sign in, sign out set to online
|
|
109
|
+
|
|
110
|
+
# v1.0.9
|
|
111
|
+
|
|
112
|
+
## What's Changed
|
|
113
|
+
|
|
114
|
+
- Fixed active hang up callEnd duplicate trigger issue
|
|
115
|
+
|
|
116
|
+
# v1.0.8
|
|
117
|
+
|
|
118
|
+
## What's Changed
|
|
119
|
+
|
|
120
|
+
- Fixed login detection triggered by sip signaling disConnect after logout
|
|
121
|
+
|
|
122
|
+
# v1.0.7
|
|
123
|
+
|
|
124
|
+
## What's Changed
|
|
125
|
+
|
|
126
|
+
- Added forwarding of all socket events
|
|
127
|
+
|
|
128
|
+
# v1.0.6
|
|
129
|
+
|
|
130
|
+
## What's Changed
|
|
131
|
+
|
|
132
|
+
- Support listening to multiple events with the same name
|
|
133
|
+
|
|
134
|
+
# v1.0.5
|
|
135
|
+
|
|
136
|
+
## What's Changed
|
|
137
|
+
|
|
138
|
+
- Fixed socket exception reconnection
|
|
139
|
+
|
|
140
|
+
# v1.0.4
|
|
141
|
+
|
|
142
|
+
## What's Changed
|
|
143
|
+
|
|
144
|
+
- Optimized socket connection
|
|
145
|
+
|
|
146
|
+
# v1.0.3
|
|
147
|
+
|
|
148
|
+
## What's Changed
|
|
149
|
+
|
|
150
|
+
- Incoming call answer support
|
|
151
|
+
|
|
152
|
+
# v1.0.2
|
|
153
|
+
|
|
154
|
+
## What's Changed
|
|
155
|
+
|
|
156
|
+
- Released initial version
|
package/dist/index.d.ts
CHANGED
|
@@ -434,7 +434,8 @@ declare class Connect {
|
|
|
434
434
|
pingInterval?: number;
|
|
435
435
|
pingTimeout?: number;
|
|
436
436
|
};
|
|
437
|
-
currentCallId
|
|
437
|
+
private currentCallId;
|
|
438
|
+
getCurrentCallId(): string | null;
|
|
438
439
|
setCallId(callId: string | null): void;
|
|
439
440
|
reset(): Promise<void>;
|
|
440
441
|
private getAduioReference;
|
package/dist/index.global.js
CHANGED
|
@@ -3306,11 +3306,33 @@ var WebCall = (() => {
|
|
|
3306
3306
|
if (sessionId) {
|
|
3307
3307
|
config.headers.sessionId = sessionId;
|
|
3308
3308
|
}
|
|
3309
|
+
const startTime = Date.now();
|
|
3310
|
+
this.callKit.logger.info("API Request Start", {
|
|
3311
|
+
type: "API",
|
|
3312
|
+
caller: "API.Request",
|
|
3313
|
+
content: {
|
|
3314
|
+
url: config.url,
|
|
3315
|
+
headers: config.headers,
|
|
3316
|
+
data: config.data,
|
|
3317
|
+
extra,
|
|
3318
|
+
startTime
|
|
3319
|
+
}
|
|
3320
|
+
});
|
|
3309
3321
|
const res = await axios_default(config).catch(() => {
|
|
3310
3322
|
this.callKit.config.reset();
|
|
3311
3323
|
});
|
|
3324
|
+
const endTime = Date.now();
|
|
3325
|
+
this.callKit.logger.info("API Request Finish", {
|
|
3326
|
+
type: "API",
|
|
3327
|
+
caller: "API.Request",
|
|
3328
|
+
content: {
|
|
3329
|
+
url: config.url,
|
|
3330
|
+
duration: `${endTime - startTime}ms`,
|
|
3331
|
+
response: res
|
|
3332
|
+
}
|
|
3333
|
+
});
|
|
3312
3334
|
if (!res) {
|
|
3313
|
-
this.callKit.
|
|
3335
|
+
this.callKit.reset();
|
|
3314
3336
|
throw new Error("Network error");
|
|
3315
3337
|
}
|
|
3316
3338
|
const { code, data, message } = res;
|
|
@@ -3631,6 +3653,10 @@ var WebCall = (() => {
|
|
|
3631
3653
|
* Agent no answer
|
|
3632
3654
|
*/
|
|
3633
3655
|
AGENT_NO_ANSWER: "AGENT_NO_ANSWER",
|
|
3656
|
+
/**
|
|
3657
|
+
* Agent hang up
|
|
3658
|
+
*/
|
|
3659
|
+
AGENT_HANG_UP: "AGENT_HANG_UP",
|
|
3634
3660
|
/**
|
|
3635
3661
|
* Call detail record push
|
|
3636
3662
|
*/
|
|
@@ -3826,13 +3852,13 @@ var WebCall = (() => {
|
|
|
3826
3852
|
// package.json
|
|
3827
3853
|
var package_default = {
|
|
3828
3854
|
name: "@koi-design/callkit",
|
|
3829
|
-
version: "2.0.5-beta.
|
|
3855
|
+
version: "2.0.5-beta.5",
|
|
3830
3856
|
description: "callkit",
|
|
3831
3857
|
author: "koi",
|
|
3832
3858
|
license: "ISC",
|
|
3833
3859
|
scripts: {
|
|
3834
3860
|
build: "tsup",
|
|
3835
|
-
|
|
3861
|
+
start: "vite",
|
|
3836
3862
|
dev: "tsup --watch",
|
|
3837
3863
|
lint: "eslint -c ../../.eslintrc.js --ext .jsx,.js,.tsx,.ts ./package --fix",
|
|
3838
3864
|
release: "tsup && node scripts/pkg.js"
|
|
@@ -18624,6 +18650,9 @@ var WebCall = (() => {
|
|
|
18624
18650
|
}
|
|
18625
18651
|
// current call id for invite data
|
|
18626
18652
|
currentCallId = null;
|
|
18653
|
+
getCurrentCallId() {
|
|
18654
|
+
return this.currentCallId;
|
|
18655
|
+
}
|
|
18627
18656
|
setCallId(callId) {
|
|
18628
18657
|
this.callKit.logger.info("setCallId", {
|
|
18629
18658
|
caller: "Connect.setCallId",
|
|
@@ -19708,6 +19737,7 @@ var WebCall = (() => {
|
|
|
19708
19737
|
}
|
|
19709
19738
|
});
|
|
19710
19739
|
this.confirmAck(data);
|
|
19740
|
+
const callUuid = content?.callUuid || "";
|
|
19711
19741
|
if (data.event === SocketReceiveEvent.PONG) {
|
|
19712
19742
|
this.lastPingTime = Date.now();
|
|
19713
19743
|
return;
|
|
@@ -19717,32 +19747,51 @@ var WebCall = (() => {
|
|
|
19717
19747
|
this.cleanReconnectState();
|
|
19718
19748
|
}
|
|
19719
19749
|
if (data.event === SocketReceiveEvent.CUSTOMER_RINGING) {
|
|
19720
|
-
this.callKit.trigger(KitEvent.CALL_RINGING,
|
|
19750
|
+
this.callKit.trigger(KitEvent.CALL_RINGING, {
|
|
19751
|
+
time: /* @__PURE__ */ new Date(),
|
|
19752
|
+
callUuid
|
|
19753
|
+
});
|
|
19721
19754
|
}
|
|
19722
19755
|
if (data.event === SocketReceiveEvent.CUSTOMER_PICK_UP) {
|
|
19723
|
-
this.callKit.trigger(KitEvent.CALL_PICK_UP,
|
|
19756
|
+
this.callKit.trigger(KitEvent.CALL_PICK_UP, {
|
|
19757
|
+
time: /* @__PURE__ */ new Date(),
|
|
19758
|
+
callUuid
|
|
19759
|
+
});
|
|
19724
19760
|
}
|
|
19725
19761
|
if (data.event === SocketReceiveEvent.AGENT_PICK_UP) {
|
|
19726
|
-
this.callKit.trigger(KitEvent.AGENT_PICK_UP,
|
|
19762
|
+
this.callKit.trigger(KitEvent.AGENT_PICK_UP, {
|
|
19763
|
+
time: /* @__PURE__ */ new Date(),
|
|
19764
|
+
callUuid
|
|
19765
|
+
});
|
|
19727
19766
|
}
|
|
19728
19767
|
if (data.event === SocketReceiveEvent.CUSTOMER_HANG_UP) {
|
|
19729
|
-
this.callKit.trigger(KitEvent.CALL_HANG_UP,
|
|
19730
|
-
|
|
19731
|
-
|
|
19768
|
+
this.callKit.trigger(KitEvent.CALL_HANG_UP, {
|
|
19769
|
+
time: /* @__PURE__ */ new Date(),
|
|
19770
|
+
callUuid
|
|
19771
|
+
});
|
|
19772
|
+
if (callUuid) {
|
|
19773
|
+
this.callKit.connect.socketTriggerHangup(callUuid);
|
|
19732
19774
|
}
|
|
19733
19775
|
}
|
|
19734
19776
|
if (data.event === SocketReceiveEvent.CUSTOMER_NO_ANSWER) {
|
|
19735
|
-
this.callKit.trigger(KitEvent.CALL_NO_ANSWER
|
|
19736
|
-
|
|
19737
|
-
|
|
19777
|
+
this.callKit.trigger(KitEvent.CALL_NO_ANSWER, {
|
|
19778
|
+
time: /* @__PURE__ */ new Date(),
|
|
19779
|
+
callUuid
|
|
19780
|
+
});
|
|
19781
|
+
if (callUuid) {
|
|
19782
|
+
this.callKit.connect.socketTriggerHangup(callUuid);
|
|
19738
19783
|
}
|
|
19739
19784
|
}
|
|
19740
19785
|
if (data.event === SocketReceiveEvent.CALL_CDR) {
|
|
19741
|
-
this.callKit.trigger(KitEvent.CALL_CDR,
|
|
19786
|
+
this.callKit.trigger(KitEvent.CALL_CDR, {
|
|
19787
|
+
time: /* @__PURE__ */ new Date(),
|
|
19788
|
+
callUuid,
|
|
19789
|
+
...content
|
|
19790
|
+
});
|
|
19742
19791
|
}
|
|
19743
19792
|
if (data.event === SocketReceiveEvent.CLOSE) {
|
|
19744
19793
|
const { userInfo } = this.callKit.config.getConfig();
|
|
19745
|
-
this.send(SocketSendEvent.END, { agentId: userInfo.agentId });
|
|
19794
|
+
this.send(SocketSendEvent.END, { agentId: userInfo.agentId, callUuid });
|
|
19746
19795
|
}
|
|
19747
19796
|
if (data.event === SocketReceiveEvent.ERROR) {
|
|
19748
19797
|
this.setConnectAuthState("isError", true);
|
|
@@ -19752,7 +19801,8 @@ var WebCall = (() => {
|
|
|
19752
19801
|
type: "INCALL",
|
|
19753
19802
|
content: {
|
|
19754
19803
|
errCode: ErrorCode.SOKET_SERVER_ERROR,
|
|
19755
|
-
data: content
|
|
19804
|
+
data: content,
|
|
19805
|
+
callUuid
|
|
19756
19806
|
}
|
|
19757
19807
|
});
|
|
19758
19808
|
}
|
|
@@ -19764,16 +19814,25 @@ var WebCall = (() => {
|
|
|
19764
19814
|
type: "INCALL",
|
|
19765
19815
|
content: {
|
|
19766
19816
|
data: content,
|
|
19767
|
-
event: SocketReceiveEvent.SESSION_ERROR
|
|
19817
|
+
event: SocketReceiveEvent.SESSION_ERROR,
|
|
19818
|
+
callUuid
|
|
19768
19819
|
}
|
|
19769
19820
|
});
|
|
19770
19821
|
}
|
|
19771
19822
|
if (data.event === SocketReceiveEvent.AGENT_NO_ANSWER) {
|
|
19772
|
-
if (
|
|
19773
|
-
this.callKit.connect.socketTriggerHangup(
|
|
19823
|
+
if (callUuid) {
|
|
19824
|
+
this.callKit.connect.socketTriggerHangup(callUuid);
|
|
19774
19825
|
}
|
|
19775
19826
|
}
|
|
19776
|
-
|
|
19827
|
+
if (data.event === SocketReceiveEvent.AGENT_HANG_UP) {
|
|
19828
|
+
if (callUuid) {
|
|
19829
|
+
this.callKit.connect.socketTriggerHangup(callUuid);
|
|
19830
|
+
}
|
|
19831
|
+
}
|
|
19832
|
+
this.callKit.trigger(KitEvent.SERVER_SOCKET_EVENT, {
|
|
19833
|
+
...data,
|
|
19834
|
+
callUuid
|
|
19835
|
+
});
|
|
19777
19836
|
}
|
|
19778
19837
|
send(event, message) {
|
|
19779
19838
|
if (!this.connectAuthState.isConnected) {
|