@koi-design/callkit 2.1.2 → 2.1.3-beta.2

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 ADDED
@@ -0,0 +1,193 @@
1
+ # v2.1.2
2
+
3
+ ## What's Changed
4
+
5
+ - Removed redundant reset call in Socket class
6
+ - Improved ping timeout handling
7
+ - Enhanced log management with exportLog functionality
8
+ - Added log persistence support
9
+
10
+ # v2.1.1
11
+
12
+ ## What's Changed
13
+
14
+ - Bug fixes and stability improvements
15
+
16
+ # v2.1.0
17
+
18
+ ## What's Changed
19
+
20
+ - Added `isConnected` method to Socket class for better connection state management
21
+ - Enhanced socketTriggerHangup method to improve state validation and logging
22
+ - Added in-call referring state management
23
+ - Enhanced reconnect logic with isReConnected state management
24
+ - Added `excludeLogEvents` configuration to trackLogs for improved logging control
25
+ - Added socket reconnect settings configuration
26
+ - Improved refering state management and added in-call refering functionality
27
+ - Optimized trackLogs method for better readability and performance
28
+ - Updated logging structure to encapsulate data in an object for improved clarity
29
+ - Added isRefering state and related methods in Connect class
30
+ - Updated registerer setup for improved session handling
31
+ - Enhanced socket event handling with new WAITING_QUEUE constant
32
+ - Removed heartbeat management from Connect class to simplify connection handling
33
+ - Improved error handling in trackLogs method
34
+ - Added force parameter to reset method for improved reset functionality
35
+ - Enhanced SIP response logging for better visibility
36
+ - Improved error logging with event details in callback error messages
37
+
38
+ # v2.0.0
39
+
40
+ ## Breaking Changes
41
+
42
+ - Removed user status, you can now maintain user status through events yourself
43
+ - Separated registered status
44
+
45
+ ## What's Changed
46
+
47
+ - Refactored SIP reconnection and socket reconnection mechanism
48
+ - Separated call status from registered status, registered is now not associated with call status
49
+ - Optimized log output
50
+ - Optimized various details
51
+
52
+ # v1.0.24
53
+
54
+ ## What's Changed
55
+
56
+ - Added socket disconnection event. Added socket reconnection mechanism and reconnection failure event.
57
+
58
+ # v1.0.23
59
+
60
+ ## What's Changed
61
+
62
+ - login support encryptionMethod, The user can control whether to use internal encryption by setting a parameter.
63
+
64
+ # v1.0.22
65
+
66
+ ## What's Changed
67
+
68
+ - Code optimization
69
+
70
+ # v1.0.21
71
+
72
+ ## What's Changed
73
+
74
+ - Demo page, initialize CallKit address using production environment domain
75
+
76
+ # v1.0.20
77
+
78
+ ## What's Changed
79
+
80
+ - Added isAutoUpdateUserStatus optimization to config, defaults to true if not configured
81
+ - User status changed: 1, "Offline"; 2, "Online"; 3, "Break"; 4, "In Call"; 5, "Training"; 6, "Processing"
82
+ - Added html3 incoming call popup html + css reference example
83
+
84
+ # v1.0.19
85
+
86
+ ## What's Changed
87
+
88
+ - Added getInviteData to invite call invitation for data retrieval
89
+
90
+ # v1.0.18
91
+
92
+ ## What's Changed
93
+
94
+ - Added iceGatheringTimeout parameter
95
+
96
+ # v1.0.17
97
+
98
+ ## What's Changed
99
+
100
+ - Removed default handling for CALL_FAILED, currently requires user to handle actively
101
+
102
+ # v1.0.14
103
+
104
+ ## What's Changed
105
+
106
+ - Added user object, updated user status overall calls user internal functions
107
+ - Added isAutoUpdateUserStatus to config to control whether user controls user status updates
108
+
109
+ # v1.0.12
110
+
111
+ ## What's Changed
112
+
113
+ - Active hang up, user status adjusted to break
114
+ - Added AGENT_NO_ANSWER event
115
+
116
+ # v1.0.11
117
+
118
+ ## What's Changed
119
+
120
+ - Optimized user status
121
+
122
+ Login - Status: Unregistered
123
+
124
+ Sign in - Status: Idle
125
+
126
+ Dial success (received event: CALL_SUCCESS) - Status: Busy
127
+
128
+ Dial failed (received event: CALL_FAILED) - Status: Idle
129
+
130
+ Customer no answer (received event: CUSTOMER_NO_ANSWER) - Status: Break
131
+
132
+ Customer hang up (received event: CUSTOMER_HANG_UP) - Status: Break
133
+
134
+ Agent hang up (sent event: AGENT_HANG_UP) - Status: Break
135
+
136
+ Agent error (received event: ERROR) - Status: Break
137
+
138
+ - Added isRegistered method
139
+
140
+ # v1.0.10
141
+
142
+ ## What's Changed
143
+
144
+ - Agent pick up event: AGENT_PICK_UP
145
+ - Adjusted user status logic, login idle moved to sign in, sign out set to online
146
+
147
+ # v1.0.9
148
+
149
+ ## What's Changed
150
+
151
+ - Fixed active hang up callEnd duplicate trigger issue
152
+
153
+ # v1.0.8
154
+
155
+ ## What's Changed
156
+
157
+ - Fixed login detection triggered by sip signaling disConnect after logout
158
+
159
+ # v1.0.7
160
+
161
+ ## What's Changed
162
+
163
+ - Added forwarding of all socket events
164
+
165
+ # v1.0.6
166
+
167
+ ## What's Changed
168
+
169
+ - Support listening to multiple events with the same name
170
+
171
+ # v1.0.5
172
+
173
+ ## What's Changed
174
+
175
+ - Fixed socket exception reconnection
176
+
177
+ # v1.0.4
178
+
179
+ ## What's Changed
180
+
181
+ - Optimized socket connection
182
+
183
+ # v1.0.3
184
+
185
+ ## What's Changed
186
+
187
+ - Incoming call answer support
188
+
189
+ # v1.0.2
190
+
191
+ ## What's Changed
192
+
193
+ - Released initial version
package/dist/index.d.ts CHANGED
@@ -546,6 +546,10 @@ declare class Connect {
546
546
  * @returns
547
547
  */
548
548
  hangup(isUnprompted?: boolean, isError?: boolean): Promise<void>;
549
+ /**
550
+ * Terminate active call (connecting calling ringing)
551
+ */
552
+ private terminateActiveCall;
549
553
  /**
550
554
  * The remote media stream. Undefined if call not answered.
551
555
  * @param session - Session to get the media stream from.
@@ -3879,7 +3879,7 @@ var WebCall = (() => {
3879
3879
  // package.json
3880
3880
  var package_default = {
3881
3881
  name: "@koi-design/callkit",
3882
- version: "2.1.2",
3882
+ version: "2.1.3-beta.2",
3883
3883
  description: "callkit",
3884
3884
  author: "koi",
3885
3885
  license: "ISC",
@@ -19580,16 +19580,9 @@ ${log}` : log;
19580
19580
  return;
19581
19581
  try {
19582
19582
  if (isUnprompted) {
19583
- const shouldSendBye = this.isRinging() || this.isCalling();
19584
- if (shouldSendBye) {
19585
- if (this.hasInvite) {
19586
- if (this.currentSession?.state !== SessionState2.Terminated && this.currentSession?.state !== SessionState2.Terminating) {
19587
- this.currentSession.reject();
19588
- }
19589
- this.hasInvite = false;
19590
- } else {
19591
- await this.currentSession?.bye();
19592
- }
19583
+ const shouldByeOrReject = this.isRinging() || this.isCalling();
19584
+ if (shouldByeOrReject) {
19585
+ await this.terminateActiveCall();
19593
19586
  }
19594
19587
  }
19595
19588
  closeStream(this.mediaStream);
@@ -19609,12 +19602,54 @@ ${log}` : log;
19609
19602
  type: "SIP",
19610
19603
  content: {
19611
19604
  connectStatus: this.connectStatus,
19605
+ sessionState: this.currentSession?.state,
19612
19606
  isError,
19613
19607
  isUnprompted
19614
19608
  }
19615
19609
  });
19616
19610
  }
19617
19611
  }
19612
+ /**
19613
+ * Terminate active call (connecting calling ringing)
19614
+ */
19615
+ async terminateActiveCall() {
19616
+ if (this.hasInvite) {
19617
+ const canReject = this.currentSession?.state !== SessionState2.Terminated && this.currentSession?.state !== SessionState2.Terminating;
19618
+ if (canReject) {
19619
+ await this.currentSession.reject();
19620
+ }
19621
+ this.callKit.logger.info("Terminate active call: Invite reject", {
19622
+ caller: "Connect.terminateActiveCall",
19623
+ type: "SIP",
19624
+ content: {
19625
+ sessionState: this.currentSession.state
19626
+ }
19627
+ });
19628
+ this.hasInvite = false;
19629
+ return;
19630
+ }
19631
+ if (this.currentSession?.state === SessionState2.Establishing) {
19632
+ this.callKit.logger.info("Rejecting session in Establishing state", {
19633
+ caller: "Connect.terminateActiveCall",
19634
+ type: "SIP",
19635
+ content: {
19636
+ sessionState: this.currentSession.state
19637
+ }
19638
+ });
19639
+ await this.currentSession.reject();
19640
+ return;
19641
+ }
19642
+ if (this.currentSession?.state === SessionState2.Established) {
19643
+ this.callKit.logger.info("Sending BYE to established session", {
19644
+ caller: "Connect.terminateActiveCall",
19645
+ type: "SIP",
19646
+ content: {
19647
+ sessionState: this.currentSession.state
19648
+ }
19649
+ });
19650
+ await this.currentSession?.bye();
19651
+ }
19652
+ }
19618
19653
  /**
19619
19654
  * The remote media stream. Undefined if call not answered.
19620
19655
  * @param session - Session to get the media stream from.
@@ -20477,7 +20512,7 @@ ${log}` : log;
20477
20512
  connectStatus: this.connect.connectStatus
20478
20513
  }
20479
20514
  });
20480
- if (!this.connect.isConnecting() && !this.connect.isRinging() && !this.connect.isCalling() && !this.connect.isHolding()) {
20515
+ if (!this.connect.isConnecting() && !this.connect.isRinging() && !this.connect.isCalling()) {
20481
20516
  this.logger.warn("Currently not in a call", {
20482
20517
  caller: "CallKit.hangup",
20483
20518
  content: {