genesys-cloud-streaming-client 18.0.1-develop.124 → 18.0.1-develop.125

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.
@@ -42,6 +42,7 @@ export declare class WebrtcExtension extends EventEmitter implements StreamingCl
42
42
  private iceServers;
43
43
  private stanzaInstance?;
44
44
  private webrtcSessions;
45
+ private reinviteCache;
45
46
  get jid(): string | undefined;
46
47
  constructor(client: Client, clientOptions: IClientOptions);
47
48
  private onOnlineStatusChange;
@@ -57,6 +57,12 @@ class WebrtcExtension extends events_1.EventEmitter {
57
57
  this.discoRetries = 0;
58
58
  this.iceServers = [];
59
59
  this.webrtcSessions = [];
60
+ // Store a maximum of 5 previous non-duplicate reinvites.
61
+ // These will automatically be purged after three minutes.
62
+ this.reinviteCache = new lru_cache_1.LRUCache({
63
+ max: 5,
64
+ ttl: 1000 * 60 * 3
65
+ });
60
66
  this.client = client;
61
67
  this.config = {
62
68
  allowIPv6: clientOptions.allowIPv6 === true,
@@ -151,6 +157,16 @@ class WebrtcExtension extends events_1.EventEmitter {
151
157
  async handleGenesysOffer(iq) {
152
158
  const message = iq.genesysWebrtc;
153
159
  const params = message.params;
160
+ // XMPP-SIP-Gateway will repeat reinvite offers until the client has responded.
161
+ // We don't want to process the duplicate reinvites and instead will ignore them.
162
+ if (params.reinvite && this.reinviteCache.get(message.id)) {
163
+ this.logger.info('Ignoring duplicate reinvite offer', message.id);
164
+ return;
165
+ }
166
+ // If the reinvite isn't a duplicate, we should cache it so we can check against new offers.
167
+ if (params.reinvite) {
168
+ this.reinviteCache.set(message.id, true);
169
+ }
154
170
  const ignoreHostCandidatesForForceTurnFF = this.getIceTransportPolicy() === 'relay' && browserama_1.isFirefox;
155
171
  const commonParams = {
156
172
  id: params.sessionId,
@@ -17,6 +17,6 @@
17
17
  "file": "v18/streaming-client.browser.js"
18
18
  }
19
19
  ],
20
- "build": "124",
21
- "buildDate": "2025-01-03T08:00:08.746147971Z"
20
+ "build": "125",
21
+ "buildDate": "2025-01-14T19:50:26.073074953Z"
22
22
  }
@@ -31993,6 +31993,12 @@ class WebrtcExtension extends EventEmitter {
31993
31993
  this.discoRetries = 0;
31994
31994
  this.iceServers = [];
31995
31995
  this.webrtcSessions = [];
31996
+ // Store a maximum of 5 previous non-duplicate reinvites.
31997
+ // These will automatically be purged after three minutes.
31998
+ this.reinviteCache = new LRUCache({
31999
+ max: 5,
32000
+ ttl: 1000 * 60 * 3
32001
+ });
31996
32002
  this.client = client;
31997
32003
  this.config = {
31998
32004
  allowIPv6: clientOptions.allowIPv6 === true,
@@ -32092,6 +32098,16 @@ class WebrtcExtension extends EventEmitter {
32092
32098
  return __awaiter$5(this, void 0, void 0, function* () {
32093
32099
  const message = iq.genesysWebrtc;
32094
32100
  const params = message.params;
32101
+ // XMPP-SIP-Gateway will repeat reinvite offers until the client has responded.
32102
+ // We don't want to process the duplicate reinvites and instead will ignore them.
32103
+ if (params.reinvite && this.reinviteCache.get(message.id)) {
32104
+ this.logger.info('Ignoring duplicate reinvite offer', message.id);
32105
+ return;
32106
+ }
32107
+ // If the reinvite isn't a duplicate, we should cache it so we can check against new offers.
32108
+ if (params.reinvite) {
32109
+ this.reinviteCache.set(message.id, true);
32110
+ }
32095
32111
  const ignoreHostCandidatesForForceTurnFF = this.getIceTransportPolicy() === 'relay' && browserama_min.exports.isFirefox;
32096
32112
  const commonParams = {
32097
32113
  id: params.sessionId,
@@ -42,6 +42,7 @@ export declare class WebrtcExtension extends EventEmitter implements StreamingCl
42
42
  private iceServers;
43
43
  private stanzaInstance?;
44
44
  private webrtcSessions;
45
+ private reinviteCache;
45
46
  get jid(): string | undefined;
46
47
  constructor(client: Client, clientOptions: IClientOptions);
47
48
  private onOnlineStatusChange;
package/dist/es/webrtc.js CHANGED
@@ -54,6 +54,12 @@ export class WebrtcExtension extends EventEmitter {
54
54
  this.discoRetries = 0;
55
55
  this.iceServers = [];
56
56
  this.webrtcSessions = [];
57
+ // Store a maximum of 5 previous non-duplicate reinvites.
58
+ // These will automatically be purged after three minutes.
59
+ this.reinviteCache = new LRUCache({
60
+ max: 5,
61
+ ttl: 1000 * 60 * 3
62
+ });
57
63
  this.client = client;
58
64
  this.config = {
59
65
  allowIPv6: clientOptions.allowIPv6 === true,
@@ -153,6 +159,16 @@ export class WebrtcExtension extends EventEmitter {
153
159
  return __awaiter(this, void 0, void 0, function* () {
154
160
  const message = iq.genesysWebrtc;
155
161
  const params = message.params;
162
+ // XMPP-SIP-Gateway will repeat reinvite offers until the client has responded.
163
+ // We don't want to process the duplicate reinvites and instead will ignore them.
164
+ if (params.reinvite && this.reinviteCache.get(message.id)) {
165
+ this.logger.info('Ignoring duplicate reinvite offer', message.id);
166
+ return;
167
+ }
168
+ // If the reinvite isn't a duplicate, we should cache it so we can check against new offers.
169
+ if (params.reinvite) {
170
+ this.reinviteCache.set(message.id, true);
171
+ }
156
172
  const ignoreHostCandidatesForForceTurnFF = this.getIceTransportPolicy() === 'relay' && isFirefox;
157
173
  const commonParams = {
158
174
  id: params.sessionId,
@@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
7
  # [Unreleased](https://github.com/purecloudlabs/genesys-cloud-streaming-client/compare/v18.0.0...HEAD)
8
+ ### Changed
9
+ * [STREAM-313](https://inindca.atlassian.net/browse/STREAM-313) - Streaming-client will ignore duplicate reinvite offers.
10
+
8
11
  ### Breaking Changes
9
12
  * Lru-cache was upgraded from v6 to v11, which uses newer language features. Depending on your language target version, you may need to configure a transpiler accordingly. For example, we added `plugin-proposal-class-properties` and `plugin-transform-private-methods` to our Babel config for streaming-client.
10
13
 
@@ -42,6 +42,7 @@ export declare class WebrtcExtension extends EventEmitter implements StreamingCl
42
42
  private iceServers;
43
43
  private stanzaInstance?;
44
44
  private webrtcSessions;
45
+ private reinviteCache;
45
46
  get jid(): string | undefined;
46
47
  constructor(client: Client, clientOptions: IClientOptions);
47
48
  private onOnlineStatusChange;
@@ -57,6 +57,12 @@ class WebrtcExtension extends events_1.EventEmitter {
57
57
  this.discoRetries = 0;
58
58
  this.iceServers = [];
59
59
  this.webrtcSessions = [];
60
+ // Store a maximum of 5 previous non-duplicate reinvites.
61
+ // These will automatically be purged after three minutes.
62
+ this.reinviteCache = new lru_cache_1.LRUCache({
63
+ max: 5,
64
+ ttl: 1000 * 60 * 3
65
+ });
60
66
  this.client = client;
61
67
  this.config = {
62
68
  allowIPv6: clientOptions.allowIPv6 === true,
@@ -151,6 +157,16 @@ class WebrtcExtension extends events_1.EventEmitter {
151
157
  async handleGenesysOffer(iq) {
152
158
  const message = iq.genesysWebrtc;
153
159
  const params = message.params;
160
+ // XMPP-SIP-Gateway will repeat reinvite offers until the client has responded.
161
+ // We don't want to process the duplicate reinvites and instead will ignore them.
162
+ if (params.reinvite && this.reinviteCache.get(message.id)) {
163
+ this.logger.info('Ignoring duplicate reinvite offer', message.id);
164
+ return;
165
+ }
166
+ // If the reinvite isn't a duplicate, we should cache it so we can check against new offers.
167
+ if (params.reinvite) {
168
+ this.reinviteCache.set(message.id, true);
169
+ }
154
170
  const ignoreHostCandidatesForForceTurnFF = this.getIceTransportPolicy() === 'relay' && browserama_1.isFirefox;
155
171
  const commonParams = {
156
172
  id: params.sessionId,