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

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.
@@ -34,6 +34,7 @@ class GenesysCloudMediaSession {
34
34
  this.allowTCP = !!params.allowTCP;
35
35
  this.reinvite = !!params.reinvite;
36
36
  this.privAnswerMode = params.privAnswerMode;
37
+ this.meetingId = params.meetingId;
37
38
  // babel does not like the typescript recipe for multiple extends so we are hacking this one
38
39
  // referencing https://github.com/babel/babel/issues/798
39
40
  const eventEmitter = new events_1.EventEmitter();
@@ -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,
@@ -177,6 +193,7 @@ class WebrtcExtension extends events_1.EventEmitter {
177
193
  originalRoomJid: pendingSession.originalRoomJid,
178
194
  privAnswerMode: pendingSession.privAnswerMode
179
195
  };
196
+ delete this.pendingSessions[pendingSession.sessionId];
180
197
  }
181
198
  else {
182
199
  mediaSessionParams = commonParams;
@@ -284,15 +301,13 @@ class WebrtcExtension extends events_1.EventEmitter {
284
301
  }
285
302
  prepareSession(options) {
286
303
  const pendingSession = this.pendingSessions[options.sid];
287
- // TODO: when we can safely remove the jingle session handling, this pending session
288
- // will need to be deleted in the `handleGenesysOffer` fn.
289
- if (pendingSession) {
290
- delete this.pendingSessions[pendingSession.sessionId];
291
- }
292
304
  if (pendingSession === null || pendingSession === void 0 ? void 0 : pendingSession.sdpOverXmpp) {
293
305
  this.logger.debug('skipping creation of jingle webrtc session due to sdpOverXmpp on the pendingSession');
294
306
  return;
295
307
  }
308
+ if (pendingSession) {
309
+ delete this.pendingSessions[pendingSession.sessionId];
310
+ }
296
311
  const ignoreHostCandidatesForForceTurnFF = this.getIceTransportPolicy() === 'relay' && browserama_1.isFirefox;
297
312
  const gcSessionOpts = {
298
313
  options,
@@ -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": "126",
21
+ "buildDate": "2025-01-16T19:49:50.170135360Z"
22
22
  }
@@ -31445,6 +31445,7 @@ class GenesysCloudMediaSession {
31445
31445
  this.allowTCP = !!params.allowTCP;
31446
31446
  this.reinvite = !!params.reinvite;
31447
31447
  this.privAnswerMode = params.privAnswerMode;
31448
+ this.meetingId = params.meetingId;
31448
31449
  // babel does not like the typescript recipe for multiple extends so we are hacking this one
31449
31450
  // referencing https://github.com/babel/babel/issues/798
31450
31451
  const eventEmitter = new EventEmitter();
@@ -31993,6 +31994,12 @@ class WebrtcExtension extends EventEmitter {
31993
31994
  this.discoRetries = 0;
31994
31995
  this.iceServers = [];
31995
31996
  this.webrtcSessions = [];
31997
+ // Store a maximum of 5 previous non-duplicate reinvites.
31998
+ // These will automatically be purged after three minutes.
31999
+ this.reinviteCache = new LRUCache({
32000
+ max: 5,
32001
+ ttl: 1000 * 60 * 3
32002
+ });
31996
32003
  this.client = client;
31997
32004
  this.config = {
31998
32005
  allowIPv6: clientOptions.allowIPv6 === true,
@@ -32092,6 +32099,16 @@ class WebrtcExtension extends EventEmitter {
32092
32099
  return __awaiter$5(this, void 0, void 0, function* () {
32093
32100
  const message = iq.genesysWebrtc;
32094
32101
  const params = message.params;
32102
+ // XMPP-SIP-Gateway will repeat reinvite offers until the client has responded.
32103
+ // We don't want to process the duplicate reinvites and instead will ignore them.
32104
+ if (params.reinvite && this.reinviteCache.get(message.id)) {
32105
+ this.logger.info('Ignoring duplicate reinvite offer', message.id);
32106
+ return;
32107
+ }
32108
+ // If the reinvite isn't a duplicate, we should cache it so we can check against new offers.
32109
+ if (params.reinvite) {
32110
+ this.reinviteCache.set(message.id, true);
32111
+ }
32095
32112
  const ignoreHostCandidatesForForceTurnFF = this.getIceTransportPolicy() === 'relay' && browserama_min.exports.isFirefox;
32096
32113
  const commonParams = {
32097
32114
  id: params.sessionId,
@@ -32112,6 +32129,7 @@ class WebrtcExtension extends EventEmitter {
32112
32129
  const pendingSession = this.pendingSessions[params.sessionId];
32113
32130
  if (pendingSession) {
32114
32131
  mediaSessionParams = Object.assign(Object.assign({}, commonParams), { meetingId: pendingSession.meetingId, fromUserId: pendingSession.fromUserId, originalRoomJid: pendingSession.originalRoomJid, privAnswerMode: pendingSession.privAnswerMode });
32132
+ delete this.pendingSessions[pendingSession.sessionId];
32115
32133
  }
32116
32134
  else {
32117
32135
  mediaSessionParams = commonParams;
@@ -32232,15 +32250,13 @@ class WebrtcExtension extends EventEmitter {
32232
32250
  }
32233
32251
  prepareSession(options) {
32234
32252
  const pendingSession = this.pendingSessions[options.sid];
32235
- // TODO: when we can safely remove the jingle session handling, this pending session
32236
- // will need to be deleted in the `handleGenesysOffer` fn.
32237
- if (pendingSession) {
32238
- delete this.pendingSessions[pendingSession.sessionId];
32239
- }
32240
32253
  if (pendingSession === null || pendingSession === void 0 ? void 0 : pendingSession.sdpOverXmpp) {
32241
32254
  this.logger.debug('skipping creation of jingle webrtc session due to sdpOverXmpp on the pendingSession');
32242
32255
  return;
32243
32256
  }
32257
+ if (pendingSession) {
32258
+ delete this.pendingSessions[pendingSession.sessionId];
32259
+ }
32244
32260
  const ignoreHostCandidatesForForceTurnFF = this.getIceTransportPolicy() === 'relay' && browserama_min.exports.isFirefox;
32245
32261
  const gcSessionOpts = {
32246
32262
  options,
@@ -31,6 +31,7 @@ export class GenesysCloudMediaSession {
31
31
  this.allowTCP = !!params.allowTCP;
32
32
  this.reinvite = !!params.reinvite;
33
33
  this.privAnswerMode = params.privAnswerMode;
34
+ this.meetingId = params.meetingId;
34
35
  // babel does not like the typescript recipe for multiple extends so we are hacking this one
35
36
  // referencing https://github.com/babel/babel/issues/798
36
37
  const eventEmitter = new EventEmitter();
@@ -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,
@@ -173,6 +189,7 @@ export class WebrtcExtension extends EventEmitter {
173
189
  const pendingSession = this.pendingSessions[params.sessionId];
174
190
  if (pendingSession) {
175
191
  mediaSessionParams = Object.assign(Object.assign({}, commonParams), { meetingId: pendingSession.meetingId, fromUserId: pendingSession.fromUserId, originalRoomJid: pendingSession.originalRoomJid, privAnswerMode: pendingSession.privAnswerMode });
192
+ delete this.pendingSessions[pendingSession.sessionId];
176
193
  }
177
194
  else {
178
195
  mediaSessionParams = commonParams;
@@ -293,15 +310,13 @@ export class WebrtcExtension extends EventEmitter {
293
310
  }
294
311
  prepareSession(options) {
295
312
  const pendingSession = this.pendingSessions[options.sid];
296
- // TODO: when we can safely remove the jingle session handling, this pending session
297
- // will need to be deleted in the `handleGenesysOffer` fn.
298
- if (pendingSession) {
299
- delete this.pendingSessions[pendingSession.sessionId];
300
- }
301
313
  if (pendingSession === null || pendingSession === void 0 ? void 0 : pendingSession.sdpOverXmpp) {
302
314
  this.logger.debug('skipping creation of jingle webrtc session due to sdpOverXmpp on the pendingSession');
303
315
  return;
304
316
  }
317
+ if (pendingSession) {
318
+ delete this.pendingSessions[pendingSession.sessionId];
319
+ }
305
320
  const ignoreHostCandidatesForForceTurnFF = this.getIceTransportPolicy() === 'relay' && isFirefox;
306
321
  const gcSessionOpts = {
307
322
  options,
@@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8
8
  ### Breaking Changes
9
9
  * 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
10
 
11
+ ### Changed
12
+ * [STREAM-313](https://inindca.atlassian.net/browse/STREAM-313) - Streaming-client will ignore duplicate reinvite offers.
13
+ * [PCM-2081](https://inindca.atlassian.net/browse/PCM-2081) - Set meetingId when initializing GenesysCloudMediaSessions and only delete pending sessions when processed for the right session type.
14
+
11
15
  ### Fixed
12
16
  * [STREAM-207](https://inindca.atlassian.net/browse/STREAM-207) - [STREAM-207] handle ice candidates received before the offer (sdpOverXmpp only)
13
17
 
@@ -34,6 +34,7 @@ class GenesysCloudMediaSession {
34
34
  this.allowTCP = !!params.allowTCP;
35
35
  this.reinvite = !!params.reinvite;
36
36
  this.privAnswerMode = params.privAnswerMode;
37
+ this.meetingId = params.meetingId;
37
38
  // babel does not like the typescript recipe for multiple extends so we are hacking this one
38
39
  // referencing https://github.com/babel/babel/issues/798
39
40
  const eventEmitter = new events_1.EventEmitter();
@@ -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,
@@ -177,6 +193,7 @@ class WebrtcExtension extends events_1.EventEmitter {
177
193
  originalRoomJid: pendingSession.originalRoomJid,
178
194
  privAnswerMode: pendingSession.privAnswerMode
179
195
  };
196
+ delete this.pendingSessions[pendingSession.sessionId];
180
197
  }
181
198
  else {
182
199
  mediaSessionParams = commonParams;
@@ -284,15 +301,13 @@ class WebrtcExtension extends events_1.EventEmitter {
284
301
  }
285
302
  prepareSession(options) {
286
303
  const pendingSession = this.pendingSessions[options.sid];
287
- // TODO: when we can safely remove the jingle session handling, this pending session
288
- // will need to be deleted in the `handleGenesysOffer` fn.
289
- if (pendingSession) {
290
- delete this.pendingSessions[pendingSession.sessionId];
291
- }
292
304
  if (pendingSession === null || pendingSession === void 0 ? void 0 : pendingSession.sdpOverXmpp) {
293
305
  this.logger.debug('skipping creation of jingle webrtc session due to sdpOverXmpp on the pendingSession');
294
306
  return;
295
307
  }
308
+ if (pendingSession) {
309
+ delete this.pendingSessions[pendingSession.sessionId];
310
+ }
296
311
  const ignoreHostCandidatesForForceTurnFF = this.getIceTransportPolicy() === 'relay' && browserama_1.isFirefox;
297
312
  const gcSessionOpts = {
298
313
  options,