@wazo/sdk 0.37.24 → 0.37.25

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 (94) hide show
  1. package/dist/wazo-sdk.js +6 -6
  2. package/esm/__tests__/api-client.test.js +12 -12
  3. package/esm/__tests__/web-rtc-client.test.js +120 -103
  4. package/esm/api/amid.js +1 -1
  5. package/esm/api/call-logd.js +2 -2
  6. package/esm/api/ctid-ng.js +3 -3
  7. package/esm/api/dird.js +1 -1
  8. package/esm/api/webhookd.js +1 -1
  9. package/esm/api-client.js +12 -12
  10. package/esm/checker/Checker.js +145 -128
  11. package/esm/checker/checks/aor.js +12 -12
  12. package/esm/checker/checks/api.js +12 -12
  13. package/esm/checker/checks/index.js +135 -118
  14. package/esm/checker/checks/wazo-websocket.js +15 -15
  15. package/esm/checker/checks/webrtc-transport.js +120 -103
  16. package/esm/checker/checks/webrtc.js +120 -103
  17. package/esm/domain/AdHocAPIConference.js +12 -12
  18. package/esm/domain/CallLog.js +1 -1
  19. package/esm/domain/Contact.js +1 -1
  20. package/esm/domain/Features.js +12 -12
  21. package/esm/domain/Phone/CTIPhone.js +26 -26
  22. package/esm/domain/Phone/WebRTCPhone.js +87 -86
  23. package/esm/domain/__tests__/CallLog.test.js +1 -1
  24. package/esm/domain/__tests__/Contact.test.js +1 -1
  25. package/esm/index.js +356 -338
  26. package/esm/lib/WazoSessionDescriptionHandler.js +1 -1
  27. package/esm/service/CallApi.js +12 -12
  28. package/esm/service/IssueReporter.js +1 -1
  29. package/esm/service/__tests__/IssueReporter.test.js +1 -1
  30. package/esm/service/getApiClient.js +12 -12
  31. package/esm/simple/Auth.js +346 -328
  32. package/esm/simple/Configuration.js +346 -328
  33. package/esm/simple/Directory.js +12 -12
  34. package/esm/simple/Phone.js +346 -328
  35. package/esm/simple/Websocket.js +17 -17
  36. package/esm/simple/index.js +350 -332
  37. package/esm/simple/room/LocalParticipant.js +350 -332
  38. package/esm/simple/room/Participant.js +350 -332
  39. package/esm/simple/room/RemoteParticipant.js +350 -332
  40. package/esm/simple/room/Room.js +351 -333
  41. package/esm/simple/room/SipRoom.js +350 -332
  42. package/esm/simple/room/Stream.js +350 -332
  43. package/esm/simple/room/__tests__/RemoteParticipant.test.js +350 -332
  44. package/esm/simple/utils.js +350 -332
  45. package/esm/web-rtc-client.js +120 -103
  46. package/esm/websocket-client.js +15 -15
  47. package/lib/__tests__/api-client.test.js +12 -12
  48. package/lib/__tests__/web-rtc-client.test.js +120 -103
  49. package/lib/api/amid.js +1 -1
  50. package/lib/api/call-logd.js +2 -2
  51. package/lib/api/ctid-ng.js +3 -3
  52. package/lib/api/dird.js +1 -1
  53. package/lib/api/webhookd.js +1 -1
  54. package/lib/api-client.js +12 -12
  55. package/lib/checker/Checker.js +145 -128
  56. package/lib/checker/checks/aor.js +12 -12
  57. package/lib/checker/checks/api.js +12 -12
  58. package/lib/checker/checks/index.js +135 -118
  59. package/lib/checker/checks/wazo-websocket.js +15 -15
  60. package/lib/checker/checks/webrtc-transport.js +120 -103
  61. package/lib/checker/checks/webrtc.js +120 -103
  62. package/lib/domain/AdHocAPIConference.js +12 -12
  63. package/lib/domain/CallLog.js +1 -1
  64. package/lib/domain/Contact.js +1 -1
  65. package/lib/domain/Features.js +12 -12
  66. package/lib/domain/Phone/CTIPhone.js +26 -26
  67. package/lib/domain/Phone/WebRTCPhone.js +87 -86
  68. package/lib/domain/__tests__/CallLog.test.js +1 -1
  69. package/lib/domain/__tests__/Contact.test.js +1 -1
  70. package/lib/index.js +356 -338
  71. package/lib/lib/WazoSessionDescriptionHandler.js +1 -1
  72. package/lib/service/CallApi.js +12 -12
  73. package/lib/service/IssueReporter.js +1 -1
  74. package/lib/service/__tests__/IssueReporter.test.js +1 -1
  75. package/lib/service/getApiClient.js +12 -12
  76. package/lib/simple/Auth.js +346 -328
  77. package/lib/simple/Configuration.js +346 -328
  78. package/lib/simple/Directory.js +12 -12
  79. package/lib/simple/Phone.js +346 -328
  80. package/lib/simple/Websocket.js +17 -17
  81. package/lib/simple/index.js +350 -332
  82. package/lib/simple/room/LocalParticipant.js +350 -332
  83. package/lib/simple/room/Participant.js +350 -332
  84. package/lib/simple/room/RemoteParticipant.js +350 -332
  85. package/lib/simple/room/Room.js +351 -333
  86. package/lib/simple/room/SipRoom.js +350 -332
  87. package/lib/simple/room/Stream.js +350 -332
  88. package/lib/simple/room/__tests__/RemoteParticipant.test.js +350 -332
  89. package/lib/simple/utils.js +350 -332
  90. package/lib/web-rtc-client.js +120 -103
  91. package/lib/websocket-client.js +15 -15
  92. package/package.json +1 -1
  93. package/src/domain/Phone/WebRTCPhone.js +3 -2
  94. package/src/web-rtc-client.js +27 -10
@@ -1034,7 +1034,7 @@ var IssueReporter$1 = new IssueReporter();
1034
1034
 
1035
1035
  const methods = ['head', 'get', 'post', 'put', 'delete'];
1036
1036
 
1037
- const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
1037
+ const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
1038
1038
 
1039
1039
  // Use a function here to be able to mock it in tests
