@wazo/sdk 0.37.17 → 0.37.21

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.
Files changed (118) hide show
  1. package/dist/wazo-sdk.js +3 -3
  2. package/esm/__tests__/api-client.test.js +52 -9
  3. package/esm/__tests__/web-rtc-client.test.js +96 -21
  4. package/esm/api/agentd.js +26 -3
  5. package/esm/api/amid.js +26 -3
  6. package/esm/api/application.js +26 -3
  7. package/esm/api/auth.js +26 -3
  8. package/esm/api/call-logd.js +28 -5
  9. package/esm/api/calld.js +26 -3
  10. package/esm/api/chatd.js +26 -3
  11. package/esm/api/confd.js +50 -7
  12. package/esm/api/ctid-ng.js +26 -3
  13. package/esm/api/dird.js +26 -3
  14. package/esm/api/webhookd.js +26 -3
  15. package/esm/api-client.js +52 -9
  16. package/esm/checker/Checker.js +98 -21
  17. package/esm/checker/checks/aor.js +52 -9
  18. package/esm/checker/checks/api.js +52 -9
  19. package/esm/checker/checks/index.js +98 -21
  20. package/esm/checker/checks/wazo-websocket.js +28 -3
  21. package/esm/checker/checks/webrtc-transport.js +96 -21
  22. package/esm/checker/checks/webrtc.js +96 -21
  23. package/esm/domain/AdHocAPIConference.js +52 -9
  24. package/esm/domain/CallLog.js +2 -2
  25. package/esm/domain/Features.js +52 -9
  26. package/esm/domain/Meeting.js +19 -2
  27. package/esm/domain/Phone/CTIPhone.js +52 -9
  28. package/esm/domain/Phone/WebRTCPhone.js +41 -5
  29. package/esm/domain/Recording.js +1 -1
  30. package/esm/domain/__tests__/CallLog.test.js +2 -2
  31. package/esm/index.js +119 -22
  32. package/esm/lib/WazoSessionDescriptionHandler.js +26 -3
  33. package/esm/service/CallApi.js +52 -9
  34. package/esm/service/IssueReporter.js +26 -3
  35. package/esm/service/__tests__/IssueReporter.test.js +26 -3
  36. package/esm/service/getApiClient.js +52 -9
  37. package/esm/simple/Auth.js +119 -22
  38. package/esm/simple/Configuration.js +119 -22
  39. package/esm/simple/Directory.js +52 -9
  40. package/esm/simple/Phone.js +119 -22
  41. package/esm/simple/Websocket.js +29 -3
  42. package/esm/simple/index.js +119 -22
  43. package/esm/simple/room/LocalParticipant.js +119 -22
  44. package/esm/simple/room/Participant.js +119 -22
  45. package/esm/simple/room/RemoteParticipant.js +119 -22
  46. package/esm/simple/room/Room.js +119 -22
  47. package/esm/simple/room/SipRoom.js +119 -22
  48. package/esm/simple/room/Stream.js +119 -22
  49. package/esm/simple/room/__tests__/RemoteParticipant.test.js +119 -22
  50. package/esm/simple/utils.js +119 -22
  51. package/esm/utils/__tests__/api-requester.test.js +26 -3
  52. package/esm/utils/api-requester.js +26 -3
  53. package/esm/web-rtc-client.js +96 -21
  54. package/esm/websocket-client.js +29 -4
  55. package/lib/__tests__/api-client.test.js +52 -9
  56. package/lib/__tests__/web-rtc-client.test.js +96 -21
  57. package/lib/api/agentd.js +26 -3
  58. package/lib/api/amid.js +26 -3
  59. package/lib/api/application.js +26 -3
  60. package/lib/api/auth.js +26 -3
  61. package/lib/api/call-logd.js +28 -5
  62. package/lib/api/calld.js +26 -3
  63. package/lib/api/chatd.js +26 -3
  64. package/lib/api/confd.js +50 -7
  65. package/lib/api/ctid-ng.js +26 -3
  66. package/lib/api/dird.js +26 -3
  67. package/lib/api/webhookd.js +26 -3
  68. package/lib/api-client.js +52 -9
  69. package/lib/checker/Checker.js +98 -21
  70. package/lib/checker/checks/aor.js +52 -9
  71. package/lib/checker/checks/api.js +52 -9
  72. package/lib/checker/checks/index.js +98 -21
  73. package/lib/checker/checks/wazo-websocket.js +28 -3
  74. package/lib/checker/checks/webrtc-transport.js +96 -21
  75. package/lib/checker/checks/webrtc.js +96 -21
  76. package/lib/domain/AdHocAPIConference.js +52 -9
  77. package/lib/domain/CallLog.js +2 -2
  78. package/lib/domain/Features.js +52 -9
  79. package/lib/domain/Meeting.js +19 -2
  80. package/lib/domain/Phone/CTIPhone.js +52 -9
  81. package/lib/domain/Phone/WebRTCPhone.js +41 -4
  82. package/lib/domain/Recording.js +1 -1
  83. package/lib/domain/__tests__/CallLog.test.js +2 -2
  84. package/lib/index.js +119 -22
  85. package/lib/lib/WazoSessionDescriptionHandler.js +26 -3
  86. package/lib/service/CallApi.js +52 -9
  87. package/lib/service/IssueReporter.js +26 -3
  88. package/lib/service/__tests__/IssueReporter.test.js +26 -3
  89. package/lib/service/getApiClient.js +52 -9
  90. package/lib/simple/Auth.js +119 -22
  91. package/lib/simple/Configuration.js +119 -22
  92. package/lib/simple/Directory.js +52 -9
  93. package/lib/simple/Phone.js +119 -22
  94. package/lib/simple/Websocket.js +29 -3
  95. package/lib/simple/index.js +119 -22
  96. package/lib/simple/room/LocalParticipant.js +119 -22
  97. package/lib/simple/room/Participant.js +119 -22
  98. package/lib/simple/room/RemoteParticipant.js +119 -22
  99. package/lib/simple/room/Room.js +119 -22
  100. package/lib/simple/room/SipRoom.js +119 -22
  101. package/lib/simple/room/Stream.js +119 -22
  102. package/lib/simple/room/__tests__/RemoteParticipant.test.js +119 -22
  103. package/lib/simple/utils.js +119 -22
  104. package/lib/utils/__tests__/api-requester.test.js +26 -3
  105. package/lib/utils/api-requester.js +26 -3
  106. package/lib/web-rtc-client.js +96 -21
  107. package/lib/websocket-client.js +29 -3
  108. package/package.json +2 -2
  109. package/src/api/confd.js +5 -2
  110. package/src/domain/CallLog.js +1 -1
  111. package/src/domain/Meeting.js +19 -2
  112. package/src/domain/Phone/WebRTCPhone.js +14 -1
  113. package/src/domain/Recording.js +1 -1
  114. package/src/service/IssueReporter.js +26 -3
  115. package/src/simple/Phone.js +5 -0
  116. package/src/types/WebSocketMessage.js +5 -1
  117. package/src/web-rtc-client.js +44 -12
  118. package/src/websocket-client.js +2 -0
