@wazo/sdk 0.37.16 → 0.37.20

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 (114) hide show
  1. package/dist/wazo-sdk.js +5 -5
  2. package/esm/__tests__/api-client.test.js +9 -5
  3. package/esm/__tests__/web-rtc-client.test.js +69 -19
  4. package/esm/api/agentd.js +1 -1
  5. package/esm/api/amid.js +1 -1
  6. package/esm/api/application.js +1 -1
  7. package/esm/api/auth.js +1 -1
  8. package/esm/api/call-logd.js +3 -3
  9. package/esm/api/calld.js +1 -1
  10. package/esm/api/chatd.js +1 -1
  11. package/esm/api/confd.js +7 -3
  12. package/esm/api/ctid-ng.js +1 -1
  13. package/esm/api/dird.js +1 -1
  14. package/esm/api/webhookd.js +1 -1
  15. package/esm/api-client.js +9 -5
  16. package/esm/checker/Checker.js +69 -19
  17. package/esm/checker/checks/aor.js +9 -5
  18. package/esm/checker/checks/api.js +9 -5
  19. package/esm/checker/checks/index.js +69 -19
  20. package/esm/checker/checks/wazo-websocket.js +1 -1
  21. package/esm/checker/checks/webrtc-transport.js +69 -19
  22. package/esm/checker/checks/webrtc.js +69 -19
  23. package/esm/domain/AdHocAPIConference.js +9 -5
  24. package/esm/domain/CallLog.js +2 -2
  25. package/esm/domain/Features.js +9 -5
  26. package/esm/domain/Meeting.js +6 -2
  27. package/esm/domain/Phone/CTIPhone.js +9 -5
  28. package/esm/domain/Phone/WebRTCPhone.js +9 -2
  29. package/esm/domain/Recording.js +1 -1
  30. package/esm/domain/__tests__/CallLog.test.js +2 -2
  31. package/esm/index.js +77 -19
  32. package/esm/lib/WazoSessionDescriptionHandler.js +1 -1
  33. package/esm/service/CallApi.js +9 -5
  34. package/esm/service/IssueReporter.js +1 -1
  35. package/esm/service/__tests__/IssueReporter.test.js +1 -1
  36. package/esm/service/getApiClient.js +9 -5
  37. package/esm/simple/Auth.js +77 -19
  38. package/esm/simple/Configuration.js +77 -19
  39. package/esm/simple/Directory.js +9 -5
  40. package/esm/simple/Phone.js +77 -19
  41. package/esm/simple/Websocket.js +1 -1
  42. package/esm/simple/index.js +77 -19
  43. package/esm/simple/room/LocalParticipant.js +77 -19
  44. package/esm/simple/room/Participant.js +77 -19
  45. package/esm/simple/room/RemoteParticipant.js +77 -19
  46. package/esm/simple/room/Room.js +77 -19
  47. package/esm/simple/room/SipRoom.js +77 -19
  48. package/esm/simple/room/Stream.js +77 -19
  49. package/esm/simple/room/__tests__/RemoteParticipant.test.js +77 -19
  50. package/esm/simple/utils.js +77 -19
  51. package/esm/utils/__tests__/api-requester.test.js +1 -1
  52. package/esm/utils/api-requester.js +1 -1
  53. package/esm/web-rtc-client.js +69 -19
  54. package/esm/websocket-client.js +1 -1
  55. package/lib/__tests__/api-client.test.js +9 -5
  56. package/lib/__tests__/web-rtc-client.test.js +69 -19
  57. package/lib/api/agentd.js +1 -1
  58. package/lib/api/amid.js +1 -1
  59. package/lib/api/application.js +1 -1
  60. package/lib/api/auth.js +1 -1
  61. package/lib/api/call-logd.js +3 -3
  62. package/lib/api/calld.js +1 -1
  63. package/lib/api/chatd.js +1 -1
  64. package/lib/api/confd.js +7 -3
  65. package/lib/api/ctid-ng.js +1 -1
  66. package/lib/api/dird.js +1 -1
  67. package/lib/api/webhookd.js +1 -1
  68. package/lib/api-client.js +9 -5
  69. package/lib/checker/Checker.js +69 -19
  70. package/lib/checker/checks/aor.js +9 -5
  71. package/lib/checker/checks/api.js +9 -5
  72. package/lib/checker/checks/index.js +69 -19
  73. package/lib/checker/checks/wazo-websocket.js +1 -1
  74. package/lib/checker/checks/webrtc-transport.js +69 -19
  75. package/lib/checker/checks/webrtc.js +69 -19
  76. package/lib/domain/AdHocAPIConference.js +9 -5
  77. package/lib/domain/CallLog.js +2 -2
  78. package/lib/domain/Features.js +9 -5
  79. package/lib/domain/Meeting.js +6 -2
  80. package/lib/domain/Phone/CTIPhone.js +9 -5
  81. package/lib/domain/Phone/WebRTCPhone.js +9 -1
  82. package/lib/domain/Recording.js +1 -1
  83. package/lib/domain/__tests__/CallLog.test.js +2 -2
  84. package/lib/index.js +77 -19
  85. package/lib/lib/WazoSessionDescriptionHandler.js +1 -1
  86. package/lib/service/CallApi.js +9 -5
  87. package/lib/service/IssueReporter.js +1 -1
  88. package/lib/service/__tests__/IssueReporter.test.js +1 -1
  89. package/lib/service/getApiClient.js +9 -5
  90. package/lib/simple/Auth.js +77 -19
  91. package/lib/simple/Configuration.js +77 -19
  92. package/lib/simple/Directory.js +9 -5
  93. package/lib/simple/Phone.js +77 -19
  94. package/lib/simple/Websocket.js +1 -1
  95. package/lib/simple/index.js +77 -19
  96. package/lib/simple/room/LocalParticipant.js +77 -19
  97. package/lib/simple/room/Participant.js +77 -19
  98. package/lib/simple/room/RemoteParticipant.js +77 -19
  99. package/lib/simple/room/Room.js +77 -19
  100. package/lib/simple/room/SipRoom.js +77 -19
  101. package/lib/simple/room/Stream.js +77 -19
  102. package/lib/simple/room/__tests__/RemoteParticipant.test.js +77 -19
  103. package/lib/simple/utils.js +77 -19
  104. package/lib/utils/__tests__/api-requester.test.js +1 -1
  105. package/lib/utils/api-requester.js +1 -1
  106. package/lib/web-rtc-client.js +69 -19
  107. package/lib/websocket-client.js +1 -1
  108. package/package.json +2 -2
  109. package/src/domain/CallLog.js +1 -1
  110. package/src/domain/Meeting.js +6 -2
  111. package/src/domain/Phone/WebRTCPhone.js +7 -0
  112. package/src/domain/Recording.js +1 -1
  113. package/src/service/IssueReporter.js +1 -1
  114. package/src/web-rtc-client.js +60 -14
