@vonage/client-sdk 2.7.2 → 2.7.4

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.
@@ -543,12 +543,6 @@ function requireKotlinKotlinStdlib () {
543
543
  };
544
544
  }(Math.log, Math.LN2);
545
545
  }
546
- if (typeof String.prototype.startsWith === 'undefined') {
547
- Object.defineProperty(String.prototype, 'startsWith', {value: function (searchString, position) {
548
- position = position || 0;
549
- return this.lastIndexOf(searchString, position) === position;
550
- }});
551
- }
552
546
  if (typeof String.prototype.endsWith === 'undefined') {
553
547
  Object.defineProperty(String.prototype, 'endsWith', {value: function (searchString, position) {
554
548
  var subjectString = this.toString();
@@ -560,6 +554,12 @@ function requireKotlinKotlinStdlib () {
560
554
  return lastIndex !== -1 && lastIndex === position;
561
555
  }});
562
556
  }
557
+ if (typeof String.prototype.startsWith === 'undefined') {
558
+ Object.defineProperty(String.prototype, 'startsWith', {value: function (searchString, position) {
559
+ position = position || 0;
560
+ return this.lastIndexOf(searchString, position) === position;
561
+ }});
562
+ }
563
563
  //endregion
564
564
  (function (factory) {
565
565
  if (typeof undefined === 'function' && undefined.amd)
@@ -26291,9 +26291,6 @@ function requireClientsdkClientcore () {
26291
26291
  initMetadataForCompanion(Companion_150);
26292
26292
  initMetadataForObject($serializer_173, '$serializer', VOID, VOID, [GeneratedSerializer]);
26293
26293
  initMetadataForClass(SessionTerminatedEvent, 'SessionTerminatedEvent', VOID, VOID, [SocketEvent], VOID, VOID, {0: $serializer_getInstance_173});
26294
- function onConversationEvent(event) {
26295
- }
26296
- initMetadataForInterface(ConversationEventListener, 'ConversationEventListener');
26297
26294
  function onRTCHangup(conversationId, legId, hangup) {
26298
26295
  }
26299
26296
  function onRTCTransfer(conversationId, legId) {
@@ -26310,7 +26307,10 @@ function requireClientsdkClientcore () {
26310
26307
  function onAudioDTMFUpdate(conversationId, legId, digits) {
26311
26308
  }
26312
26309
  initMetadataForInterface(AudioEventListener, 'AudioEventListener');
26313
- initMetadataForClass(ChatAPIImpl$1, VOID, VOID, VOID, [ConversationEventListener, RTCEventListener, AudioEventListener]);
26310
+ function onConversationEvent(event) {
26311
+ }
26312
+ initMetadataForInterface(ConversationEventListener, 'ConversationEventListener');
26313
+ initMetadataForClass(ChatAPIImpl$1, VOID, VOID, VOID, [RTCEventListener, AudioEventListener, ConversationEventListener]);
26314
26314
  initMetadataForClass(ChatAPIImpl, 'ChatAPIImpl', VOID, VOID, [ChatAPI]);
26315
26315
  initMetadataForClass(LoggingLevel, 'LoggingLevel', VOID, Enum);
26316
26316
  initMetadataForObject(DefaultConfig, 'DefaultConfig');
@@ -26471,7 +26471,7 @@ function requireClientsdkClientcore () {
26471
26471
  initMetadataForClass(HangupReason, 'HangupReason', VOID, Enum);
26472
26472
  initMetadataForClass(LegStatus, 'LegStatus', VOID, Enum);
26473
26473
  initMetadataForClass(CallDisconnectReason, 'CallDisconnectReason', VOID, Enum);
26474
- initMetadataForClass(VoiceAPIImpl$1, VOID, VOID, VOID, [ConversationEventListener, RTCEventListener, AudioEventListener]);
26474
+ initMetadataForClass(VoiceAPIImpl$1, VOID, VOID, VOID, [RTCEventListener, AudioEventListener, ConversationEventListener]);
26475
26475
  initMetadataForClass(VoiceAPIImpl, 'VoiceAPIImpl');
26476
26476
  initMetadataForInterface(CallEvent, 'CallEvent');
26477
26477
  initMetadataForClass(SetupOutboundCall, 'SetupOutboundCall', VOID, VOID, [CallEvent]);
@@ -26700,7 +26700,7 @@ function requireClientsdkClientcore () {
26700
26700
  initMetadataForClass(runAfterDelay$1);
26701
26701
  //endregion
26702
26702
  function BuildKonfig() {
26703
- this.i1i_1 = '2.7.2';
26703
+ this.i1i_1 = '2.7.4';
26704
26704
  }
26705
26705
  var BuildKonfig_instance;
26706
26706
  function BuildKonfig_getInstance() {
@@ -63766,6 +63766,17 @@ function requireClientsdkClientcore () {
63766
63766
  return Unit_instance;
63767
63767
  };
63768
63768
  }
63769
+ function VoiceAPIImpl$serverCall$lambda(this$0, $context, $callback) {
63770
+ return function () {
63771
+ var session = this$0.k3q_1.e1j(getKClass(SessionReducer)).a2c_1.c2();
63772
+ var tmp;
63773
+ if (!(session instanceof Active_0)) {
63774
+ return false;
63775
+ }
63776
+ attemptOutboundCall(this$0, session.a36_1.y3c_1, session.z35_1, $context, 1, null, $callback);
63777
+ return true;
63778
+ };
63779
+ }
63769
63780
  function VoiceAPIImpl$attemptOutboundCall$lambda$lambda$lambda$lambda(this$0, $call, $callback, $legId, $sessionId) {
63770
63781
  return function (it) {
63771
63782
  var tmp;
@@ -65145,12 +65156,10 @@ function requireClientsdkClientcore () {
65145
65156
  return withCoreLock(VoiceAPIImpl$getCallLegs$lambda(this, callback, callId, parameters));
65146
65157
  };
65147
65158
  protoOf(VoiceAPIImpl).t1q = function (context, callback) {
65148
- var session = this.k3q_1.e1j(getKClass(SessionReducer)).a2c_1.c2();
65149
- if (!(session instanceof Active_0)) {
65159
+ var started = withCoreLock(VoiceAPIImpl$serverCall$lambda(this, context, callback));
65160
+ if (!started) {
65150
65161
  invokeCallbackWithError(new SessionNoActiveSessionError(), callback);
65151
- return Unit_instance;
65152
65162
  }
65153
- attemptOutboundCall(this, session.a36_1.y3c_1, session.z35_1, context, 1, null, callback);
65154
65163
  };
65155
65164
  protoOf(VoiceAPIImpl).u1q = function (callId, callback) {
65156
65165
  return withCoreLock(VoiceAPIImpl$reconnectCall$lambda(this, callback, callId));
@@ -84208,6 +84217,11 @@ function pcSetupEventOfSignalingState(state) {
84208
84217
  class MediaClient {
84209
84218
  constructor() {
84210
84219
  this.pcs = new Map();
84220
+ /**
84221
+ * Per leg, so a second leg (a transfer) collects stats too and one leg ending cannot stop
84222
+ * collection for the others.
84223
+ */
84224
+ this.statsTimers = new Map();
84211
84225
  this.pcListeners = new WeakMap();
84212
84226
  this.audio = undefined;
84213
84227
  }
@@ -84232,18 +84246,28 @@ class MediaClient {
84232
84246
  if (!pc) {
84233
84247
  return closure(new clientsdkClientcore_jsExports.vonage.PeerConnectionNotFoundJS(id));
84234
84248
  }
84235
- this.intervalId = setInterval(() => {
84249
+ if (this.statsTimers.has(id)) {
84250
+ return closure(null);
84251
+ }
84252
+ this.statsTimers.set(id, setInterval(() => {
84236
84253
  if (pc.connectionState != 'connected') {
84237
- clearTimeout(this.intervalId);
84254
+ this.stopRtcStatsCollection(id);
84238
84255
  return;
84239
84256
  }
84240
84257
  pc.getStats().then((result) => {
84241
84258
  var _a;
84242
84259
  (_a = this.delegate) === null || _a === void 0 ? void 0 : _a.onRawRtcStats(id, toRawRtcStats(result));
84243
84260
  });
84244
- }, interval);
84261
+ }, interval));
84245
84262
  closure(null);
84246
84263
  }
84264
+ stopRtcStatsCollection(id) {
84265
+ const timer = this.statsTimers.get(id);
84266
+ if (timer !== undefined) {
84267
+ clearInterval(timer);
84268
+ this.statsTimers.delete(id);
84269
+ }
84270
+ }
84247
84271
  enableMediaInbound(rtcId, offerSDP, closure) {
84248
84272
  return __awaiter(this, void 0, void 0, function* () {
84249
84273
  try {
@@ -84415,6 +84439,7 @@ class MediaClient {
84415
84439
  return closure(null);
84416
84440
  }
84417
84441
  this.pcs.delete(id); // Remove from map before closing connection so size check in closePeerConnection is accurate
84442
+ this.stopRtcStatsCollection(id);
84418
84443
  // trigger state change manually
84419
84444
  (_a = this.delegate) === null || _a === void 0 ? void 0 : _a.onConnectionChange(id, 'closed');
84420
84445
  this.closePeerConnection(pc);
@@ -519,12 +519,6 @@ function requireKotlinKotlinStdlib () {
519
519
  };
520
520
  }(Math.log, Math.LN2);
521
521
  }
522
- if (typeof String.prototype.startsWith === 'undefined') {
523
- Object.defineProperty(String.prototype, 'startsWith', {value: function (searchString, position) {
524
- position = position || 0;
525
- return this.lastIndexOf(searchString, position) === position;
526
- }});
527
- }
528
522
  if (typeof String.prototype.endsWith === 'undefined') {
529
523
  Object.defineProperty(String.prototype, 'endsWith', {value: function (searchString, position) {
530
524
  var subjectString = this.toString();
@@ -536,6 +530,12 @@ function requireKotlinKotlinStdlib () {
536
530
  return lastIndex !== -1 && lastIndex === position;
537
531
  }});
538
532
  }
533
+ if (typeof String.prototype.startsWith === 'undefined') {
534
+ Object.defineProperty(String.prototype, 'startsWith', {value: function (searchString, position) {
535
+ position = position || 0;
536
+ return this.lastIndexOf(searchString, position) === position;
537
+ }});
538
+ }
539
539
  //endregion
540
540
  (function (factory) {
541
541
  if (typeof undefined === 'function' && undefined.amd)
@@ -26267,9 +26267,6 @@ function requireClientsdkClientcore () {
26267
26267
  initMetadataForCompanion(Companion_150);
26268
26268
  initMetadataForObject($serializer_173, '$serializer', VOID, VOID, [GeneratedSerializer]);
26269
26269
  initMetadataForClass(SessionTerminatedEvent, 'SessionTerminatedEvent', VOID, VOID, [SocketEvent], VOID, VOID, {0: $serializer_getInstance_173});
26270
- function onConversationEvent(event) {
26271
- }
26272
- initMetadataForInterface(ConversationEventListener, 'ConversationEventListener');
26273
26270
  function onRTCHangup(conversationId, legId, hangup) {
26274
26271
  }
26275
26272
  function onRTCTransfer(conversationId, legId) {
@@ -26286,7 +26283,10 @@ function requireClientsdkClientcore () {
26286
26283
  function onAudioDTMFUpdate(conversationId, legId, digits) {
26287
26284
  }
26288
26285
  initMetadataForInterface(AudioEventListener, 'AudioEventListener');
26289
- initMetadataForClass(ChatAPIImpl$1, VOID, VOID, VOID, [ConversationEventListener, RTCEventListener, AudioEventListener]);
26286
+ function onConversationEvent(event) {
26287
+ }
26288
+ initMetadataForInterface(ConversationEventListener, 'ConversationEventListener');
26289
+ initMetadataForClass(ChatAPIImpl$1, VOID, VOID, VOID, [RTCEventListener, AudioEventListener, ConversationEventListener]);
26290
26290
  initMetadataForClass(ChatAPIImpl, 'ChatAPIImpl', VOID, VOID, [ChatAPI]);
26291
26291
  initMetadataForClass(LoggingLevel, 'LoggingLevel', VOID, Enum);
26292
26292
  initMetadataForObject(DefaultConfig, 'DefaultConfig');
@@ -26447,7 +26447,7 @@ function requireClientsdkClientcore () {
26447
26447
  initMetadataForClass(HangupReason, 'HangupReason', VOID, Enum);
26448
26448
  initMetadataForClass(LegStatus, 'LegStatus', VOID, Enum);
26449
26449
  initMetadataForClass(CallDisconnectReason, 'CallDisconnectReason', VOID, Enum);
26450
- initMetadataForClass(VoiceAPIImpl$1, VOID, VOID, VOID, [ConversationEventListener, RTCEventListener, AudioEventListener]);
26450
+ initMetadataForClass(VoiceAPIImpl$1, VOID, VOID, VOID, [RTCEventListener, AudioEventListener, ConversationEventListener]);
26451
26451
  initMetadataForClass(VoiceAPIImpl, 'VoiceAPIImpl');
26452
26452
  initMetadataForInterface(CallEvent, 'CallEvent');
26453
26453
  initMetadataForClass(SetupOutboundCall, 'SetupOutboundCall', VOID, VOID, [CallEvent]);
@@ -26676,7 +26676,7 @@ function requireClientsdkClientcore () {
26676
26676
  initMetadataForClass(runAfterDelay$1);
26677
26677
  //endregion
26678
26678
  function BuildKonfig() {
26679
- this.i1i_1 = '2.7.2';
26679
+ this.i1i_1 = '2.7.4';
26680
26680
  }
26681
26681
  var BuildKonfig_instance;
26682
26682
  function BuildKonfig_getInstance() {
@@ -63742,6 +63742,17 @@ function requireClientsdkClientcore () {
63742
63742
  return Unit_instance;
63743
63743
  };
63744
63744
  }
63745
+ function VoiceAPIImpl$serverCall$lambda(this$0, $context, $callback) {
63746
+ return function () {
63747
+ var session = this$0.k3q_1.e1j(getKClass(SessionReducer)).a2c_1.c2();
63748
+ var tmp;
63749
+ if (!(session instanceof Active_0)) {
63750
+ return false;
63751
+ }
63752
+ attemptOutboundCall(this$0, session.a36_1.y3c_1, session.z35_1, $context, 1, null, $callback);
63753
+ return true;
63754
+ };
63755
+ }
63745
63756
  function VoiceAPIImpl$attemptOutboundCall$lambda$lambda$lambda$lambda(this$0, $call, $callback, $legId, $sessionId) {
63746
63757
  return function (it) {
63747
63758
  var tmp;
@@ -65121,12 +65132,10 @@ function requireClientsdkClientcore () {
65121
65132
  return withCoreLock(VoiceAPIImpl$getCallLegs$lambda(this, callback, callId, parameters));
65122
65133
  };
65123
65134
  protoOf(VoiceAPIImpl).t1q = function (context, callback) {
65124
- var session = this.k3q_1.e1j(getKClass(SessionReducer)).a2c_1.c2();
65125
- if (!(session instanceof Active_0)) {
65135
+ var started = withCoreLock(VoiceAPIImpl$serverCall$lambda(this, context, callback));
65136
+ if (!started) {
65126
65137
  invokeCallbackWithError(new SessionNoActiveSessionError(), callback);
65127
- return Unit_instance;
65128
65138
  }
65129
- attemptOutboundCall(this, session.a36_1.y3c_1, session.z35_1, context, 1, null, callback);
65130
65139
  };
65131
65140
  protoOf(VoiceAPIImpl).u1q = function (callId, callback) {
65132
65141
  return withCoreLock(VoiceAPIImpl$reconnectCall$lambda(this, callback, callId));
@@ -84184,6 +84193,11 @@ function pcSetupEventOfSignalingState(state) {
84184
84193
  class MediaClient {
84185
84194
  constructor() {
84186
84195
  this.pcs = new Map();
84196
+ /**
84197
+ * Per leg, so a second leg (a transfer) collects stats too and one leg ending cannot stop
84198
+ * collection for the others.
84199
+ */
84200
+ this.statsTimers = new Map();
84187
84201
  this.pcListeners = new WeakMap();
84188
84202
  this.audio = undefined;
84189
84203
  }
@@ -84208,18 +84222,28 @@ class MediaClient {
84208
84222
  if (!pc) {
84209
84223
  return closure(new clientsdkClientcore_jsExports.vonage.PeerConnectionNotFoundJS(id));
84210
84224
  }
84211
- this.intervalId = setInterval(() => {
84225
+ if (this.statsTimers.has(id)) {
84226
+ return closure(null);
84227
+ }
84228
+ this.statsTimers.set(id, setInterval(() => {
84212
84229
  if (pc.connectionState != 'connected') {
84213
- clearTimeout(this.intervalId);
84230
+ this.stopRtcStatsCollection(id);
84214
84231
  return;
84215
84232
  }
84216
84233
  pc.getStats().then((result) => {
84217
84234
  var _a;
84218
84235
  (_a = this.delegate) === null || _a === void 0 ? void 0 : _a.onRawRtcStats(id, toRawRtcStats(result));
84219
84236
  });
84220
- }, interval);
84237
+ }, interval));
84221
84238
  closure(null);
84222
84239
  }
84240
+ stopRtcStatsCollection(id) {
84241
+ const timer = this.statsTimers.get(id);
84242
+ if (timer !== undefined) {
84243
+ clearInterval(timer);
84244
+ this.statsTimers.delete(id);
84245
+ }
84246
+ }
84223
84247
  enableMediaInbound(rtcId, offerSDP, closure) {
84224
84248
  return __awaiter(this, void 0, void 0, function* () {
84225
84249
  try {
@@ -84391,6 +84415,7 @@ class MediaClient {
84391
84415
  return closure(null);
84392
84416
  }
84393
84417
  this.pcs.delete(id); // Remove from map before closing connection so size check in closePeerConnection is accurate
84418
+ this.stopRtcStatsCollection(id);
84394
84419
  // trigger state change manually
84395
84420
  (_a = this.delegate) === null || _a === void 0 ? void 0 : _a.onConnectionChange(id, 'closed');
84396
84421
  this.closePeerConnection(pc);
@@ -135,12 +135,6 @@
135
135
  };
136
136
  }(Math.log, Math.LN2);
137
137
  }
138
- if (typeof String.prototype.startsWith === 'undefined') {
139
- Object.defineProperty(String.prototype, 'startsWith', {value: function (searchString, position) {
140
- position = position || 0;
141
- return this.lastIndexOf(searchString, position) === position;
142
- }});
143
- }
144
138
  if (typeof String.prototype.endsWith === 'undefined') {
145
139
  Object.defineProperty(String.prototype, 'endsWith', {value: function (searchString, position) {
146
140
  var subjectString = this.toString();
@@ -152,6 +146,12 @@
152
146
  return lastIndex !== -1 && lastIndex === position;
153
147
  }});
154
148
  }
149
+ if (typeof String.prototype.startsWith === 'undefined') {
150
+ Object.defineProperty(String.prototype, 'startsWith', {value: function (searchString, position) {
151
+ position = position || 0;
152
+ return this.lastIndexOf(searchString, position) === position;
153
+ }});
154
+ }
155
155
  //endregion
156
156
  (function (factory) {
157
157
  factory(module.exports);
@@ -25113,9 +25113,6 @@
25113
25113
  initMetadataForCompanion(Companion_150);
25114
25114
  initMetadataForObject($serializer_173, '$serializer', VOID, VOID, [GeneratedSerializer]);
25115
25115
  initMetadataForClass(SessionTerminatedEvent, 'SessionTerminatedEvent', VOID, VOID, [SocketEvent], VOID, VOID, {0: $serializer_getInstance_173});
25116
- function onConversationEvent(event) {
25117
- }
25118
- initMetadataForInterface(ConversationEventListener, 'ConversationEventListener');
25119
25116
  function onRTCHangup(conversationId, legId, hangup) {
25120
25117
  }
25121
25118
  function onRTCTransfer(conversationId, legId) {
@@ -25132,7 +25129,10 @@
25132
25129
  function onAudioDTMFUpdate(conversationId, legId, digits) {
25133
25130
  }
25134
25131
  initMetadataForInterface(AudioEventListener, 'AudioEventListener');
25135
- initMetadataForClass(ChatAPIImpl$1, VOID, VOID, VOID, [ConversationEventListener, RTCEventListener, AudioEventListener]);
25132
+ function onConversationEvent(event) {
25133
+ }
25134
+ initMetadataForInterface(ConversationEventListener, 'ConversationEventListener');
25135
+ initMetadataForClass(ChatAPIImpl$1, VOID, VOID, VOID, [RTCEventListener, AudioEventListener, ConversationEventListener]);
25136
25136
  initMetadataForClass(ChatAPIImpl, 'ChatAPIImpl', VOID, VOID, [ChatAPI]);
25137
25137
  initMetadataForClass(LoggingLevel, 'LoggingLevel', VOID, Enum);
25138
25138
  initMetadataForObject(DefaultConfig, 'DefaultConfig');
@@ -25271,7 +25271,7 @@
25271
25271
  initMetadataForClass(HangupReason, 'HangupReason', VOID, Enum);
25272
25272
  initMetadataForClass(LegStatus, 'LegStatus', VOID, Enum);
25273
25273
  initMetadataForClass(CallDisconnectReason, 'CallDisconnectReason', VOID, Enum);
25274
- initMetadataForClass(VoiceAPIImpl$1, VOID, VOID, VOID, [ConversationEventListener, RTCEventListener, AudioEventListener]);
25274
+ initMetadataForClass(VoiceAPIImpl$1, VOID, VOID, VOID, [RTCEventListener, AudioEventListener, ConversationEventListener]);
25275
25275
  initMetadataForClass(VoiceAPIImpl, 'VoiceAPIImpl');
25276
25276
  initMetadataForInterface(CallEvent, 'CallEvent');
25277
25277
  initMetadataForClass(SetupOutboundCall, 'SetupOutboundCall', VOID, VOID, [CallEvent]);
@@ -25500,7 +25500,7 @@
25500
25500
  initMetadataForClass(runAfterDelay$1);
25501
25501
  //endregion
25502
25502
  function BuildKonfig() {
25503
- this.i1i_1 = '2.7.2';
25503
+ this.i1i_1 = '2.7.4';
25504
25504
  }
25505
25505
  var BuildKonfig_instance;
25506
25506
  function EmergencyCallOptions(ringbackTone) {
@@ -61910,6 +61910,16 @@
61910
61910
  return Unit_instance;
61911
61911
  };
61912
61912
  }
61913
+ function VoiceAPIImpl$serverCall$lambda(this$0, $context, $callback) {
61914
+ return function () {
61915
+ var session = this$0.k3q_1.e1j(getKClass(SessionReducer)).a2c_1.c2();
61916
+ if (!(session instanceof Active_0)) {
61917
+ return false;
61918
+ }
61919
+ attemptOutboundCall(this$0, session.a36_1.y3c_1, session.z35_1, $context, 1, null, $callback);
61920
+ return true;
61921
+ };
61922
+ }
61913
61923
  function VoiceAPIImpl$attemptOutboundCall$lambda$lambda$lambda$lambda(this$0, $call, $callback, $legId, $sessionId) {
61914
61924
  return function (it) {
61915
61925
  if (it instanceof Exception) {
@@ -63175,12 +63185,10 @@
63175
63185
  return withCoreLock(VoiceAPIImpl$getCallLegs$lambda(this, callback, callId, parameters));
63176
63186
  };
63177
63187
  protoOf(VoiceAPIImpl).t1q = function (context, callback) {
63178
- var session = this.k3q_1.e1j(getKClass(SessionReducer)).a2c_1.c2();
63179
- if (!(session instanceof Active_0)) {
63188
+ var started = withCoreLock(VoiceAPIImpl$serverCall$lambda(this, context, callback));
63189
+ if (!started) {
63180
63190
  invokeCallbackWithError(new SessionNoActiveSessionError(), callback);
63181
- return Unit_instance;
63182
63191
  }
63183
- attemptOutboundCall(this, session.a36_1.y3c_1, session.z35_1, context, 1, null, callback);
63184
63192
  };
63185
63193
  protoOf(VoiceAPIImpl).u1q = function (callId, callback) {
63186
63194
  return withCoreLock(VoiceAPIImpl$reconnectCall$lambda(this, callback, callId));
@@ -86124,6 +86132,11 @@
86124
86132
  class MediaClient {
86125
86133
  constructor() {
86126
86134
  this.pcs = new Map();
86135
+ /**
86136
+ * Per leg, so a second leg (a transfer) collects stats too and one leg ending cannot stop
86137
+ * collection for the others.
86138
+ */
86139
+ this.statsTimers = new Map();
86127
86140
  this.pcListeners = new WeakMap();
86128
86141
  this.audio = undefined;
86129
86142
  }
@@ -86148,18 +86161,28 @@
86148
86161
  if (!pc) {
86149
86162
  return closure(new clientsdkClientcore_jsExports.vonage.PeerConnectionNotFoundJS(id));
86150
86163
  }
86151
- this.intervalId = setInterval(() => {
86164
+ if (this.statsTimers.has(id)) {
86165
+ return closure(null);
86166
+ }
86167
+ this.statsTimers.set(id, setInterval(() => {
86152
86168
  if (pc.connectionState != 'connected') {
86153
- clearTimeout(this.intervalId);
86169
+ this.stopRtcStatsCollection(id);
86154
86170
  return;
86155
86171
  }
86156
86172
  pc.getStats().then((result) => {
86157
86173
  var _a;
86158
86174
  (_a = this.delegate) === null || _a === void 0 ? void 0 : _a.onRawRtcStats(id, toRawRtcStats(result));
86159
86175
  });
86160
- }, interval);
86176
+ }, interval));
86161
86177
  closure(null);
86162
86178
  }
86179
+ stopRtcStatsCollection(id) {
86180
+ const timer = this.statsTimers.get(id);
86181
+ if (timer !== undefined) {
86182
+ clearInterval(timer);
86183
+ this.statsTimers.delete(id);
86184
+ }
86185
+ }
86163
86186
  enableMediaInbound(rtcId, offerSDP, closure) {
86164
86187
  return __awaiter(this, void 0, void 0, function* () {
86165
86188
  try {
@@ -86331,6 +86354,7 @@
86331
86354
  return closure(null);
86332
86355
  }
86333
86356
  this.pcs.delete(id); // Remove from map before closing connection so size check in closePeerConnection is accurate
86357
+ this.stopRtcStatsCollection(id);
86334
86358
  // trigger state change manually
86335
86359
  (_a = this.delegate) === null || _a === void 0 ? void 0 : _a.onConnectionChange(id, 'closed');
86336
86360
  this.closePeerConnection(pc);