@@ -440,6 +440,7 @@ class IssueReporter {
440
440
 
441
441
 
442
442
 
443
+
443
444
 
444
445
  constructor() {
445
446
  addLevelsTo(this);
@@ -451,12 +452,17 @@ class IssueReporter {
451
452
  this.bufferTimeout = null;
452
453
  this._boundProcessBuffer = this._processBuffer.bind(this);
453
454
  this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
455
+ this._callback = null;
454
456
  }
455
457
 
456
458
  init() {
457
459
  this._catchConsole();
458
460
  }
459
461
 
462
+ setCallback(cb ) {
463
+ this._callback = cb;
464
+ }
465
+
460
466
  configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
461
467
  this.remoteClientConfiguration = configuration;
462
468
  }
@@ -492,6 +498,7 @@ class IssueReporter {
492
498
 
493
499
  // Handle category label
494
500
  let category = null;
501
+ let skipSendToRemote = false;
495
502
  let extra = {};
496
503
  if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
497
504
  category = args[0].split('=')[1];
@@ -507,6 +514,7 @@ class IssueReporter {
507
514
  errorMessage: lastArg.message,
508
515
  errorStack: lastArg.stack,
509
516
  errorType: lastArg.constructor.name,
517
+ skipSendToRemote: lastArg.skipSendToRemote,
510
518
  };
511
519
  } else {
512
520
  extra = lastArg;
@@ -515,6 +523,11 @@ class IssueReporter {
515
523
  args.splice(1, 1);
516
524
  }
517
525
 
526
+ if (extra.skipSendToRemote) {
527
+ skipSendToRemote = true;
528
+ delete extra.skipSendToRemote;
529
+ }
530
+
518
531
  const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
519
532
  const message = args.join(', ');
520
533
  let consoleMessage = message;
@@ -535,7 +548,13 @@ class IssueReporter {
535
548
  const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
536
549
  oldMethod.apply(oldMethod, [date, consoleMessage]);
537
550
 
538
- this._sendToRemoteLogger(level, { date, message, category, ...extra });
551
+ if (this._callback) {
552
+ this._callback(level, consoleMessage);
553
+ }
554
+
555
+ if (!skipSendToRemote) {
556
+ this._sendToRemoteLogger(level, { date, message, category, ...extra });
557
+ }
539
558
  }
540
559
 
541
560
  logRequest(url , options , response , start ) {
@@ -680,7 +699,11 @@ class IssueReporter {
680
699
  },
681
700
  // $FlowFixMe
682
701
  body,
683
- }).catch(() => {
702
+ }).catch((e ) => {
703
+ // $FlowFixMe
704
+ e.skipSendToRemote = true;
705
+ this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
706
+
684
707
  setTimeout(() => {
685
708
  if (isArray) {
686
709
  payload = payload.map(message => {
@@ -692,7 +715,7 @@ class IssueReporter {
692
715
  payload._retry = retry + 1;
693
716
  }
694
717
 
695
- this._sendDebugToGrafana(body, retry + 1);
718
+ this._sendDebugToGrafana(payload, retry + 1);
696
719
  }, 5000 + retry * 1000);
697
720
  });
698
721
  }
@@ -2630,7 +2653,8 @@ class ExternalApp {
2630
2653
 
2631
2654
 
2632
2655
 
2633
-
2656
+
2657
+
2634
2658
 
2635
2659
 
2636
2660
  class Meeting {
@@ -2642,6 +2666,7 @@ class Meeting {
2642
2666
 
2643
2667
 
2644
2668
 
2669
+
2645
2670
 
2646
2671
 
2647
2672
  static parse(plain ) {
@@ -2653,14 +2678,28 @@ class Meeting {
2653
2678
  port: plain.port,
2654
2679
  uuid: plain.uuid,
2655
2680
  number: plain.number,
2681
+ persistent: plain.persistent,
2656
2682
  });
2657
2683
  }
2658
2684
 
2685
+ static parseMany(items ) {
2686
+ return items.map(plain => Meeting.parse(plain));
2687
+ }
2688
+
2659
2689
  static newFrom(meeting ) {
2660
2690
  return newFrom(meeting, Meeting);
2661
2691
  }
2662
2692
 
2663
- constructor({ uuid, name, guestSipAuthorization, ownerUuids, port, uri, number } = {}) {
2693
+ constructor({
2694
+ uuid,
2695
+ name,
2696
+ guestSipAuthorization,
2697
+ ownerUuids,
2698
+ port,
2699
+ uri,
2700
+ number,
2701
+ persistent,
2702
+ } = {}) {
2664
2703
  this.guestSipAuthorization = guestSipAuthorization;
2665
2704
  this.uri = uri;
2666
2705
  this.name = name;
@@ -2668,6 +2707,7 @@ class Meeting {
2668
2707
  this.port = port;
2669
2708
  this.uuid = uuid;
2670
2709
  this.number = number;
2710
+ this.persistent = persistent;
2671
2711
 
2672
2712
  // Useful to compare instead of instanceof with minified code
2673
2713
  this.type = 'Meeting';
@@ -2745,8 +2785,11 @@ var confdMethods = (client , baseUrl ) => ({
2745
2785
  }
2746
2786
  },
2747
2787
 
2748
- createMyMeeting: (name ) =>
2749
- client.post(`${baseUrl}/users/me/meetings`, { name }).then(Meeting.parse),
2788
+ getMyMeetings: () =>
2789
+ client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
2790
+
2791
+ createMyMeeting: (name , persistent ) =>
2792
+ client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
2750
2793
 
2751
2794
  deleteMyMeeting: (meetingUuid ) =>
2752
2795
  client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
@@ -3576,7 +3619,7 @@ class Recording {
3576
3619
 
3577
3620
 
3578
3621
 
3579
- static parseMany(recordings ) {
3622
+ static parseMany(recordings = []) {
3580
3623
  return recordings.map(item => Recording.parse(item));
3581
3624
  }
3582
3625
 
@@ -3702,7 +3745,7 @@ class CallLog {
3702
3745
  duration: (plain.duration || 0) * 1000, // duration is in seconds
3703
3746
  start: moment(plain.start).toDate(),
3704
3747
  end: plain.end ? moment(plain.end).toDate() : null,
3705
- recordings: Recording.parseMany(plain.recordings),
3748
+ recordings: Recording.parseMany(plain.recordings || []),
3706
3749
  });
3707
3750
  }
3708
3751
 
@@ -6547,6 +6590,7 @@ const ON_REINVITE$1 = 'reinvite';
6547
6590
  const ON_ERROR = 'onError';
6548
6591
  const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
6549
6592
  const ON_NETWORK_STATS$1 = 'onNetworkStats';
6593
+ const ON_DISCONNECTED$1 = 'onDisconnected';
6550
6594
 
6551
6595
  const events$1 = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
6552
6596
  const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
@@ -6623,6 +6667,7 @@ class WebRTCClient extends Emitter {
6623
6667
 
6624
6668
 
6625
6669
 
6670
+
6626
6671
 
6627
6672
  static isAPrivateIp(ip ) {
6628
6673
  const regex = /^(?:10|127|172\.(?:1[6-9]|2[0-9]|3[01])|192\.168)\..*/;
@@ -6688,6 +6733,7 @@ class WebRTCClient extends Emitter {
6688
6733
  this.ON_ERROR = ON_ERROR;
6689
6734
  this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
6690
6735
  this.ON_NETWORK_STATS = ON_NETWORK_STATS$1;
6736
+ this.ON_DISCONNECTED = ON_DISCONNECTED$1;
6691
6737
  }
6692
6738
 
6693
6739
  configureMedia(media ) {
@@ -6953,7 +6999,9 @@ class WebRTCClient extends Emitter {
6953
6999
  const inviteOptions = {
6954
7000
  requestDelegate: {
6955
7001
  onAccept: (response ) => {
6956
- session.sessionDescriptionHandler.peerConnection.sfu = conference;
7002
+ if (session.sessionDescriptionHandler.peerConnection) {
7003
+ session.sessionDescriptionHandler.peerConnection.sfu = conference;
7004
+ }
6957
7005
  this._onAccepted(session, response.session, true);
6958
7006
  },
6959
7007
  onReject: (response ) => {
@@ -7289,7 +7337,7 @@ class WebRTCClient extends Emitter {
7289
7337
  // We search for the last transceiver without `video-` in the mid (video- means remote transceiver)
7290
7338
  const transceivers = pc.getTransceivers();
7291
7339
  const transceiverIdx = lastIndexOf(transceivers, transceiver =>
7292
- transceiver.sender.track === null && transceiver.mid.indexOf('video') === -1);
7340
+ transceiver.sender.track === null && transceiver.mid && transceiver.mid.indexOf('video') === -1);
7293
7341
 
7294
7342
  videoSender = transceiverIdx !== -1 ? transceivers[transceiverIdx].sender : null;
7295
7343
  } else {
@@ -7825,6 +7873,16 @@ class WebRTCClient extends Emitter {
7825
7873
  return this.hasRemoteVideo(sessionId) ? this.getRemoteStream(sessionId) : null;
7826
7874
  }
7827
7875
 
7876
+ // Useful in a react-native environment when remoteMediaStream is not updated
7877
+ getRemoteVideoStreamFromPc(sessionId ) {
7878
+ const pc = this.getPeerConnection(sessionId);
7879
+ if (!pc) {
7880
+ return null;
7881
+ }
7882
+
7883
+ return pc.getRemoteStreams().find(stream => !!stream.getVideoTracks().length);
7884
+ }
7885
+
7828
7886
  hasVideo(sessionId ) {
7829
7887
  return this.hasLocalVideo(sessionId) || this.hasRemoteVideo(sessionId);
7830
7888
  }
@@ -8314,6 +8372,7 @@ class WebRTCClient extends Emitter {
8314
8372
 
8315
8373
  this.updateRemoteStream(this.getSipSessionId(session));
8316
8374
 
8375
+ const pc = session.sessionDescriptionHandler.peerConnection;
8317
8376
  const onTrack = (event ) => {
8318
8377
  const isAudioOnly = this._isAudioOnly(session);
8319
8378
  const { kind, label, readyState, id, muted } = event.track;
@@ -8333,6 +8392,12 @@ class WebRTCClient extends Emitter {
8333
8392
 
8334
8393
  session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
8335
8394
 
8395
+ pc.oniceconnectionstatechange = () => {
8396
+ if (pc.iceConnectionState === 'disconnected') {
8397
+ this.eventEmitter.emit(ON_DISCONNECTED$1);
8398
+ }
8399
+ };
8400
+
8336
8401
  if (withEvent) {
8337
8402
  this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
8338
8403
  }
@@ -8552,6 +8617,7 @@ class WebRTCClient extends Emitter {
8552
8617
  let videoBytesReceived = 0;
8553
8618
  let transportSent = 0;
8554
8619
  let transportReceived = 0;
8620
+ let packetsLost = 0;
8555
8621
 
8556
8622
  stats.forEach(report => {
8557
8623
  if (report.type === 'outbound-rtp' && report.kind === 'audio') {
@@ -8564,7 +8630,7 @@ class WebRTCClient extends Emitter {
8564
8630
  videoBytesSent += report.bytesSent + report.headerBytesSent;
8565
8631
  }
8566
8632
  if (report.type === 'inbound-rtp' && report.kind === 'audio') {
8567
- networkStats.packetsLost = report.packetsLost;
8633
+ packetsLost += report.packetsLost;
8568
8634
  networkStats.packetsReceived = report.packetsReceived;
8569
8635
  audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
8570
8636
  }
@@ -8581,27 +8647,36 @@ class WebRTCClient extends Emitter {
8581
8647
  }
8582
8648
  }
8583
8649
  if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
8650
+ packetsLost += report.packetsLost;
8584
8651
  networkStats.roundTripTime = report.roundTripTime;
8585
8652
  networkStats.jitter = report.jitter;
8586
8653
  }
8654
+ if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
8655
+ packetsLost += report.packetsLost;
8656
+ }
8587
8657
  if (report.type === 'transport') {
8588
8658
  transportSent += report.bytesSent;
8589
8659
  transportReceived += report.bytesReceived;
8590
8660
  }
8591
8661
  });
8592
8662
 
8593
- networkStats.audioBytesSent = audioBytesSent;
8663
+ networkStats.packetsLost = packetsLost;
8664
+ networkStats.totalAudioBytesSent = audioBytesSent;
8665
+ networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
8666
+ networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
8594
8667
  networkStats.audioBytesReceived = audioBytesReceived;
8595
- networkStats.videoBytesSent = videoBytesSent;
8596
- networkStats.videoBytesReceived = videoBytesReceived;
8668
+ networkStats.totalVideoBytesSent = videoBytesSent;
8669
+ networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
8670
+ networkStats.totalVideoBytesReceived = videoBytesReceived;
8671
+ networkStats.videoBytesReceived = videoBytesReceived - lastVideoReceived;
8672
+ networkStats.totalTransportSent = transportSent - lastTransportSent;
8597
8673
  networkStats.transportSent = transportSent;
8598
- networkStats.transportReceived = transportReceived;
8674
+ networkStats.totalTransportReceived = transportReceived;
8675
+ networkStats.transportReceived = transportReceived - lastTransportReceived;
8599
8676
 
8600
- const bandwidth = (networkStats.audioBytesSent - lastAudioSent) + (networkStats.videoBytesSent - lastVideoSent)
8601
- + (networkStats.audioBytesReceived - lastAudioReceived) + (networkStats.videoBytesReceived - lastVideoReceived)
8602
- + (networkStats.transportReceived - lastTransportReceived) + (networkStats.transportSent - lastTransportSent);
8603
-
8604
- networkStats.bandwidth = bandwidth;
8677
+ networkStats.bandwidth = networkStats.audioBytesSent + networkStats.audioBytesReceived
8678
+ + networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
8679
+ + networkStats.transportSent;
8605
8680
 
8606
8681
  this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
8607
8682
  this.sessionNetworkStats[sessionId].push(networkStats);
@@ -8650,6 +8725,7 @@ const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
8650
8725
  const ON_NETWORK_STATS = 'onNetworkStats';
8651
8726
  const ON_CHAT = 'phone/ON_CHAT';
8652
8727
  const ON_SIGNAL = 'phone/ON_SIGNAL';
8728
+ const ON_DISCONNECTED = 'onDisconnected';
8653
8729
 
8654
8730
  const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
8655
8731
  const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
@@ -8689,6 +8765,7 @@ const events = [
8689
8765
  ON_CHAT,
8690
8766
  ON_SIGNAL,
8691
8767
  ON_NETWORK_STATS,
8768
+ ON_DISCONNECTED,
8692
8769
  ];
8693
8770
 
8694
8771
  const logger$7 = IssueReporter$1.loggerFor('webrtc-phone');
@@ -9010,9 +9087,11 @@ class WebRTCPhone extends Emitter {
9010
9087
  case SessionState.Terminated: {
9011
9088
  logger$7.info('WebRTC phone - call terminated', { sipId: sipSession.id });
9012
9089
 
9090
+ // Should be called before `_onCallTerminated` or the callCount will not decrement...
9091
+ const callSession = this._createCallSession(sipSession);
9013
9092
  const wasCurrentSession = this._onCallTerminated(sipSession);
9014
9093
 
9015
- return this.eventEmitter.emit(ON_CALL_ENDED, this._createCallSession(sipSession), wasCurrentSession);
9094
+ return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
9016
9095
  }
9017
9096
  }
9018
9097
  });
@@ -9960,6 +10039,10 @@ class WebRTCPhone extends Emitter {
9960
10039
  return callSession ? this.client.getRemoteVideoStream(callSession.sipCallId) : null;
9961
10040
  }
9962
10041
 
10042
+ getRemoteVideoStreamFromPc(callSession ) {
10043
+ return callSession ? this.client.getRemoteVideoStreamFromPc(callSession.sipCallId) : null;
10044
+ }
10045
+
9963
10046
  hasRemoteVideo(callSession ) {
9964
10047
  return callSession ? this.client.hasRemoteVideo(callSession.sipCallId) : false;
9965
10048
  }
@@ -10041,6 +10124,11 @@ class WebRTCPhone extends Emitter {
10041
10124
  this.eventEmitter.emit(ON_UNREGISTERED);
10042
10125
  });
10043
10126
 
10127
+ this.client.on(this.client.ON_DISCONNECTED, () => {
10128
+ logger$7.info('WebRTC disconnected');
10129
+ this.eventEmitter.emit(ON_DISCONNECTED);
10130
+ });
10131
+
10044
10132
  this.client.on(this.client.REGISTERED, () => {
10045
10133
  logger$7.info('WebRTC registered', {
10046
10134
  shouldSendReinvite: this.shouldSendReinvite,
@@ -10297,6 +10385,7 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
10297
10385
  ON_NETWORK_STATS: ON_NETWORK_STATS,
10298
10386
  ON_CHAT: ON_CHAT,
10299
10387
  ON_SIGNAL: ON_SIGNAL,
10388
+ ON_DISCONNECTED: ON_DISCONNECTED,
10300
10389
  MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
10301
10390
  MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
10302
10391
  events: events,
@@ -10637,6 +10726,11 @@ class Phone extends Emitter {
10637
10726
  return this.getRemoteVideoStream(callSession);
10638
10727
  }
10639
10728
 
10729
+ // Useful in a react-native environment when remoteMediaStream is not updated
10730
+ getRemoteVideoStreamFromPc(callSession ) {
10731
+ return this.phone ? this.phone.getRemoteVideoStreamFromPc(callSession) : false;
10732
+ }
10733
+
10640
10734
  hasVideo(callSession ) {
10641
10735
  return this.phone ? this.phone.hasVideo(callSession) : false;
10642
10736
  }
@@ -10796,6 +10890,7 @@ const AGENT_PAUSED = 'agent_paused';
10796
10890
  const AGENT_UNPAUSED = 'agent_unpaused';
10797
10891
  const CONFERENCE_ADHOC_PARTICIPANT_LEFT = 'conference_adhoc_participant_left';
10798
10892
  const CONFERENCE_ADHOC_DELETED = 'conference_adhoc_deleted';
10893
+ const MEETING_USER_PROGRESS = 'meeting_user_progress';
10799
10894
 
10800
10895
  const BLACKLIST_EVENTS = [
10801
10896
  CHAT_MESSAGE_SENT,
@@ -11146,6 +11241,7 @@ WebSocketClient.eventLists = [
11146
11241
  AGENT_UNPAUSED,
11147
11242
  CONFERENCE_ADHOC_PARTICIPANT_LEFT,
11148
11243
  CONFERENCE_ADHOC_DELETED,
11244
+ MEETING_USER_PROGRESS,
11149
11245
  ];
11150
11246
 
11151
11247
  var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
@@ -11216,6 +11312,7 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
11216
11312
  AGENT_UNPAUSED: AGENT_UNPAUSED,
11217
11313
  CONFERENCE_ADHOC_PARTICIPANT_LEFT: CONFERENCE_ADHOC_PARTICIPANT_LEFT,
11218
11314
  CONFERENCE_ADHOC_DELETED: CONFERENCE_ADHOC_DELETED,
11315
+ MEETING_USER_PROGRESS: MEETING_USER_PROGRESS,
11219
11316
  HEARTBEAT_ENGINE_VERSION: HEARTBEAT_ENGINE_VERSION,
11220
11317
  'default': WebSocketClient
11221
11318
  });