@@ -673,7 +673,7 @@ class IssueReporter {
673
673
  payload._retry = retry + 1;
674
674
  }
675
675
 
676
- this._sendDebugToGrafana(body, retry + 1);
676
+ this._sendDebugToGrafana(payload, retry + 1);
677
677
  }, 5000 + retry * 1000);
678
678
  });
679
679
  }
@@ -3175,7 +3175,8 @@ class ExternalApp {
3175
3175
 
3176
3176
 
3177
3177
 
3178
-
3178
+
3179
+
3179
3180
 
3180
3181
 
3181
3182
  class Meeting {
@@ -3187,6 +3188,7 @@ class Meeting {
3187
3188
 
3188
3189
 
3189
3190
 
3191
+
3190
3192
 
3191
3193
 
3192
3194
  static parse(plain ) {
@@ -3198,6 +3200,7 @@ class Meeting {
3198
3200
  port: plain.port,
3199
3201
  uuid: plain.uuid,
3200
3202
  number: plain.number,
3203
+ persistent: plain.persistent,
3201
3204
  });
3202
3205
  }
3203
3206
 
@@ -3205,7 +3208,7 @@ class Meeting {
3205
3208
  return newFrom(meeting, Meeting);
3206
3209
  }
3207
3210
 
3208
- constructor({ uuid, name, guestSipAuthorization, ownerUuids, port, uri, number } = {}) {
3211
+ constructor({ uuid, name, guestSipAuthorization, ownerUuids, port, uri, number, persistent } = {}) {
3209
3212
  this.guestSipAuthorization = guestSipAuthorization;
3210
3213
  this.uri = uri;
3211
3214
  this.name = name;
@@ -3213,6 +3216,7 @@ class Meeting {
3213
3216
  this.port = port;
3214
3217
  this.uuid = uuid;
3215
3218
  this.number = number;
3219
+ this.persistent = persistent;
3216
3220
 
3217
3221
  // Useful to compare instead of instanceof with minified code
3218
3222
  this.type = 'Meeting';
@@ -3776,7 +3780,7 @@ class Recording {
3776
3780
 
3777
3781
 
3778
3782
 
3779
- static parseMany(recordings ) {
3783
+ static parseMany(recordings = []) {
3780
3784
  return recordings.map(item => Recording.parse(item));
3781
3785
  }
3782
3786
 
@@ -3902,7 +3906,7 @@ class CallLog {
3902
3906
  duration: (plain.duration || 0) * 1000, // duration is in seconds
3903
3907
  start: moment__default['default'](plain.start).toDate(),
3904
3908
  end: plain.end ? moment__default['default'](plain.end).toDate() : null,
3905
- recordings: Recording.parseMany(plain.recordings),
3909
+ recordings: Recording.parseMany(plain.recordings || []),
3906
3910
  });
3907
3911
  }
3908
3912
 
@@ -5297,6 +5301,7 @@ const ON_REINVITE = 'reinvite';
5297
5301
  const ON_ERROR = 'onError';
5298
5302
  const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
5299
5303
  const ON_NETWORK_STATS = 'onNetworkStats';
5304
+ const ON_DISCONNECTED = 'onDisconnected';
5300
5305
  class CanceledCallError extends Error {}
5301
5306
 
5302
5307
  const MAX_REGISTER_TRIES = 10;
@@ -5370,6 +5375,7 @@ class WebRTCClient extends Emitter {
5370
5375
 
5371
5376
 
5372
5377
 
5378
+
5373
5379
 
5374
5380
  static isAPrivateIp(ip ) {
5375
5381
  const regex = /^(?:10|127|172\.(?:1[6-9]|2[0-9]|3[01])|192\.168)\..*/;
@@ -5435,6 +5441,7 @@ class WebRTCClient extends Emitter {
5435
5441
  this.ON_ERROR = ON_ERROR;
5436
5442
  this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
5437
5443
  this.ON_NETWORK_STATS = ON_NETWORK_STATS;
5444
+ this.ON_DISCONNECTED = ON_DISCONNECTED;
5438
5445
  }
5439
5446
 
5440
5447
  configureMedia(media ) {
@@ -6036,7 +6043,7 @@ class WebRTCClient extends Emitter {
6036
6043
  // We search for the last transceiver without `video-` in the mid (video- means remote transceiver)
6037
6044
  const transceivers = pc.getTransceivers();
6038
6045
  const transceiverIdx = lastIndexOf(transceivers, transceiver =>
6039
- transceiver.sender.track === null && transceiver.mid.indexOf('video') === -1);
6046
+ transceiver.sender.track === null && transceiver.mid && transceiver.mid.indexOf('video') === -1);
6040
6047
 
6041
6048
  videoSender = transceiverIdx !== -1 ? transceivers[transceiverIdx].sender : null;
6042
6049
  } else {
@@ -6282,10 +6289,13 @@ class WebRTCClient extends Emitter {
6282
6289
  return null;
6283
6290
  }
6284
6291
 
6285
- // let's update the local value
6286
- if (this.audio && this.audio.deviceId) {
6287
- // $FlowFixMe
6288
- this.audio.deviceId.exact = id;
6292
+ // let's update the local audio value
6293
+ if (this.audio) {
6294
+ this.audio = {
6295
+ deviceId: {
6296
+ exact: id,
6297
+ },
6298
+ };
6289
6299
  }
6290
6300
 
6291
6301
  if (session) {
@@ -6298,6 +6308,9 @@ class WebRTCClient extends Emitter {
6298
6308
  const sender = pc && pc.getSenders().find(s => audioTrack && s && s.track && s.track.kind === audioTrack.kind);
6299
6309
 
6300
6310
  if (sender) {
6311
+ if (sender.track) {
6312
+ audioTrack.enabled = sender.track.enabled;
6313
+ }
6301
6314
  sender.replaceTrack(audioTrack);
6302
6315
  }
6303
6316
 
@@ -6322,7 +6335,7 @@ class WebRTCClient extends Emitter {
6322
6335
  return null;
6323
6336
  }
6324
6337
 
6325
- // let's update the local value
6338
+ // let's update the local video value
6326
6339
  if (this.video) {
6327
6340
  this.video = {
6328
6341
  deviceId: {
@@ -6357,12 +6370,21 @@ class WebRTCClient extends Emitter {
6357
6370
  return navigator.mediaDevices.getUserMedia(constraints).then(async stream => {
6358
6371
  const videoTrack = stream.getVideoTracks()[0];
6359
6372
  let sender = pc && pc.getSenders().find(s => videoTrack && s && s.track && s.track.kind === videoTrack.kind);
6373
+ let wasTrackEnabled = false;
6360
6374
  if (!sender) {
6361
6375
  sender = pc && pc.getSenders().find(s => !s.track);
6362
6376
  }
6363
6377
 
6364
6378
  if (sender) {
6365
- sender.replaceTrack(videoTrack);
6379
+ // No video track means video not enabled
6380
+ wasTrackEnabled = sender.track ? sender.track.enabled : false;
6381
+ videoTrack.enabled = wasTrackEnabled;
6382
+
6383
+ if (!wasTrackEnabled) {
6384
+ videoTrack.stop();
6385
+ }
6386
+
6387
+ sender.replaceTrack(wasTrackEnabled ? videoTrack : null);
6366
6388
  }
6367
6389
 
6368
6390
  // let's update the local stream
@@ -7046,6 +7068,7 @@ class WebRTCClient extends Emitter {
7046
7068
 
7047
7069
  this.updateRemoteStream(this.getSipSessionId(session));
7048
7070
 
7071
+ const pc = session.sessionDescriptionHandler.peerConnection;
7049
7072
  const onTrack = (event ) => {
7050
7073
  const isAudioOnly = this._isAudioOnly(session);
7051
7074
  const { kind, label, readyState, id, muted } = event.track;
@@ -7065,6 +7088,12 @@ class WebRTCClient extends Emitter {
7065
7088
 
7066
7089
  session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
7067
7090
 
7091
+ pc.oniceconnectionstatechange = () => {
7092
+ if (pc.iceConnectionState === 'disconnected') {
7093
+ this.eventEmitter.emit(ON_DISCONNECTED);
7094
+ }
7095
+ };
7096
+
7068
7097
  if (withEvent) {
7069
7098
  this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
7070
7099
  }
@@ -7276,25 +7305,33 @@ class WebRTCClient extends Emitter {
7276
7305
  const lastVideoSent = lastNetworkStats ? lastNetworkStats.videoBytesSent : 0;
7277
7306
  const lastAudioReceived = lastNetworkStats ? lastNetworkStats.audioBytesReceived : 0;
7278
7307
  const lastVideoReceived = lastNetworkStats ? lastNetworkStats.videoBytesReceived : 0;
7308
+ const lastTransportSent = lastNetworkStats ? lastNetworkStats.transportSent : 0;
7309
+ const lastTransportReceived = lastNetworkStats ? lastNetworkStats.transportReceived : 0;
7279
7310
  let audioBytesSent = 0;
7280
7311
  let audioBytesReceived = 0;
7281
7312
  let videoBytesSent = 0;
7282
7313
  let videoBytesReceived = 0;
7314
+ let transportSent = 0;
7315
+ let transportReceived = 0;
7316
+ let packetsLost = 0;
7283
7317
 
7284
7318
  stats.forEach(report => {
7285
7319
  if (report.type === 'outbound-rtp' && report.kind === 'audio') {
7320
+ audioBytesSent += report.bytesSent + report.headerBytesSent;
7321
+ }
7322
+ if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
7286
7323
  audioBytesSent += report.bytesSent;
7287
7324
  }
7288
7325
  if (report.type === 'outbound-rtp' && report.kind === 'video') {
7289
- videoBytesSent += report.bytesSent;
7326
+ videoBytesSent += report.bytesSent + report.headerBytesSent;
7290
7327
  }
7291
7328
  if (report.type === 'inbound-rtp' && report.kind === 'audio') {
7292
- networkStats.packetsLost = report.packetsLost;
7329
+ packetsLost += report.packetsLost;
7293
7330
  networkStats.packetsReceived = report.packetsReceived;
7294
- audioBytesReceived += report.bytesReceived;
7331
+ audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
7295
7332
  }
7296
7333
  if (report.type === 'inbound-rtp' && report.kind === 'video') {
7297
- videoBytesReceived += report.bytesReceived;
7334
+ videoBytesReceived += report.bytesReceived + report.headerBytesReceived;
7298
7335
  }
7299
7336
  if (report.type === 'outbound-rtp' && report.kind === 'video') {
7300
7337
  if ('framesPerSecond' in report) {
@@ -7306,19 +7343,32 @@ class WebRTCClient extends Emitter {
7306
7343
  }
7307
7344
  }
7308
7345
  if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
7346
+ packetsLost += report.packetsLost;
7309
7347
  networkStats.roundTripTime = report.roundTripTime;
7310
7348
  networkStats.jitter = report.jitter;
7311
7349
  }
7350
+ if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
7351
+ packetsLost += report.packetsLost;
7352
+ }
7353
+ if (report.type === 'transport') {
7354
+ transportSent += report.bytesSent;
7355
+ transportReceived += report.bytesReceived;
7356
+ }
7312
7357
  });
7313
7358
 
7359
+ networkStats.packetsLost = packetsLost;
7314
7360
  networkStats.audioBytesSent = audioBytesSent;
7315
7361
  networkStats.audioBytesReceived = audioBytesReceived;
7316
7362
  networkStats.videoBytesSent = videoBytesSent;
7317
7363
  networkStats.videoBytesReceived = videoBytesReceived;
7364
+ networkStats.transportSent = transportSent;
7365
+ networkStats.transportReceived = transportReceived;
7366
+
7367
+ const bandwidth = (networkStats.audioBytesSent - lastAudioSent) + (networkStats.videoBytesSent - lastVideoSent)
7368
+ + (networkStats.audioBytesReceived - lastAudioReceived) + (networkStats.videoBytesReceived - lastVideoReceived)
7369
+ + (networkStats.transportReceived - lastTransportReceived) + (networkStats.transportSent - lastTransportSent);
7318
7370
 
7319
- networkStats.bandwidth = (networkStats.audioBytesSent - lastAudioSent)
7320
- + (networkStats.videoBytesSent - lastVideoSent) + (networkStats.audioBytesReceived - lastAudioReceived)
7321
- + (networkStats.videoBytesReceived - lastVideoReceived);
7371
+ networkStats.bandwidth = bandwidth;
7322
7372
 
7323
7373
  this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
7324
7374
  this.sessionNetworkStats[sessionId].push(networkStats);
@@ -605,7 +605,7 @@ class IssueReporter {
605
605
  payload._retry = retry + 1;
606
606
  }
607
607
 
608
- this._sendDebugToGrafana(body, retry + 1);
608
+ this._sendDebugToGrafana(payload, retry + 1);
609
609
  }, 5000 + retry * 1000);
610
610
  });
611
611
  }
@@ -2797,7 +2797,8 @@ class ExternalApp {
2797
2797
 
2798
2798
 
2799
2799
 
2800
-
2800
+
2801
+
2801
2802
 
2802
2803
 
2803
2804
  class Meeting {
@@ -2809,6 +2810,7 @@ class Meeting {
2809
2810
 
2810
2811
 
2811
2812
 
2813
+
2812
2814
 
2813
2815
 
2814
2816
  static parse(plain ) {
@@ -2820,6 +2822,7 @@ class Meeting {
2820
2822
  port: plain.port,
2821
2823
  uuid: plain.uuid,
2822
2824
  number: plain.number,
2825
+ persistent: plain.persistent,
2823
2826
  });
2824
2827
  }
2825
2828
 
@@ -2827,7 +2830,7 @@ class Meeting {
2827
2830
  return newFrom(meeting, Meeting);
2828
2831
  }
2829
2832
 
2830
- constructor({ uuid, name, guestSipAuthorization, ownerUuids, port, uri, number } = {}) {
2833
+ constructor({ uuid, name, guestSipAuthorization, ownerUuids, port, uri, number, persistent } = {}) {
2831
2834
  this.guestSipAuthorization = guestSipAuthorization;
2832
2835
  this.uri = uri;
2833
2836
  this.name = name;
@@ -2835,6 +2838,7 @@ class Meeting {
2835
2838
  this.port = port;
2836
2839
  this.uuid = uuid;
2837
2840
  this.number = number;
2841
+ this.persistent = persistent;
2838
2842
 
2839
2843
  // Useful to compare instead of instanceof with minified code
2840
2844
  this.type = 'Meeting';
@@ -3192,7 +3196,7 @@ class Recording {
3192
3196
 
3193
3197
 
3194
3198
 
3195
- static parseMany(recordings ) {
3199
+ static parseMany(recordings = []) {
3196
3200
  return recordings.map(item => Recording.parse(item));
3197
3201
  }
3198
3202
 
@@ -3318,7 +3322,7 @@ class CallLog {
3318
3322
  duration: (plain.duration || 0) * 1000, // duration is in seconds
3319
3323
  start: moment__default['default'](plain.start).toDate(),
3320
3324
  end: plain.end ? moment__default['default'](plain.end).toDate() : null,
3321
- recordings: Recording.parseMany(plain.recordings),
3325
+ recordings: Recording.parseMany(plain.recordings || []),
3322
3326
  });
3323
3327
  }
3324
3328
 
@@ -59,7 +59,7 @@ class Recording {
59
59
 
60
60
 
61
61
 
62
- static parseMany(recordings ) {
62
+ static parseMany(recordings = []) {
63
63
  return recordings.map(item => Recording.parse(item));
64
64
  }
65
65
 
@@ -185,7 +185,7 @@ class CallLog {
185
185
  duration: (plain.duration || 0) * 1000, // duration is in seconds
186
186
  start: moment__default['default'](plain.start).toDate(),
187
187
  end: plain.end ? moment__default['default'](plain.end).toDate() : null,
188
- recordings: Recording.parseMany(plain.recordings),
188
+ recordings: Recording.parseMany(plain.recordings || []),
189
189
  });
190
190
  }
191
191
 
@@ -390,7 +390,7 @@ class IssueReporter {
390
390
  payload._retry = retry + 1;
391
391
  }
392
392
 
393
- this._sendDebugToGrafana(body, retry + 1);
393
+ this._sendDebugToGrafana(payload, retry + 1);
394
394
  }, 5000 + retry * 1000);
395
395
  });
396
396
  }
@@ -2593,7 +2593,8 @@ class ExternalApp {
2593
2593
 
2594
2594
 
2595
2595
 
2596
-
2596
+
2597
+
2597
2598
 
2598
2599
 
2599
2600
  class Meeting {
@@ -2605,6 +2606,7 @@ class Meeting {
2605
2606
 
2606
2607
 
2607
2608
 
2609
+
2608
2610
 
2609
2611
 
2610
2612
  static parse(plain ) {
@@ -2616,6 +2618,7 @@ class Meeting {
2616
2618
  port: plain.port,
2617
2619
  uuid: plain.uuid,
2618
2620
  number: plain.number,
2621
+ persistent: plain.persistent,
2619
2622
  });
2620
2623
  }
2621
2624
 
@@ -2623,7 +2626,7 @@ class Meeting {
2623
2626
  return newFrom(meeting, Meeting);
2624
2627
  }
2625
2628
 
2626
- constructor({ uuid, name, guestSipAuthorization, ownerUuids, port, uri, number } = {}) {
2629
+ constructor({ uuid, name, guestSipAuthorization, ownerUuids, port, uri, number, persistent } = {}) {
2627
2630
  this.guestSipAuthorization = guestSipAuthorization;
2628
2631
  this.uri = uri;
2629
2632
  this.name = name;
@@ -2631,6 +2634,7 @@ class Meeting {
2631
2634
  this.port = port;
2632
2635
  this.uuid = uuid;
2633
2636
  this.number = number;
2637
+ this.persistent = persistent;
2634
2638
 
2635
2639
  // Useful to compare instead of instanceof with minified code
2636
2640
  this.type = 'Meeting';
@@ -3194,7 +3198,7 @@ class Recording {
3194
3198
 
3195
3199
 
3196
3200
 
3197
- static parseMany(recordings ) {
3201
+ static parseMany(recordings = []) {
3198
3202
  return recordings.map(item => Recording.parse(item));
3199
3203
  }
3200
3204
 
@@ -3320,7 +3324,7 @@ class CallLog {
3320
3324
  duration: (plain.duration || 0) * 1000, // duration is in seconds
3321
3325
  start: moment__default['default'](plain.start).toDate(),
3322
3326
  end: plain.end ? moment__default['default'](plain.end).toDate() : null,
3323
- recordings: Recording.parseMany(plain.recordings),
3327
+ recordings: Recording.parseMany(plain.recordings || []),
3324
3328
  });
3325
3329
  }
3326
3330
 
@@ -20,7 +20,8 @@ var newFrom = (instance , ToClass ) => {
20
20
 
21
21
 
22
22
 
23
-
23
+
24
+
24
25
 
25
26
 
26
27
  class Meeting {
@@ -32,6 +33,7 @@ class Meeting {
32
33
 
33
34
 
34
35
 
36
+
35
37
 
36
38
 
37
39
  static parse(plain ) {
@@ -43,6 +45,7 @@ class Meeting {
43
45
  port: plain.port,
44
46
  uuid: plain.uuid,
45
47
  number: plain.number,
48
+ persistent: plain.persistent,
46
49
  });
47
50
  }
48
51
 
@@ -50,7 +53,7 @@ class Meeting {
50
53
  return newFrom(meeting, Meeting);
51
54
  }
52
55
 
53
- constructor({ uuid, name, guestSipAuthorization, ownerUuids, port, uri, number } = {}) {
56
+ constructor({ uuid, name, guestSipAuthorization, ownerUuids, port, uri, number, persistent } = {}) {
54
57
  this.guestSipAuthorization = guestSipAuthorization;
55
58
  this.uri = uri;
56
59
  this.name = name;
@@ -58,6 +61,7 @@ class Meeting {
58
61
  this.port = port;
59
62
  this.uuid = uuid;
60
63
  this.number = number;
64
+ this.persistent = persistent;
61
65
 
62
66
  // Useful to compare instead of instanceof with minified code
63
67
  this.type = 'Meeting';
@@ -2101,7 +2101,7 @@ class Recording {
2101
2101
 
2102
2102
 
2103
2103
 
2104
- static parseMany(recordings ) {
2104
+ static parseMany(recordings = []) {
2105
2105
  return recordings.map(item => Recording.parse(item));
2106
2106
  }
2107
2107
 
@@ -2227,7 +2227,7 @@ class CallLog {
2227
2227
  duration: (plain.duration || 0) * 1000, // duration is in seconds
2228
2228
  start: moment__default['default'](plain.start).toDate(),
2229
2229
  end: plain.end ? moment__default['default'](plain.end).toDate() : null,
2230
- recordings: Recording.parseMany(plain.recordings),
2230
+ recordings: Recording.parseMany(plain.recordings || []),
2231
2231
  });
2232
2232
  }
2233
2233
 
@@ -2771,7 +2771,7 @@ class IssueReporter {
2771
2771
  payload._retry = retry + 1;
2772
2772
  }
2773
2773
 
2774
- this._sendDebugToGrafana(body, retry + 1);
2774
+ this._sendDebugToGrafana(payload, retry + 1);
2775
2775
  }, 5000 + retry * 1000);
2776
2776
  });
2777
2777
  }
@@ -3489,7 +3489,8 @@ class ExternalApp {
3489
3489
 
3490
3490
 
3491
3491
 
3492
-
3492
+
3493
+
3493
3494
 
3494
3495
 
3495
3496
  class Meeting {
@@ -3501,6 +3502,7 @@ class Meeting {
3501
3502
 
3502
3503
 
3503
3504
 
3505
+
3504
3506
 
3505
3507
 
3506
3508
  static parse(plain ) {
@@ -3512,6 +3514,7 @@ class Meeting {
3512
3514
  port: plain.port,
3513
3515
  uuid: plain.uuid,
3514
3516
  number: plain.number,
3517
+ persistent: plain.persistent,
3515
3518
  });
3516
3519
  }
3517
3520
 
@@ -3519,7 +3522,7 @@ class Meeting {
3519
3522
  return newFrom(meeting, Meeting);
3520
3523
  }
3521
3524
 
3522
- constructor({ uuid, name, guestSipAuthorization, ownerUuids, port, uri, number } = {}) {
3525
+ constructor({ uuid, name, guestSipAuthorization, ownerUuids, port, uri, number, persistent } = {}) {
3523
3526
  this.guestSipAuthorization = guestSipAuthorization;
3524
3527
  this.uri = uri;
3525
3528
  this.name = name;
@@ -3527,6 +3530,7 @@ class Meeting {
3527
3530
  this.port = port;
3528
3531
  this.uuid = uuid;
3529
3532
  this.number = number;
3533
+ this.persistent = persistent;
3530
3534
 
3531
3535
  // Useful to compare instead of instanceof with minified code
3532
3536
  this.type = 'Meeting';
@@ -748,7 +748,7 @@ class IssueReporter {
748
748
  payload._retry = retry + 1;
749
749
  }
750
750
 
751
- this._sendDebugToGrafana(body, retry + 1);
751
+ this._sendDebugToGrafana(payload, retry + 1);
752
752
  }, 5000 + retry * 1000);
753
753
  });
754
754
  }
@@ -886,6 +886,7 @@ const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
886
886
  const ON_NETWORK_STATS = 'onNetworkStats';
887
887
  const ON_CHAT = 'phone/ON_CHAT';
888
888
  const ON_SIGNAL = 'phone/ON_SIGNAL';
889
+ const ON_DISCONNECTED = 'onDisconnected';
889
890
 
890
891
  const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
891
892
  const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
@@ -925,6 +926,7 @@ const events = [
925
926
  ON_CHAT,
926
927
  ON_SIGNAL,
927
928
  ON_NETWORK_STATS,
929
+ ON_DISCONNECTED,
928
930
  ];
929
931
 
930
932
  const logger = IssueReporter$1.loggerFor('webrtc-phone');
@@ -2277,6 +2279,11 @@ class WebRTCPhone extends Emitter {
2277
2279
  this.eventEmitter.emit(ON_UNREGISTERED);
2278
2280
  });
2279
2281
 
2282
+ this.client.on(this.client.ON_DISCONNECTED, () => {
2283
+ logger.info('WebRTC disconnected');
2284
+ this.eventEmitter.emit(ON_DISCONNECTED);
2285
+ });
2286
+
2280
2287
  this.client.on(this.client.REGISTERED, () => {
2281
2288
  logger.info('WebRTC registered', {
2282
2289
  shouldSendReinvite: this.shouldSendReinvite,
@@ -2512,6 +2519,7 @@ exports.ON_CALL_UNMUTED = ON_CALL_UNMUTED;
2512
2519
  exports.ON_CAMERA_DISABLED = ON_CAMERA_DISABLED;
2513
2520
  exports.ON_CAMERA_RESUMED = ON_CAMERA_RESUMED;
2514
2521
  exports.ON_CHAT = ON_CHAT;
2522
+ exports.ON_DISCONNECTED = ON_DISCONNECTED;
2515
2523
  exports.ON_MESSAGE = ON_MESSAGE;
2516
2524
  exports.ON_MESSAGE_TRACK_UPDATED = ON_MESSAGE_TRACK_UPDATED;
2517
2525
  exports.ON_NETWORK_STATS = ON_NETWORK_STATS;
@@ -31,7 +31,7 @@ class Recording {
31
31
 
32
32
 
33
33
 
34
- static parseMany(recordings ) {
34
+ static parseMany(recordings = []) {
35
35
  return recordings.map(item => Recording.parse(item));
36
36
  }
37
37
 
@@ -59,7 +59,7 @@ class Recording {
59
59
 
60
60
 
61
61
 
62
- static parseMany(recordings ) {
62
+ static parseMany(recordings = []) {
63
63
  return recordings.map(item => Recording.parse(item));
64
64
  }
65
65
 
@@ -185,7 +185,7 @@ class CallLog {
185
185
  duration: (plain.duration || 0) * 1000, // duration is in seconds
186
186
  start: moment__default['default'](plain.start).toDate(),
187
187
  end: plain.end ? moment__default['default'](plain.end).toDate() : null,
188
- recordings: Recording.parseMany(plain.recordings),
188
+ recordings: Recording.parseMany(plain.recordings || []),
189
189
  });
190
190
  }
191
191