1040
1040
  const realFetch = () => {
@@ -1173,7 +1173,7 @@ class ApiRequester {
1173
1173
  };
1174
1174
 
1175
1175
  if (this.refreshTokenPromise) {
1176
- logger.info('A token is already refreshing, waiting ...', { url });
1176
+ logger$c.info('A token is already refreshing, waiting ...', { url });
1177
1177
  await this.refreshTokenPromise;
1178
1178
  }
1179
1179
 
@@ -1193,7 +1193,7 @@ class ApiRequester {
1193
1193
  return promise.then(async (err ) => {
1194
1194
  // Check if the token is still valid
1195
1195
  if (firstCall && this._checkTokenExpired(response, err)) {
1196
- logger.warn('token expired', { error: err.reason });
1196
+ logger$c.warn('token expired', { error: err.reason });
1197
1197
  // Replay the call after refreshing the token
1198
1198
  return this._replayWithNewToken(err, path, method, body, headers, parse);
1199
1199
  }
@@ -1203,7 +1203,7 @@ class ApiRequester {
1203
1203
  : exceptionClass.fromResponse(err, response.status);
1204
1204
 
1205
1205
  if (this.shouldLogErrors) {
1206
- logger.error('API error', error);
1206
+ logger$c.error('API error', error);
1207
1207
  }
1208
1208
 
1209
1209
  throw error;
@@ -1213,7 +1213,7 @@ class ApiRequester {
1213
1213
  return newParse(response, isJson);
1214
1214
  }).catch(error => {
1215
1215
  if (this.shouldLogErrors) {
1216
- logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
1216
+ logger$c.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
1217
1217
  }
1218
1218
 
1219
1219
  throw error;
@@ -1241,13 +1241,13 @@ class ApiRequester {
1241
1241
  ) {
1242
1242
  const isTokenNotFound = this._isTokenNotFound(err);
1243
1243
  let newPath = path;
1244
- logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
1244
+ logger$c.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
1245
1245
 
1246
1246
  this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
1247
1247
 
1248
1248
  return this.refreshTokenPromise.then(() => {
1249
1249
  this.refreshTokenPromise = null;
1250
- logger.info('token refreshed', { isTokenNotFound });
1250
+ logger$c.info('token refreshed', { isTokenNotFound });
1251
1251
  if (isTokenNotFound) {
1252
1252
  const pathParts = path.split('/');
1253
1253
  pathParts.pop();
@@ -4063,7 +4063,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
4063
4063
 
4064
4064
  // const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
4065
4065
 
4066
- const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
4066
+ const logger$b = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
4067
4067
 
4068
4068
  class CTIPhone extends Emitter {
4069
4069
 
@@ -4076,7 +4076,7 @@ class CTIPhone extends Emitter {
4076
4076
 
4077
4077
  constructor(session , isMobile = false, callbackAllLines = false) {
4078
4078
  super();
4079
- logger$1.info('CTI Phone created');
4079
+ logger$b.info('CTI Phone created');
4080
4080
  this.session = session;
4081
4081
  this.isMobile = isMobile;
4082
4082
  this.callbackAllLines = callbackAllLines;
@@ -4137,7 +4137,7 @@ class CTIPhone extends Emitter {
4137
4137
  }
4138
4138
 
4139
4139
  async makeCall(number , line ) {
4140
- logger$1.info('make CTI call', { number });
4140
+ logger$b.info('make CTI call', { number });
4141
4141
 
4142
4142
  if (!number) {
4143
4143
  return null;
@@ -4160,7 +4160,7 @@ class CTIPhone extends Emitter {
4160
4160
  if (!callSession) {
4161
4161
  return Promise.resolve(null);
4162
4162
  }
4163
- logger$1.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
4163
+ logger$b.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
4164
4164
 
4165
4165
  if (!this.currentCall) {
4166
4166
  this.currentCall = callSession.call;
@@ -4173,7 +4173,7 @@ class CTIPhone extends Emitter {
4173
4173
  if (!callSession) {
4174
4174
  return;
4175
4175
  }
4176
- logger$1.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
4176
+ logger$b.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
4177
4177
 
4178
4178
  this.currentCall = undefined;
4179
4179
  this.eventEmitter.emit('onCallEnded', callSession);
@@ -4183,7 +4183,7 @@ class CTIPhone extends Emitter {
4183
4183
  if (!callSession) {
4184
4184
  return Promise.resolve(false);
4185
4185
  }
4186
- logger$1.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
4186
+ logger$b.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
4187
4187
 
4188
4188
  try {
4189
4189
  await CallApi.cancelCall(callSession);
@@ -4194,7 +4194,7 @@ class CTIPhone extends Emitter {
4194
4194
  this.eventEmitter.emit('onCallEnded', callSession);
4195
4195
  return true;
4196
4196
  } catch (e) {
4197
- logger$1.error('hangup CTI call, error', e);
4197
+ logger$b.error('hangup CTI call, error', e);
4198
4198
 
4199
4199
  this.eventEmitter.emit('onCallFailed', callSession);
4200
4200
  return false;
@@ -4207,7 +4207,7 @@ class CTIPhone extends Emitter {
4207
4207
  if (!callSession) {
4208
4208
  return;
4209
4209
  }
4210
- logger$1.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
4210
+ logger$b.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
4211
4211
 
4212
4212
  await CallApi.cancelCall(callSession);
4213
4213
  this.eventEmitter.emit('onCallEnded', callSession);
@@ -4217,7 +4217,7 @@ class CTIPhone extends Emitter {
4217
4217
  if (!callSession) {
4218
4218
  return;
4219
4219
  }
4220
- logger$1.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
4220
+ logger$b.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
4221
4221
 
4222
4222
  await CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_BLIND);
4223
4223
  }
@@ -4230,19 +4230,19 @@ class CTIPhone extends Emitter {
4230
4230
  if (!callSession) {
4231
4231
  return;
4232
4232
  }
4233
- logger$1.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
4233
+ logger$b.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
4234
4234
 
4235
4235
  return CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_ATTENDED);
4236
4236
  }
4237
4237
 
4238
4238
  async cancelCTIIndirectTransfer(transferId ) {
4239
- logger$1.info('cancel CTI transfer', { transferId });
4239
+ logger$b.info('cancel CTI transfer', { transferId });
4240
4240
 
4241
4241
  return CallApi.cancelCallTransfer(transferId);
4242
4242
  }
4243
4243
 
4244
4244
  async confirmCTIIndirectTransfer(transferId ) {
4245
- logger$1.info('confirm CTI transfer', { transferId });
4245
+ logger$b.info('confirm CTI transfer', { transferId });
4246
4246
 
4247
4247
  return CallApi.confirmCallTransfer(transferId);
4248
4248
  }
@@ -4251,19 +4251,19 @@ class CTIPhone extends Emitter {
4251
4251
  if (!callSession) {
4252
4252
  return;
4253
4253
  }
4254
- logger$1.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
4254
+ logger$b.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
4255
4255
 
4256
4256
  return CallApi.sendDTMF(callSession.callId, digits);
4257
4257
  }
4258
4258
 
4259
4259
  onConnectionMade() {
4260
- logger$1.info('on CTI connection made');
4260
+ logger$b.info('on CTI connection made');
4261
4261
 
4262
4262
  this.eventEmitter.emit('onCallAccepted');
4263
4263
  }
4264
4264
 
4265
4265
  async close() {
4266
- logger$1.info('CTI close');
4266
+ logger$b.info('CTI close');
4267
4267
 
4268
4268
  return Promise.resolve();
4269
4269
  }
@@ -4272,7 +4272,7 @@ class CTIPhone extends Emitter {
4272
4272
  if (!callSession) {
4273
4273
  return;
4274
4274
  }
4275
- logger$1.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
4275
+ logger$b.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
4276
4276
 
4277
4277
  return CallApi.hold(callSession.callId);
4278
4278
  }
@@ -4281,7 +4281,7 @@ class CTIPhone extends Emitter {
4281
4281
  if (!callSession) {
4282
4282
  return;
4283
4283
  }
4284
- logger$1.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
4284
+ logger$b.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
4285
4285
 
4286
4286
  return CallApi.resume(callSession.callId);
4287
4287
  }
@@ -4290,7 +4290,7 @@ class CTIPhone extends Emitter {
4290
4290
  if (!callSession) {
4291
4291
  return;
4292
4292
  }
4293
- logger$1.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
4293
+ logger$b.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
4294
4294
 
4295
4295
  return CallApi.mute(callSession.callId);
4296
4296
  }
@@ -4299,7 +4299,7 @@ class CTIPhone extends Emitter {
4299
4299
  if (!callSession) {
4300
4300
  return;
4301
4301
  }
4302
- logger$1.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
4302
+ logger$b.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
4303
4303
 
4304
4304
  return CallApi.unmute(callSession.callId);
4305
4305
  }
@@ -5308,7 +5308,7 @@ const AGENTD_VERSION = '1.0';
5308
5308
  const WEBHOOKD_VERSION = '1.0';
5309
5309
  const AMID_VERSION = '1.0';
5310
5310
 
5311
- const logger$2 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
5311
+ const logger$a = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
5312
5312
 
5313
5313
  class ApiClient {
5314
5314
 
@@ -5360,12 +5360,12 @@ class ApiClient {
5360
5360
  }
5361
5361
 
5362
5362
  async forceRefreshToken() {
5363
- logger$2.info('forcing refresh token, calling callback');
5363
+ logger$a.info('forcing refresh token, calling callback');
5364
5364
  return this.refreshTokenCallback();
5365
5365
  }
5366
5366
 
5367
5367
  async refreshTokenCallback() {
5368
- logger$2.info('refresh token callback called', {
5368
+ logger$a.info('refresh token callback called', {
5369
5369
  refreshToken: this.refreshToken,
5370
5370
  refreshBackend: this.refreshBackend,
5371
5371
  refreshExpiration: this.refreshExpiration,
@@ -5383,7 +5383,7 @@ class ApiClient {
5383
5383
  this.isMobile,
5384
5384
  );
5385
5385
 
5386
- logger$2.info('token refreshed', { token: session.token });
5386
+ logger$a.info('token refreshed', { token: session.token });
5387
5387
 
5388
5388
  if (this.onRefreshToken) {
5389
5389
  this.onRefreshToken(session.token, session);
@@ -5696,7 +5696,7 @@ class AdHocAPIConference {
5696
5696
 
5697
5697
  /* */
5698
5698
 
5699
- const parseCandidate = (candidate ) => {
5699
+ const parseCandidate$1 = (candidate ) => {
5700
5700
  if (!candidate) {
5701
5701
  return null;
5702
5702
  }
@@ -5850,7 +5850,7 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
5850
5850
  this.peerConnectionDelegate.onicecandidate = event => {
5851
5851
  wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
5852
5852
  if (event.candidate) {
5853
- this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
5853
+ this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
5854
5854
  }
5855
5855
  };
5856
5856
 
@@ -6314,7 +6314,7 @@ const DEFAULT_ICE_TIMEOUT = 3000;
6314
6314
  const SEND_STATS_DELAY = 5000;
6315
6315
 
6316
6316
  const states = ['STATUS_NULL', 'STATUS_NEW', 'STATUS_CONNECTING', 'STATUS_CONNECTED', 'STATUS_COMPLETED'];
6317
- const logger$3 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
6317
+ const logger$9 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
6318
6318
  const statsLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-stats') : console;
6319
6319
 
6320
6320
  // events
@@ -6328,14 +6328,14 @@ const TRANSPORT_ERROR = 'transportError';
6328
6328
  const MESSAGE = 'message';
6329
6329
  const ACCEPTED = 'accepted';
6330
6330
  const REJECTED = 'rejected';
6331
- const ON_TRACK = 'onTrack';
6332
- const ON_REINVITE = 'reinvite';
6331
+ const ON_TRACK$1 = 'onTrack';
6332
+ const ON_REINVITE$1 = 'reinvite';
6333
6333
  const ON_ERROR = 'onError';
6334
6334
  const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
6335
- const ON_NETWORK_STATS = 'onNetworkStats';
6336
- const ON_DISCONNECTED = 'onDisconnected';
6335
+ const ON_NETWORK_STATS$1 = 'onNetworkStats';
6336
+ const ON_DISCONNECTED$1 = 'onDisconnected';
6337
6337
 
6338
- const events = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
6338
+ const events$1 = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
6339
6339
  const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
6340
6340
  class CanceledCallError extends Error {}
6341
6341
 
@@ -6471,12 +6471,12 @@ class WebRTCClient extends Emitter {
6471
6471
  this.MESSAGE = MESSAGE;
6472
6472
  this.ACCEPTED = ACCEPTED;
6473
6473
  this.REJECTED = REJECTED;
6474
- this.ON_TRACK = ON_TRACK;
6475
- this.ON_REINVITE = ON_REINVITE;
6474
+ this.ON_TRACK = ON_TRACK$1;
6475
+ this.ON_REINVITE = ON_REINVITE$1;
6476
6476
  this.ON_ERROR = ON_ERROR;
6477
6477
  this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
6478
- this.ON_NETWORK_STATS = ON_NETWORK_STATS;
6479
- this.ON_DISCONNECTED = ON_DISCONNECTED;
6478
+ this.ON_NETWORK_STATS = ON_NETWORK_STATS$1;
6479
+ this.ON_DISCONNECTED = ON_DISCONNECTED$1;
6480
6480
  }
6481
6481
 
6482
6482
  configureMedia(media ) {
@@ -6493,13 +6493,13 @@ class WebRTCClient extends Emitter {
6493
6493
 
6494
6494
  createUserAgent(configOverrides ) {
6495
6495
  const webRTCConfiguration = this._createWebRTCConfiguration(configOverrides);
6496
- logger$3.info('sdk webrtc, creating UA', { webRTCConfiguration });
6496
+ logger$9.info('sdk webrtc, creating UA', { webRTCConfiguration });
6497
6497
 
6498
6498
  webRTCConfiguration.delegate = {
6499
6499
  onConnect: this.onConnect.bind(this),
6500
6500
  onDisconnect: this.onDisconnect.bind(this),
6501
6501
  onInvite: (invitation ) => {
6502
- logger$3.info('sdk webrtc on invite', {
6502
+ logger$9.info('sdk webrtc on invite', {
6503
6503
  method: 'delegate.onInvite',
6504
6504
  id: invitation.id,
6505
6505
  remoteURI: invitation.remoteURI,
@@ -6542,7 +6542,7 @@ class WebRTCClient extends Emitter {
6542
6542
  }
6543
6543
 
6544
6544
  onConnect() {
6545
- logger$3.info('sdk webrtc connected', { method: 'delegate.onConnect' });
6545
+ logger$9.info('sdk webrtc connected', { method: 'delegate.onConnect' });
6546
6546
  this.eventEmitter.emit(CONNECTED);
6547
6547
  if (!this.isRegistered() && this.registerer && this.registerer.waiting) {
6548
6548
  this.registerer.waitingToggle(false);
@@ -6551,7 +6551,7 @@ class WebRTCClient extends Emitter {
6551
6551
  }
6552
6552
 
6553
6553
  async onDisconnect(error ) {
6554
- logger$3.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
6554
+ logger$9.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
6555
6555
  this.connectionPromise = null;
6556
6556
  // The UA will attempt to reconnect automatically when an error occurred
6557
6557
  this.eventEmitter.emit(DISCONNECTED, error);
@@ -6576,37 +6576,37 @@ class WebRTCClient extends Emitter {
6576
6576
  };
6577
6577
 
6578
6578
  if (this.skipRegister) {
6579
- logger$3.info('sdk webrtc skip register...', logInfo);
6579
+ logger$9.info('sdk webrtc skip register...', logInfo);
6580
6580
  return Promise.resolve();
6581
6581
  }
6582
6582
 
6583
- logger$3.info('sdk webrtc registering...', logInfo);
6583
+ logger$9.info('sdk webrtc registering...', logInfo);
6584
6584
 
6585
6585
  if (!this.userAgent) {
6586
- logger$3.info('sdk webrtc recreating User Agent');
6586
+ logger$9.info('sdk webrtc recreating User Agent');
6587
6587
  this.userAgent = this.createUserAgent(this.uaConfigOverrides);
6588
6588
  }
6589
6589
  if (!this.userAgent || this.isRegistered()) {
6590
- logger$3.info('sdk webrtc registering aborted, already registered or no UA can be created');
6590
+ logger$9.info('sdk webrtc registering aborted, already registered or no UA can be created');
6591
6591
  return Promise.resolve();
6592
6592
  }
6593
6593
 
6594
6594
  if (this.connectionPromise || (this.registerer && this.registerer.waiting)) {
6595
- logger$3.info('sdk webrtc registering aborted due to a registration in progress.');
6595
+ logger$9.info('sdk webrtc registering aborted due to a registration in progress.');
6596
6596
  return Promise.resolve();
6597
6597
  }
6598
6598
 
6599
6599
  const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
6600
6600
 
6601
6601
  const onRegisterFailed = () => {
6602
- logger$3.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
6602
+ logger$9.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
6603
6603
  this.connectionPromise = null;
6604
6604
  if (this.registerer && this.registerer.waiting) {
6605
6605
  this.registerer.waitingToggle(false);
6606
6606
  }
6607
6607
 
6608
6608
  if (tries <= MAX_REGISTER_TRIES) {
6609
- logger$3.info('sdk webrtc registering, retrying...', { tries });
6609
+ logger$9.info('sdk webrtc registering, retrying...', { tries });
6610
6610
  setTimeout(() => this.register(tries + 1), 300);
6611
6611
  }
6612
6612
  };
@@ -6615,18 +6615,18 @@ class WebRTCClient extends Emitter {
6615
6615
  // Avoid race condition with the close method called just before register and setting userAgent to null
6616
6616
  // during the resolution of the primise.
6617
6617
  if (!this.userAgent) {
6618
- logger$3.info('sdk webrtc recreating User Agent after connection');
6618
+ logger$9.info('sdk webrtc recreating User Agent after connection');
6619
6619
  this.userAgent = this.createUserAgent(this.uaConfigOverrides);
6620
6620
  }
6621
6621
 
6622
- logger$3.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
6622
+ logger$9.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
6623
6623
  this.registerer = new registerer.Registerer(this.userAgent, registerOptions);
6624
6624
  this.connectionPromise = null;
6625
6625
  this._monkeyPatchRegisterer(this.registerer);
6626
6626
 
6627
6627
  // Bind registerer events
6628
6628
  this.registerer.stateChange.addListener(newState => {
6629
- logger$3.info('sdk webrtc registering, state changed', { newState });
6629
+ logger$9.info('sdk webrtc registering, state changed', { newState });
6630
6630
 
6631
6631
  if (newState === registererState.RegistererState.Registered && this.registerer
6632
6632
  && this.registerer.state === registererState.RegistererState.Registered) {
@@ -6639,7 +6639,7 @@ class WebRTCClient extends Emitter {
6639
6639
  const options = {
6640
6640
  requestDelegate: {
6641
6641
  onReject: response => {
6642
- logger$3.error('sdk webrtc registering, rejected', { response });
6642
+ logger$9.error('sdk webrtc registering, rejected', { response });
6643
6643
 
6644
6644
  onRegisterFailed();
6645
6645
  },
@@ -6647,13 +6647,13 @@ class WebRTCClient extends Emitter {
6647
6647
  };
6648
6648
 
6649
6649
  return this.registerer.register(options).catch((e) => {
6650
- logger$3.error('sdk webrtc registering, error', e);
6650
+ logger$9.error('sdk webrtc registering, error', e);
6651
6651
 
6652
6652
  this.eventEmitter.emit(REGISTRATION_FAILED);
6653
6653
  return e;
6654
6654
  });
6655
6655
  }).catch(error => {
6656
- logger$3.error('sdk webrtc registering, transport error', error);
6656
+ logger$9.error('sdk webrtc registering, transport error', error);
6657
6657
  onRegisterFailed();
6658
6658
  });
6659
6659
  }
@@ -6682,21 +6682,21 @@ class WebRTCClient extends Emitter {
6682
6682
  }
6683
6683
 
6684
6684
  unregister() {
6685
- logger$3.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
6685
+ logger$9.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
6686
6686
  if (!this.registerer) {
6687
6687
  return Promise.resolve();
6688
6688
  }
6689
6689
 
6690
6690
  try {
6691
6691
  return this.registerer.unregister().then(() => {
6692
- logger$3.info('sdk webrtc unregistered');
6692
+ logger$9.info('sdk webrtc unregistered');
6693
6693
  this._cleanupRegister();
6694
6694
  }).catch(e => {
6695
- logger$3.error('sdk webrtc unregistering, promise error', e);
6695
+ logger$9.error('sdk webrtc unregistering, promise error', e);
6696
6696
  this._cleanupRegister();
6697
6697
  });
6698
6698
  } catch (e) {
6699
- logger$3.error('sdk webrtc unregistering, error', e);
6699
+ logger$9.error('sdk webrtc unregistering, error', e);
6700
6700
  // Avoid issue with `undefined is not an object (evaluating 'new.target.prototype')` when triggering a new
6701
6701
  // error when the registerer is in a bad state
6702
6702
  this._cleanupRegister();
@@ -6704,7 +6704,7 @@ class WebRTCClient extends Emitter {
6704
6704
  }
6705
6705
 
6706
6706
  stop() {
6707
- logger$3.info('sdk webrtc stop', { userAgent: !!this.userAgent });
6707
+ logger$9.info('sdk webrtc stop', { userAgent: !!this.userAgent });
6708
6708
  if (!this.userAgent) {
6709
6709
  return Promise.resolve();
6710
6710
  }
@@ -6712,12 +6712,12 @@ class WebRTCClient extends Emitter {
6712
6712
  return this.userAgent.stop().then(() => {
6713
6713
  return this._cleanupRegister();
6714
6714
  }).catch(e => {
6715
- logger$3.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
6715
+ logger$9.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
6716
6716
  });
6717
6717
  }
6718
6718
 
6719
6719
  call(number , enableVideo , audioOnly = false, conference = false) {
6720
- logger$3.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
6720
+ logger$9.info('sdk webrtc creating call', { number, enableVideo, audioOnly, conference });
6721
6721
  const inviterOptions = {
6722
6722
  sessionDescriptionHandlerOptionsReInvite: {
6723
6723
  conference,
@@ -6748,7 +6748,7 @@ class WebRTCClient extends Emitter {
6748
6748
  this._onAccepted(session, response.session, true);
6749
6749
  },
6750
6750
  onReject: (response ) => {
6751
- logger$3.info('on call rejected', { id: session.id, fromTag: session.fromTag });
6751
+ logger$9.info('on call rejected', { id: session.id, fromTag: session.fromTag });
6752
6752
  this._stopSendingStats(session);
6753
6753
  this.stopNetworkMonitoring(session);
6754
6754
 
@@ -6771,11 +6771,11 @@ class WebRTCClient extends Emitter {
6771
6771
  }
6772
6772
 
6773
6773
  answer(session , enableVideo ) {
6774
- logger$3.info('sdk webrtc answer call', { id: session.id, enableVideo });
6774
+ logger$9.info('sdk webrtc answer call', { id: session.id, enableVideo });
6775
6775
 
6776
6776
  if (!session || !session.accept) {
6777
6777
  const error = 'No session to answer, or not an invitation';
6778
- logger$3.warn(error);
6778
+ logger$9.warn(error);
6779
6779
  return Promise.reject(new Error(error));
6780
6780
  }
6781
6781
  const options = {
@@ -6785,15 +6785,15 @@ class WebRTCClient extends Emitter {
6785
6785
  return session.accept(options).then(() => {
6786
6786
  if (session.isCanceled) {
6787
6787
  const message = 'accepted a canceled session (or was canceled during the accept phase).';
6788
- logger$3.error(message, { id: session.id });
6788
+ logger$9.error(message, { id: session.id });
6789
6789
  this.onCallEnded(session);
6790
6790
 
6791
6791
  throw new CanceledCallError(message);
6792
6792
  }
6793
- logger$3.info('sdk webrtc answer, accepted.');
6793
+ logger$9.info('sdk webrtc answer, accepted.');
6794
6794
  this._onAccepted(session);
6795
6795
  }).catch(e => {
6796
- logger$3.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
6796
+ logger$9.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
6797
6797
 
6798
6798
  throw e;
6799
6799
  });
@@ -6801,7 +6801,7 @@ class WebRTCClient extends Emitter {
6801
6801
 
6802
6802
  hangup(session ) {
6803
6803
  const { state, id } = session;
6804
- logger$3.info('sdk webrtc hangup call', { id, state });
6804
+ logger$9.info('sdk webrtc hangup call', { id, state });
6805
6805
 
6806
6806
  try {
6807
6807
  this._stopSendingStats(session);
@@ -6830,7 +6830,7 @@ class WebRTCClient extends Emitter {
6830
6830
 
6831
6831
  return bye();
6832
6832
  } catch (error) {
6833
- logger$3.warn('sdk webrtc hangup, error', error);
6833
+ logger$9.warn('sdk webrtc hangup, error', error);
6834
6834
  }
6835
6835
 
6836
6836
  return null;
@@ -6848,7 +6848,7 @@ class WebRTCClient extends Emitter {
6848
6848
  // Fetch and emit an event at `interval` with session network stats
6849
6849
  startNetworkMonitoring(session , interval = 1000) {
6850
6850
  const sessionId = this.getSipSessionId(session);
6851
- logger$3.info('starting network inspection', { id: sessionId });
6851
+ logger$9.info('starting network inspection', { id: sessionId });
6852
6852
 
6853
6853
  this.sessionNetworkStats[sessionId] = [];
6854
6854
 
@@ -6858,7 +6858,7 @@ class WebRTCClient extends Emitter {
6858
6858
  stopNetworkMonitoring(session ) {
6859
6859
  const sessionId = this.getSipSessionId(session);
6860
6860
  const exists = sessionId in this.networkMonitoringInterval;
6861
- logger$3.info('stopping network inspection', { id: sessionId, exists });
6861
+ logger$9.info('stopping network inspection', { id: sessionId, exists });
6862
6862
 
6863
6863
  if (exists) {
6864
6864
  clearInterval(this.networkMonitoringInterval[sessionId]);
@@ -6868,17 +6868,17 @@ class WebRTCClient extends Emitter {
6868
6868
  }
6869
6869
 
6870
6870
  reject(session ) {
6871
- logger$3.info('sdk webrtc reject call', { id: session.id });
6871
+ logger$9.info('sdk webrtc reject call', { id: session.id });
6872
6872
 
6873
6873
  try {
6874
6874
  return session.reject ? session.reject() : session.cancel();
6875
6875
  } catch (e) {
6876
- logger$3.warn('Error when rejecting call', e.message, e.stack);
6876
+ logger$9.warn('Error when rejecting call', e.message, e.stack);
6877
6877
  }
6878
6878
  }
6879
6879
 
6880
6880
  async close() {
6881
- logger$3.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
6881
+ logger$9.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
6882
6882
  this._cleanupMedia();
6883
6883
  this.connectionPromise = null;
6884
6884
 
@@ -6909,7 +6909,7 @@ class WebRTCClient extends Emitter {
6909
6909
  // eg: "INVITE not rejectable in state Completed"
6910
6910
  }
6911
6911
  this.userAgent = null;
6912
- logger$3.info('sdk webrtc client closed');
6912
+ logger$9.info('sdk webrtc client closed');
6913
6913
  }
6914
6914
 
6915
6915
  getNumber(session ) {
@@ -6922,13 +6922,13 @@ class WebRTCClient extends Emitter {
6922
6922
  }
6923
6923
 
6924
6924
  mute(session ) {
6925
- logger$3.info('sdk webrtc mute', { id: session.id });
6925
+ logger$9.info('sdk webrtc mute', { id: session.id });
6926
6926
 
6927
6927
  this._toggleAudio(session, true);
6928
6928
  }
6929
6929
 
6930
6930
  unmute(session ) {
6931
- logger$3.info('sdk webrtc unmute', { id: session.id });
6931
+ logger$9.info('sdk webrtc unmute', { id: session.id });
6932
6932
 
6933
6933
  this._toggleAudio(session, false);
6934
6934
  }
@@ -6968,13 +6968,13 @@ class WebRTCClient extends Emitter {
6968
6968
  }
6969
6969
 
6970
6970
  toggleCameraOn(session ) {
6971
- logger$3.info('sdk webrtc toggle camera on', { id: session.id });
6971
+ logger$9.info('sdk webrtc toggle camera on', { id: session.id });
6972
6972
 
6973
6973
  this._toggleVideo(session, false);
6974
6974
  }
6975
6975
 
6976
6976
  toggleCameraOff(session ) {
6977
- logger$3.info('sdk webrtc toggle camera off', { id: session.id });
6977
+ logger$9.info('sdk webrtc toggle camera off', { id: session.id });
6978
6978
 
6979
6979
  this._toggleVideo(session, true);
6980
6980
  }
@@ -6983,7 +6983,7 @@ class WebRTCClient extends Emitter {
6983
6983
  const sessionId = this.getSipSessionId(session);
6984
6984
  const hasVideo = hadVideo || this.hasLocalVideo(sessionId);
6985
6985
 
6986
- logger$3.info('sdk webrtc hold', {
6986
+ logger$9.info('sdk webrtc hold', {
6987
6987
  sessionId,
6988
6988
  keys: Object.keys(this.heldSessions),
6989
6989
  pendingReinvite: !!session.pendingReinvite,
@@ -7032,7 +7032,7 @@ class WebRTCClient extends Emitter {
7032
7032
  const sessionId = this.getSipSessionId(session);
7033
7033
  const hasVideo = sessionId in this.heldSessions && this.heldSessions[sessionId].hasVideo;
7034
7034
 
7035
- logger$3.info('sdk webrtc unhold', {
7035
+ logger$9.info('sdk webrtc unhold', {
7036
7036
  sessionId,
7037
7037
  keys: Object.keys(this.heldSessions),
7038
7038
  pendingReinvite: !!session.pendingReinvite,
@@ -7180,7 +7180,7 @@ class WebRTCClient extends Emitter {
7180
7180
  if (!session.sessionDescriptionHandler) {
7181
7181
  return;
7182
7182
  }
7183
- logger$3.info('Sending DTMF', {
7183
+ logger$9.info('Sending DTMF', {
7184
7184
  id: this.getSipSessionId(session),
7185
7185
  tone,
7186
7186
  });
@@ -7196,7 +7196,7 @@ class WebRTCClient extends Emitter {
7196
7196
  transfer(session , target ) {
7197
7197
  this.hold(session);
7198
7198
 
7199
- logger$3.info('Transfering a session', {
7199
+ logger$9.info('Transfering a session', {
7200
7200
  id: this.getSipSessionId(session),
7201
7201
  target,
7202
7202
  });
@@ -7218,17 +7218,17 @@ class WebRTCClient extends Emitter {
7218
7218
  atxfer(session ) {
7219
7219
  this.hold(session);
7220
7220
 
7221
- logger$3.info('webrtc transfer started', { id: this.getSipSessionId(session) });
7221
+ logger$9.info('webrtc transfer started', { id: this.getSipSessionId(session) });
7222
7222
 
7223
7223
  const result = {
7224
7224
  newSession: null,
7225
7225
  init: async (target ) => {
7226
- logger$3.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
7226
+ logger$9.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
7227
7227
 
7228
7228
  result.newSession = await this.call(target);
7229
7229
  },
7230
7230
  complete: () => {
7231
- logger$3.info('webrtc transfer completed', {
7231
+ logger$9.info('webrtc transfer completed', {
7232
7232
  id: this.getSipSessionId(session),
7233
7233
  referId: this.getSipSessionId(result.newSession),
7234
7234
  });
@@ -7249,7 +7249,7 @@ class WebRTCClient extends Emitter {
7249
7249
  return;
7250
7250
  }
7251
7251
 
7252
- logger$3.info('send WebRTC message', { sipId: sipSession.id, contentType });
7252
+ logger$9.info('send WebRTC message', { sipId: sipSession.id, contentType });
7253
7253
 
7254
7254
  try {
7255
7255
  sipSession.message({
@@ -7291,7 +7291,7 @@ class WebRTCClient extends Emitter {
7291
7291
  }
7292
7292
 
7293
7293
  changeAudioOutputVolume(volume ) {
7294
- logger$3.info('Changing audio output volume', { volume });
7294
+ logger$9.info('Changing audio output volume', { volume });
7295
7295
 
7296
7296
  Object.values(this.audioElements).forEach(audioElement => {
7297
7297
  if (audioElement instanceof HTMLAudioElement) {
@@ -7303,7 +7303,7 @@ class WebRTCClient extends Emitter {
7303
7303
  }
7304
7304
 
7305
7305
  changeAudioOutputDevice(id ) {
7306
- logger$3.info('Changing audio output device', { id });
7306
+ logger$9.info('Changing audio output device', { id });
7307
7307
 
7308
7308
  Object.values(this.audioElements).forEach(audioElement => {
7309
7309
  // `setSinkId` method is not included in any flow type definitions for HTMLAudioElements but is a valid method
@@ -7320,7 +7320,7 @@ class WebRTCClient extends Emitter {
7320
7320
 
7321
7321
  changeAudioInputDevice(id , session ) {
7322
7322
  const currentId = this.getAudioDeviceId();
7323
- logger$3.info('setting audio input device', { id, currentId, session: !!session });
7323
+ logger$9.info('setting audio input device', { id, currentId, session: !!session });
7324
7324
 
7325
7325
  if (id === currentId) {
7326
7326
  return null;
@@ -7366,7 +7366,7 @@ class WebRTCClient extends Emitter {
7366
7366
 
7367
7367
  setVideoInputDevice(id ) {
7368
7368
  const currentId = this.getVideoDeviceId();
7369
- logger$3.info('setting video input device', { id, currentId });
7369
+ logger$9.info('setting video input device', { id, currentId });
7370
7370
 
7371
7371
  if (id === currentId) {
7372
7372
  return null;
@@ -7391,7 +7391,7 @@ class WebRTCClient extends Emitter {
7391
7391
  const sessionId = this.getSipSessionId(session);
7392
7392
  const localStream = this.getLocalStream(sessionId);
7393
7393
 
7394
- logger$3.info('changing video input device', { id, sessionId });
7394
+ logger$9.info('changing video input device', { id, sessionId });
7395
7395
 
7396
7396
  // Release old video stream
7397
7397
  if (localStream) {
@@ -7459,7 +7459,7 @@ class WebRTCClient extends Emitter {
7459
7459
  const shouldDoScreenSharing = newConstraints && newConstraints.screen;
7460
7460
  const desktop = newConstraints && newConstraints.desktop;
7461
7461
 
7462
- logger$3.info('Sending reinvite', {
7462
+ logger$9.info('Sending reinvite', {
7463
7463
  id: this.getSipSessionId(sipSession),
7464
7464
  newConstraints,
7465
7465
  conference,
@@ -7497,7 +7497,7 @@ class WebRTCClient extends Emitter {
7497
7497
  sipSession.incomingInviteRequest.message.body = response.message.body;
7498
7498
  }
7499
7499
 
7500
- logger$3.info('on re-INVITE accepted', {
7500
+ logger$9.info('on re-INVITE accepted', {
7501
7501
  id: this.getSipSessionId(sipSession),
7502
7502
  wasMuted,
7503
7503
  shouldDoScreenSharing,
@@ -7515,7 +7515,7 @@ class WebRTCClient extends Emitter {
7515
7515
  this.eventEmitter.emit(ON_SCREEN_SHARING_REINVITE, sipSession, response, desktop);
7516
7516
  }
7517
7517
 
7518
- return this.eventEmitter.emit(ON_REINVITE, sipSession, response);
7518
+ return this.eventEmitter.emit(ON_REINVITE$1, sipSession, response);
7519
7519
  },
7520
7520
  },
7521
7521
  sessionDescriptionHandlerModifiers: [replaceLocalIpModifier],
@@ -7672,7 +7672,7 @@ class WebRTCClient extends Emitter {
7672
7672
  }
7673
7673
 
7674
7674
  startHeartbeat() {
7675
- logger$3.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
7675
+ logger$9.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
7676
7676
  if (!this.userAgent) {
7677
7677
  this.heartbeat.stop();
7678
7678
  return;
@@ -7685,7 +7685,7 @@ class WebRTCClient extends Emitter {
7685
7685
  }
7686
7686
 
7687
7687
  stopHeartbeat() {
7688
- logger$3.info('sdk webrtc stop heartbeat');
7688
+ logger$9.info('sdk webrtc stop heartbeat');
7689
7689
  this.heartbeat.stop();
7690
7690
  }
7691
7691
 
@@ -7706,7 +7706,7 @@ class WebRTCClient extends Emitter {
7706
7706
  }
7707
7707
 
7708
7708
  attemptReconnection() {
7709
- logger$3.info('attempt reconnection', { userAgent: !!this.userAgent });
7709
+ logger$9.info('attempt reconnection', { userAgent: !!this.userAgent });
7710
7710
  if (!this.userAgent) {
7711
7711
  return;
7712
7712
  }
@@ -7731,7 +7731,7 @@ class WebRTCClient extends Emitter {
7731
7731
  return;
7732
7732
  }
7733
7733
 
7734
- logger$3.info('setting local media stream', {
7734
+ logger$9.info('setting local media stream', {
7735
7735
  sipSessionId,
7736
7736
  tracks: newStream ? newStream.getTracks() : null,
7737
7737
  });
@@ -7748,7 +7748,7 @@ class WebRTCClient extends Emitter {
7748
7748
 
7749
7749
  const oldStream = this.getLocalStream(sipSessionId);
7750
7750
 
7751
- logger$3.info('updating local stream', {
7751
+ logger$9.info('updating local stream', {
7752
7752
  sipSessionId,
7753
7753
  oldStream: !!oldStream,
7754
7754
  tracks: newStream.getTracks(),
@@ -7768,7 +7768,7 @@ class WebRTCClient extends Emitter {
7768
7768
  const remoteStream = this.getRemoteStream(sessionId);
7769
7769
  const pc = this.getPeerConnection(sessionId);
7770
7770
 
7771
- logger$3.info('Updating remote stream', {
7771
+ logger$9.info('Updating remote stream', {
7772
7772
  sessionId,
7773
7773
  tracks: remoteStream ? remoteStream.getTracks() : null,
7774
7774
  receiverTracks: pc && pc.getReceivers ? pc.getReceivers().map(receiver => receiver.track) : null,
@@ -7793,14 +7793,16 @@ class WebRTCClient extends Emitter {
7793
7793
  const screenSharing = constraints && 'screen' in constraints ? constraints.screen : false;
7794
7794
  const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
7795
7795
  const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
7796
+ const mandatoryVideo = constraints && typeof constraints.video === 'object' ? constraints.video.mandatory : {};
7796
7797
 
7797
- logger$3.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
7798
+ logger$9.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
7798
7799
 
7799
7800
  return {
7800
7801
  constraints: {
7801
7802
  // Exact constraint are not supported with `getDisplayMedia` and we must have a video=false in desktop screenshare
7802
7803
  audio: screenSharing ? !isDesktop : (withAudio ? this._getAudioConstraints() : false),
7803
- video: screenSharing ? (isDesktop ? ({ mandatory: { chromeMediaSource: 'desktop' } }) : { cursor: 'always' })
7804
+ video: screenSharing ? (isDesktop
7805
+ ? ({ mandatory: { chromeMediaSource: 'desktop', ...(mandatoryVideo || {}) } }) : { cursor: 'always' })
7804
7806
  : this._getVideoConstraints(enableVideo),
7805
7807
  screen: screenSharing,
7806
7808
  desktop: isDesktop,
@@ -7843,7 +7845,7 @@ class WebRTCClient extends Emitter {
7843
7845
  }
7844
7846
 
7845
7847
  _onTransportError() {
7846
- logger$3.error('on transport error');
7848
+ logger$9.error('on transport error');
7847
7849
  this.eventEmitter.emit(TRANSPORT_ERROR);
7848
7850
  this.attemptReconnection();
7849
7851
  }
@@ -7852,7 +7854,7 @@ class WebRTCClient extends Emitter {
7852
7854
  const body = message && typeof message === 'object' ? message.data : message;
7853
7855
  if (body && body.indexOf('200 OK') !== -1) {
7854
7856
  if (this.hasHeartbeat()) {
7855
- logger$3.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
7857
+ logger$9.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
7856
7858
 
7857
7859
  this.heartbeat.onHeartbeat();
7858
7860
  if (this.heartbeatCb) {
@@ -7863,7 +7865,7 @@ class WebRTCClient extends Emitter {
7863
7865
  }
7864
7866
 
7865
7867
  async _onHeartbeatTimeout() {
7866
- logger$3.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
7868
+ logger$9.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
7867
7869
 
7868
7870
  if (this.heartbeatTimeoutCb) {
7869
7871
  this.heartbeatTimeoutCb();
@@ -7875,7 +7877,7 @@ class WebRTCClient extends Emitter {
7875
7877
  try {
7876
7878
  await this.userAgent.transport.disconnect();
7877
7879
  } catch (e) {
7878
- logger$3.error('Transport disconnection after heartbeat timeout, error', e);
7880
+ logger$9.error('Transport disconnection after heartbeat timeout, error', e);
7879
7881
  }
7880
7882
  }
7881
7883
 
@@ -7908,31 +7910,31 @@ class WebRTCClient extends Emitter {
7908
7910
  }
7909
7911
 
7910
7912
  _connectIfNeeded() {
7911
- logger$3.info('connect if needed, checking', { connected: this.isConnected() });
7913
+ logger$9.info('connect if needed, checking', { connected: this.isConnected() });
7912
7914
  if (!this.userAgent) {
7913
- logger$3.info('need to recreate User Agent');
7915
+ logger$9.info('need to recreate User Agent');
7914
7916
  this.userAgent = this.createUserAgent(this.uaConfigOverrides);
7915
7917
  }
7916
7918
 
7917
7919
  if (this.isConnected()) {
7918
- logger$3.info('webrtc sdk, already connected');
7920
+ logger$9.info('webrtc sdk, already connected');
7919
7921
  return Promise.resolve();
7920
7922
  }
7921
7923
 
7922
7924
  if (this.isConnecting()) {
7923
- logger$3.info('webrtc sdk, already connecting...');
7925
+ logger$9.info('webrtc sdk, already connecting...');
7924
7926
 
7925
7927
  this.connectionPromise = this.userAgent.transport.connectPromise;
7926
7928
  return this.connectionPromise;
7927
7929
  }
7928
7930
 
7929
7931
  if (this.connectionPromise) {
7930
- logger$3.info('webrtc sdk, connection promise connecting...');
7932
+ logger$9.info('webrtc sdk, connection promise connecting...');
7931
7933
  // $FlowFixMe
7932
7934
  return this.connectionPromise;
7933
7935
  }
7934
7936
 
7935
- logger$3.info('WebRTC UA needs to connect');
7937
+ logger$9.info('WebRTC UA needs to connect');
7936
7938
 
7937
7939
  // Force UA to reconnect
7938
7940
  if (this.userAgent && this.userAgent.state !== userAgentState.UserAgentState.Stopped) {
@@ -8057,7 +8059,7 @@ class WebRTCClient extends Emitter {
8057
8059
 
8058
8060
  sdh.peerConnectionDelegate = {
8059
8061
  onicecandidateerror: (error ) => {
8060
- logger$3.error('on icecandidate error', {
8062
+ logger$9.error('on icecandidate error', {
8061
8063
  address: error.address,
8062
8064
  port: error.port,
8063
8065
  errorCode: error.errorCode,
@@ -8086,7 +8088,7 @@ class WebRTCClient extends Emitter {
8086
8088
  updatedNumber = session.assertedIdentity.uri.normal.user;
8087
8089
  updatedCalleeName = session.assertedIdentity.displayName || updatedNumber;
8088
8090
  }
8089
- logger$3.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
8091
+ logger$9.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
8090
8092
 
8091
8093
  // Useful to know if it's a video upgrade or an unhold from a remote peer with a video stream
8092
8094
 
@@ -8102,12 +8104,12 @@ class WebRTCClient extends Emitter {
8102
8104
 
8103
8105
  this._setupMedias(session);
8104
8106
 
8105
- return this.eventEmitter.emit(ON_REINVITE, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
8107
+ return this.eventEmitter.emit(ON_REINVITE$1, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
8106
8108
  };
8107
8109
  }
8108
8110
 
8109
8111
  _onAccepted(session , sessionDialog , withEvent = true) {
8110
- logger$3.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
8112
+ logger$9.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
8111
8113
 
8112
8114
  this.storeSipSession(session);
8113
8115
 
@@ -8119,14 +8121,14 @@ class WebRTCClient extends Emitter {
8119
8121
  const onTrack = (event ) => {
8120
8122
  const isAudioOnly = this._isAudioOnly(session);
8121
8123
  const { kind, label, readyState, id, muted } = event.track;
8122
- logger$3.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
8124
+ logger$9.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
8123
8125
 
8124
8126
  // Stop video track in audio only mode
8125
8127
  if (isAudioOnly && kind === 'video') {
8126
8128
  event.track.stop();
8127
8129
  }
8128
8130
 
8129
- this.eventEmitter.emit(ON_TRACK, session, event);
8131
+ this.eventEmitter.emit(ON_TRACK$1, session, event);
8130
8132
  };
8131
8133
 
8132
8134
  if (session.sessionDescriptionHandler.peerConnection) {
@@ -8135,12 +8137,14 @@ class WebRTCClient extends Emitter {
8135
8137
 
8136
8138
  session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
8137
8139
 
8138
- pc.oniceconnectionstatechange = () => {
8139
- logger$3.info('on ice connection state changed', { state: pc.iceConnectionState });
8140
- if (pc.iceConnectionState === 'disconnected') {
8141
- this.eventEmitter.emit(ON_DISCONNECTED);
8142
- }
8143
- };
8140
+ if (pc) {
8141
+ pc.oniceconnectionstatechange = () => {
8142
+ logger$9.info('on ice connection state changed', { state: pc.iceConnectionState });
8143
+ if (pc.iceConnectionState === 'disconnected') {
8144
+ this.eventEmitter.emit(ON_DISCONNECTED$1);
8145
+ }
8146
+ };
8147
+ }
8144
8148
 
8145
8149
  if (withEvent) {
8146
8150
  this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
@@ -8309,10 +8313,10 @@ class WebRTCClient extends Emitter {
8309
8313
 
8310
8314
  _stopSendingStats(session ) {
8311
8315
  const sessionId = this.getSipSessionId(session);
8312
- logger$3.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
8316
+ logger$9.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
8313
8317
 
8314
8318
  if (sessionId in this.statsIntervals) {
8315
- logger$3.trace('Stop sending stats for call', { sessionId });
8319
+ logger$9.trace('Stop sending stats for call', { sessionId });
8316
8320
  this.statsIntervals[sessionId]();
8317
8321
  delete this.statsIntervals[sessionId];
8318
8322
  }
@@ -8328,7 +8332,7 @@ class WebRTCClient extends Emitter {
8328
8332
  try {
8329
8333
  await this.userAgent.transport.disconnect();
8330
8334
  } catch (e) {
8331
- logger$3.error('WebRTC transport disconnect, error', e);
8335
+ logger$9.error('WebRTC transport disconnect, error', e);
8332
8336
  }
8333
8337
  }
8334
8338
  }
@@ -8350,13 +8354,17 @@ class WebRTCClient extends Emitter {
8350
8354
  const nbStats = this.sessionNetworkStats[sessionId].length;
8351
8355
  const lastNetworkStats = this.sessionNetworkStats[sessionId][nbStats - 1];
8352
8356
  const lastAudioSent = lastNetworkStats ? lastNetworkStats.audioBytesSent : 0;
8357
+ const lastAudioContentSent = lastNetworkStats ? lastNetworkStats.audioContentSent : 0;
8353
8358
  const lastVideoSent = lastNetworkStats ? lastNetworkStats.videoBytesSent : 0;
8354
8359
  const lastAudioReceived = lastNetworkStats ? lastNetworkStats.audioBytesReceived : 0;
8360
+ const lastAudioContentReceived = lastNetworkStats ? lastNetworkStats.audioContentReceived : 0;
8355
8361
  const lastVideoReceived = lastNetworkStats ? lastNetworkStats.videoBytesReceived : 0;
8356
8362
  const lastTransportSent = lastNetworkStats ? lastNetworkStats.transportSent : 0;
8357
8363
  const lastTransportReceived = lastNetworkStats ? lastNetworkStats.transportReceived : 0;
8358
- let audioBytesSent = 0;
8359
- let audioBytesReceived = 0;
8364
+ let audioBytesSent = 0; // content + header
8365
+ let audioBytesReceived = 0; // content + header
8366
+ let audioContentSent = 0; // useful to detect blank call
8367
+ let audioContentReceived = 0;
8360
8368
  let videoBytesSent = 0;
8361
8369
  let videoBytesReceived = 0;
8362
8370
  let transportSent = 0;
@@ -8366,6 +8374,7 @@ class WebRTCClient extends Emitter {
8366
8374
  stats.forEach(report => {
8367
8375
  if (report.type === 'outbound-rtp' && report.kind === 'audio') {
8368
8376
  audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
8377
+ audioContentSent += Number(report.bytesSent);
8369
8378
  }
8370
8379
  if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
8371
8380
  audioBytesSent += Number(report.bytesSent);
@@ -8377,6 +8386,7 @@ class WebRTCClient extends Emitter {
8377
8386
  packetsLost += Number(report.packetsLost);
8378
8387
  networkStats.packetsReceived = Number(report.packetsReceived);
8379
8388
  audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
8389
+ audioContentReceived += Number(report.bytesReceived);
8380
8390
  }
8381
8391
  if (report.type === 'inbound-rtp' && report.kind === 'video') {
8382
8392
  videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
@@ -8405,10 +8415,17 @@ class WebRTCClient extends Emitter {
8405
8415
  });
8406
8416
 
8407
8417
  networkStats.packetsLost = packetsLost;
8418
+
8408
8419
  networkStats.totalAudioBytesSent = audioBytesSent;
8409
8420
  networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
8410
8421
  networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
8411
8422
  networkStats.audioBytesReceived = audioBytesReceived;
8423
+
8424
+ networkStats.totalAudioContentSent = audioContentSent;
8425
+ networkStats.audioContentSent = audioContentSent - lastAudioContentSent;
8426
+ networkStats.totalAudioBytesReceived = audioContentReceived - lastAudioContentReceived;
8427
+ networkStats.audioContentReceived = audioContentReceived;
8428
+
8412
8429
  networkStats.totalVideoBytesSent = videoBytesSent;
8413
8430
  networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
8414
8431
  networkStats.totalVideoBytesReceived = videoBytesReceived;
@@ -8422,7 +8439,7 @@ class WebRTCClient extends Emitter {
8422
8439
  + networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
8423
8440
  + networkStats.transportSent;
8424
8441
 
8425
- this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
8442
+ this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
8426
8443
  this.sessionNetworkStats[sessionId].push(networkStats);
8427
8444
  }
8428
8445
 
@@ -8450,8 +8467,8 @@ const ON_CALL_FAILED = 'onCallFailed';
8450
8467
  const ON_CALL_ENDED = 'onCallEnded';
8451
8468
  const ON_CALL_ENDING = 'onCallEnding';
8452
8469
  const ON_MESSAGE = 'onMessage';
8453
- const ON_REINVITE$1 = 'reinvite';
8454
- const ON_TRACK$1 = 'onTrack';
8470
+ const ON_REINVITE = 'reinvite';
8471
+ const ON_TRACK = 'onTrack';
8455
8472
  const ON_AUDIO_STREAM = 'onAudioStream';
8456
8473
  const ON_VIDEO_STREAM = 'onVideoStream';
8457
8474
  const ON_REMOVE_STREAM = 'onRemoveStream';
@@ -8466,15 +8483,15 @@ const ON_PLAY_PROGRESS_SOUND = 'playProgressSound';
8466
8483
  const ON_VIDEO_INPUT_CHANGE = 'videoInputChange';
8467
8484
  const ON_CALL_ERROR = 'onCallError';
8468
8485
  const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
8469
- const ON_NETWORK_STATS$1 = 'onNetworkStats';
8486
+ const ON_NETWORK_STATS = 'onNetworkStats';
8470
8487
  const ON_CHAT = 'phone/ON_CHAT';
8471
8488
  const ON_SIGNAL = 'phone/ON_SIGNAL';
8472
- const ON_DISCONNECTED$1 = 'onDisconnected';
8489
+ const ON_DISCONNECTED = 'onDisconnected';
8473
8490
 
8474
8491
  const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
8475
8492
  const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
8476
8493
 
8477
- const events$1 = [
8494
+ const events = [
8478
8495
  ON_USER_AGENT,
8479
8496
  ON_REGISTERED,
8480
8497
  ON_UNREGISTERED,
@@ -8492,8 +8509,8 @@ const events$1 = [
8492
8509
  ON_CALL_FAILED,
8493
8510
  ON_CALL_ENDED,
8494
8511
  ON_MESSAGE,
8495
- ON_REINVITE$1,
8496
- ON_TRACK$1,
8512
+ ON_REINVITE,
8513
+ ON_TRACK,
8497
8514
  ON_AUDIO_STREAM,
8498
8515
  ON_VIDEO_STREAM,
8499
8516
  ON_REMOVE_STREAM,
@@ -8508,11 +8525,11 @@ const events$1 = [
8508
8525
  ON_CALL_ERROR,
8509
8526
  ON_CHAT,
8510
8527
  ON_SIGNAL,
8511
- ON_NETWORK_STATS$1,
8512
- ON_DISCONNECTED$1,
8528
+ ON_NETWORK_STATS,
8529
+ ON_DISCONNECTED,
8513
8530
  ];
8514
8531
 
8515
- const logger$4 = IssueReporter$1.loggerFor('webrtc-phone');
8532
+ const logger$8 = IssueReporter$1.loggerFor('webrtc-phone');
8516
8533
 
8517
8534
  class WebRTCPhone extends Emitter {
8518
8535
 
@@ -8585,7 +8602,7 @@ class WebRTCPhone extends Emitter {
8585
8602
  }).catch(error => {
8586
8603
  // Avoid exception on `t.server.scheme` in sip transport when losing the webrtc socket connection
8587
8604
  console.error('register error', error, error.message, error.stack);
8588
- logger$4.error('WebRTC register error', { message: error.message, stack: error.stack });
8605
+ logger$8.error('WebRTC register error', { message: error.message, stack: error.stack });
8589
8606
  });
8590
8607
  }
8591
8608
 
@@ -8600,7 +8617,7 @@ class WebRTCPhone extends Emitter {
8600
8617
  if (!this.client) {
8601
8618
  return;
8602
8619
  }
8603
- logger$4.info('WebRTC phone stop');
8620
+ logger$8.info('WebRTC phone stop');
8604
8621
  this.client.stop();
8605
8622
  }
8606
8623
 
@@ -8615,11 +8632,12 @@ class WebRTCPhone extends Emitter {
8615
8632
  async sendReinvite(callSession , constraints = null, conference = false,
8616
8633
  audioOnly = false, iceRestart = false) {
8617
8634
  const sipSession = this.findSipSession(callSession);
8618
- logger$4.info('WebRTC phone - send reinvite', {
8635
+ logger$8.info('WebRTC phone - send reinvite', {
8619
8636
  sessionId: sipSession ? sipSession.id : null,
8620
8637
  constraints,
8621
8638
  audioOnly,
8622
8639
  conference,
8640
+ iceRestart,
8623
8641
  });
8624
8642
 
8625
8643
  if (!sipSession) {
@@ -8652,7 +8670,7 @@ class WebRTCPhone extends Emitter {
8652
8670
  }
8653
8671
 
8654
8672
  startHeartbeat() {
8655
- logger$4.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
8673
+ logger$8.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
8656
8674
  if (!this.client || this.client.hasHeartbeat()) {
8657
8675
  return;
8658
8676
  }
@@ -8661,7 +8679,7 @@ class WebRTCPhone extends Emitter {
8661
8679
  }
8662
8680
 
8663
8681
  stopHeartbeat() {
8664
- logger$4.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
8682
+ logger$8.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
8665
8683
  if (!this.client) {
8666
8684
  return;
8667
8685
  }
@@ -8678,7 +8696,7 @@ class WebRTCPhone extends Emitter {
8678
8696
  }
8679
8697
 
8680
8698
  reconnect() {
8681
- logger$4.info('WebRTC phone - reconnect', { client: !!this.client });
8699
+ logger$8.info('WebRTC phone - reconnect', { client: !!this.client });
8682
8700
  if (!this.client) {
8683
8701
  return;
8684
8702
  }
@@ -8719,7 +8737,7 @@ class WebRTCPhone extends Emitter {
8719
8737
  return false;
8720
8738
  }
8721
8739
 
8722
- logger$4.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
8740
+ logger$8.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
8723
8741
 
8724
8742
  this.client.downgradeToAudio(sipSession);
8725
8743
 
@@ -8742,7 +8760,7 @@ class WebRTCPhone extends Emitter {
8742
8760
  return Promise.resolve(false);
8743
8761
  }
8744
8762
 
8745
- logger$4.info('Upgrade to video', {
8763
+ logger$8.info('Upgrade to video', {
8746
8764
  id: callSession ? callSession.getId() : null,
8747
8765
  constraints,
8748
8766
  isConference,
@@ -8782,7 +8800,7 @@ class WebRTCPhone extends Emitter {
8782
8800
 
8783
8801
  _sendReinviteMessage(callSession , isUpgrade ) {
8784
8802
  const sipSession = this.findSipSession(callSession);
8785
- logger$4.info('Sending reinvite message', {
8803
+ logger$8.info('Sending reinvite message', {
8786
8804
  id: callSession ? callSession.getId() : null,
8787
8805
  isUpgrade,
8788
8806
  });
@@ -8808,7 +8826,7 @@ class WebRTCPhone extends Emitter {
8808
8826
  // Monkey patch to know when canceled with the CANCEL message
8809
8827
  const onCancel = sipSession._onCancel.bind(sipSession);
8810
8828
  sipSession._onCancel = (message ) => {
8811
- logger$4.trace('on sip session canceled', { callId: message.callId });
8829
+ logger$8.trace('on sip session canceled', { callId: message.callId });
8812
8830
 
8813
8831
  onCancel(message);
8814
8832
  const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
@@ -8836,13 +8854,13 @@ class WebRTCPhone extends Emitter {
8836
8854
  this.audioOutputVolume,
8837
8855
  );
8838
8856
  case sessionState.SessionState.Terminating:
8839
- logger$4.info('WebRTC phone - call terminating', { sipId: sipSession.id });
8857
+ logger$8.info('WebRTC phone - call terminating', { sipId: sipSession.id });
8840
8858
 
8841
8859
  this.eventEmitter.emit(ON_CALL_ENDING, this._createCallSession(sipSession));
8842
8860
 
8843
8861
  break;
8844
8862
  case sessionState.SessionState.Terminated: {
8845
- logger$4.info('WebRTC phone - call terminated', { sipId: sipSession.id });
8863
+ logger$8.info('WebRTC phone - call terminated', { sipId: sipSession.id });
8846
8864
 
8847
8865
  // Should be called before `_onCallTerminated` or the callCount will not decrement...
8848
8866
  const callSession = this._createCallSession(sipSession);
@@ -8864,7 +8882,7 @@ class WebRTCPhone extends Emitter {
8864
8882
  const [stream] = event.streams;
8865
8883
  const kind = event && event.track && event.track.kind;
8866
8884
 
8867
- logger$4.info('on track stream called on the peer connection', {
8885
+ logger$8.info('on track stream called on the peer connection', {
8868
8886
  callId: this.getSipSessionId(sipSession),
8869
8887
  streamId: stream ? stream.id : null,
8870
8888
  tracks: stream ? stream.getTracks() : null,
@@ -8884,7 +8902,7 @@ class WebRTCPhone extends Emitter {
8884
8902
  };
8885
8903
 
8886
8904
  peerConnection.onremovestream = event => {
8887
- logger$4.info('on remove stream called on the peer connection', {
8905
+ logger$8.info('on remove stream called on the peer connection', {
8888
8906
  id: event.stream.id,
8889
8907
  tracks: event.stream.getTracks(),
8890
8908
  });
@@ -8894,7 +8912,7 @@ class WebRTCPhone extends Emitter {
8894
8912
  }
8895
8913
 
8896
8914
  async startScreenSharing(constraints , callSession ) {
8897
- logger$4.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
8915
+ logger$8.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
8898
8916
 
8899
8917
  const screenShareStream = await this.client.getStreamFromConstraints(constraints);
8900
8918
  if (!screenShareStream) {
@@ -8934,7 +8952,7 @@ class WebRTCPhone extends Emitter {
8934
8952
  return;
8935
8953
  }
8936
8954
 
8937
- logger$4.info('WebRTC phone - stop screen sharing', {
8955
+ logger$8.info('WebRTC phone - stop screen sharing', {
8938
8956
  restoreLocalStream,
8939
8957
  });
8940
8958
 
@@ -8990,7 +9008,7 @@ class WebRTCPhone extends Emitter {
8990
9008
  const pc = this.client.getPeerConnection(sipSessionId);
8991
9009
  const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
8992
9010
 
8993
- logger$4.info('WebRTC phone - on screensharing', {
9011
+ logger$8.info('WebRTC phone - on screensharing', {
8994
9012
  hadVideo,
8995
9013
  id: this.getSipSessionId(sipSession),
8996
9014
  screenTrack,
@@ -8998,7 +9016,7 @@ class WebRTCPhone extends Emitter {
8998
9016
 
8999
9017
  if (screenTrack) {
9000
9018
  screenTrack.onended = () => {
9001
- logger$4.info('WebRTC phone - on screenshare ended', {
9019
+ logger$8.info('WebRTC phone - on screenshare ended', {
9002
9020
  hadVideo,
9003
9021
  id: this.getSipSessionId(sipSession),
9004
9022
  screenTrack,
@@ -9029,7 +9047,7 @@ class WebRTCPhone extends Emitter {
9029
9047
  }
9030
9048
 
9031
9049
  _onCallAccepted(sipSession , cameraEnabled ) {
9032
- logger$4.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
9050
+ logger$8.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
9033
9051
 
9034
9052
  const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
9035
9053
  this.currentSipSession = sipSession;
@@ -9047,7 +9065,7 @@ class WebRTCPhone extends Emitter {
9047
9065
  }
9048
9066
 
9049
9067
  changeAudioDevice(id ) {
9050
- logger$4.info('WebRTC phone - change audio device', { deviceId: id });
9068
+ logger$8.info('WebRTC phone - change audio device', { deviceId: id });
9051
9069
  this.audioOutputDeviceId = id;
9052
9070
  this.client.changeAudioOutputDevice(id);
9053
9071
  }
@@ -9057,14 +9075,14 @@ class WebRTCPhone extends Emitter {
9057
9075
  }
9058
9076
 
9059
9077
  changeRingDevice(id ) {
9060
- logger$4.info('WebRTC phone - changing ring device', { id });
9078
+ logger$8.info('WebRTC phone - changing ring device', { id });
9061
9079
 
9062
9080
  this.audioRingDeviceId = id;
9063
9081
  }
9064
9082
 
9065
9083
  // volume is a value between 0 and 1
9066
9084
  changeAudioVolume(volume ) {
9067
- logger$4.info('WebRTC phone - changing audio volume', { volume });
9085
+ logger$8.info('WebRTC phone - changing audio volume', { volume });
9068
9086
 
9069
9087
  this.audioOutputVolume = volume;
9070
9088
  this.client.changeAudioOutputVolume(volume);
@@ -9072,31 +9090,31 @@ class WebRTCPhone extends Emitter {
9072
9090
 
9073
9091
  // volume is a value between 0 and 1
9074
9092
  changeRingVolume(volume ) {
9075
- logger$4.info('WebRTC phone - changing ring volume', { volume });
9093
+ logger$8.info('WebRTC phone - changing ring volume', { volume });
9076
9094
 
9077
9095
  this.audioRingVolume = volume;
9078
9096
  }
9079
9097
 
9080
9098
  changeAudioInputDevice(id ) {
9081
- logger$4.info('WebRTC phone - changeAudio input device', { deviceId: id });
9099
+ logger$8.info('WebRTC phone - changeAudio input device', { deviceId: id });
9082
9100
 
9083
9101
  return this.client.changeAudioInputDevice(id, this.currentSipSession);
9084
9102
  }
9085
9103
 
9086
9104
  changeVideoInputDevice(id ) {
9087
- logger$4.info('WebRTC phone - change video input device', { deviceId: id });
9105
+ logger$8.info('WebRTC phone - change video input device', { deviceId: id });
9088
9106
 
9089
9107
  return this.client.changeVideoInputDevice(id, this.currentSipSession);
9090
9108
  }
9091
9109
 
9092
9110
  changeSessionVideoInputDevice(id ) {
9093
- logger$4.info('WebRTC phone - change session video input device', { deviceId: id });
9111
+ logger$8.info('WebRTC phone - change session video input device', { deviceId: id });
9094
9112
 
9095
9113
  return this.client.changeSessionVideoInputDevice(id, this.currentSipSession);
9096
9114
  }
9097
9115
 
9098
9116
  _onCallTerminated(sipSession ) {
9099
- logger$4.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9117
+ logger$8.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9100
9118
 
9101
9119
  const callSession = this._createCallSession(sipSession);
9102
9120
  const isCurrentSession = this.isCurrentCallSipSession(callSession);
@@ -9130,7 +9148,7 @@ class WebRTCPhone extends Emitter {
9130
9148
  const hasIncomingCallSession = this.hasIncomingCallSession();
9131
9149
 
9132
9150
  // Re-trigger incoming call event for remaining incoming calls
9133
- logger$4.info('WebRTC phone - check to re-trigger incoming call', {
9151
+ logger$8.info('WebRTC phone - check to re-trigger incoming call', {
9134
9152
  sipId: sipSession.id,
9135
9153
  shouldRetrigger,
9136
9154
  hasIncomingCallSession,
@@ -9221,37 +9239,37 @@ class WebRTCPhone extends Emitter {
9221
9239
 
9222
9240
  // Deprecated
9223
9241
  getLocalStreamForCall(callSession ) {
9224
- logger$4.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
9242
+ logger$8.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
9225
9243
 
9226
9244
  return this.getLocalStream(callSession);
9227
9245
  }
9228
9246
 
9229
9247
  // Deprecated
9230
9248
  getRemoteStreamForCall(callSession ) {
9231
- logger$4.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
9249
+ logger$8.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
9232
9250
 
9233
9251
  return this.getRemoteVideoStream(callSession);
9234
9252
  }
9235
9253
 
9236
9254
  getRemoteStreamsForCall(callSession ) {
9237
- logger$4.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
9255
+ logger$8.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
9238
9256
 
9239
9257
  return this.getRemoteStream(callSession);
9240
9258
  }
9241
9259
 
9242
9260
  accept(callSession , cameraEnabled ) {
9243
- logger$4.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
9261
+ logger$8.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
9244
9262
  if (this.currentSipSession) {
9245
9263
  this.holdSipSession(this.currentSipSession, this.currentCallSession, true);
9246
9264
  }
9247
9265
 
9248
9266
  if (!callSession) {
9249
- logger$4.warn('no CallSession to accept.');
9267
+ logger$8.warn('no CallSession to accept.');
9250
9268
  return Promise.resolve(null);
9251
9269
  }
9252
9270
 
9253
9271
  if (callSession.getId() in this.acceptedSessions) {
9254
- logger$4.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
9272
+ logger$8.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
9255
9273
  return Promise.resolve(callSession.sipCallId);
9256
9274
  }
9257
9275
 
@@ -9263,24 +9281,24 @@ class WebRTCPhone extends Emitter {
9263
9281
  const sipSession = this.client.getSipSession(callSession.getId());
9264
9282
  if (sipSession) {
9265
9283
  if (sipSession.state === sessionState.SessionState.Terminated || sipSession.state === sessionState.SessionState.Terminating) {
9266
- logger$4.warn('Trying to answer a terminated sipSession.');
9284
+ logger$8.warn('Trying to answer a terminated sipSession.');
9267
9285
 
9268
9286
  return Promise.resolve(null);
9269
9287
  }
9270
9288
 
9271
- logger$4.info('accept call, session found', { sipId: sipSession.id });
9289
+ logger$8.info('accept call, session found', { sipId: sipSession.id });
9272
9290
 
9273
9291
  // $FlowFixMe
9274
9292
  return this.client.answer(sipSession, this.allowVideo ? cameraEnabled : false).then(() => {
9275
9293
  return callSession.sipCallId;
9276
9294
  }).catch(e => {
9277
- logger$4.error(e);
9295
+ logger$8.error(e);
9278
9296
  this.endCurrentCall(callSession);
9279
9297
  throw e;
9280
9298
  });
9281
9299
  }
9282
9300
 
9283
- logger$4.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
9301
+ logger$8.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
9284
9302
 
9285
9303
  return Promise.resolve(null);
9286
9304
  }
@@ -9290,7 +9308,7 @@ class WebRTCPhone extends Emitter {
9290
9308
  }
9291
9309
 
9292
9310
  async reject(callSession ) {
9293
- logger$4.info('reject WebRTC called', { id: callSession.getId() });
9311
+ logger$8.info('reject WebRTC called', { id: callSession.getId() });
9294
9312
 
9295
9313
  this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'call rejected locally');
9296
9314
  if (!callSession || callSession.getId() in this.rejectedSessions) {
@@ -9302,14 +9320,14 @@ class WebRTCPhone extends Emitter {
9302
9320
 
9303
9321
  const sipSession = this.findSipSession(callSession);
9304
9322
  if (sipSession) {
9305
- logger$4.info('WebRTC rejecting', { sipId: sipSession.id });
9323
+ logger$8.info('WebRTC rejecting', { sipId: sipSession.id });
9306
9324
 
9307
9325
  this.client.hangup(sipSession);
9308
9326
  }
9309
9327
  }
9310
9328
 
9311
9329
  async ignore(callSession ) {
9312
- logger$4.info('WebRTC ignore', { id: callSession.getId() });
9330
+ logger$8.info('WebRTC ignore', { id: callSession.getId() });
9313
9331
 
9314
9332
  // kill the ring
9315
9333
  this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'ignoring call');
@@ -9321,14 +9339,14 @@ class WebRTCPhone extends Emitter {
9321
9339
  const sipSession = this.findSipSession(callSession);
9322
9340
 
9323
9341
  if (sipSession) {
9324
- logger$4.info('WebRTC atxfer', { sipId: sipSession.id });
9342
+ logger$8.info('WebRTC atxfer', { sipId: sipSession.id });
9325
9343
 
9326
9344
  return this.client.atxfer(sipSession);
9327
9345
  }
9328
9346
  }
9329
9347
 
9330
9348
  hold(callSession , withEvent = true, isConference = false) {
9331
- logger$4.info('WebRTC hold', { id: callSession.getId() });
9349
+ logger$8.info('WebRTC hold', { id: callSession.getId() });
9332
9350
 
9333
9351
  const sipSession = this.findSipSession(callSession);
9334
9352
 
@@ -9343,18 +9361,18 @@ class WebRTCPhone extends Emitter {
9343
9361
  }
9344
9362
 
9345
9363
  resume(callSession , isConference = false, withEvent = true) {
9346
- logger$4.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
9364
+ logger$8.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
9347
9365
 
9348
9366
  const sipSession = this.findSipSession(callSession);
9349
9367
  if (!sipSession) {
9350
9368
  return new Promise((resolve, reject) => reject(new Error('No session to resume')));
9351
9369
  }
9352
9370
 
9353
- logger$4.info('WebRTC resuming', { sipId: sipSession.id });
9371
+ logger$8.info('WebRTC resuming', { sipId: sipSession.id });
9354
9372
 
9355
9373
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
9356
9374
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
9357
- logger$4.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9375
+ logger$8.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9358
9376
  this.holdSipSession(this.currentSipSession, callSession);
9359
9377
  }
9360
9378
 
@@ -9379,7 +9397,7 @@ class WebRTCPhone extends Emitter {
9379
9397
  const sessionId = this.getSipSessionId(sipSession);
9380
9398
  const hasVideo = this.client.hasLocalVideo(sessionId);
9381
9399
 
9382
- logger$4.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
9400
+ logger$8.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
9383
9401
 
9384
9402
  // Stop screenshre if needed
9385
9403
  if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
@@ -9410,7 +9428,7 @@ class WebRTCPhone extends Emitter {
9410
9428
  return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
9411
9429
  }
9412
9430
  const sessionId = this.getSipSessionId(sipSession);
9413
- logger$4.info('WebRTC unhold sip session', { sessionId, isConference });
9431
+ logger$8.info('WebRTC unhold sip session', { sessionId, isConference });
9414
9432
 
9415
9433
  const { hasVideo } = this.client.getHeldSession(sessionId) || {};
9416
9434
  const wasScreensharing = this.lastScreenShare && this.lastScreenShare.sipSessionId === sessionId;
@@ -9454,14 +9472,14 @@ class WebRTCPhone extends Emitter {
9454
9472
  }
9455
9473
 
9456
9474
  mute(callSession , withEvent = true) {
9457
- logger$4.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
9475
+ logger$8.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
9458
9476
 
9459
9477
  const sipSession = this.findSipSession(callSession);
9460
9478
  if (!sipSession) {
9461
9479
  return;
9462
9480
  }
9463
9481
 
9464
- logger$4.info('WebRTC muting', { sipId: sipSession.id });
9482
+ logger$8.info('WebRTC muting', { sipId: sipSession.id });
9465
9483
  this.client.mute(sipSession);
9466
9484
  const newCallSession = this._createCallSession(sipSession, callSession, { muted: true });
9467
9485
 
@@ -9475,14 +9493,14 @@ class WebRTCPhone extends Emitter {
9475
9493
  }
9476
9494
 
9477
9495
  unmute(callSession , withEvent = true) {
9478
- logger$4.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
9496
+ logger$8.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
9479
9497
 
9480
9498
  const sipSession = this.findSipSession(callSession);
9481
9499
  if (!sipSession) {
9482
9500
  return;
9483
9501
  }
9484
9502
 
9485
- logger$4.info('WebRTC unmuting', { sipId: sipSession.id });
9503
+ logger$8.info('WebRTC unmuting', { sipId: sipSession.id });
9486
9504
  this.client.unmute(sipSession);
9487
9505
  const newCallSession = this._createCallSession(sipSession, callSession, { muted: false });
9488
9506
 
@@ -9509,7 +9527,7 @@ class WebRTCPhone extends Emitter {
9509
9527
  if (!sipSession) {
9510
9528
  return;
9511
9529
  }
9512
- logger$4.info('WebRTC turn camera on', { sipId: sipSession.id });
9530
+ logger$8.info('WebRTC turn camera on', { sipId: sipSession.id });
9513
9531
 
9514
9532
  this.client.toggleCameraOn(sipSession);
9515
9533
 
@@ -9521,7 +9539,7 @@ class WebRTCPhone extends Emitter {
9521
9539
  if (!sipSession) {
9522
9540
  return;
9523
9541
  }
9524
- logger$4.info('WebRTC turn camera off', { sipId: sipSession.id });
9542
+ logger$8.info('WebRTC turn camera off', { sipId: sipSession.id });
9525
9543
 
9526
9544
  this.client.toggleCameraOff(sipSession);
9527
9545
  this.eventEmitter.emit(ON_CAMERA_DISABLED, this._createCameraDisabledCallSession(sipSession, callSession));
@@ -9533,7 +9551,7 @@ class WebRTCPhone extends Emitter {
9533
9551
  return;
9534
9552
  }
9535
9553
 
9536
- logger$4.info('WebRTC send key', { sipId: sipSession.id, tone });
9554
+ logger$8.info('WebRTC send key', { sipId: sipSession.id, tone });
9537
9555
  this.client.sendDTMF(sipSession, tone);
9538
9556
  }
9539
9557
 
@@ -9541,7 +9559,7 @@ class WebRTCPhone extends Emitter {
9541
9559
  // @TODO: line is not used here
9542
9560
  async makeCall(number , line , cameraEnabled ,
9543
9561
  audioOnly = false, conference = false) {
9544
- logger$4.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled });
9562
+ logger$8.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled, audioOnly, conference });
9545
9563
  if (!number) {
9546
9564
  return Promise.resolve(null);
9547
9565
  }
@@ -9551,7 +9569,7 @@ class WebRTCPhone extends Emitter {
9551
9569
  }
9552
9570
  if (this.currentSipSession) {
9553
9571
  this.holdSipSession(this.currentSipSession, this.currentCallSession, true).catch(e => {
9554
- logger$4.warn('Unable to hold current session when making another call', e);
9572
+ logger$8.warn('Unable to hold current session when making another call', e);
9555
9573
  });
9556
9574
  }
9557
9575
 
@@ -9561,7 +9579,7 @@ class WebRTCPhone extends Emitter {
9561
9579
  this._bindEvents(sipSession);
9562
9580
  } catch (error) {
9563
9581
  console.warn(error);
9564
- logger$4.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
9582
+ logger$8.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
9565
9583
  return Promise.resolve(null);
9566
9584
  }
9567
9585
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
@@ -9589,7 +9607,7 @@ class WebRTCPhone extends Emitter {
9589
9607
  return;
9590
9608
  }
9591
9609
 
9592
- logger$4.info('WebRTC transfer', { sipId: sipSession.id, target });
9610
+ logger$8.info('WebRTC transfer', { sipId: sipSession.id, target });
9593
9611
 
9594
9612
  this.client.transfer(sipSession, target);
9595
9613
  }
@@ -9598,7 +9616,7 @@ class WebRTCPhone extends Emitter {
9598
9616
  const sipSession = this.client.getSipSession(source.sipCallId);
9599
9617
  const sipSessionTarget = this.client.getSipSession(destination.sipCallId);
9600
9618
 
9601
- logger$4.info('WebRTC indirect transfer', {
9619
+ logger$8.info('WebRTC indirect transfer', {
9602
9620
  sipId: sipSession ? sipSession.id : null,
9603
9621
  target: sipSessionTarget ? sipSessionTarget.id : null,
9604
9622
  });
@@ -9637,7 +9655,7 @@ class WebRTCPhone extends Emitter {
9637
9655
  return false;
9638
9656
  }
9639
9657
 
9640
- logger$4.info('WebRTC hangup', { sipId: sipSession.id });
9658
+ logger$8.info('WebRTC hangup', { sipId: sipSession.id });
9641
9659
 
9642
9660
  const sipSessionId = this.getSipSessionId(sipSession);
9643
9661
 
@@ -9683,7 +9701,7 @@ class WebRTCPhone extends Emitter {
9683
9701
  endCurrentCall(callSession ) {
9684
9702
  const isCurrent = this.isCurrentCallSipSession(callSession);
9685
9703
 
9686
- logger$4.info('Ending current call', {
9704
+ logger$8.info('Ending current call', {
9687
9705
  id: callSession ? callSession.getId() : null,
9688
9706
  isCurrent,
9689
9707
  });
@@ -9707,7 +9725,7 @@ class WebRTCPhone extends Emitter {
9707
9725
  }
9708
9726
 
9709
9727
  async close() {
9710
- logger$4.info('WebRTC close');
9728
+ logger$8.info('WebRTC close');
9711
9729
 
9712
9730
  try {
9713
9731
  await Promise.race([
@@ -9715,7 +9733,7 @@ class WebRTCPhone extends Emitter {
9715
9733
  new Promise((resolve, reject) => setTimeout(() => reject(new Error('Unregister, timed out')), 3000)),
9716
9734
  ]);
9717
9735
  } catch (e) {
9718
- logger$4.error('WebRTC close, unregister error', e);
9736
+ logger$8.error('WebRTC close, unregister error', e);
9719
9737
  }
9720
9738
 
9721
9739
  this.client.close();
@@ -9733,12 +9751,12 @@ class WebRTCPhone extends Emitter {
9733
9751
  }
9734
9752
 
9735
9753
  enableRinging() {
9736
- logger$4.info('WebRTC enable ringing');
9754
+ logger$8.info('WebRTC enable ringing');
9737
9755
  this.ringingEnabled = true;
9738
9756
  }
9739
9757
 
9740
9758
  disableRinging() {
9741
- logger$4.info('WebRTC disable ringing');
9759
+ logger$8.info('WebRTC disable ringing');
9742
9760
  this.ringingEnabled = false;
9743
9761
  }
9744
9762
 
@@ -9778,7 +9796,7 @@ class WebRTCPhone extends Emitter {
9778
9796
 
9779
9797
  // Deprecated
9780
9798
  getLocalMediaStream(callSession ) {
9781
- logger$4.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
9799
+ logger$8.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
9782
9800
  return this.getLocalStream(callSession);
9783
9801
  }
9784
9802
 
@@ -9820,7 +9838,7 @@ class WebRTCPhone extends Emitter {
9820
9838
  this.client.on(this.client.INVITE, (sipSession , wantsToDoVideo ) => {
9821
9839
  const autoAnswer = sipSession.request.getHeader('Answer-Mode') === 'Auto';
9822
9840
  const withVideo = this.allowVideo ? wantsToDoVideo : false;
9823
- logger$4.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
9841
+ logger$8.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
9824
9842
 
9825
9843
  const callSession = this._createIncomingCallSession(sipSession, withVideo, null, autoAnswer);
9826
9844
  this.incomingSessions.push(callSession.getId());
@@ -9843,7 +9861,7 @@ class WebRTCPhone extends Emitter {
9843
9861
  });
9844
9862
 
9845
9863
  this.client.on(this.client.ON_REINVITE, (...args) => {
9846
- logger$4.info('WebRTC on reinvite', {
9864
+ logger$8.info('WebRTC on reinvite', {
9847
9865
  sessionId: args[0].id,
9848
9866
  inviteId: args[1].id,
9849
9867
  updatedCalleeName: args[2],
@@ -9863,7 +9881,7 @@ class WebRTCPhone extends Emitter {
9863
9881
  });
9864
9882
 
9865
9883
  this.client.on(this.client.ACCEPTED, (sipSession ) => {
9866
- logger$4.info('WebRTC call accepted', { sipId: sipSession.id });
9884
+ logger$8.info('WebRTC call accepted', { sipId: sipSession.id });
9867
9885
 
9868
9886
  this._onCallAccepted(sipSession, this.client.hasVideo(this.getSipSessionId(sipSession)));
9869
9887
 
@@ -9874,22 +9892,22 @@ class WebRTCPhone extends Emitter {
9874
9892
  this.client.on('ended', () => {});
9875
9893
 
9876
9894
  this.client.on(this.client.ON_ERROR, e => {
9877
- logger$4.error('WebRTC error', e);
9895
+ logger$8.error('WebRTC error', e);
9878
9896
  this.eventEmitter.emit(ON_CALL_ERROR, e);
9879
9897
  });
9880
9898
 
9881
9899
  this.client.on(this.client.UNREGISTERED, () => {
9882
- logger$4.info('WebRTC unregistered');
9900
+ logger$8.info('WebRTC unregistered');
9883
9901
  this.eventEmitter.emit(ON_UNREGISTERED);
9884
9902
  });
9885
9903
 
9886
9904
  this.client.on(this.client.ON_DISCONNECTED, () => {
9887
- logger$4.info('WebRTC disconnected');
9888
- this.eventEmitter.emit(ON_DISCONNECTED$1);
9905
+ logger$8.info('WebRTC disconnected');
9906
+ this.eventEmitter.emit(ON_DISCONNECTED);
9889
9907
  });
9890
9908
 
9891
9909
  this.client.on(this.client.REGISTERED, () => {
9892
- logger$4.info('WebRTC registered', {
9910
+ logger$8.info('WebRTC registered', {
9893
9911
  shouldSendReinvite: this.shouldSendReinvite,
9894
9912
  state: this.currentSipSession ? this.currentSipSession.state : null,
9895
9913
  currentSipSession: !!this.currentSipSession,
@@ -9910,19 +9928,19 @@ class WebRTCPhone extends Emitter {
9910
9928
  // Send reinvite with iceRestart
9911
9929
  this.sendReinvite(this.currentCallSession, null, isConference, !hasVideo, true);
9912
9930
  } catch (e) {
9913
- logger$4.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
9931
+ logger$8.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
9914
9932
  }
9915
9933
  }
9916
9934
  });
9917
9935
 
9918
9936
  this.client.on(this.client.CONNECTED, () => {
9919
- logger$4.info('WebRTC client connected');
9937
+ logger$8.info('WebRTC client connected');
9920
9938
 
9921
9939
  this.stopHeartbeat();
9922
9940
  });
9923
9941
 
9924
9942
  this.client.on(this.client.DISCONNECTED, () => {
9925
- logger$4.info('WebRTC client disconnected');
9943
+ logger$8.info('WebRTC client disconnected');
9926
9944
 
9927
9945
  this.eventEmitter.emit(ON_UNREGISTERED);
9928
9946
 
@@ -9936,7 +9954,7 @@ class WebRTCPhone extends Emitter {
9936
9954
  });
9937
9955
 
9938
9956
  this.client.on(this.client.ON_TRACK, (session, event) => {
9939
- this.eventEmitter.emit(ON_TRACK$1, session, event);
9957
+ this.eventEmitter.emit(ON_TRACK, session, event);
9940
9958
  });
9941
9959
 
9942
9960
  this.client.on('onVideoInputChange', stream => {
@@ -9951,7 +9969,7 @@ class WebRTCPhone extends Emitter {
9951
9969
  this.client.on(this.client.ON_NETWORK_STATS, (session, stats, previousStats) => {
9952
9970
  const callSession = this.getCallSession(this.getSipSessionId(session));
9953
9971
 
9954
- this.eventEmitter.emit(ON_NETWORK_STATS$1, callSession, stats, previousStats);
9972
+ this.eventEmitter.emit(ON_NETWORK_STATS, callSession, stats, previousStats);
9955
9973
  });
9956
9974
 
9957
9975
  // Used when upgrading directly in screenshare mode
@@ -9960,7 +9978,7 @@ class WebRTCPhone extends Emitter {
9960
9978
  const localStream = this.client.getLocalStream(sipSessionId);
9961
9979
  const callSession = this.callSessions[sipSessionId];
9962
9980
 
9963
- logger$4.info('Updrading directly in screensharing mode', {
9981
+ logger$8.info('Updrading directly in screensharing mode', {
9964
9982
  sipSessionId,
9965
9983
  tracks: localStream ? localStream.getTracks() : null,
9966
9984
  });
@@ -10138,8 +10156,8 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
10138
10156
  ON_CALL_ENDED: ON_CALL_ENDED,
10139
10157
  ON_CALL_ENDING: ON_CALL_ENDING,
10140
10158
  ON_MESSAGE: ON_MESSAGE,
10141
- ON_REINVITE: ON_REINVITE$1,
10142
- ON_TRACK: ON_TRACK$1,
10159
+ ON_REINVITE: ON_REINVITE,
10160
+ ON_TRACK: ON_TRACK,
10143
10161
  ON_AUDIO_STREAM: ON_AUDIO_STREAM,
10144
10162
  ON_VIDEO_STREAM: ON_VIDEO_STREAM,
10145
10163
  ON_REMOVE_STREAM: ON_REMOVE_STREAM,
@@ -10154,13 +10172,13 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
10154
10172
  ON_VIDEO_INPUT_CHANGE: ON_VIDEO_INPUT_CHANGE,
10155
10173
  ON_CALL_ERROR: ON_CALL_ERROR,
10156
10174
  ON_MESSAGE_TRACK_UPDATED: ON_MESSAGE_TRACK_UPDATED,
10157
- ON_NETWORK_STATS: ON_NETWORK_STATS$1,
10175
+ ON_NETWORK_STATS: ON_NETWORK_STATS,
10158
10176
  ON_CHAT: ON_CHAT,
10159
10177
  ON_SIGNAL: ON_SIGNAL,
10160
- ON_DISCONNECTED: ON_DISCONNECTED$1,
10178
+ ON_DISCONNECTED: ON_DISCONNECTED,
10161
10179
  MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
10162
10180
  MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
10163
- events: events$1,
10181
+ events: events,
10164
10182
  'default': WebRTCPhone
10165
10183
  });
10166
10184
 
@@ -10169,7 +10187,7 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
10169
10187
  class InvalidSubscription extends Error {}
10170
10188
  class InvalidAuthorization extends Error {}
10171
10189
 
10172
- const logger$5 = IssueReporter$1.loggerFor('simple-auth');
10190
+ const logger$7 = IssueReporter$1.loggerFor('simple-auth');
10173
10191
 
10174
10192
  class Auth {
10175
10193
 
@@ -10204,7 +10222,7 @@ class Auth {
10204
10222
  setApiClientId(this.clientId);
10205
10223
  setRefreshExpiration(this.expiration);
10206
10224
  setOnRefreshToken((token , session ) => {
10207
- logger$5.info('on refresh token done', { token });
10225
+ logger$7.info('on refresh token done', { token });
10208
10226
  setApiToken(token);
10209
10227
  Wazo.Websocket.updateToken(token);
10210
10228
 
@@ -10249,7 +10267,7 @@ class Auth {
10249
10267
  const rawSession = await getApiClient().auth.authenticate(token);
10250
10268
  return this._onAuthenticated(rawSession);
10251
10269
  } catch (e) {
10252
- logger$5.error('on validate token error', e);
10270
+ logger$7.error('on validate token error', e);
10253
10271
  console.warn(e);
10254
10272
  return false;
10255
10273
  }
@@ -10430,7 +10448,7 @@ var Auth$1 = global.wazoAuthInstance;
10430
10448
 
10431
10449
  //
10432
10450
 
10433
- const SOCKET_EVENTS = {
10451
+ const SOCKET_EVENTS$1 = {
10434
10452
  ON_OPEN: 'onopen',
10435
10453
  ON_MESSAGE: 'onmessage',
10436
10454
  ON_ERROR: 'onerror',
@@ -10583,16 +10601,16 @@ class WebSocketClient extends Emitter {
10583
10601
 
10584
10602
  this.socket.onopen = () => {
10585
10603
  logger$6.info('on Wazo WS open', { method: 'connect', host: this.host });
10586
- this.eventEmitter.emit(SOCKET_EVENTS.ON_OPEN);
10604
+ this.eventEmitter.emit(SOCKET_EVENTS$1.ON_OPEN);
10587
10605
  };
10588
10606
 
10589
10607
  this.socket.onerror = event => {
10590
10608
  logger$6.error('on Wazo WS error', event.target);
10591
- this.eventEmitter.emit(SOCKET_EVENTS.ON_ERROR, event);
10609
+ this.eventEmitter.emit(SOCKET_EVENTS$1.ON_ERROR, event);
10592
10610
  };
10593
10611
 
10594
10612
  this.socket.onmessage = (event ) => {
10595
- this.eventEmitter.emit(SOCKET_EVENTS.ON_MESSAGE, event.data);
10613
+ this.eventEmitter.emit(SOCKET_EVENTS$1.ON_MESSAGE, event.data);
10596
10614
 
10597
10615
  const message = JSON.parse(typeof event.data === 'string' ? event.data : '{}');
10598
10616
  let { name } = message;
@@ -10625,11 +10643,11 @@ class WebSocketClient extends Emitter {
10625
10643
  token: this.token,
10626
10644
  });
10627
10645
  this.initialized = false;
10628
- this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, event);
10646
+ this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, event);
10629
10647
 
10630
10648
  switch (event.code) {
10631
10649
  case 4002:
10632
- this.eventEmitter.emit(SOCKET_EVENTS.ON_AUTH_FAILED);
10650
+ this.eventEmitter.emit(SOCKET_EVENTS$1.ON_AUTH_FAILED);
10633
10651
  break;
10634
10652
  }
10635
10653
  };
@@ -10745,7 +10763,7 @@ class WebSocketClient extends Emitter {
10745
10763
  break;
10746
10764
  case 'start':
10747
10765
  this.initialized = true;
10748
- this.eventEmitter.emit(SOCKET_EVENTS.INITIALIZED);
10766
+ this.eventEmitter.emit(SOCKET_EVENTS$1.INITIALIZED);
10749
10767
  break;
10750
10768
  default:
10751
10769
  this.eventEmitter.emit('message', message);
@@ -10792,7 +10810,7 @@ class WebSocketClient extends Emitter {
10792
10810
  logger$6.log('heartbeat timed out', { host: this.host, token: this.token });
10793
10811
 
10794
10812
  this.close();
10795
- this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, new Error('Websocket ping failure.'));
10813
+ this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, new Error('Websocket ping failure.'));
10796
10814
 
10797
10815
  if (this.onHeartBeatTimeout) {
10798
10816
  this.onHeartBeatTimeout();
@@ -10872,7 +10890,7 @@ WebSocketClient.eventLists = [
10872
10890
 
10873
10891
  var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
10874
10892
  __proto__: null,
10875
- SOCKET_EVENTS: SOCKET_EVENTS,
10893
+ SOCKET_EVENTS: SOCKET_EVENTS$1,
10876
10894
  AUTH_SESSION_EXPIRE_SOON: AUTH_SESSION_EXPIRE_SOON,
10877
10895
  FAVORITE_ADDED: FAVORITE_ADDED,
10878
10896
  FAVORITE_DELETED: FAVORITE_DELETED,
@@ -10945,10 +10963,10 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
10945
10963
 
10946
10964
  //
10947
10965
 
10948
- const { SOCKET_EVENTS: SOCKET_EVENTS$1, ...OTHER_EVENTS } = WebSocketClient$1;
10949
- const ALL_EVENTS = [...Object.values(SOCKET_EVENTS$1), ...Object.values(OTHER_EVENTS)];
10966
+ const { SOCKET_EVENTS, ...OTHER_EVENTS } = WebSocketClient$1;
10967
+ const ALL_EVENTS = [...Object.values(SOCKET_EVENTS), ...Object.values(OTHER_EVENTS)];
10950
10968
 
10951
- const logger$7 = IssueReporter$1.loggerFor('simple-ws-client');
10969
+ const logger$5 = IssueReporter$1.loggerFor('simple-ws-client');
10952
10970
 
10953
10971
  class Websocket extends Emitter {
10954
10972
 
@@ -10962,9 +10980,9 @@ class Websocket extends Emitter {
10962
10980
  // $FlowFixMe
10963
10981
  this[key] = OTHER_EVENTS[key];
10964
10982
  });
10965
- Object.keys(SOCKET_EVENTS$1).forEach(key => {
10983
+ Object.keys(SOCKET_EVENTS).forEach(key => {
10966
10984
  // $FlowFixMe
10967
- this[key] = SOCKET_EVENTS$1[key];
10985
+ this[key] = SOCKET_EVENTS[key];
10968
10986
  });
10969
10987
  this.eventLists = WebSocketClient.eventLists;
10970
10988
 
@@ -10972,7 +10990,7 @@ class Websocket extends Emitter {
10972
10990
  }
10973
10991
 
10974
10992
  open(host , session ) {
10975
- logger$7.info('open simple WebSocket', { host, token: session.token });
10993
+ logger$5.info('open simple WebSocket', { host, token: session.token });
10976
10994
  this.ws = new WebSocketClient(
10977
10995
  {
10978
10996
  host,
@@ -11000,7 +11018,7 @@ class Websocket extends Emitter {
11000
11018
  }
11001
11019
 
11002
11020
  updateToken(token ) {
11003
- logger$7.info('update token via simple Websocket', { token, ws: !!this.ws });
11021
+ logger$5.info('update token via simple Websocket', { token, ws: !!this.ws });
11004
11022
 
11005
11023
  if (!this.ws) {
11006
11024
  return;
@@ -11028,7 +11046,7 @@ var Websocket$1 = global.wazoWebsocketInstance;
11028
11046
 
11029
11047
  //
11030
11048
 
11031
- const logger$8 = IssueReporter$1.loggerFor('room');
11049
+ const logger$4 = IssueReporter$1.loggerFor('room');
11032
11050
 
11033
11051
  class Participant extends Emitter {
11034
11052
 
@@ -11150,7 +11168,7 @@ class Participant extends Emitter {
11150
11168
  }
11151
11169
 
11152
11170
  onTalking(isTalking ) {
11153
- logger$8.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
11171
+ logger$4.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
11154
11172
  this.isTalking = isTalking;
11155
11173
  // you may notice we're not broadcasting: since all participants are getting this info
11156
11174
  // directly from asterisk, there's no need to do so
@@ -11253,7 +11271,7 @@ class Participant extends Emitter {
11253
11271
  }
11254
11272
 
11255
11273
  updateStatus(status , broadcast = true) {
11256
- logger$8.info('updating participant status', { name: this.name, status });
11274
+ logger$4.info('updating participant status', { name: this.name, status });
11257
11275
 
11258
11276
  if (typeof status.audioMuted !== 'undefined' && status.audioMuted !== this.audioMuted) {
11259
11277
  if (status.audioMuted) {
@@ -11301,7 +11319,7 @@ class Participant extends Emitter {
11301
11319
 
11302
11320
  broadcastStatus(inboundStatus = null) {
11303
11321
  const status = inboundStatus || this.getStatus();
11304
- logger$8.info('broadcasting participant status', { callId: this.callId, status });
11322
+ logger$4.info('broadcasting participant status', { callId: this.callId, status });
11305
11323
 
11306
11324
  this.room.sendSignal({
11307
11325
  type: SIGNAL_TYPE_PARTICIPANT_UPDATE,
@@ -11337,9 +11355,9 @@ class LocalParticipant extends Participant {
11337
11355
  const SIGNAL_TYPE_PARTICIPANT_UPDATE = 'signal/PARTICIPANT_UPDATE';
11338
11356
  const SIGNAL_TYPE_PARTICIPANT_REQUEST = 'signal/PARTICIPANT_REQUEST';
11339
11357
 
11340
- const logger$9 = IssueReporter$1.loggerFor('sdk-room');
11358
+ const logger$3 = IssueReporter$1.loggerFor('sdk-room');
11341
11359
 
11342
- class Room extends Emitter {
11360
+ class Room$1 extends Emitter {
11343
11361
 
11344
11362
 
11345
11363
 
@@ -11397,7 +11415,7 @@ class Room extends Emitter {
11397
11415
  extra = {},
11398
11416
  ) {
11399
11417
  super();
11400
- logger$9.info('room initialized', { callId, extension, sourceId, meetingUuid });
11418
+ logger$3.info('room initialized', { callId, extension, sourceId, meetingUuid });
11401
11419
 
11402
11420
  // Represents the room callSession
11403
11421
  this.callSession = callSession;
@@ -11463,7 +11481,7 @@ class Room extends Emitter {
11463
11481
  * @returns {Promise<Room>}
11464
11482
  */
11465
11483
  static async connect({ extension, constraints, audioOnly = false, extra, room, meeting } ) {
11466
- logger$9.info('connecting to room', { extension, audioOnly, room: !!room });
11484
+ logger$3.info('connecting to room', { extension, audioOnly, room: !!room });
11467
11485
 
11468
11486
  if (!room) {
11469
11487
  await Wazo.Phone.connect();
@@ -11476,7 +11494,7 @@ class Room extends Emitter {
11476
11494
 
11477
11495
  // Call_created is triggered before call_accepted, so we have to listen for it here.
11478
11496
  Wazo.Websocket.once(Wazo.Websocket.CALL_CREATED, ({ data }) => {
11479
- logger$9.info('room call received via WS', { callId: data.call_id });
11497
+ logger$3.info('room call received via WS', { callId: data.call_id });
11480
11498
  if (room) {
11481
11499
  room.setCallId(data.call_id);
11482
11500
  }
@@ -11484,7 +11502,7 @@ class Room extends Emitter {
11484
11502
 
11485
11503
  const callSession = await Wazo.Phone.call(extension, withCamera, null, audioOnly, true);
11486
11504
  // eslint-disable-next-line no-param-reassign
11487
- room = new Room(callSession, extension, null, null, extra);
11505
+ room = new Room$1(callSession, extension, null, null, extra);
11488
11506
 
11489
11507
  // Wait for the call to be accepted
11490
11508
  await new Promise((resolve, reject) => {
@@ -11505,7 +11523,7 @@ class Room extends Emitter {
11505
11523
  // Retrieve conference
11506
11524
  const conference = contacts.find(contact => contact.numbers.find(number => number.number === extension));
11507
11525
 
11508
- logger$9.info('connected to room', {
11526
+ logger$3.info('connected to room', {
11509
11527
  sourceId: conference ? conference.sourceId : null,
11510
11528
  name: conference ? conference.name : null,
11511
11529
  });
@@ -11515,7 +11533,7 @@ class Room extends Emitter {
11515
11533
  room.setName(conference.name);
11516
11534
  }
11517
11535
  } else if (meeting) {
11518
- logger$9.info('Already connected to meeting', {
11536
+ logger$3.info('Already connected to meeting', {
11519
11537
  uuid: meeting.uuid,
11520
11538
  name: meeting.name,
11521
11539
  });
@@ -11528,13 +11546,13 @@ class Room extends Emitter {
11528
11546
  }
11529
11547
 
11530
11548
  static disconnect() {
11531
- logger$9.info('static disconnection to room');
11549
+ logger$3.info('static disconnection to room');
11532
11550
 
11533
11551
  Wazo.Phone.disconnect();
11534
11552
  }
11535
11553
 
11536
11554
  async disconnect() {
11537
- logger$9.info('disconnection to room called');
11555
+ logger$3.info('disconnection to room called');
11538
11556
 
11539
11557
  await Wazo.Phone.hangup(this.callSession);
11540
11558
  this.callSession = null;
@@ -11554,19 +11572,19 @@ class Room extends Emitter {
11554
11572
  }
11555
11573
 
11556
11574
  setSourceId(sourceId ) {
11557
- logger$9.info('set room source id', { sourceId });
11575
+ logger$3.info('set room source id', { sourceId });
11558
11576
 
11559
11577
  this.sourceId = sourceId;
11560
11578
  }
11561
11579
 
11562
11580
  setMeetingUuid(meetingUuid ) {
11563
- logger$9.info('set meeting uuid', { meetingUuid });
11581
+ logger$3.info('set meeting uuid', { meetingUuid });
11564
11582
 
11565
11583
  this.meetingUuid = meetingUuid;
11566
11584
  }
11567
11585
 
11568
11586
  setCallId(callId ) {
11569
- logger$9.info('set room call id', { callId });
11587
+ logger$3.info('set room call id', { callId });
11570
11588
 
11571
11589
  if (callId) {
11572
11590
  this.callId = callId;
@@ -11574,7 +11592,7 @@ class Room extends Emitter {
11574
11592
  }
11575
11593
 
11576
11594
  setName(name ) {
11577
- logger$9.info('set room name', { name });
11595
+ logger$3.info('set room name', { name });
11578
11596
 
11579
11597
  this.name = name;
11580
11598
  }
@@ -11593,7 +11611,7 @@ class Room extends Emitter {
11593
11611
  }
11594
11612
 
11595
11613
  async startScreenSharing(constraints ) {
11596
- logger$9.info('start room screen sharing', { constraints });
11614
+ logger$3.info('start room screen sharing', { constraints });
11597
11615
 
11598
11616
  const screensharingStream = await Wazo.Phone.startScreenSharing(constraints, this.callSession);
11599
11617
  if (!screensharingStream) {
@@ -11607,7 +11625,7 @@ class Room extends Emitter {
11607
11625
  }
11608
11626
 
11609
11627
  async stopScreenSharing(restoreLocalStream = true) {
11610
- logger$9.info('stop room screen sharing');
11628
+ logger$3.info('stop room screen sharing');
11611
11629
 
11612
11630
  await Wazo.Phone.stopScreenSharing(this.callSession, restoreLocalStream);
11613
11631
 
@@ -11619,7 +11637,7 @@ class Room extends Emitter {
11619
11637
  }
11620
11638
 
11621
11639
  turnCameraOff() {
11622
- logger$9.info('turn room camera off');
11640
+ logger$3.info('turn room camera off');
11623
11641
 
11624
11642
  Wazo.Phone.turnCameraOff(this.callSession);
11625
11643
 
@@ -11629,7 +11647,7 @@ class Room extends Emitter {
11629
11647
  }
11630
11648
 
11631
11649
  turnCameraOn() {
11632
- logger$9.info('turn room camera on');
11650
+ logger$3.info('turn room camera on');
11633
11651
 
11634
11652
  Wazo.Phone.turnCameraOn(this.callSession);
11635
11653
 
@@ -11639,7 +11657,7 @@ class Room extends Emitter {
11639
11657
  }
11640
11658
 
11641
11659
  mute() {
11642
- logger$9.info('mute room');
11660
+ logger$3.info('mute room');
11643
11661
 
11644
11662
  Wazo.Phone.mute(this.callSession);
11645
11663
 
@@ -11647,7 +11665,7 @@ class Room extends Emitter {
11647
11665
  }
11648
11666
 
11649
11667
  unmute() {
11650
- logger$9.info('unmute room');
11668
+ logger$3.info('unmute room');
11651
11669
 
11652
11670
  Wazo.Phone.unmute(this.callSession);
11653
11671
 
@@ -11667,7 +11685,7 @@ class Room extends Emitter {
11667
11685
  }
11668
11686
 
11669
11687
  hold() {
11670
- logger$9.info('hold room');
11688
+ logger$3.info('hold room');
11671
11689
 
11672
11690
  Wazo.Phone.hold(this.callSession, true);
11673
11691
 
@@ -11677,7 +11695,7 @@ class Room extends Emitter {
11677
11695
  }
11678
11696
 
11679
11697
  async resume() {
11680
- logger$9.info('resume room');
11698
+ logger$3.info('resume room');
11681
11699
 
11682
11700
  const newStream = await Wazo.Phone.resume(this.callSession, true);
11683
11701
 
@@ -11705,13 +11723,13 @@ class Room extends Emitter {
11705
11723
  }
11706
11724
 
11707
11725
  sendDTMF(tone ) {
11708
- logger$9.info('send room DTMF', { tone });
11726
+ logger$3.info('send room DTMF', { tone });
11709
11727
 
11710
11728
  Wazo.Phone.sendDTMF(tone, this.callSession);
11711
11729
  }
11712
11730
 
11713
11731
  async sendReinvite(newConstraints = null) {
11714
- logger$9.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
11732
+ logger$3.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
11715
11733
  const wasScreensharing = this.localParticipant && this.localParticipant.screensharing;
11716
11734
 
11717
11735
  Wazo.Phone.on(Wazo.Phone.ON_SHARE_SCREEN_STARTED, () => {
@@ -11770,7 +11788,7 @@ class Room extends Emitter {
11770
11788
  Wazo.Phone.phone.on(Wazo.Phone.phone.client.ON_REINVITE, this._boundOnReinvite);
11771
11789
 
11772
11790
  this.on(this.ON_AUDIO_STREAM, stream => {
11773
- logger$9.info('on room audio stream');
11791
+ logger$3.info('on room audio stream');
11774
11792
 
11775
11793
  this.audioStream = stream;
11776
11794
  if (!this.roomAudioElement) {
@@ -11783,7 +11801,7 @@ class Room extends Emitter {
11783
11801
  });
11784
11802
 
11785
11803
  this.on(this.ON_VIDEO_STREAM, (stream, streamId, event, sipSession) => {
11786
- logger$9.info('on room video stream', { streamId });
11804
+ logger$3.info('on room video stream', { streamId });
11787
11805
 
11788
11806
  this._mapMsid(sipSession.body.body);
11789
11807
 
@@ -11798,7 +11816,7 @@ class Room extends Emitter {
11798
11816
  });
11799
11817
 
11800
11818
  this.on(this.ON_REMOVE_STREAM, stream => {
11801
- logger$9.info('on room remove stream');
11819
+ logger$3.info('on room remove stream');
11802
11820
 
11803
11821
  const participant = this.participants.find(someParticipant =>
11804
11822
  someParticipant.streams.find(someStream => someStream && someStream.id === stream.id));
@@ -11930,7 +11948,7 @@ class Room extends Emitter {
11930
11948
  const requester = this._getParticipantFromCallId(origin.callId);
11931
11949
  if (requester) {
11932
11950
  // @FIXME?: when need to trigger an update on join-in; this is a bit of a hack
11933
- logger$9.info('trigger room requester status', { origin });
11951
+ logger$3.info('trigger room requester status', { origin });
11934
11952
  requester.triggerUpdate('REQUESTER_UPDATE');
11935
11953
  }
11936
11954
  break;
@@ -11961,24 +11979,24 @@ class Room extends Emitter {
11961
11979
 
11962
11980
  // When we join the room, we can call `getConferenceParticipantsAsUser`, not before.
11963
11981
  if (participant.user_uuid === session.uuid) {
11964
- logger$9.info('room current user joined');
11982
+ logger$3.info('room current user joined');
11965
11983
 
11966
11984
  // Retrieve participants via an API calls
11967
11985
  const conferenceId = this.sourceId || payload.data.conference_id;
11968
11986
  let response;
11969
11987
  try {
11970
11988
  if (this.meetingUuid) {
11971
- logger$9.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
11989
+ logger$3.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
11972
11990
  response = await getApiClient().calld.getMeetingParticipantsAsUser(this.meetingUuid);
11973
11991
  } else {
11974
- logger$9.info('fetching conference participants', { conferenceId });
11992
+ logger$3.info('fetching conference participants', { conferenceId });
11975
11993
  response = await getApiClient().calld.getConferenceParticipantsAsUser(conferenceId);
11976
11994
  }
11977
11995
  } catch (e) {
11978
- logger$9.error('room participants fetching, error', e);
11996
+ logger$3.error('room participants fetching, error', e);
11979
11997
  }
11980
11998
  if (response) {
11981
- logger$9.info('conference participants fetched', { nb: response.items.length });
11999
+ logger$3.info('conference participants fetched', { nb: response.items.length });
11982
12000
  participants = response.items.map(item => {
11983
12001
  const isMe = item.call_id === this.callId;
11984
12002
 
@@ -12005,7 +12023,7 @@ class Room extends Emitter {
12005
12023
  ? new Wazo.RemoteParticipant(this, participant)
12006
12024
  : null;
12007
12025
 
12008
- logger$9.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
12026
+ logger$3.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
12009
12027
 
12010
12028
  if (remoteParticipant) {
12011
12029
  this.participants.push(remoteParticipant);
@@ -12170,12 +12188,12 @@ class Room extends Emitter {
12170
12188
 
12171
12189
  //
12172
12190
 
12173
- const logger$a = IssueReporter$1.loggerFor('sdk-sip-room');
12191
+ const logger$2 = IssueReporter$1.loggerFor('sdk-sip-room');
12174
12192
 
12175
- class SipRoom extends Room {
12193
+ class SipRoom extends Room$1 {
12176
12194
 
12177
12195
  static async connect({ extension, constraints, audioOnly = false, extra, room } ) {
12178
- logger$a.info('connecting to sip room', { extension, audioOnly, room: !!room });
12196
+ logger$2.info('connecting to sip room', { extension, audioOnly, room: !!room });
12179
12197
 
12180
12198
  if (!room) {
12181
12199
  await Wazo.Phone.connect();
@@ -12191,7 +12209,7 @@ class SipRoom extends Room {
12191
12209
  room.setCallId(room.callSession.call.id);
12192
12210
  }
12193
12211
 
12194
- logger$a.info('connected to room', {
12212
+ logger$2.info('connected to room', {
12195
12213
  extension: room.extension,
12196
12214
  });
12197
12215
 
@@ -12199,7 +12217,7 @@ class SipRoom extends Room {
12199
12217
  }
12200
12218
 
12201
12219
  mute() {
12202
- logger$a.info('mute sip room');
12220
+ logger$2.info('mute sip room');
12203
12221
 
12204
12222
  Wazo.Phone.mute(this.callSession, false);
12205
12223
 
@@ -12207,7 +12225,7 @@ class SipRoom extends Room {
12207
12225
  }
12208
12226
 
12209
12227
  unmute() {
12210
- logger$a.info('unmute sip room');
12228
+ logger$2.info('unmute sip room');
12211
12229
 
12212
12230
  Wazo.Phone.unmute(this.callSession, false);
12213
12231
 
@@ -12491,7 +12509,7 @@ class NotificationOptions {
12491
12509
 
12492
12510
 
12493
12511
  // Represents a conference room, like `9000`.
12494
- class Room$1 {
12512
+ class Room {
12495
12513
 
12496
12514
 
12497
12515
 
@@ -12512,7 +12530,7 @@ class Room$1 {
12512
12530
  }
12513
12531
 
12514
12532
  connect(callSession ) {
12515
- return new Room$1({ ...this, connectedCallSession: callSession });
12533
+ return new Room({ ...this, connectedCallSession: callSession });
12516
12534
  }
12517
12535
 
12518
12536
  has(callSession ) {
@@ -12521,7 +12539,7 @@ class Room$1 {
12521
12539
 
12522
12540
  addParticipant(uuid , extension , talking = null) {
12523
12541
  if (!this.participants.some(participant => participant.uuid === uuid || participant.extension === extension)) {
12524
- return new Room$1({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
12542
+ return new Room({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
12525
12543
  }
12526
12544
 
12527
12545
  return this;
@@ -12540,7 +12558,7 @@ class Room$1 {
12540
12558
  updatedParticipants.push(participant);
12541
12559
  }
12542
12560
 
12543
- return new Room$1({ ...this, participants: updatedParticipants });
12561
+ return new Room({ ...this, participants: updatedParticipants });
12544
12562
  }
12545
12563
 
12546
12564
  updateParticipantByExtension(extension , participant , shouldAdd = false) {
@@ -12556,7 +12574,7 @@ class Room$1 {
12556
12574
  updatedParticipants.push(participant);
12557
12575
  }
12558
12576
 
12559
- return new Room$1({ ...this, participants: updatedParticipants });
12577
+ return new Room({ ...this, participants: updatedParticipants });
12560
12578
  }
12561
12579
 
12562
12580
  hasCallWithId(id ) {
@@ -12564,18 +12582,18 @@ class Room$1 {
12564
12582
  }
12565
12583
 
12566
12584
  disconnect() {
12567
- return new Room$1({ ...this, connectedCallSession: null });
12585
+ return new Room({ ...this, connectedCallSession: null });
12568
12586
  }
12569
12587
 
12570
12588
  removeParticipantWithUUID(uuid ) {
12571
- return new Room$1({
12589
+ return new Room({
12572
12590
  ...this,
12573
12591
  participants: this.participants.filter(participant => participant.uuid !== uuid),
12574
12592
  });
12575
12593
  }
12576
12594
 
12577
12595
  removeParticipantWithExtension(extension ) {
12578
- return new Room$1({
12596
+ return new Room({
12579
12597
  ...this,
12580
12598
  participants: this.participants.filter(participant => participant.extension !== extension),
12581
12599
  });
@@ -12586,7 +12604,7 @@ class Room$1 {
12586
12604
  }
12587
12605
 
12588
12606
  static newFrom(room ) {
12589
- return newFrom(room, Room$1);
12607
+ return newFrom(room, Room);
12590
12608
  }
12591
12609
  }
12592
12610
 
@@ -12893,11 +12911,11 @@ var wazoWebsocket = {
12893
12911
  resolve();
12894
12912
  };
12895
12913
 
12896
- client.on(SOCKET_EVENTS.ON_ERROR, error => {
12914
+ client.on(SOCKET_EVENTS$1.ON_ERROR, error => {
12897
12915
  handleError(`Connection error : ${error}`);
12898
12916
  });
12899
12917
 
12900
- client.on(SOCKET_EVENTS.ON_OPEN, () => {
12918
+ client.on(SOCKET_EVENTS$1.ON_OPEN, () => {
12901
12919
  if (session.hasEngineVersionGte(HEARTBEAT_ENGINE_VERSION)) {
12902
12920
  client.setOnHeartbeatTimeout(() => {
12903
12921
  handleError('No response to heartbeat');
@@ -12998,7 +13016,7 @@ var webrtc = {
12998
13016
  }),
12999
13017
  };
13000
13018
 
13001
- const parseCandidate$1 = line => {
13019
+ const parseCandidate = line => {
13002
13020
  let parts;
13003
13021
  // Parse both variants.
13004
13022
  if (line.indexOf('a=candidate:') === 0) {
@@ -13089,7 +13107,7 @@ var SymmetricNat = {
13089
13107
  }
13090
13108
 
13091
13109
  if (e.candidate && e.candidate.candidate.indexOf('srflx') !== -1) {
13092
- const cand = parseCandidate$1(e.candidate.candidate);
13110
+ const cand = parseCandidate(e.candidate.candidate);
13093
13111
  if (!candidates[cand.relatedPort]) candidates[cand.relatedPort] = [];
13094
13112
  candidates[cand.relatedPort].push(cand.port);
13095
13113
  } else if (!e.candidate) {
@@ -13157,7 +13175,7 @@ var iceIpv4 = {
13157
13175
  const rawCandidate = e.candidate.candidate;
13158
13176
  if (rawCandidate.indexOf('srflx') !== -1 || rawCandidate.indexOf('relay') !== -1) {
13159
13177
  hasSrflxOrRelay = true;
13160
- const candidate = parseCandidate$1(e.candidate.candidate);
13178
+ const candidate = parseCandidate(e.candidate.candidate);
13161
13179
  ips.push(candidate.ip);
13162
13180
  }
13163
13181
  } else if (!e.candidate) {
@@ -13194,7 +13212,7 @@ var checks = [
13194
13212
 
13195
13213
  //
13196
13214
 
13197
- const logger$b = IssueReporter$1.loggerFor('engine-check');
13215
+ const logger$1 = IssueReporter$1.loggerFor('engine-check');
13198
13216
 
13199
13217
  class Checker {
13200
13218
 
@@ -13212,28 +13230,28 @@ class Checker {
13212
13230
  async check(onCheckBegin = () => {}, onCheckResult = () => {}) {
13213
13231
  await this._addEngineVersion();
13214
13232
 
13215
- logger$b.info('Engine check starting');
13233
+ logger$1.info('Engine check starting');
13216
13234
 
13217
13235
  for (let i = 0; i < this.checks.length; i++) {
13218
13236
  const { name, check } = this.checks[i];
13219
13237
 
13220
- logger$b.info(`Checking ${name} ...`);
13238
+ logger$1.info(`Checking ${name} ...`);
13221
13239
 
13222
13240
  onCheckBegin(name);
13223
13241
  try {
13224
13242
  // eslint-disable-next-line no-await-in-loop
13225
13243
  const result = await check(this.server, this.session, this.externalAppConfig);
13226
- logger$b.info(`Checking ${name} success.`, { result });
13244
+ logger$1.info(`Checking ${name} success.`, { result });
13227
13245
 
13228
13246
  onCheckResult(name, result);
13229
13247
  } catch (e) {
13230
- logger$b.info(`Checking ${name} failure`, { message: e.message });
13248
+ logger$1.info(`Checking ${name} failure`, { message: e.message });
13231
13249
 
13232
13250
  onCheckResult(name, e);
13233
13251
  }
13234
13252
  }
13235
13253
 
13236
- logger$b.info('Engine check done.');
13254
+ logger$1.info('Engine check done.');
13237
13255
  }
13238
13256
 
13239
13257
  addCheck(check ) {
@@ -13257,7 +13275,7 @@ const Wazo = {
13257
13275
  Auth: Auth$1,
13258
13276
  Phone: Phone$1,
13259
13277
  Websocket: Websocket$1,
13260
- Room,
13278
+ Room: Room$1,
13261
13279
  SipRoom,
13262
13280
  RemoteParticipant,
13263
13281
  LocalParticipant,
@@ -13290,7 +13308,7 @@ const Wazo = {
13290
13308
  Session,
13291
13309
  Voicemail,
13292
13310
  Relocation,
13293
- ConferenceRoom: Room$1,
13311
+ ConferenceRoom: Room,
13294
13312
  CallSession,
13295
13313
  IndirectTransfer,
13296
13314
  SwitchboardCall,
@@ -13326,7 +13344,7 @@ if (global) {
13326
13344
 
13327
13345
  //
13328
13346
 
13329
- const logger$c = IssueReporter$1.loggerFor('simple-phone');
13347
+ const logger = IssueReporter$1.loggerFor('simple-phone');
13330
13348
  const sipLogger = IssueReporter$1.loggerFor('sip.js');
13331
13349
  const protocolLogger = IssueReporter$1.loggerFor('sip');
13332
13350
 
@@ -13433,7 +13451,7 @@ class Phone extends Emitter {
13433
13451
  async disconnect() {
13434
13452
  if (this.phone) {
13435
13453
  if (this.phone.hasAnActiveCall()) {
13436
- logger$c.info('hangup call on disconnect');
13454
+ logger.info('hangup call on disconnect');
13437
13455
  // $FlowFixMe
13438
13456
  await this.phone.hangup();
13439
13457
  }
@@ -13456,13 +13474,13 @@ class Phone extends Emitter {
13456
13474
  }
13457
13475
 
13458
13476
  async hangup(callSession ) {
13459
- logger$c.info('hangup via simple phone', { callId: callSession.getId() });
13477
+ logger.info('hangup via simple phone', { callId: callSession.getId() });
13460
13478
 
13461
13479
  return this.phone && this.phone.hangup(callSession);
13462
13480
  }
13463
13481
 
13464
13482
  async accept(callSession , cameraEnabled ) {
13465
- logger$c.info('accept via simple phone', { callId: callSession.getId(), cameraEnabled });
13483
+ logger.info('accept via simple phone', { callId: callSession.getId(), cameraEnabled });
13466
13484
 
13467
13485
  return this.phone && this.phone.accept(callSession, cameraEnabled);
13468
13486
  }
@@ -13501,7 +13519,7 @@ class Phone extends Emitter {
13501
13519
  muteViaAPI(callSession ) {
13502
13520
  if (callSession && callSession.callId) {
13503
13521
  Wazo.getApiClient().calld.mute(callSession.callId).catch(e => {
13504
- logger$c.error('Mute via API, error', e);
13522
+ logger.error('Mute via API, error', e);
13505
13523
  });
13506
13524
  }
13507
13525
  }
@@ -13509,7 +13527,7 @@ class Phone extends Emitter {
13509
13527
  unmuteViaAPI(callSession ) {
13510
13528
  if (callSession && callSession.callId) {
13511
13529
  Wazo.getApiClient().calld.unmute(callSession.callId).catch(e => {
13512
- logger$c.error('Unmute via API, error', e);
13530
+ logger.error('Unmute via API, error', e);
13513
13531
  });
13514
13532
  }
13515
13533
  }
@@ -13617,7 +13635,7 @@ class Phone extends Emitter {
13617
13635
 
13618
13636
  // @Deprecated
13619
13637
  getLocalMediaStream(callSession ) {
13620
- logger$c.warn('Phone.getLocalMediaStream is deprecated, use Phone.getLocalStream instead');
13638
+ logger.warn('Phone.getLocalMediaStream is deprecated, use Phone.getLocalStream instead');
13621
13639
 
13622
13640
  return this.phone && this.phone.getLocalStream(callSession);
13623
13641
  }
@@ -13640,20 +13658,20 @@ class Phone extends Emitter {
13640
13658
 
13641
13659
  // @Deprecated
13642
13660
  getRemoteStreamForCall(callSession ) {
13643
- logger$c.warn('Phone.getRemoteStreamForCall is deprecated, use Phone.getRemoteStream instead');
13661
+ logger.warn('Phone.getRemoteStreamForCall is deprecated, use Phone.getRemoteStream instead');
13644
13662
  return this.getRemoteStream(callSession);
13645
13663
  }
13646
13664
 
13647
13665
  // Returns remote streams directly from the peerConnection
13648
13666
  // @Deprecated
13649
13667
  getRemoteStreamsForCall(callSession ) {
13650
- logger$c.warn('Phone.getRemoteStreamsForCall is deprecated, use Phone.getLocalStream instead');
13668
+ logger.warn('Phone.getRemoteStreamsForCall is deprecated, use Phone.getLocalStream instead');
13651
13669
  return this.getLocalStream(callSession);
13652
13670
  }
13653
13671
 
13654
13672
  // @Deprecated
13655
13673
  getRemoteVideoStreamForCall(callSession ) {
13656
- logger$c.warn('Phone.getRemoteVideoStreamForCall is deprecated, use Phone.getRemoteVideoStream instead');
13674
+ logger.warn('Phone.getRemoteVideoStreamForCall is deprecated, use Phone.getRemoteVideoStream instead');
13657
13675
 
13658
13676
  return this.getRemoteVideoStream(callSession);
13659
13677
  }
@@ -13714,7 +13732,7 @@ class Phone extends Emitter {
13714
13732
 
13715
13733
  _transferEvents() {
13716
13734
  this.unbind();
13717
- [...events, ...transportEvents].forEach(event => {
13735
+ [...events$1, ...transportEvents].forEach(event => {
13718
13736
  this.client.on(event, (...args) =>
13719
13737
  this.eventEmitter.emit.apply(this.eventEmitter.emit, [`client-${event}`, ...args]));
13720
13738
  });