@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
@@ -1024,7 +1024,7 @@ var IssueReporter$1 = new IssueReporter();
1024
1024
 
1025
1025
  const methods = ['head', 'get', 'post', 'put', 'delete'];
1026
1026
 
1027
- const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
1027
+ const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
1028
1028
 
1029
1029
  // Use a function here to be able to mock it in tests
1030
1030
  const realFetch = () => {
@@ -1163,7 +1163,7 @@ class ApiRequester {
1163
1163
  };
1164
1164
 
1165
1165
  if (this.refreshTokenPromise) {
1166
- logger.info('A token is already refreshing, waiting ...', { url });
1166
+ logger$c.info('A token is already refreshing, waiting ...', { url });
1167
1167
  await this.refreshTokenPromise;
1168
1168
  }
1169
1169
 
@@ -1183,7 +1183,7 @@ class ApiRequester {
1183
1183
  return promise.then(async (err ) => {
1184
1184
  // Check if the token is still valid
1185
1185
  if (firstCall && this._checkTokenExpired(response, err)) {
1186
- logger.warn('token expired', { error: err.reason });
1186
+ logger$c.warn('token expired', { error: err.reason });
1187
1187
  // Replay the call after refreshing the token
1188
1188
  return this._replayWithNewToken(err, path, method, body, headers, parse);
1189
1189
  }
@@ -1193,7 +1193,7 @@ class ApiRequester {
1193
1193
  : exceptionClass.fromResponse(err, response.status);
1194
1194
 
1195
1195
  if (this.shouldLogErrors) {
1196
- logger.error('API error', error);
1196
+ logger$c.error('API error', error);
1197
1197
  }
1198
1198
 
1199
1199
  throw error;
@@ -1203,7 +1203,7 @@ class ApiRequester {
1203
1203
  return newParse(response, isJson);
1204
1204
  }).catch(error => {
1205
1205
  if (this.shouldLogErrors) {
1206
- logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
1206
+ logger$c.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
1207
1207
  }
1208
1208
 
1209
1209
  throw error;
@@ -1231,13 +1231,13 @@ class ApiRequester {
1231
1231
  ) {
1232
1232
  const isTokenNotFound = this._isTokenNotFound(err);
1233
1233
  let newPath = path;
1234
- logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
1234
+ logger$c.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
1235
1235
 
1236
1236
  this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
1237
1237
 
1238
1238
  return this.refreshTokenPromise.then(() => {
1239
1239
  this.refreshTokenPromise = null;
1240
- logger.info('token refreshed', { isTokenNotFound });
1240
+ logger$c.info('token refreshed', { isTokenNotFound });
1241
1241
  if (isTokenNotFound) {
1242
1242
  const pathParts = path.split('/');
1243
1243
  pathParts.pop();
@@ -4053,7 +4053,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
4053
4053
 
4054
4054
  // const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
4055
4055
 
4056
- const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
4056
+ const logger$b = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
4057
4057
 
4058
4058
  class CTIPhone extends Emitter {
4059
4059
 
@@ -4066,7 +4066,7 @@ class CTIPhone extends Emitter {
4066
4066
 
4067
4067
  constructor(session , isMobile = false, callbackAllLines = false) {
4068
4068
  super();
4069
- logger$1.info('CTI Phone created');
4069
+ logger$b.info('CTI Phone created');
4070
4070
  this.session = session;
4071
4071
  this.isMobile = isMobile;
4072
4072
  this.callbackAllLines = callbackAllLines;
@@ -4127,7 +4127,7 @@ class CTIPhone extends Emitter {
4127
4127
  }
4128
4128
 
4129
4129
  async makeCall(number , line ) {
4130
- logger$1.info('make CTI call', { number });
4130
+ logger$b.info('make CTI call', { number });
4131
4131
 
4132
4132
  if (!number) {
4133
4133
  return null;
@@ -4150,7 +4150,7 @@ class CTIPhone extends Emitter {
4150
4150
  if (!callSession) {
4151
4151
  return Promise.resolve(null);
4152
4152
  }
4153
- logger$1.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
4153
+ logger$b.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
4154
4154
 
4155
4155
  if (!this.currentCall) {
4156
4156
  this.currentCall = callSession.call;
@@ -4163,7 +4163,7 @@ class CTIPhone extends Emitter {
4163
4163
  if (!callSession) {
4164
4164
  return;
4165
4165
  }
4166
- logger$1.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
4166
+ logger$b.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
4167
4167
 
4168
4168
  this.currentCall = undefined;
4169
4169
  this.eventEmitter.emit('onCallEnded', callSession);
@@ -4173,7 +4173,7 @@ class CTIPhone extends Emitter {
4173
4173
  if (!callSession) {
4174
4174
  return Promise.resolve(false);
4175
4175
  }
4176
- logger$1.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
4176
+ logger$b.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
4177
4177
 
4178
4178
  try {
4179
4179
  await CallApi.cancelCall(callSession);
@@ -4184,7 +4184,7 @@ class CTIPhone extends Emitter {
4184
4184
  this.eventEmitter.emit('onCallEnded', callSession);
4185
4185
  return true;
4186
4186
  } catch (e) {
4187
- logger$1.error('hangup CTI call, error', e);
4187
+ logger$b.error('hangup CTI call, error', e);
4188
4188
 
4189
4189
  this.eventEmitter.emit('onCallFailed', callSession);
4190
4190
  return false;
@@ -4197,7 +4197,7 @@ class CTIPhone extends Emitter {
4197
4197
  if (!callSession) {
4198
4198
  return;
4199
4199
  }
4200
- logger$1.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
4200
+ logger$b.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
4201
4201
 
4202
4202
  await CallApi.cancelCall(callSession);
4203
4203
  this.eventEmitter.emit('onCallEnded', callSession);
@@ -4207,7 +4207,7 @@ class CTIPhone extends Emitter {
4207
4207
  if (!callSession) {
4208
4208
  return;
4209
4209
  }
4210
- logger$1.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
4210
+ logger$b.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
4211
4211
 
4212
4212
  await CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_BLIND);
4213
4213
  }
@@ -4220,19 +4220,19 @@ class CTIPhone extends Emitter {
4220
4220
  if (!callSession) {
4221
4221
  return;
4222
4222
  }
4223
- logger$1.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
4223
+ logger$b.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
4224
4224
 
4225
4225
  return CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_ATTENDED);
4226
4226
  }
4227
4227
 
4228
4228
  async cancelCTIIndirectTransfer(transferId ) {
4229
- logger$1.info('cancel CTI transfer', { transferId });
4229
+ logger$b.info('cancel CTI transfer', { transferId });
4230
4230
 
4231
4231
  return CallApi.cancelCallTransfer(transferId);
4232
4232
  }
4233
4233
 
4234
4234
  async confirmCTIIndirectTransfer(transferId ) {
4235
- logger$1.info('confirm CTI transfer', { transferId });
4235
+ logger$b.info('confirm CTI transfer', { transferId });
4236
4236
 
4237
4237
  return CallApi.confirmCallTransfer(transferId);
4238
4238
  }
@@ -4241,19 +4241,19 @@ class CTIPhone extends Emitter {
4241
4241
  if (!callSession) {
4242
4242
  return;
4243
4243
  }
4244
- logger$1.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
4244
+ logger$b.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
4245
4245
 
4246
4246
  return CallApi.sendDTMF(callSession.callId, digits);
4247
4247
  }
4248
4248
 
4249
4249
  onConnectionMade() {
4250
- logger$1.info('on CTI connection made');
4250
+ logger$b.info('on CTI connection made');
4251
4251
 
4252
4252
  this.eventEmitter.emit('onCallAccepted');
4253
4253
  }
4254
4254
 
4255
4255
  async close() {
4256
- logger$1.info('CTI close');
4256
+ logger$b.info('CTI close');
4257
4257
 
4258
4258
  return Promise.resolve();
4259
4259
  }
@@ -4262,7 +4262,7 @@ class CTIPhone extends Emitter {
4262
4262
  if (!callSession) {
4263
4263
  return;
4264
4264
  }
4265
- logger$1.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
4265
+ logger$b.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
4266
4266
 
4267
4267
  return CallApi.hold(callSession.callId);
4268
4268
  }
@@ -4271,7 +4271,7 @@ class CTIPhone extends Emitter {
4271
4271
  if (!callSession) {
4272
4272
  return;
4273
4273
  }
4274
- logger$1.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
4274
+ logger$b.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
4275
4275
 
4276
4276
  return CallApi.resume(callSession.callId);
4277
4277
  }
@@ -4280,7 +4280,7 @@ class CTIPhone extends Emitter {
4280
4280
  if (!callSession) {
4281
4281
  return;
4282
4282
  }
4283
- logger$1.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
4283
+ logger$b.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
4284
4284
 
4285
4285
  return CallApi.mute(callSession.callId);
4286
4286
  }
@@ -4289,7 +4289,7 @@ class CTIPhone extends Emitter {
4289
4289
  if (!callSession) {
4290
4290
  return;
4291
4291
  }
4292
- logger$1.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
4292
+ logger$b.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
4293
4293
 
4294
4294
  return CallApi.unmute(callSession.callId);
4295
4295
  }
@@ -5298,7 +5298,7 @@ const AGENTD_VERSION = '1.0';
5298
5298
  const WEBHOOKD_VERSION = '1.0';
5299
5299
  const AMID_VERSION = '1.0';
5300
5300
 
5301
- const logger$2 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
5301
+ const logger$a = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
5302
5302
 
5303
5303
  class ApiClient {
5304
5304
 
@@ -5350,12 +5350,12 @@ class ApiClient {
5350
5350
  }
5351
5351
 
5352
5352
  async forceRefreshToken() {
5353
- logger$2.info('forcing refresh token, calling callback');
5353
+ logger$a.info('forcing refresh token, calling callback');
5354
5354
  return this.refreshTokenCallback();
5355
5355
  }
5356
5356
 
5357
5357
  async refreshTokenCallback() {
5358
- logger$2.info('refresh token callback called', {
5358
+ logger$a.info('refresh token callback called', {
5359
5359
  refreshToken: this.refreshToken,
5360
5360
  refreshBackend: this.refreshBackend,
5361
5361
  refreshExpiration: this.refreshExpiration,
@@ -5373,7 +5373,7 @@ class ApiClient {
5373
5373
  this.isMobile,
5374
5374
  );
5375
5375
 
5376
- logger$2.info('token refreshed', { token: session.token });
5376
+ logger$a.info('token refreshed', { token: session.token });
5377
5377
 
5378
5378
  if (this.onRefreshToken) {
5379
5379
  this.onRefreshToken(session.token, session);
@@ -5686,7 +5686,7 @@ class AdHocAPIConference {
5686
5686
 
5687
5687
  /* */
5688
5688
 
5689
- const parseCandidate = (candidate ) => {
5689
+ const parseCandidate$1 = (candidate ) => {
5690
5690
  if (!candidate) {
5691
5691
  return null;
5692
5692
  }
@@ -5840,7 +5840,7 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
5840
5840
  this.peerConnectionDelegate.onicecandidate = event => {
5841
5841
  wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
5842
5842
  if (event.candidate) {
5843
- this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
5843
+ this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
5844
5844
  }
5845
5845
  };
5846
5846
 
@@ -6304,7 +6304,7 @@ const DEFAULT_ICE_TIMEOUT = 3000;
6304
6304
  const SEND_STATS_DELAY = 5000;
6305
6305
 
6306
6306
  const states = ['STATUS_NULL', 'STATUS_NEW', 'STATUS_CONNECTING', 'STATUS_CONNECTED', 'STATUS_COMPLETED'];
6307
- const logger$3 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
6307
+ const logger$9 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
6308
6308
  const statsLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-stats') : console;
6309
6309
 
6310
6310
  // events
@@ -6318,14 +6318,14 @@ const TRANSPORT_ERROR = 'transportError';
6318
6318
  const MESSAGE = 'message';
6319
6319
  const ACCEPTED = 'accepted';
6320
6320
  const REJECTED = 'rejected';
6321
- const ON_TRACK = 'onTrack';
6322
- const ON_REINVITE = 'reinvite';
6321
+ const ON_TRACK$1 = 'onTrack';
6322
+ const ON_REINVITE$1 = 'reinvite';
6323
6323
  const ON_ERROR = 'onError';
6324
6324
  const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
6325
- const ON_NETWORK_STATS = 'onNetworkStats';
6326
- const ON_DISCONNECTED = 'onDisconnected';
6325
+ const ON_NETWORK_STATS$1 = 'onNetworkStats';
6326
+ const ON_DISCONNECTED$1 = 'onDisconnected';
6327
6327
 
6328
- const events = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
6328
+ const events$1 = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
6329
6329
  const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
6330
6330
  class CanceledCallError extends Error {}
6331
6331
 
@@ -6461,12 +6461,12 @@ class WebRTCClient extends Emitter {
6461
6461
  this.MESSAGE = MESSAGE;
6462
6462
  this.ACCEPTED = ACCEPTED;
6463
6463
  this.REJECTED = REJECTED;
6464
- this.ON_TRACK = ON_TRACK;
6465
- this.ON_REINVITE = ON_REINVITE;
6464
+ this.ON_TRACK = ON_TRACK$1;
6465
+ this.ON_REINVITE = ON_REINVITE$1;
6466
6466
  this.ON_ERROR = ON_ERROR;
6467
6467
  this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
6468
- this.ON_NETWORK_STATS = ON_NETWORK_STATS;
6469
- this.ON_DISCONNECTED = ON_DISCONNECTED;
6468
+ this.ON_NETWORK_STATS = ON_NETWORK_STATS$1;
6469
+ this.ON_DISCONNECTED = ON_DISCONNECTED$1;
6470
6470
  }
6471
6471
 
6472
6472
  configureMedia(media ) {
@@ -6483,13 +6483,13 @@ class WebRTCClient extends Emitter {
6483
6483
 
6484
6484
  createUserAgent(configOverrides ) {
6485
6485
  const webRTCConfiguration = this._createWebRTCConfiguration(configOverrides);
6486
- logger$3.info('sdk webrtc, creating UA', { webRTCConfiguration });
6486
+ logger$9.info('sdk webrtc, creating UA', { webRTCConfiguration });
6487
6487
 
6488
6488
  webRTCConfiguration.delegate = {
6489
6489
  onConnect: this.onConnect.bind(this),
6490
6490
  onDisconnect: this.onDisconnect.bind(this),
6491
6491
  onInvite: (invitation ) => {
6492
- logger$3.info('sdk webrtc on invite', {
6492
+ logger$9.info('sdk webrtc on invite', {
6493
6493
  method: 'delegate.onInvite',
6494
6494
  id: invitation.id,
6495
6495
  remoteURI: invitation.remoteURI,
@@ -6532,7 +6532,7 @@ class WebRTCClient extends Emitter {
6532
6532
  }
6533
6533
 
6534
6534
  onConnect() {
6535
- logger$3.info('sdk webrtc connected', { method: 'delegate.onConnect' });
6535
+ logger$9.info('sdk webrtc connected', { method: 'delegate.onConnect' });
6536
6536
  this.eventEmitter.emit(CONNECTED);
6537
6537
  if (!this.isRegistered() && this.registerer && this.registerer.waiting) {
6538
6538
  this.registerer.waitingToggle(false);
@@ -6541,7 +6541,7 @@ class WebRTCClient extends Emitter {
6541
6541
  }
6542
6542
 
6543
6543
  async onDisconnect(error ) {
6544
- logger$3.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
6544
+ logger$9.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
6545
6545
  this.connectionPromise = null;
6546
6546
  // The UA will attempt to reconnect automatically when an error occurred
6547
6547
  this.eventEmitter.emit(DISCONNECTED, error);
@@ -6566,37 +6566,37 @@ class WebRTCClient extends Emitter {
6566
6566
  };
6567
6567
 
6568
6568
  if (this.skipRegister) {
6569
- logger$3.info('sdk webrtc skip register...', logInfo);
6569
+ logger$9.info('sdk webrtc skip register...', logInfo);
6570
6570
  return Promise.resolve();
6571
6571
  }
6572
6572
 
6573
- logger$3.info('sdk webrtc registering...', logInfo);
6573
+ logger$9.info('sdk webrtc registering...', logInfo);
6574
6574
 
6575
6575
  if (!this.userAgent) {
6576
- logger$3.info('sdk webrtc recreating User Agent');
6576
+ logger$9.info('sdk webrtc recreating User Agent');
6577
6577
  this.userAgent = this.createUserAgent(this.uaConfigOverrides);
6578
6578
  }
6579
6579
  if (!this.userAgent || this.isRegistered()) {
6580
- logger$3.info('sdk webrtc registering aborted, already registered or no UA can be created');
6580
+ logger$9.info('sdk webrtc registering aborted, already registered or no UA can be created');
6581
6581
  return Promise.resolve();
6582
6582
  }
6583
6583
 
6584
6584
  if (this.connectionPromise || (this.registerer && this.registerer.waiting)) {
6585
- logger$3.info('sdk webrtc registering aborted due to a registration in progress.');
6585
+ logger$9.info('sdk webrtc registering aborted due to a registration in progress.');
6586
6586
  return Promise.resolve();
6587
6587
  }
6588
6588
 
6589
6589
  const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
6590
6590
 
6591
6591
  const onRegisterFailed = () => {
6592
- logger$3.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
6592
+ logger$9.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
6593
6593
  this.connectionPromise = null;
6594
6594
  if (this.registerer && this.registerer.waiting) {
6595
6595
  this.registerer.waitingToggle(false);
6596
6596
  }
6597
6597
 
6598
6598
  if (tries <= MAX_REGISTER_TRIES) {
6599
- logger$3.info('sdk webrtc registering, retrying...', { tries });
6599
+ logger$9.info('sdk webrtc registering, retrying...', { tries });
6600
6600
  setTimeout(() => this.register(tries + 1), 300);
6601
6601
  }
6602
6602
  };
@@ -6605,18 +6605,18 @@ class WebRTCClient extends Emitter {
6605
6605
  // Avoid race condition with the close method called just before register and setting userAgent to null
6606
6606
  // during the resolution of the primise.
6607
6607
  if (!this.userAgent) {
6608
- logger$3.info('sdk webrtc recreating User Agent after connection');
6608
+ logger$9.info('sdk webrtc recreating User Agent after connection');
6609
6609
  this.userAgent = this.createUserAgent(this.uaConfigOverrides);
6610
6610
  }
6611
6611
 
6612
- logger$3.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
6612
+ logger$9.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
6613
6613
  this.registerer = new Registerer(this.userAgent, registerOptions);
6614
6614
  this.connectionPromise = null;
6615
6615
  this._monkeyPatchRegisterer(this.registerer);
6616
6616
 
6617
6617
  // Bind registerer events
6618
6618
  this.registerer.stateChange.addListener(newState => {
6619
- logger$3.info('sdk webrtc registering, state changed', { newState });
6619
+ logger$9.info('sdk webrtc registering, state changed', { newState });
6620
6620
 
6621
6621
  if (newState === RegistererState.Registered && this.registerer
6622
6622
  && this.registerer.state === RegistererState.Registered) {
@@ -6629,7 +6629,7 @@ class WebRTCClient extends Emitter {
6629
6629
  const options = {
6630
6630
  requestDelegate: {
6631
6631
  onReject: response => {
6632
- logger$3.error('sdk webrtc registering, rejected', { response });
6632
+ logger$9.error('sdk webrtc registering, rejected', { response });
6633
6633
 
6634
6634
  onRegisterFailed();
6635
6635
  },
@@ -6637,13 +6637,13 @@ class WebRTCClient extends Emitter {
6637
6637
  };
6638
6638
 
6639
6639
  return this.registerer.register(options).catch((e) => {
6640
- logger$3.error('sdk webrtc registering, error', e);
6640
+ logger$9.error('sdk webrtc registering, error', e);
6641
6641
 
6642
6642
  this.eventEmitter.emit(REGISTRATION_FAILED);
6643
6643
  return e;
6644
6644
  });
6645
6645
  }).catch(error => {
6646
- logger$3.error('sdk webrtc registering, transport error', error);
6646
+ logger$9.error('sdk webrtc registering, transport error', error);
6647
6647
  onRegisterFailed();
6648
6648
  });
6649
6649
  }
@@ -6672,21 +6672,21 @@ class WebRTCClient extends Emitter {
6672
6672
  }
6673
6673
 
6674
6674
  unregister() {
6675
- logger$3.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
6675
+ logger$9.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
6676
6676
  if (!this.registerer) {
6677
6677
  return Promise.resolve();
6678
6678
  }
6679
6679
 
6680
6680
  try {
6681
6681
  return this.registerer.unregister().then(() => {
6682
- logger$3.info('sdk webrtc unregistered');
6682
+ logger$9.info('sdk webrtc unregistered');
6683
6683
  this._cleanupRegister();
6684
6684
  }).catch(e => {
6685
- logger$3.error('sdk webrtc unregistering, promise error', e);
6685
+ logger$9.error('sdk webrtc unregistering, promise error', e);
6686
6686
  this._cleanupRegister();
6687
6687
  });
6688
6688
  } catch (e) {
6689
- logger$3.error('sdk webrtc unregistering, error', e);
6689
+ logger$9.error('sdk webrtc unregistering, error', e);
6690
6690
  // Avoid issue with `undefined is not an object (evaluating 'new.target.prototype')` when triggering a new
6691
6691
  // error when the registerer is in a bad state
6692
6692
  this._cleanupRegister();
@@ -6694,7 +6694,7 @@ class WebRTCClient extends Emitter {
6694
6694
  }
6695
6695
 
6696
6696
  stop() {
6697
- logger$3.info('sdk webrtc stop', { userAgent: !!this.userAgent });
6697
+ logger$9.info('sdk webrtc stop', { userAgent: !!this.userAgent });
6698
6698
  if (!this.userAgent) {
6699
6699
  return Promise.resolve();
6700
6700
  }
@@ -6702,12 +6702,12 @@ class WebRTCClient extends Emitter {
6702
6702
  return this.userAgent.stop().then(() => {
6703
6703
  return this._cleanupRegister();
6704
6704
  }).catch(e => {
6705
- logger$3.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
6705
+ logger$9.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
6706
6706
  });
6707
6707
  }
6708
6708
 
6709
6709
  call(number , enableVideo , audioOnly = false, conference = false) {
6710
- logger$3.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
6710
+ logger$9.info('sdk webrtc creating call', { number, enableVideo, audioOnly, conference });
6711
6711
  const inviterOptions = {
6712
6712
  sessionDescriptionHandlerOptionsReInvite: {
6713
6713
  conference,
@@ -6738,7 +6738,7 @@ class WebRTCClient extends Emitter {
6738
6738
  this._onAccepted(session, response.session, true);
6739
6739
  },
6740
6740
  onReject: (response ) => {
6741
- logger$3.info('on call rejected', { id: session.id, fromTag: session.fromTag });
6741
+ logger$9.info('on call rejected', { id: session.id, fromTag: session.fromTag });
6742
6742
  this._stopSendingStats(session);
6743
6743
  this.stopNetworkMonitoring(session);
6744
6744
 
@@ -6761,11 +6761,11 @@ class WebRTCClient extends Emitter {
6761
6761
  }
6762
6762
 
6763
6763
  answer(session , enableVideo ) {
6764
- logger$3.info('sdk webrtc answer call', { id: session.id, enableVideo });
6764
+ logger$9.info('sdk webrtc answer call', { id: session.id, enableVideo });
6765
6765
 
6766
6766
  if (!session || !session.accept) {
6767
6767
  const error = 'No session to answer, or not an invitation';
6768
- logger$3.warn(error);
6768
+ logger$9.warn(error);
6769
6769
  return Promise.reject(new Error(error));
6770
6770
  }
6771
6771
  const options = {
@@ -6775,15 +6775,15 @@ class WebRTCClient extends Emitter {
6775
6775
  return session.accept(options).then(() => {
6776
6776
  if (session.isCanceled) {
6777
6777
  const message = 'accepted a canceled session (or was canceled during the accept phase).';
6778
- logger$3.error(message, { id: session.id });
6778
+ logger$9.error(message, { id: session.id });
6779
6779
  this.onCallEnded(session);
6780
6780
 
6781
6781
  throw new CanceledCallError(message);
6782
6782
  }
6783
- logger$3.info('sdk webrtc answer, accepted.');
6783
+ logger$9.info('sdk webrtc answer, accepted.');
6784
6784
  this._onAccepted(session);
6785
6785
  }).catch(e => {
6786
- logger$3.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
6786
+ logger$9.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
6787
6787
 
6788
6788
  throw e;
6789
6789
  });
@@ -6791,7 +6791,7 @@ class WebRTCClient extends Emitter {
6791
6791
 
6792
6792
  hangup(session ) {
6793
6793
  const { state, id } = session;
6794
- logger$3.info('sdk webrtc hangup call', { id, state });
6794
+ logger$9.info('sdk webrtc hangup call', { id, state });
6795
6795
 
6796
6796
  try {
6797
6797
  this._stopSendingStats(session);
@@ -6820,7 +6820,7 @@ class WebRTCClient extends Emitter {
6820
6820
 
6821
6821
  return bye();
6822
6822
  } catch (error) {
6823
- logger$3.warn('sdk webrtc hangup, error', error);
6823
+ logger$9.warn('sdk webrtc hangup, error', error);
6824
6824
  }
6825
6825
 
6826
6826
  return null;
@@ -6838,7 +6838,7 @@ class WebRTCClient extends Emitter {
6838
6838
  // Fetch and emit an event at `interval` with session network stats
6839
6839
  startNetworkMonitoring(session , interval = 1000) {
6840
6840
  const sessionId = this.getSipSessionId(session);
6841
- logger$3.info('starting network inspection', { id: sessionId });
6841
+ logger$9.info('starting network inspection', { id: sessionId });
6842
6842
 
6843
6843
  this.sessionNetworkStats[sessionId] = [];
6844
6844
 
@@ -6848,7 +6848,7 @@ class WebRTCClient extends Emitter {
6848
6848
  stopNetworkMonitoring(session ) {
6849
6849
  const sessionId = this.getSipSessionId(session);
6850
6850
  const exists = sessionId in this.networkMonitoringInterval;
6851
- logger$3.info('stopping network inspection', { id: sessionId, exists });
6851
+ logger$9.info('stopping network inspection', { id: sessionId, exists });
6852
6852
 
6853
6853
  if (exists) {
6854
6854
  clearInterval(this.networkMonitoringInterval[sessionId]);
@@ -6858,17 +6858,17 @@ class WebRTCClient extends Emitter {
6858
6858
  }
6859
6859
 
6860
6860
  reject(session ) {
6861
- logger$3.info('sdk webrtc reject call', { id: session.id });
6861
+ logger$9.info('sdk webrtc reject call', { id: session.id });
6862
6862
 
6863
6863
  try {
6864
6864
  return session.reject ? session.reject() : session.cancel();
6865
6865
  } catch (e) {
6866
- logger$3.warn('Error when rejecting call', e.message, e.stack);
6866
+ logger$9.warn('Error when rejecting call', e.message, e.stack);
6867
6867
  }
6868
6868
  }
6869
6869
 
6870
6870
  async close() {
6871
- logger$3.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
6871
+ logger$9.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
6872
6872
  this._cleanupMedia();
6873
6873
  this.connectionPromise = null;
6874
6874
 
@@ -6899,7 +6899,7 @@ class WebRTCClient extends Emitter {
6899
6899
  // eg: "INVITE not rejectable in state Completed"
6900
6900
  }
6901
6901
  this.userAgent = null;
6902
- logger$3.info('sdk webrtc client closed');
6902
+ logger$9.info('sdk webrtc client closed');
6903
6903
  }
6904
6904
 
6905
6905
  getNumber(session ) {
@@ -6912,13 +6912,13 @@ class WebRTCClient extends Emitter {
6912
6912
  }
6913
6913
 
6914
6914
  mute(session ) {
6915
- logger$3.info('sdk webrtc mute', { id: session.id });
6915
+ logger$9.info('sdk webrtc mute', { id: session.id });
6916
6916
 
6917
6917
  this._toggleAudio(session, true);
6918
6918
  }
6919
6919
 
6920
6920
  unmute(session ) {
6921
- logger$3.info('sdk webrtc unmute', { id: session.id });
6921
+ logger$9.info('sdk webrtc unmute', { id: session.id });
6922
6922
 
6923
6923
  this._toggleAudio(session, false);
6924
6924
  }
@@ -6958,13 +6958,13 @@ class WebRTCClient extends Emitter {
6958
6958
  }
6959
6959
 
6960
6960
  toggleCameraOn(session ) {
6961
- logger$3.info('sdk webrtc toggle camera on', { id: session.id });
6961
+ logger$9.info('sdk webrtc toggle camera on', { id: session.id });
6962
6962
 
6963
6963
  this._toggleVideo(session, false);
6964
6964
  }
6965
6965
 
6966
6966
  toggleCameraOff(session ) {
6967
- logger$3.info('sdk webrtc toggle camera off', { id: session.id });
6967
+ logger$9.info('sdk webrtc toggle camera off', { id: session.id });
6968
6968
 
6969
6969
  this._toggleVideo(session, true);
6970
6970
  }
@@ -6973,7 +6973,7 @@ class WebRTCClient extends Emitter {
6973
6973
  const sessionId = this.getSipSessionId(session);
6974
6974
  const hasVideo = hadVideo || this.hasLocalVideo(sessionId);
6975
6975
 
6976
- logger$3.info('sdk webrtc hold', {
6976
+ logger$9.info('sdk webrtc hold', {
6977
6977
  sessionId,
6978
6978
  keys: Object.keys(this.heldSessions),
6979
6979
  pendingReinvite: !!session.pendingReinvite,
@@ -7022,7 +7022,7 @@ class WebRTCClient extends Emitter {
7022
7022
  const sessionId = this.getSipSessionId(session);
7023
7023
  const hasVideo = sessionId in this.heldSessions && this.heldSessions[sessionId].hasVideo;
7024
7024
 
7025
- logger$3.info('sdk webrtc unhold', {
7025
+ logger$9.info('sdk webrtc unhold', {
7026
7026
  sessionId,
7027
7027
  keys: Object.keys(this.heldSessions),
7028
7028
  pendingReinvite: !!session.pendingReinvite,
@@ -7170,7 +7170,7 @@ class WebRTCClient extends Emitter {
7170
7170
  if (!session.sessionDescriptionHandler) {
7171
7171
  return;
7172
7172
  }
7173
- logger$3.info('Sending DTMF', {
7173
+ logger$9.info('Sending DTMF', {
7174
7174
  id: this.getSipSessionId(session),
7175
7175
  tone,
7176
7176
  });
@@ -7186,7 +7186,7 @@ class WebRTCClient extends Emitter {
7186
7186
  transfer(session , target ) {
7187
7187
  this.hold(session);
7188
7188
 
7189
- logger$3.info('Transfering a session', {
7189
+ logger$9.info('Transfering a session', {
7190
7190
  id: this.getSipSessionId(session),
7191
7191
  target,
7192
7192
  });
@@ -7208,17 +7208,17 @@ class WebRTCClient extends Emitter {
7208
7208
  atxfer(session ) {
7209
7209
  this.hold(session);
7210
7210
 
7211
- logger$3.info('webrtc transfer started', { id: this.getSipSessionId(session) });
7211
+ logger$9.info('webrtc transfer started', { id: this.getSipSessionId(session) });
7212
7212
 
7213
7213
  const result = {
7214
7214
  newSession: null,
7215
7215
  init: async (target ) => {
7216
- logger$3.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
7216
+ logger$9.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
7217
7217
 
7218
7218
  result.newSession = await this.call(target);
7219
7219
  },
7220
7220
  complete: () => {
7221
- logger$3.info('webrtc transfer completed', {
7221
+ logger$9.info('webrtc transfer completed', {
7222
7222
  id: this.getSipSessionId(session),
7223
7223
  referId: this.getSipSessionId(result.newSession),
7224
7224
  });
@@ -7239,7 +7239,7 @@ class WebRTCClient extends Emitter {
7239
7239
  return;
7240
7240
  }
7241
7241
 
7242
- logger$3.info('send WebRTC message', { sipId: sipSession.id, contentType });
7242
+ logger$9.info('send WebRTC message', { sipId: sipSession.id, contentType });
7243
7243
 
7244
7244
  try {
7245
7245
  sipSession.message({
@@ -7281,7 +7281,7 @@ class WebRTCClient extends Emitter {
7281
7281
  }
7282
7282
 
7283
7283
  changeAudioOutputVolume(volume ) {
7284
- logger$3.info('Changing audio output volume', { volume });
7284
+ logger$9.info('Changing audio output volume', { volume });
7285
7285
 
7286
7286
  Object.values(this.audioElements).forEach(audioElement => {
7287
7287
  if (audioElement instanceof HTMLAudioElement) {
@@ -7293,7 +7293,7 @@ class WebRTCClient extends Emitter {
7293
7293
  }
7294
7294
 
7295
7295
  changeAudioOutputDevice(id ) {
7296
- logger$3.info('Changing audio output device', { id });
7296
+ logger$9.info('Changing audio output device', { id });
7297
7297
 
7298
7298
  Object.values(this.audioElements).forEach(audioElement => {
7299
7299
  // `setSinkId` method is not included in any flow type definitions for HTMLAudioElements but is a valid method
@@ -7310,7 +7310,7 @@ class WebRTCClient extends Emitter {
7310
7310
 
7311
7311
  changeAudioInputDevice(id , session ) {
7312
7312
  const currentId = this.getAudioDeviceId();
7313
- logger$3.info('setting audio input device', { id, currentId, session: !!session });
7313
+ logger$9.info('setting audio input device', { id, currentId, session: !!session });
7314
7314
 
7315
7315
  if (id === currentId) {
7316
7316
  return null;
@@ -7356,7 +7356,7 @@ class WebRTCClient extends Emitter {
7356
7356
 
7357
7357
  setVideoInputDevice(id ) {
7358
7358
  const currentId = this.getVideoDeviceId();
7359
- logger$3.info('setting video input device', { id, currentId });
7359
+ logger$9.info('setting video input device', { id, currentId });
7360
7360
 
7361
7361
  if (id === currentId) {
7362
7362
  return null;
@@ -7381,7 +7381,7 @@ class WebRTCClient extends Emitter {
7381
7381
  const sessionId = this.getSipSessionId(session);
7382
7382
  const localStream = this.getLocalStream(sessionId);
7383
7383
 
7384
- logger$3.info('changing video input device', { id, sessionId });
7384
+ logger$9.info('changing video input device', { id, sessionId });
7385
7385
 
7386
7386
  // Release old video stream
7387
7387
  if (localStream) {
@@ -7449,7 +7449,7 @@ class WebRTCClient extends Emitter {
7449
7449
  const shouldDoScreenSharing = newConstraints && newConstraints.screen;
7450
7450
  const desktop = newConstraints && newConstraints.desktop;
7451
7451
 
7452
- logger$3.info('Sending reinvite', {
7452
+ logger$9.info('Sending reinvite', {
7453
7453
  id: this.getSipSessionId(sipSession),
7454
7454
  newConstraints,
7455
7455
  conference,
@@ -7487,7 +7487,7 @@ class WebRTCClient extends Emitter {
7487
7487
  sipSession.incomingInviteRequest.message.body = response.message.body;
7488
7488
  }
7489
7489
 
7490
- logger$3.info('on re-INVITE accepted', {
7490
+ logger$9.info('on re-INVITE accepted', {
7491
7491
  id: this.getSipSessionId(sipSession),
7492
7492
  wasMuted,
7493
7493
  shouldDoScreenSharing,
@@ -7505,7 +7505,7 @@ class WebRTCClient extends Emitter {
7505
7505
  this.eventEmitter.emit(ON_SCREEN_SHARING_REINVITE, sipSession, response, desktop);
7506
7506
  }
7507
7507
 
7508
- return this.eventEmitter.emit(ON_REINVITE, sipSession, response);
7508
+ return this.eventEmitter.emit(ON_REINVITE$1, sipSession, response);
7509
7509
  },
7510
7510
  },
7511
7511
  sessionDescriptionHandlerModifiers: [replaceLocalIpModifier],
@@ -7662,7 +7662,7 @@ class WebRTCClient extends Emitter {
7662
7662
  }
7663
7663
 
7664
7664
  startHeartbeat() {
7665
- logger$3.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
7665
+ logger$9.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
7666
7666
  if (!this.userAgent) {
7667
7667
  this.heartbeat.stop();
7668
7668
  return;
@@ -7675,7 +7675,7 @@ class WebRTCClient extends Emitter {
7675
7675
  }
7676
7676
 
7677
7677
  stopHeartbeat() {
7678
- logger$3.info('sdk webrtc stop heartbeat');
7678
+ logger$9.info('sdk webrtc stop heartbeat');
7679
7679
  this.heartbeat.stop();
7680
7680
  }
7681
7681
 
@@ -7696,7 +7696,7 @@ class WebRTCClient extends Emitter {
7696
7696
  }
7697
7697
 
7698
7698
  attemptReconnection() {
7699
- logger$3.info('attempt reconnection', { userAgent: !!this.userAgent });
7699
+ logger$9.info('attempt reconnection', { userAgent: !!this.userAgent });
7700
7700
  if (!this.userAgent) {
7701
7701
  return;
7702
7702
  }
@@ -7721,7 +7721,7 @@ class WebRTCClient extends Emitter {
7721
7721
  return;
7722
7722
  }
7723
7723
 
7724
- logger$3.info('setting local media stream', {
7724
+ logger$9.info('setting local media stream', {
7725
7725
  sipSessionId,
7726
7726
  tracks: newStream ? newStream.getTracks() : null,
7727
7727
  });
@@ -7738,7 +7738,7 @@ class WebRTCClient extends Emitter {
7738
7738
 
7739
7739
  const oldStream = this.getLocalStream(sipSessionId);
7740
7740
 
7741
- logger$3.info('updating local stream', {
7741
+ logger$9.info('updating local stream', {
7742
7742
  sipSessionId,
7743
7743
  oldStream: !!oldStream,
7744
7744
  tracks: newStream.getTracks(),
@@ -7758,7 +7758,7 @@ class WebRTCClient extends Emitter {
7758
7758
  const remoteStream = this.getRemoteStream(sessionId);
7759
7759
  const pc = this.getPeerConnection(sessionId);
7760
7760
 
7761
- logger$3.info('Updating remote stream', {
7761
+ logger$9.info('Updating remote stream', {
7762
7762
  sessionId,
7763
7763
  tracks: remoteStream ? remoteStream.getTracks() : null,
7764
7764
  receiverTracks: pc && pc.getReceivers ? pc.getReceivers().map(receiver => receiver.track) : null,
@@ -7783,14 +7783,16 @@ class WebRTCClient extends Emitter {
7783
7783
  const screenSharing = constraints && 'screen' in constraints ? constraints.screen : false;
7784
7784
  const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
7785
7785
  const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
7786
+ const mandatoryVideo = constraints && typeof constraints.video === 'object' ? constraints.video.mandatory : {};
7786
7787
 
7787
- logger$3.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
7788
+ logger$9.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
7788
7789
 
7789
7790
  return {
7790
7791
  constraints: {
7791
7792
  // Exact constraint are not supported with `getDisplayMedia` and we must have a video=false in desktop screenshare
7792
7793
  audio: screenSharing ? !isDesktop : (withAudio ? this._getAudioConstraints() : false),
7793
- video: screenSharing ? (isDesktop ? ({ mandatory: { chromeMediaSource: 'desktop' } }) : { cursor: 'always' })
7794
+ video: screenSharing ? (isDesktop
7795
+ ? ({ mandatory: { chromeMediaSource: 'desktop', ...(mandatoryVideo || {}) } }) : { cursor: 'always' })
7794
7796
  : this._getVideoConstraints(enableVideo),
7795
7797
  screen: screenSharing,
7796
7798
  desktop: isDesktop,
@@ -7833,7 +7835,7 @@ class WebRTCClient extends Emitter {
7833
7835
  }
7834
7836
 
7835
7837
  _onTransportError() {
7836
- logger$3.error('on transport error');
7838
+ logger$9.error('on transport error');
7837
7839
  this.eventEmitter.emit(TRANSPORT_ERROR);
7838
7840
  this.attemptReconnection();
7839
7841
  }
@@ -7842,7 +7844,7 @@ class WebRTCClient extends Emitter {
7842
7844
  const body = message && typeof message === 'object' ? message.data : message;
7843
7845
  if (body && body.indexOf('200 OK') !== -1) {
7844
7846
  if (this.hasHeartbeat()) {
7845
- logger$3.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
7847
+ logger$9.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
7846
7848
 
7847
7849
  this.heartbeat.onHeartbeat();
7848
7850
  if (this.heartbeatCb) {
@@ -7853,7 +7855,7 @@ class WebRTCClient extends Emitter {
7853
7855
  }
7854
7856
 
7855
7857
  async _onHeartbeatTimeout() {
7856
- logger$3.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
7858
+ logger$9.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
7857
7859
 
7858
7860
  if (this.heartbeatTimeoutCb) {
7859
7861
  this.heartbeatTimeoutCb();
@@ -7865,7 +7867,7 @@ class WebRTCClient extends Emitter {
7865
7867
  try {
7866
7868
  await this.userAgent.transport.disconnect();
7867
7869
  } catch (e) {
7868
- logger$3.error('Transport disconnection after heartbeat timeout, error', e);
7870
+ logger$9.error('Transport disconnection after heartbeat timeout, error', e);
7869
7871
  }
7870
7872
  }
7871
7873
 
@@ -7898,31 +7900,31 @@ class WebRTCClient extends Emitter {
7898
7900
  }
7899
7901
 
7900
7902
  _connectIfNeeded() {
7901
- logger$3.info('connect if needed, checking', { connected: this.isConnected() });
7903
+ logger$9.info('connect if needed, checking', { connected: this.isConnected() });
7902
7904
  if (!this.userAgent) {
7903
- logger$3.info('need to recreate User Agent');
7905
+ logger$9.info('need to recreate User Agent');
7904
7906
  this.userAgent = this.createUserAgent(this.uaConfigOverrides);
7905
7907
  }
7906
7908
 
7907
7909
  if (this.isConnected()) {
7908
- logger$3.info('webrtc sdk, already connected');
7910
+ logger$9.info('webrtc sdk, already connected');
7909
7911
  return Promise.resolve();
7910
7912
  }
7911
7913
 
7912
7914
  if (this.isConnecting()) {
7913
- logger$3.info('webrtc sdk, already connecting...');
7915
+ logger$9.info('webrtc sdk, already connecting...');
7914
7916
 
7915
7917
  this.connectionPromise = this.userAgent.transport.connectPromise;
7916
7918
  return this.connectionPromise;
7917
7919
  }
7918
7920
 
7919
7921
  if (this.connectionPromise) {
7920
- logger$3.info('webrtc sdk, connection promise connecting...');
7922
+ logger$9.info('webrtc sdk, connection promise connecting...');
7921
7923
  // $FlowFixMe
7922
7924
  return this.connectionPromise;
7923
7925
  }
7924
7926
 
7925
- logger$3.info('WebRTC UA needs to connect');
7927
+ logger$9.info('WebRTC UA needs to connect');
7926
7928
 
7927
7929
  // Force UA to reconnect
7928
7930
  if (this.userAgent && this.userAgent.state !== UserAgentState.Stopped) {
@@ -8047,7 +8049,7 @@ class WebRTCClient extends Emitter {
8047
8049
 
8048
8050
  sdh.peerConnectionDelegate = {
8049
8051
  onicecandidateerror: (error ) => {
8050
- logger$3.error('on icecandidate error', {
8052
+ logger$9.error('on icecandidate error', {
8051
8053
  address: error.address,
8052
8054
  port: error.port,
8053
8055
  errorCode: error.errorCode,
@@ -8076,7 +8078,7 @@ class WebRTCClient extends Emitter {
8076
8078
  updatedNumber = session.assertedIdentity.uri.normal.user;
8077
8079
  updatedCalleeName = session.assertedIdentity.displayName || updatedNumber;
8078
8080
  }
8079
- logger$3.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
8081
+ logger$9.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
8080
8082
 
8081
8083
  // Useful to know if it's a video upgrade or an unhold from a remote peer with a video stream
8082
8084
 
@@ -8092,12 +8094,12 @@ class WebRTCClient extends Emitter {
8092
8094
 
8093
8095
  this._setupMedias(session);
8094
8096
 
8095
- return this.eventEmitter.emit(ON_REINVITE, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
8097
+ return this.eventEmitter.emit(ON_REINVITE$1, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
8096
8098
  };
8097
8099
  }
8098
8100
 
8099
8101
  _onAccepted(session , sessionDialog , withEvent = true) {
8100
- logger$3.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
8102
+ logger$9.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
8101
8103
 
8102
8104
  this.storeSipSession(session);
8103
8105
 
@@ -8109,14 +8111,14 @@ class WebRTCClient extends Emitter {
8109
8111
  const onTrack = (event ) => {
8110
8112
  const isAudioOnly = this._isAudioOnly(session);
8111
8113
  const { kind, label, readyState, id, muted } = event.track;
8112
- logger$3.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
8114
+ logger$9.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
8113
8115
 
8114
8116
  // Stop video track in audio only mode
8115
8117
  if (isAudioOnly && kind === 'video') {
8116
8118
  event.track.stop();
8117
8119
  }
8118
8120
 
8119
- this.eventEmitter.emit(ON_TRACK, session, event);
8121
+ this.eventEmitter.emit(ON_TRACK$1, session, event);
8120
8122
  };
8121
8123
 
8122
8124
  if (session.sessionDescriptionHandler.peerConnection) {
@@ -8125,12 +8127,14 @@ class WebRTCClient extends Emitter {
8125
8127
 
8126
8128
  session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
8127
8129
 
8128
- pc.oniceconnectionstatechange = () => {
8129
- logger$3.info('on ice connection state changed', { state: pc.iceConnectionState });
8130
- if (pc.iceConnectionState === 'disconnected') {
8131
- this.eventEmitter.emit(ON_DISCONNECTED);
8132
- }
8133
- };
8130
+ if (pc) {
8131
+ pc.oniceconnectionstatechange = () => {
8132
+ logger$9.info('on ice connection state changed', { state: pc.iceConnectionState });
8133
+ if (pc.iceConnectionState === 'disconnected') {
8134
+ this.eventEmitter.emit(ON_DISCONNECTED$1);
8135
+ }
8136
+ };
8137
+ }
8134
8138
 
8135
8139
  if (withEvent) {
8136
8140
  this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
@@ -8299,10 +8303,10 @@ class WebRTCClient extends Emitter {
8299
8303
 
8300
8304
  _stopSendingStats(session ) {
8301
8305
  const sessionId = this.getSipSessionId(session);
8302
- logger$3.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
8306
+ logger$9.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
8303
8307
 
8304
8308
  if (sessionId in this.statsIntervals) {
8305
- logger$3.trace('Stop sending stats for call', { sessionId });
8309
+ logger$9.trace('Stop sending stats for call', { sessionId });
8306
8310
  this.statsIntervals[sessionId]();
8307
8311
  delete this.statsIntervals[sessionId];
8308
8312
  }
@@ -8318,7 +8322,7 @@ class WebRTCClient extends Emitter {
8318
8322
  try {
8319
8323
  await this.userAgent.transport.disconnect();
8320
8324
  } catch (e) {
8321
- logger$3.error('WebRTC transport disconnect, error', e);
8325
+ logger$9.error('WebRTC transport disconnect, error', e);
8322
8326
  }
8323
8327
  }
8324
8328
  }
@@ -8340,13 +8344,17 @@ class WebRTCClient extends Emitter {
8340
8344
  const nbStats = this.sessionNetworkStats[sessionId].length;
8341
8345
  const lastNetworkStats = this.sessionNetworkStats[sessionId][nbStats - 1];
8342
8346
  const lastAudioSent = lastNetworkStats ? lastNetworkStats.audioBytesSent : 0;
8347
+ const lastAudioContentSent = lastNetworkStats ? lastNetworkStats.audioContentSent : 0;
8343
8348
  const lastVideoSent = lastNetworkStats ? lastNetworkStats.videoBytesSent : 0;
8344
8349
  const lastAudioReceived = lastNetworkStats ? lastNetworkStats.audioBytesReceived : 0;
8350
+ const lastAudioContentReceived = lastNetworkStats ? lastNetworkStats.audioContentReceived : 0;
8345
8351
  const lastVideoReceived = lastNetworkStats ? lastNetworkStats.videoBytesReceived : 0;
8346
8352
  const lastTransportSent = lastNetworkStats ? lastNetworkStats.transportSent : 0;
8347
8353
  const lastTransportReceived = lastNetworkStats ? lastNetworkStats.transportReceived : 0;
8348
- let audioBytesSent = 0;
8349
- let audioBytesReceived = 0;
8354
+ let audioBytesSent = 0; // content + header
8355
+ let audioBytesReceived = 0; // content + header
8356
+ let audioContentSent = 0; // useful to detect blank call
8357
+ let audioContentReceived = 0;
8350
8358
  let videoBytesSent = 0;
8351
8359
  let videoBytesReceived = 0;
8352
8360
  let transportSent = 0;
@@ -8356,6 +8364,7 @@ class WebRTCClient extends Emitter {
8356
8364
  stats.forEach(report => {
8357
8365
  if (report.type === 'outbound-rtp' && report.kind === 'audio') {
8358
8366
  audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
8367
+ audioContentSent += Number(report.bytesSent);
8359
8368
  }
8360
8369
  if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
8361
8370
  audioBytesSent += Number(report.bytesSent);
@@ -8367,6 +8376,7 @@ class WebRTCClient extends Emitter {
8367
8376
  packetsLost += Number(report.packetsLost);
8368
8377
  networkStats.packetsReceived = Number(report.packetsReceived);
8369
8378
  audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
8379
+ audioContentReceived += Number(report.bytesReceived);
8370
8380
  }
8371
8381
  if (report.type === 'inbound-rtp' && report.kind === 'video') {
8372
8382
  videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
@@ -8395,10 +8405,17 @@ class WebRTCClient extends Emitter {
8395
8405
  });
8396
8406
 
8397
8407
  networkStats.packetsLost = packetsLost;
8408
+
8398
8409
  networkStats.totalAudioBytesSent = audioBytesSent;
8399
8410
  networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
8400
8411
  networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
8401
8412
  networkStats.audioBytesReceived = audioBytesReceived;
8413
+
8414
+ networkStats.totalAudioContentSent = audioContentSent;
8415
+ networkStats.audioContentSent = audioContentSent - lastAudioContentSent;
8416
+ networkStats.totalAudioBytesReceived = audioContentReceived - lastAudioContentReceived;
8417
+ networkStats.audioContentReceived = audioContentReceived;
8418
+
8402
8419
  networkStats.totalVideoBytesSent = videoBytesSent;
8403
8420
  networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
8404
8421
  networkStats.totalVideoBytesReceived = videoBytesReceived;
@@ -8412,7 +8429,7 @@ class WebRTCClient extends Emitter {
8412
8429
  + networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
8413
8430
  + networkStats.transportSent;
8414
8431
 
8415
- this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
8432
+ this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
8416
8433
  this.sessionNetworkStats[sessionId].push(networkStats);
8417
8434
  }
8418
8435
 
@@ -8440,8 +8457,8 @@ const ON_CALL_FAILED = 'onCallFailed';
8440
8457
  const ON_CALL_ENDED = 'onCallEnded';
8441
8458
  const ON_CALL_ENDING = 'onCallEnding';
8442
8459
  const ON_MESSAGE = 'onMessage';
8443
- const ON_REINVITE$1 = 'reinvite';
8444
- const ON_TRACK$1 = 'onTrack';
8460
+ const ON_REINVITE = 'reinvite';
8461
+ const ON_TRACK = 'onTrack';
8445
8462
  const ON_AUDIO_STREAM = 'onAudioStream';
8446
8463
  const ON_VIDEO_STREAM = 'onVideoStream';
8447
8464
  const ON_REMOVE_STREAM = 'onRemoveStream';
@@ -8456,15 +8473,15 @@ const ON_PLAY_PROGRESS_SOUND = 'playProgressSound';
8456
8473
  const ON_VIDEO_INPUT_CHANGE = 'videoInputChange';
8457
8474
  const ON_CALL_ERROR = 'onCallError';
8458
8475
  const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
8459
- const ON_NETWORK_STATS$1 = 'onNetworkStats';
8476
+ const ON_NETWORK_STATS = 'onNetworkStats';
8460
8477
  const ON_CHAT = 'phone/ON_CHAT';
8461
8478
  const ON_SIGNAL = 'phone/ON_SIGNAL';
8462
- const ON_DISCONNECTED$1 = 'onDisconnected';
8479
+ const ON_DISCONNECTED = 'onDisconnected';
8463
8480
 
8464
8481
  const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
8465
8482
  const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
8466
8483
 
8467
- const events$1 = [
8484
+ const events = [
8468
8485
  ON_USER_AGENT,
8469
8486
  ON_REGISTERED,
8470
8487
  ON_UNREGISTERED,
@@ -8482,8 +8499,8 @@ const events$1 = [
8482
8499
  ON_CALL_FAILED,
8483
8500
  ON_CALL_ENDED,
8484
8501
  ON_MESSAGE,
8485
- ON_REINVITE$1,
8486
- ON_TRACK$1,
8502
+ ON_REINVITE,
8503
+ ON_TRACK,
8487
8504
  ON_AUDIO_STREAM,
8488
8505
  ON_VIDEO_STREAM,
8489
8506
  ON_REMOVE_STREAM,
@@ -8498,11 +8515,11 @@ const events$1 = [
8498
8515
  ON_CALL_ERROR,
8499
8516
  ON_CHAT,
8500
8517
  ON_SIGNAL,
8501
- ON_NETWORK_STATS$1,
8502
- ON_DISCONNECTED$1,
8518
+ ON_NETWORK_STATS,
8519
+ ON_DISCONNECTED,
8503
8520
  ];
8504
8521
 
8505
- const logger$4 = IssueReporter$1.loggerFor('webrtc-phone');
8522
+ const logger$8 = IssueReporter$1.loggerFor('webrtc-phone');
8506
8523
 
8507
8524
  class WebRTCPhone extends Emitter {
8508
8525
 
@@ -8575,7 +8592,7 @@ class WebRTCPhone extends Emitter {
8575
8592
  }).catch(error => {
8576
8593
  // Avoid exception on `t.server.scheme` in sip transport when losing the webrtc socket connection
8577
8594
  console.error('register error', error, error.message, error.stack);
8578
- logger$4.error('WebRTC register error', { message: error.message, stack: error.stack });
8595
+ logger$8.error('WebRTC register error', { message: error.message, stack: error.stack });
8579
8596
  });
8580
8597
  }
8581
8598
 
@@ -8590,7 +8607,7 @@ class WebRTCPhone extends Emitter {
8590
8607
  if (!this.client) {
8591
8608
  return;
8592
8609
  }
8593
- logger$4.info('WebRTC phone stop');
8610
+ logger$8.info('WebRTC phone stop');
8594
8611
  this.client.stop();
8595
8612
  }
8596
8613
 
@@ -8605,11 +8622,12 @@ class WebRTCPhone extends Emitter {
8605
8622
  async sendReinvite(callSession , constraints = null, conference = false,
8606
8623
  audioOnly = false, iceRestart = false) {
8607
8624
  const sipSession = this.findSipSession(callSession);
8608
- logger$4.info('WebRTC phone - send reinvite', {
8625
+ logger$8.info('WebRTC phone - send reinvite', {
8609
8626
  sessionId: sipSession ? sipSession.id : null,
8610
8627
  constraints,
8611
8628
  audioOnly,
8612
8629
  conference,
8630
+ iceRestart,
8613
8631
  });
8614
8632
 
8615
8633
  if (!sipSession) {
@@ -8642,7 +8660,7 @@ class WebRTCPhone extends Emitter {
8642
8660
  }
8643
8661
 
8644
8662
  startHeartbeat() {
8645
- logger$4.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
8663
+ logger$8.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
8646
8664
  if (!this.client || this.client.hasHeartbeat()) {
8647
8665
  return;
8648
8666
  }
@@ -8651,7 +8669,7 @@ class WebRTCPhone extends Emitter {
8651
8669
  }
8652
8670
 
8653
8671
  stopHeartbeat() {
8654
- logger$4.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
8672
+ logger$8.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
8655
8673
  if (!this.client) {
8656
8674
  return;
8657
8675
  }
@@ -8668,7 +8686,7 @@ class WebRTCPhone extends Emitter {
8668
8686
  }
8669
8687
 
8670
8688
  reconnect() {
8671
- logger$4.info('WebRTC phone - reconnect', { client: !!this.client });
8689
+ logger$8.info('WebRTC phone - reconnect', { client: !!this.client });
8672
8690
  if (!this.client) {
8673
8691
  return;
8674
8692
  }
@@ -8709,7 +8727,7 @@ class WebRTCPhone extends Emitter {
8709
8727
  return false;
8710
8728
  }
8711
8729
 
8712
- logger$4.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
8730
+ logger$8.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
8713
8731
 
8714
8732
  this.client.downgradeToAudio(sipSession);
8715
8733
 
@@ -8732,7 +8750,7 @@ class WebRTCPhone extends Emitter {
8732
8750
  return Promise.resolve(false);
8733
8751
  }
8734
8752
 
8735
- logger$4.info('Upgrade to video', {
8753
+ logger$8.info('Upgrade to video', {
8736
8754
  id: callSession ? callSession.getId() : null,
8737
8755
  constraints,
8738
8756
  isConference,
@@ -8772,7 +8790,7 @@ class WebRTCPhone extends Emitter {
8772
8790
 
8773
8791
  _sendReinviteMessage(callSession , isUpgrade ) {
8774
8792
  const sipSession = this.findSipSession(callSession);
8775
- logger$4.info('Sending reinvite message', {
8793
+ logger$8.info('Sending reinvite message', {
8776
8794
  id: callSession ? callSession.getId() : null,
8777
8795
  isUpgrade,
8778
8796
  });
@@ -8798,7 +8816,7 @@ class WebRTCPhone extends Emitter {
8798
8816
  // Monkey patch to know when canceled with the CANCEL message
8799
8817
  const onCancel = sipSession._onCancel.bind(sipSession);
8800
8818
  sipSession._onCancel = (message ) => {
8801
- logger$4.trace('on sip session canceled', { callId: message.callId });
8819
+ logger$8.trace('on sip session canceled', { callId: message.callId });
8802
8820
 
8803
8821
  onCancel(message);
8804
8822
  const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
@@ -8826,13 +8844,13 @@ class WebRTCPhone extends Emitter {
8826
8844
  this.audioOutputVolume,
8827
8845
  );
8828
8846
  case SessionState.Terminating:
8829
- logger$4.info('WebRTC phone - call terminating', { sipId: sipSession.id });
8847
+ logger$8.info('WebRTC phone - call terminating', { sipId: sipSession.id });
8830
8848
 
8831
8849
  this.eventEmitter.emit(ON_CALL_ENDING, this._createCallSession(sipSession));
8832
8850
 
8833
8851
  break;
8834
8852
  case SessionState.Terminated: {
8835
- logger$4.info('WebRTC phone - call terminated', { sipId: sipSession.id });
8853
+ logger$8.info('WebRTC phone - call terminated', { sipId: sipSession.id });
8836
8854
 
8837
8855
  // Should be called before `_onCallTerminated` or the callCount will not decrement...
8838
8856
  const callSession = this._createCallSession(sipSession);
@@ -8854,7 +8872,7 @@ class WebRTCPhone extends Emitter {
8854
8872
  const [stream] = event.streams;
8855
8873
  const kind = event && event.track && event.track.kind;
8856
8874
 
8857
- logger$4.info('on track stream called on the peer connection', {
8875
+ logger$8.info('on track stream called on the peer connection', {
8858
8876
  callId: this.getSipSessionId(sipSession),
8859
8877
  streamId: stream ? stream.id : null,
8860
8878
  tracks: stream ? stream.getTracks() : null,
@@ -8874,7 +8892,7 @@ class WebRTCPhone extends Emitter {
8874
8892
  };
8875
8893
 
8876
8894
  peerConnection.onremovestream = event => {
8877
- logger$4.info('on remove stream called on the peer connection', {
8895
+ logger$8.info('on remove stream called on the peer connection', {
8878
8896
  id: event.stream.id,
8879
8897
  tracks: event.stream.getTracks(),
8880
8898
  });
@@ -8884,7 +8902,7 @@ class WebRTCPhone extends Emitter {
8884
8902
  }
8885
8903
 
8886
8904
  async startScreenSharing(constraints , callSession ) {
8887
- logger$4.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
8905
+ logger$8.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
8888
8906
 
8889
8907
  const screenShareStream = await this.client.getStreamFromConstraints(constraints);
8890
8908
  if (!screenShareStream) {
@@ -8924,7 +8942,7 @@ class WebRTCPhone extends Emitter {
8924
8942
  return;
8925
8943
  }
8926
8944
 
8927
- logger$4.info('WebRTC phone - stop screen sharing', {
8945
+ logger$8.info('WebRTC phone - stop screen sharing', {
8928
8946
  restoreLocalStream,
8929
8947
  });
8930
8948
 
@@ -8980,7 +8998,7 @@ class WebRTCPhone extends Emitter {
8980
8998
  const pc = this.client.getPeerConnection(sipSessionId);
8981
8999
  const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
8982
9000
 
8983
- logger$4.info('WebRTC phone - on screensharing', {
9001
+ logger$8.info('WebRTC phone - on screensharing', {
8984
9002
  hadVideo,
8985
9003
  id: this.getSipSessionId(sipSession),
8986
9004
  screenTrack,
@@ -8988,7 +9006,7 @@ class WebRTCPhone extends Emitter {
8988
9006
 
8989
9007
  if (screenTrack) {
8990
9008
  screenTrack.onended = () => {
8991
- logger$4.info('WebRTC phone - on screenshare ended', {
9009
+ logger$8.info('WebRTC phone - on screenshare ended', {
8992
9010
  hadVideo,
8993
9011
  id: this.getSipSessionId(sipSession),
8994
9012
  screenTrack,
@@ -9019,7 +9037,7 @@ class WebRTCPhone extends Emitter {
9019
9037
  }
9020
9038
 
9021
9039
  _onCallAccepted(sipSession , cameraEnabled ) {
9022
- logger$4.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
9040
+ logger$8.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
9023
9041
 
9024
9042
  const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
9025
9043
  this.currentSipSession = sipSession;
@@ -9037,7 +9055,7 @@ class WebRTCPhone extends Emitter {
9037
9055
  }
9038
9056
 
9039
9057
  changeAudioDevice(id ) {
9040
- logger$4.info('WebRTC phone - change audio device', { deviceId: id });
9058
+ logger$8.info('WebRTC phone - change audio device', { deviceId: id });
9041
9059
  this.audioOutputDeviceId = id;
9042
9060
  this.client.changeAudioOutputDevice(id);
9043
9061
  }
@@ -9047,14 +9065,14 @@ class WebRTCPhone extends Emitter {
9047
9065
  }
9048
9066
 
9049
9067
  changeRingDevice(id ) {
9050
- logger$4.info('WebRTC phone - changing ring device', { id });
9068
+ logger$8.info('WebRTC phone - changing ring device', { id });
9051
9069
 
9052
9070
  this.audioRingDeviceId = id;
9053
9071
  }
9054
9072
 
9055
9073
  // volume is a value between 0 and 1
9056
9074
  changeAudioVolume(volume ) {
9057
- logger$4.info('WebRTC phone - changing audio volume', { volume });
9075
+ logger$8.info('WebRTC phone - changing audio volume', { volume });
9058
9076
 
9059
9077
  this.audioOutputVolume = volume;
9060
9078
  this.client.changeAudioOutputVolume(volume);
@@ -9062,31 +9080,31 @@ class WebRTCPhone extends Emitter {
9062
9080
 
9063
9081
  // volume is a value between 0 and 1
9064
9082
  changeRingVolume(volume ) {
9065
- logger$4.info('WebRTC phone - changing ring volume', { volume });
9083
+ logger$8.info('WebRTC phone - changing ring volume', { volume });
9066
9084
 
9067
9085
  this.audioRingVolume = volume;
9068
9086
  }
9069
9087
 
9070
9088
  changeAudioInputDevice(id ) {
9071
- logger$4.info('WebRTC phone - changeAudio input device', { deviceId: id });
9089
+ logger$8.info('WebRTC phone - changeAudio input device', { deviceId: id });
9072
9090
 
9073
9091
  return this.client.changeAudioInputDevice(id, this.currentSipSession);
9074
9092
  }
9075
9093
 
9076
9094
  changeVideoInputDevice(id ) {
9077
- logger$4.info('WebRTC phone - change video input device', { deviceId: id });
9095
+ logger$8.info('WebRTC phone - change video input device', { deviceId: id });
9078
9096
 
9079
9097
  return this.client.changeVideoInputDevice(id, this.currentSipSession);
9080
9098
  }
9081
9099
 
9082
9100
  changeSessionVideoInputDevice(id ) {
9083
- logger$4.info('WebRTC phone - change session video input device', { deviceId: id });
9101
+ logger$8.info('WebRTC phone - change session video input device', { deviceId: id });
9084
9102
 
9085
9103
  return this.client.changeSessionVideoInputDevice(id, this.currentSipSession);
9086
9104
  }
9087
9105
 
9088
9106
  _onCallTerminated(sipSession ) {
9089
- logger$4.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9107
+ logger$8.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9090
9108
 
9091
9109
  const callSession = this._createCallSession(sipSession);
9092
9110
  const isCurrentSession = this.isCurrentCallSipSession(callSession);
@@ -9120,7 +9138,7 @@ class WebRTCPhone extends Emitter {
9120
9138
  const hasIncomingCallSession = this.hasIncomingCallSession();
9121
9139
 
9122
9140
  // Re-trigger incoming call event for remaining incoming calls
9123
- logger$4.info('WebRTC phone - check to re-trigger incoming call', {
9141
+ logger$8.info('WebRTC phone - check to re-trigger incoming call', {
9124
9142
  sipId: sipSession.id,
9125
9143
  shouldRetrigger,
9126
9144
  hasIncomingCallSession,
@@ -9211,37 +9229,37 @@ class WebRTCPhone extends Emitter {
9211
9229
 
9212
9230
  // Deprecated
9213
9231
  getLocalStreamForCall(callSession ) {
9214
- logger$4.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
9232
+ logger$8.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
9215
9233
 
9216
9234
  return this.getLocalStream(callSession);
9217
9235
  }
9218
9236
 
9219
9237
  // Deprecated
9220
9238
  getRemoteStreamForCall(callSession ) {
9221
- logger$4.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
9239
+ logger$8.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
9222
9240
 
9223
9241
  return this.getRemoteVideoStream(callSession);
9224
9242
  }
9225
9243
 
9226
9244
  getRemoteStreamsForCall(callSession ) {
9227
- logger$4.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
9245
+ logger$8.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
9228
9246
 
9229
9247
  return this.getRemoteStream(callSession);
9230
9248
  }
9231
9249
 
9232
9250
  accept(callSession , cameraEnabled ) {
9233
- logger$4.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
9251
+ logger$8.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
9234
9252
  if (this.currentSipSession) {
9235
9253
  this.holdSipSession(this.currentSipSession, this.currentCallSession, true);
9236
9254
  }
9237
9255
 
9238
9256
  if (!callSession) {
9239
- logger$4.warn('no CallSession to accept.');
9257
+ logger$8.warn('no CallSession to accept.');
9240
9258
  return Promise.resolve(null);
9241
9259
  }
9242
9260
 
9243
9261
  if (callSession.getId() in this.acceptedSessions) {
9244
- logger$4.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
9262
+ logger$8.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
9245
9263
  return Promise.resolve(callSession.sipCallId);
9246
9264
  }
9247
9265
 
@@ -9253,24 +9271,24 @@ class WebRTCPhone extends Emitter {
9253
9271
  const sipSession = this.client.getSipSession(callSession.getId());
9254
9272
  if (sipSession) {
9255
9273
  if (sipSession.state === SessionState.Terminated || sipSession.state === SessionState.Terminating) {
9256
- logger$4.warn('Trying to answer a terminated sipSession.');
9274
+ logger$8.warn('Trying to answer a terminated sipSession.');
9257
9275
 
9258
9276
  return Promise.resolve(null);
9259
9277
  }
9260
9278
 
9261
- logger$4.info('accept call, session found', { sipId: sipSession.id });
9279
+ logger$8.info('accept call, session found', { sipId: sipSession.id });
9262
9280
 
9263
9281
  // $FlowFixMe
9264
9282
  return this.client.answer(sipSession, this.allowVideo ? cameraEnabled : false).then(() => {
9265
9283
  return callSession.sipCallId;
9266
9284
  }).catch(e => {
9267
- logger$4.error(e);
9285
+ logger$8.error(e);
9268
9286
  this.endCurrentCall(callSession);
9269
9287
  throw e;
9270
9288
  });
9271
9289
  }
9272
9290
 
9273
- logger$4.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
9291
+ logger$8.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
9274
9292
 
9275
9293
  return Promise.resolve(null);
9276
9294
  }
@@ -9280,7 +9298,7 @@ class WebRTCPhone extends Emitter {
9280
9298
  }
9281
9299
 
9282
9300
  async reject(callSession ) {
9283
- logger$4.info('reject WebRTC called', { id: callSession.getId() });
9301
+ logger$8.info('reject WebRTC called', { id: callSession.getId() });
9284
9302
 
9285
9303
  this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'call rejected locally');
9286
9304
  if (!callSession || callSession.getId() in this.rejectedSessions) {
@@ -9292,14 +9310,14 @@ class WebRTCPhone extends Emitter {
9292
9310
 
9293
9311
  const sipSession = this.findSipSession(callSession);
9294
9312
  if (sipSession) {
9295
- logger$4.info('WebRTC rejecting', { sipId: sipSession.id });
9313
+ logger$8.info('WebRTC rejecting', { sipId: sipSession.id });
9296
9314
 
9297
9315
  this.client.hangup(sipSession);
9298
9316
  }
9299
9317
  }
9300
9318
 
9301
9319
  async ignore(callSession ) {
9302
- logger$4.info('WebRTC ignore', { id: callSession.getId() });
9320
+ logger$8.info('WebRTC ignore', { id: callSession.getId() });
9303
9321
 
9304
9322
  // kill the ring
9305
9323
  this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'ignoring call');
@@ -9311,14 +9329,14 @@ class WebRTCPhone extends Emitter {
9311
9329
  const sipSession = this.findSipSession(callSession);
9312
9330
 
9313
9331
  if (sipSession) {
9314
- logger$4.info('WebRTC atxfer', { sipId: sipSession.id });
9332
+ logger$8.info('WebRTC atxfer', { sipId: sipSession.id });
9315
9333
 
9316
9334
  return this.client.atxfer(sipSession);
9317
9335
  }
9318
9336
  }
9319
9337
 
9320
9338
  hold(callSession , withEvent = true, isConference = false) {
9321
- logger$4.info('WebRTC hold', { id: callSession.getId() });
9339
+ logger$8.info('WebRTC hold', { id: callSession.getId() });
9322
9340
 
9323
9341
  const sipSession = this.findSipSession(callSession);
9324
9342
 
@@ -9333,18 +9351,18 @@ class WebRTCPhone extends Emitter {
9333
9351
  }
9334
9352
 
9335
9353
  resume(callSession , isConference = false, withEvent = true) {
9336
- logger$4.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
9354
+ logger$8.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
9337
9355
 
9338
9356
  const sipSession = this.findSipSession(callSession);
9339
9357
  if (!sipSession) {
9340
9358
  return new Promise((resolve, reject) => reject(new Error('No session to resume')));
9341
9359
  }
9342
9360
 
9343
- logger$4.info('WebRTC resuming', { sipId: sipSession.id });
9361
+ logger$8.info('WebRTC resuming', { sipId: sipSession.id });
9344
9362
 
9345
9363
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
9346
9364
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
9347
- logger$4.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9365
+ logger$8.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9348
9366
  this.holdSipSession(this.currentSipSession, callSession);
9349
9367
  }
9350
9368
 
@@ -9369,7 +9387,7 @@ class WebRTCPhone extends Emitter {
9369
9387
  const sessionId = this.getSipSessionId(sipSession);
9370
9388
  const hasVideo = this.client.hasLocalVideo(sessionId);
9371
9389
 
9372
- logger$4.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
9390
+ logger$8.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
9373
9391
 
9374
9392
  // Stop screenshre if needed
9375
9393
  if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
@@ -9400,7 +9418,7 @@ class WebRTCPhone extends Emitter {
9400
9418
  return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
9401
9419
  }
9402
9420
  const sessionId = this.getSipSessionId(sipSession);
9403
- logger$4.info('WebRTC unhold sip session', { sessionId, isConference });
9421
+ logger$8.info('WebRTC unhold sip session', { sessionId, isConference });
9404
9422
 
9405
9423
  const { hasVideo } = this.client.getHeldSession(sessionId) || {};
9406
9424
  const wasScreensharing = this.lastScreenShare && this.lastScreenShare.sipSessionId === sessionId;
@@ -9444,14 +9462,14 @@ class WebRTCPhone extends Emitter {
9444
9462
  }
9445
9463
 
9446
9464
  mute(callSession , withEvent = true) {
9447
- logger$4.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
9465
+ logger$8.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
9448
9466
 
9449
9467
  const sipSession = this.findSipSession(callSession);
9450
9468
  if (!sipSession) {
9451
9469
  return;
9452
9470
  }
9453
9471
 
9454
- logger$4.info('WebRTC muting', { sipId: sipSession.id });
9472
+ logger$8.info('WebRTC muting', { sipId: sipSession.id });
9455
9473
  this.client.mute(sipSession);
9456
9474
  const newCallSession = this._createCallSession(sipSession, callSession, { muted: true });
9457
9475
 
@@ -9465,14 +9483,14 @@ class WebRTCPhone extends Emitter {
9465
9483
  }
9466
9484
 
9467
9485
  unmute(callSession , withEvent = true) {
9468
- logger$4.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
9486
+ logger$8.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
9469
9487
 
9470
9488
  const sipSession = this.findSipSession(callSession);
9471
9489
  if (!sipSession) {
9472
9490
  return;
9473
9491
  }
9474
9492
 
9475
- logger$4.info('WebRTC unmuting', { sipId: sipSession.id });
9493
+ logger$8.info('WebRTC unmuting', { sipId: sipSession.id });
9476
9494
  this.client.unmute(sipSession);
9477
9495
  const newCallSession = this._createCallSession(sipSession, callSession, { muted: false });
9478
9496
 
@@ -9499,7 +9517,7 @@ class WebRTCPhone extends Emitter {
9499
9517
  if (!sipSession) {
9500
9518
  return;
9501
9519
  }
9502
- logger$4.info('WebRTC turn camera on', { sipId: sipSession.id });
9520
+ logger$8.info('WebRTC turn camera on', { sipId: sipSession.id });
9503
9521
 
9504
9522
  this.client.toggleCameraOn(sipSession);
9505
9523
 
@@ -9511,7 +9529,7 @@ class WebRTCPhone extends Emitter {
9511
9529
  if (!sipSession) {
9512
9530
  return;
9513
9531
  }
9514
- logger$4.info('WebRTC turn camera off', { sipId: sipSession.id });
9532
+ logger$8.info('WebRTC turn camera off', { sipId: sipSession.id });
9515
9533
 
9516
9534
  this.client.toggleCameraOff(sipSession);
9517
9535
  this.eventEmitter.emit(ON_CAMERA_DISABLED, this._createCameraDisabledCallSession(sipSession, callSession));
@@ -9523,7 +9541,7 @@ class WebRTCPhone extends Emitter {
9523
9541
  return;
9524
9542
  }
9525
9543
 
9526
- logger$4.info('WebRTC send key', { sipId: sipSession.id, tone });
9544
+ logger$8.info('WebRTC send key', { sipId: sipSession.id, tone });
9527
9545
  this.client.sendDTMF(sipSession, tone);
9528
9546
  }
9529
9547
 
@@ -9531,7 +9549,7 @@ class WebRTCPhone extends Emitter {
9531
9549
  // @TODO: line is not used here
9532
9550
  async makeCall(number , line , cameraEnabled ,
9533
9551
  audioOnly = false, conference = false) {
9534
- logger$4.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled });
9552
+ logger$8.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled, audioOnly, conference });
9535
9553
  if (!number) {
9536
9554
  return Promise.resolve(null);
9537
9555
  }
@@ -9541,7 +9559,7 @@ class WebRTCPhone extends Emitter {
9541
9559
  }
9542
9560
  if (this.currentSipSession) {
9543
9561
  this.holdSipSession(this.currentSipSession, this.currentCallSession, true).catch(e => {
9544
- logger$4.warn('Unable to hold current session when making another call', e);
9562
+ logger$8.warn('Unable to hold current session when making another call', e);
9545
9563
  });
9546
9564
  }
9547
9565
 
@@ -9551,7 +9569,7 @@ class WebRTCPhone extends Emitter {
9551
9569
  this._bindEvents(sipSession);
9552
9570
  } catch (error) {
9553
9571
  console.warn(error);
9554
- logger$4.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
9572
+ logger$8.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
9555
9573
  return Promise.resolve(null);
9556
9574
  }
9557
9575
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
@@ -9579,7 +9597,7 @@ class WebRTCPhone extends Emitter {
9579
9597
  return;
9580
9598
  }
9581
9599
 
9582
- logger$4.info('WebRTC transfer', { sipId: sipSession.id, target });
9600
+ logger$8.info('WebRTC transfer', { sipId: sipSession.id, target });
9583
9601
 
9584
9602
  this.client.transfer(sipSession, target);
9585
9603
  }
@@ -9588,7 +9606,7 @@ class WebRTCPhone extends Emitter {
9588
9606
  const sipSession = this.client.getSipSession(source.sipCallId);
9589
9607
  const sipSessionTarget = this.client.getSipSession(destination.sipCallId);
9590
9608
 
9591
- logger$4.info('WebRTC indirect transfer', {
9609
+ logger$8.info('WebRTC indirect transfer', {
9592
9610
  sipId: sipSession ? sipSession.id : null,
9593
9611
  target: sipSessionTarget ? sipSessionTarget.id : null,
9594
9612
  });
@@ -9627,7 +9645,7 @@ class WebRTCPhone extends Emitter {
9627
9645
  return false;
9628
9646
  }
9629
9647
 
9630
- logger$4.info('WebRTC hangup', { sipId: sipSession.id });
9648
+ logger$8.info('WebRTC hangup', { sipId: sipSession.id });
9631
9649
 
9632
9650
  const sipSessionId = this.getSipSessionId(sipSession);
9633
9651
 
@@ -9673,7 +9691,7 @@ class WebRTCPhone extends Emitter {
9673
9691
  endCurrentCall(callSession ) {
9674
9692
  const isCurrent = this.isCurrentCallSipSession(callSession);
9675
9693
 
9676
- logger$4.info('Ending current call', {
9694
+ logger$8.info('Ending current call', {
9677
9695
  id: callSession ? callSession.getId() : null,
9678
9696
  isCurrent,
9679
9697
  });
@@ -9697,7 +9715,7 @@ class WebRTCPhone extends Emitter {
9697
9715
  }
9698
9716
 
9699
9717
  async close() {
9700
- logger$4.info('WebRTC close');
9718
+ logger$8.info('WebRTC close');
9701
9719
 
9702
9720
  try {
9703
9721
  await Promise.race([
@@ -9705,7 +9723,7 @@ class WebRTCPhone extends Emitter {
9705
9723
  new Promise((resolve, reject) => setTimeout(() => reject(new Error('Unregister, timed out')), 3000)),
9706
9724
  ]);
9707
9725
  } catch (e) {
9708
- logger$4.error('WebRTC close, unregister error', e);
9726
+ logger$8.error('WebRTC close, unregister error', e);
9709
9727
  }
9710
9728
 
9711
9729
  this.client.close();
@@ -9723,12 +9741,12 @@ class WebRTCPhone extends Emitter {
9723
9741
  }
9724
9742
 
9725
9743
  enableRinging() {
9726
- logger$4.info('WebRTC enable ringing');
9744
+ logger$8.info('WebRTC enable ringing');
9727
9745
  this.ringingEnabled = true;
9728
9746
  }
9729
9747
 
9730
9748
  disableRinging() {
9731
- logger$4.info('WebRTC disable ringing');
9749
+ logger$8.info('WebRTC disable ringing');
9732
9750
  this.ringingEnabled = false;
9733
9751
  }
9734
9752
 
@@ -9768,7 +9786,7 @@ class WebRTCPhone extends Emitter {
9768
9786
 
9769
9787
  // Deprecated
9770
9788
  getLocalMediaStream(callSession ) {
9771
- logger$4.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
9789
+ logger$8.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
9772
9790
  return this.getLocalStream(callSession);
9773
9791
  }
9774
9792
 
@@ -9810,7 +9828,7 @@ class WebRTCPhone extends Emitter {
9810
9828
  this.client.on(this.client.INVITE, (sipSession , wantsToDoVideo ) => {
9811
9829
  const autoAnswer = sipSession.request.getHeader('Answer-Mode') === 'Auto';
9812
9830
  const withVideo = this.allowVideo ? wantsToDoVideo : false;
9813
- logger$4.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
9831
+ logger$8.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
9814
9832
 
9815
9833
  const callSession = this._createIncomingCallSession(sipSession, withVideo, null, autoAnswer);
9816
9834
  this.incomingSessions.push(callSession.getId());
@@ -9833,7 +9851,7 @@ class WebRTCPhone extends Emitter {
9833
9851
  });
9834
9852
 
9835
9853
  this.client.on(this.client.ON_REINVITE, (...args) => {
9836
- logger$4.info('WebRTC on reinvite', {
9854
+ logger$8.info('WebRTC on reinvite', {
9837
9855
  sessionId: args[0].id,
9838
9856
  inviteId: args[1].id,
9839
9857
  updatedCalleeName: args[2],
@@ -9853,7 +9871,7 @@ class WebRTCPhone extends Emitter {
9853
9871
  });
9854
9872
 
9855
9873
  this.client.on(this.client.ACCEPTED, (sipSession ) => {
9856
- logger$4.info('WebRTC call accepted', { sipId: sipSession.id });
9874
+ logger$8.info('WebRTC call accepted', { sipId: sipSession.id });
9857
9875
 
9858
9876
  this._onCallAccepted(sipSession, this.client.hasVideo(this.getSipSessionId(sipSession)));
9859
9877
 
@@ -9864,22 +9882,22 @@ class WebRTCPhone extends Emitter {
9864
9882
  this.client.on('ended', () => {});
9865
9883
 
9866
9884
  this.client.on(this.client.ON_ERROR, e => {
9867
- logger$4.error('WebRTC error', e);
9885
+ logger$8.error('WebRTC error', e);
9868
9886
  this.eventEmitter.emit(ON_CALL_ERROR, e);
9869
9887
  });
9870
9888
 
9871
9889
  this.client.on(this.client.UNREGISTERED, () => {
9872
- logger$4.info('WebRTC unregistered');
9890
+ logger$8.info('WebRTC unregistered');
9873
9891
  this.eventEmitter.emit(ON_UNREGISTERED);
9874
9892
  });
9875
9893
 
9876
9894
  this.client.on(this.client.ON_DISCONNECTED, () => {
9877
- logger$4.info('WebRTC disconnected');
9878
- this.eventEmitter.emit(ON_DISCONNECTED$1);
9895
+ logger$8.info('WebRTC disconnected');
9896
+ this.eventEmitter.emit(ON_DISCONNECTED);
9879
9897
  });
9880
9898
 
9881
9899
  this.client.on(this.client.REGISTERED, () => {
9882
- logger$4.info('WebRTC registered', {
9900
+ logger$8.info('WebRTC registered', {
9883
9901
  shouldSendReinvite: this.shouldSendReinvite,
9884
9902
  state: this.currentSipSession ? this.currentSipSession.state : null,
9885
9903
  currentSipSession: !!this.currentSipSession,
@@ -9900,19 +9918,19 @@ class WebRTCPhone extends Emitter {
9900
9918
  // Send reinvite with iceRestart
9901
9919
  this.sendReinvite(this.currentCallSession, null, isConference, !hasVideo, true);
9902
9920
  } catch (e) {
9903
- logger$4.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
9921
+ logger$8.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
9904
9922
  }
9905
9923
  }
9906
9924
  });
9907
9925
 
9908
9926
  this.client.on(this.client.CONNECTED, () => {
9909
- logger$4.info('WebRTC client connected');
9927
+ logger$8.info('WebRTC client connected');
9910
9928
 
9911
9929
  this.stopHeartbeat();
9912
9930
  });
9913
9931
 
9914
9932
  this.client.on(this.client.DISCONNECTED, () => {
9915
- logger$4.info('WebRTC client disconnected');
9933
+ logger$8.info('WebRTC client disconnected');
9916
9934
 
9917
9935
  this.eventEmitter.emit(ON_UNREGISTERED);
9918
9936
 
@@ -9926,7 +9944,7 @@ class WebRTCPhone extends Emitter {
9926
9944
  });
9927
9945
 
9928
9946
  this.client.on(this.client.ON_TRACK, (session, event) => {
9929
- this.eventEmitter.emit(ON_TRACK$1, session, event);
9947
+ this.eventEmitter.emit(ON_TRACK, session, event);
9930
9948
  });
9931
9949
 
9932
9950
  this.client.on('onVideoInputChange', stream => {
@@ -9941,7 +9959,7 @@ class WebRTCPhone extends Emitter {
9941
9959
  this.client.on(this.client.ON_NETWORK_STATS, (session, stats, previousStats) => {
9942
9960
  const callSession = this.getCallSession(this.getSipSessionId(session));
9943
9961
 
9944
- this.eventEmitter.emit(ON_NETWORK_STATS$1, callSession, stats, previousStats);
9962
+ this.eventEmitter.emit(ON_NETWORK_STATS, callSession, stats, previousStats);
9945
9963
  });
9946
9964
 
9947
9965
  // Used when upgrading directly in screenshare mode
@@ -9950,7 +9968,7 @@ class WebRTCPhone extends Emitter {
9950
9968
  const localStream = this.client.getLocalStream(sipSessionId);
9951
9969
  const callSession = this.callSessions[sipSessionId];
9952
9970
 
9953
- logger$4.info('Updrading directly in screensharing mode', {
9971
+ logger$8.info('Updrading directly in screensharing mode', {
9954
9972
  sipSessionId,
9955
9973
  tracks: localStream ? localStream.getTracks() : null,
9956
9974
  });
@@ -10128,8 +10146,8 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
10128
10146
  ON_CALL_ENDED: ON_CALL_ENDED,
10129
10147
  ON_CALL_ENDING: ON_CALL_ENDING,
10130
10148
  ON_MESSAGE: ON_MESSAGE,
10131
- ON_REINVITE: ON_REINVITE$1,
10132
- ON_TRACK: ON_TRACK$1,
10149
+ ON_REINVITE: ON_REINVITE,
10150
+ ON_TRACK: ON_TRACK,
10133
10151
  ON_AUDIO_STREAM: ON_AUDIO_STREAM,
10134
10152
  ON_VIDEO_STREAM: ON_VIDEO_STREAM,
10135
10153
  ON_REMOVE_STREAM: ON_REMOVE_STREAM,
@@ -10144,13 +10162,13 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
10144
10162
  ON_VIDEO_INPUT_CHANGE: ON_VIDEO_INPUT_CHANGE,
10145
10163
  ON_CALL_ERROR: ON_CALL_ERROR,
10146
10164
  ON_MESSAGE_TRACK_UPDATED: ON_MESSAGE_TRACK_UPDATED,
10147
- ON_NETWORK_STATS: ON_NETWORK_STATS$1,
10165
+ ON_NETWORK_STATS: ON_NETWORK_STATS,
10148
10166
  ON_CHAT: ON_CHAT,
10149
10167
  ON_SIGNAL: ON_SIGNAL,
10150
- ON_DISCONNECTED: ON_DISCONNECTED$1,
10168
+ ON_DISCONNECTED: ON_DISCONNECTED,
10151
10169
  MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
10152
10170
  MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
10153
- events: events$1,
10171
+ events: events,
10154
10172
  'default': WebRTCPhone
10155
10173
  });
10156
10174
 
@@ -10159,7 +10177,7 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
10159
10177
  class InvalidSubscription extends Error {}
10160
10178
  class InvalidAuthorization extends Error {}
10161
10179
 
10162
- const logger$5 = IssueReporter$1.loggerFor('simple-auth');
10180
+ const logger$7 = IssueReporter$1.loggerFor('simple-auth');
10163
10181
 
10164
10182
  class Auth {
10165
10183
 
@@ -10194,7 +10212,7 @@ class Auth {
10194
10212
  setApiClientId(this.clientId);
10195
10213
  setRefreshExpiration(this.expiration);
10196
10214
  setOnRefreshToken((token , session ) => {
10197
- logger$5.info('on refresh token done', { token });
10215
+ logger$7.info('on refresh token done', { token });
10198
10216
  setApiToken(token);
10199
10217
  Wazo.Websocket.updateToken(token);
10200
10218
 
@@ -10239,7 +10257,7 @@ class Auth {
10239
10257
  const rawSession = await getApiClient().auth.authenticate(token);
10240
10258
  return this._onAuthenticated(rawSession);
10241
10259
  } catch (e) {
10242
- logger$5.error('on validate token error', e);
10260
+ logger$7.error('on validate token error', e);
10243
10261
  console.warn(e);
10244
10262
  return false;
10245
10263
  }
@@ -10420,7 +10438,7 @@ var Auth$1 = global.wazoAuthInstance;
10420
10438
 
10421
10439
  //
10422
10440
 
10423
- const SOCKET_EVENTS = {
10441
+ const SOCKET_EVENTS$1 = {
10424
10442
  ON_OPEN: 'onopen',
10425
10443
  ON_MESSAGE: 'onmessage',
10426
10444
  ON_ERROR: 'onerror',
@@ -10573,16 +10591,16 @@ class WebSocketClient extends Emitter {
10573
10591
 
10574
10592
  this.socket.onopen = () => {
10575
10593
  logger$6.info('on Wazo WS open', { method: 'connect', host: this.host });
10576
- this.eventEmitter.emit(SOCKET_EVENTS.ON_OPEN);
10594
+ this.eventEmitter.emit(SOCKET_EVENTS$1.ON_OPEN);
10577
10595
  };
10578
10596
 
10579
10597
  this.socket.onerror = event => {
10580
10598
  logger$6.error('on Wazo WS error', event.target);
10581
- this.eventEmitter.emit(SOCKET_EVENTS.ON_ERROR, event);
10599
+ this.eventEmitter.emit(SOCKET_EVENTS$1.ON_ERROR, event);
10582
10600
  };
10583
10601
 
10584
10602
  this.socket.onmessage = (event ) => {
10585
- this.eventEmitter.emit(SOCKET_EVENTS.ON_MESSAGE, event.data);
10603
+ this.eventEmitter.emit(SOCKET_EVENTS$1.ON_MESSAGE, event.data);
10586
10604
 
10587
10605
  const message = JSON.parse(typeof event.data === 'string' ? event.data : '{}');
10588
10606
  let { name } = message;
@@ -10615,11 +10633,11 @@ class WebSocketClient extends Emitter {
10615
10633
  token: this.token,
10616
10634
  });
10617
10635
  this.initialized = false;
10618
- this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, event);
10636
+ this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, event);
10619
10637
 
10620
10638
  switch (event.code) {
10621
10639
  case 4002:
10622
- this.eventEmitter.emit(SOCKET_EVENTS.ON_AUTH_FAILED);
10640
+ this.eventEmitter.emit(SOCKET_EVENTS$1.ON_AUTH_FAILED);
10623
10641
  break;
10624
10642
  }
10625
10643
  };
@@ -10735,7 +10753,7 @@ class WebSocketClient extends Emitter {
10735
10753
  break;
10736
10754
  case 'start':
10737
10755
  this.initialized = true;
10738
- this.eventEmitter.emit(SOCKET_EVENTS.INITIALIZED);
10756
+ this.eventEmitter.emit(SOCKET_EVENTS$1.INITIALIZED);
10739
10757
  break;
10740
10758
  default:
10741
10759
  this.eventEmitter.emit('message', message);
@@ -10782,7 +10800,7 @@ class WebSocketClient extends Emitter {
10782
10800
  logger$6.log('heartbeat timed out', { host: this.host, token: this.token });
10783
10801
 
10784
10802
  this.close();
10785
- this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, new Error('Websocket ping failure.'));
10803
+ this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, new Error('Websocket ping failure.'));
10786
10804
 
10787
10805
  if (this.onHeartBeatTimeout) {
10788
10806
  this.onHeartBeatTimeout();
@@ -10862,7 +10880,7 @@ WebSocketClient.eventLists = [
10862
10880
 
10863
10881
  var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
10864
10882
  __proto__: null,
10865
- SOCKET_EVENTS: SOCKET_EVENTS,
10883
+ SOCKET_EVENTS: SOCKET_EVENTS$1,
10866
10884
  AUTH_SESSION_EXPIRE_SOON: AUTH_SESSION_EXPIRE_SOON,
10867
10885
  FAVORITE_ADDED: FAVORITE_ADDED,
10868
10886
  FAVORITE_DELETED: FAVORITE_DELETED,
@@ -10935,10 +10953,10 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
10935
10953
 
10936
10954
  //
10937
10955
 
10938
- const { SOCKET_EVENTS: SOCKET_EVENTS$1, ...OTHER_EVENTS } = WebSocketClient$1;
10939
- const ALL_EVENTS = [...Object.values(SOCKET_EVENTS$1), ...Object.values(OTHER_EVENTS)];
10956
+ const { SOCKET_EVENTS, ...OTHER_EVENTS } = WebSocketClient$1;
10957
+ const ALL_EVENTS = [...Object.values(SOCKET_EVENTS), ...Object.values(OTHER_EVENTS)];
10940
10958
 
10941
- const logger$7 = IssueReporter$1.loggerFor('simple-ws-client');
10959
+ const logger$5 = IssueReporter$1.loggerFor('simple-ws-client');
10942
10960
 
10943
10961
  class Websocket extends Emitter {
10944
10962
 
@@ -10952,9 +10970,9 @@ class Websocket extends Emitter {
10952
10970
  // $FlowFixMe
10953
10971
  this[key] = OTHER_EVENTS[key];
10954
10972
  });
10955
- Object.keys(SOCKET_EVENTS$1).forEach(key => {
10973
+ Object.keys(SOCKET_EVENTS).forEach(key => {
10956
10974
  // $FlowFixMe
10957
- this[key] = SOCKET_EVENTS$1[key];
10975
+ this[key] = SOCKET_EVENTS[key];
10958
10976
  });
10959
10977
  this.eventLists = WebSocketClient.eventLists;
10960
10978
 
@@ -10962,7 +10980,7 @@ class Websocket extends Emitter {
10962
10980
  }
10963
10981
 
10964
10982
  open(host , session ) {
10965
- logger$7.info('open simple WebSocket', { host, token: session.token });
10983
+ logger$5.info('open simple WebSocket', { host, token: session.token });
10966
10984
  this.ws = new WebSocketClient(
10967
10985
  {
10968
10986
  host,
@@ -10990,7 +11008,7 @@ class Websocket extends Emitter {
10990
11008
  }
10991
11009
 
10992
11010
  updateToken(token ) {
10993
- logger$7.info('update token via simple Websocket', { token, ws: !!this.ws });
11011
+ logger$5.info('update token via simple Websocket', { token, ws: !!this.ws });
10994
11012
 
10995
11013
  if (!this.ws) {
10996
11014
  return;
@@ -11018,7 +11036,7 @@ var Websocket$1 = global.wazoWebsocketInstance;
11018
11036
 
11019
11037
  //
11020
11038
 
11021
- const logger$8 = IssueReporter$1.loggerFor('room');
11039
+ const logger$4 = IssueReporter$1.loggerFor('room');
11022
11040
 
11023
11041
  class Participant extends Emitter {
11024
11042
 
@@ -11140,7 +11158,7 @@ class Participant extends Emitter {
11140
11158
  }
11141
11159
 
11142
11160
  onTalking(isTalking ) {
11143
- logger$8.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
11161
+ logger$4.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
11144
11162
  this.isTalking = isTalking;
11145
11163
  // you may notice we're not broadcasting: since all participants are getting this info
11146
11164
  // directly from asterisk, there's no need to do so
@@ -11243,7 +11261,7 @@ class Participant extends Emitter {
11243
11261
  }
11244
11262
 
11245
11263
  updateStatus(status , broadcast = true) {
11246
- logger$8.info('updating participant status', { name: this.name, status });
11264
+ logger$4.info('updating participant status', { name: this.name, status });
11247
11265
 
11248
11266
  if (typeof status.audioMuted !== 'undefined' && status.audioMuted !== this.audioMuted) {
11249
11267
  if (status.audioMuted) {
@@ -11291,7 +11309,7 @@ class Participant extends Emitter {
11291
11309
 
11292
11310
  broadcastStatus(inboundStatus = null) {
11293
11311
  const status = inboundStatus || this.getStatus();
11294
- logger$8.info('broadcasting participant status', { callId: this.callId, status });
11312
+ logger$4.info('broadcasting participant status', { callId: this.callId, status });
11295
11313
 
11296
11314
  this.room.sendSignal({
11297
11315
  type: SIGNAL_TYPE_PARTICIPANT_UPDATE,
@@ -11327,9 +11345,9 @@ class LocalParticipant extends Participant {
11327
11345
  const SIGNAL_TYPE_PARTICIPANT_UPDATE = 'signal/PARTICIPANT_UPDATE';
11328
11346
  const SIGNAL_TYPE_PARTICIPANT_REQUEST = 'signal/PARTICIPANT_REQUEST';
11329
11347
 
11330
- const logger$9 = IssueReporter$1.loggerFor('sdk-room');
11348
+ const logger$3 = IssueReporter$1.loggerFor('sdk-room');
11331
11349
 
11332
- class Room extends Emitter {
11350
+ class Room$1 extends Emitter {
11333
11351
 
11334
11352
 
11335
11353
 
@@ -11387,7 +11405,7 @@ class Room extends Emitter {
11387
11405
  extra = {},
11388
11406
  ) {
11389
11407
  super();
11390
- logger$9.info('room initialized', { callId, extension, sourceId, meetingUuid });
11408
+ logger$3.info('room initialized', { callId, extension, sourceId, meetingUuid });
11391
11409
 
11392
11410
  // Represents the room callSession
11393
11411
  this.callSession = callSession;
@@ -11453,7 +11471,7 @@ class Room extends Emitter {
11453
11471
  * @returns {Promise<Room>}
11454
11472
  */
11455
11473
  static async connect({ extension, constraints, audioOnly = false, extra, room, meeting } ) {
11456
- logger$9.info('connecting to room', { extension, audioOnly, room: !!room });
11474
+ logger$3.info('connecting to room', { extension, audioOnly, room: !!room });
11457
11475
 
11458
11476
  if (!room) {
11459
11477
  await Wazo.Phone.connect();
@@ -11466,7 +11484,7 @@ class Room extends Emitter {
11466
11484
 
11467
11485
  // Call_created is triggered before call_accepted, so we have to listen for it here.
11468
11486
  Wazo.Websocket.once(Wazo.Websocket.CALL_CREATED, ({ data }) => {
11469
- logger$9.info('room call received via WS', { callId: data.call_id });
11487
+ logger$3.info('room call received via WS', { callId: data.call_id });
11470
11488
  if (room) {
11471
11489
  room.setCallId(data.call_id);
11472
11490
  }
@@ -11474,7 +11492,7 @@ class Room extends Emitter {
11474
11492
 
11475
11493
  const callSession = await Wazo.Phone.call(extension, withCamera, null, audioOnly, true);
11476
11494
  // eslint-disable-next-line no-param-reassign
11477
- room = new Room(callSession, extension, null, null, extra);
11495
+ room = new Room$1(callSession, extension, null, null, extra);
11478
11496
 
11479
11497
  // Wait for the call to be accepted
11480
11498
  await new Promise((resolve, reject) => {
@@ -11495,7 +11513,7 @@ class Room extends Emitter {
11495
11513
  // Retrieve conference
11496
11514
  const conference = contacts.find(contact => contact.numbers.find(number => number.number === extension));
11497
11515
 
11498
- logger$9.info('connected to room', {
11516
+ logger$3.info('connected to room', {
11499
11517
  sourceId: conference ? conference.sourceId : null,
11500
11518
  name: conference ? conference.name : null,
11501
11519
  });
@@ -11505,7 +11523,7 @@ class Room extends Emitter {
11505
11523
  room.setName(conference.name);
11506
11524
  }
11507
11525
  } else if (meeting) {
11508
- logger$9.info('Already connected to meeting', {
11526
+ logger$3.info('Already connected to meeting', {
11509
11527
  uuid: meeting.uuid,
11510
11528
  name: meeting.name,
11511
11529
  });
@@ -11518,13 +11536,13 @@ class Room extends Emitter {
11518
11536
  }
11519
11537
 
11520
11538
  static disconnect() {
11521
- logger$9.info('static disconnection to room');
11539
+ logger$3.info('static disconnection to room');
11522
11540
 
11523
11541
  Wazo.Phone.disconnect();
11524
11542
  }
11525
11543
 
11526
11544
  async disconnect() {
11527
- logger$9.info('disconnection to room called');
11545
+ logger$3.info('disconnection to room called');
11528
11546
 
11529
11547
  await Wazo.Phone.hangup(this.callSession);
11530
11548
  this.callSession = null;
@@ -11544,19 +11562,19 @@ class Room extends Emitter {
11544
11562
  }
11545
11563
 
11546
11564
  setSourceId(sourceId ) {
11547
- logger$9.info('set room source id', { sourceId });
11565
+ logger$3.info('set room source id', { sourceId });
11548
11566
 
11549
11567
  this.sourceId = sourceId;
11550
11568
  }
11551
11569
 
11552
11570
  setMeetingUuid(meetingUuid ) {
11553
- logger$9.info('set meeting uuid', { meetingUuid });
11571
+ logger$3.info('set meeting uuid', { meetingUuid });
11554
11572
 
11555
11573
  this.meetingUuid = meetingUuid;
11556
11574
  }
11557
11575
 
11558
11576
  setCallId(callId ) {
11559
- logger$9.info('set room call id', { callId });
11577
+ logger$3.info('set room call id', { callId });
11560
11578
 
11561
11579
  if (callId) {
11562
11580
  this.callId = callId;
@@ -11564,7 +11582,7 @@ class Room extends Emitter {
11564
11582
  }
11565
11583
 
11566
11584
  setName(name ) {
11567
- logger$9.info('set room name', { name });
11585
+ logger$3.info('set room name', { name });
11568
11586
 
11569
11587
  this.name = name;
11570
11588
  }
@@ -11583,7 +11601,7 @@ class Room extends Emitter {
11583
11601
  }
11584
11602
 
11585
11603
  async startScreenSharing(constraints ) {
11586
- logger$9.info('start room screen sharing', { constraints });
11604
+ logger$3.info('start room screen sharing', { constraints });
11587
11605
 
11588
11606
  const screensharingStream = await Wazo.Phone.startScreenSharing(constraints, this.callSession);
11589
11607
  if (!screensharingStream) {
@@ -11597,7 +11615,7 @@ class Room extends Emitter {
11597
11615
  }
11598
11616
 
11599
11617
  async stopScreenSharing(restoreLocalStream = true) {
11600
- logger$9.info('stop room screen sharing');
11618
+ logger$3.info('stop room screen sharing');
11601
11619
 
11602
11620
  await Wazo.Phone.stopScreenSharing(this.callSession, restoreLocalStream);
11603
11621
 
@@ -11609,7 +11627,7 @@ class Room extends Emitter {
11609
11627
  }
11610
11628
 
11611
11629
  turnCameraOff() {
11612
- logger$9.info('turn room camera off');
11630
+ logger$3.info('turn room camera off');
11613
11631
 
11614
11632
  Wazo.Phone.turnCameraOff(this.callSession);
11615
11633
 
@@ -11619,7 +11637,7 @@ class Room extends Emitter {
11619
11637
  }
11620
11638
 
11621
11639
  turnCameraOn() {
11622
- logger$9.info('turn room camera on');
11640
+ logger$3.info('turn room camera on');
11623
11641
 
11624
11642
  Wazo.Phone.turnCameraOn(this.callSession);
11625
11643
 
@@ -11629,7 +11647,7 @@ class Room extends Emitter {
11629
11647
  }
11630
11648
 
11631
11649
  mute() {
11632
- logger$9.info('mute room');
11650
+ logger$3.info('mute room');
11633
11651
 
11634
11652
  Wazo.Phone.mute(this.callSession);
11635
11653
 
@@ -11637,7 +11655,7 @@ class Room extends Emitter {
11637
11655
  }
11638
11656
 
11639
11657
  unmute() {
11640
- logger$9.info('unmute room');
11658
+ logger$3.info('unmute room');
11641
11659
 
11642
11660
  Wazo.Phone.unmute(this.callSession);
11643
11661
 
@@ -11657,7 +11675,7 @@ class Room extends Emitter {
11657
11675
  }
11658
11676
 
11659
11677
  hold() {
11660
- logger$9.info('hold room');
11678
+ logger$3.info('hold room');
11661
11679
 
11662
11680
  Wazo.Phone.hold(this.callSession, true);
11663
11681
 
@@ -11667,7 +11685,7 @@ class Room extends Emitter {
11667
11685
  }
11668
11686
 
11669
11687
  async resume() {
11670
- logger$9.info('resume room');
11688
+ logger$3.info('resume room');
11671
11689
 
11672
11690
  const newStream = await Wazo.Phone.resume(this.callSession, true);
11673
11691
 
@@ -11695,13 +11713,13 @@ class Room extends Emitter {
11695
11713
  }
11696
11714
 
11697
11715
  sendDTMF(tone ) {
11698
- logger$9.info('send room DTMF', { tone });
11716
+ logger$3.info('send room DTMF', { tone });
11699
11717
 
11700
11718
  Wazo.Phone.sendDTMF(tone, this.callSession);
11701
11719
  }
11702
11720
 
11703
11721
  async sendReinvite(newConstraints = null) {
11704
- logger$9.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
11722
+ logger$3.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
11705
11723
  const wasScreensharing = this.localParticipant && this.localParticipant.screensharing;
11706
11724
 
11707
11725
  Wazo.Phone.on(Wazo.Phone.ON_SHARE_SCREEN_STARTED, () => {
@@ -11760,7 +11778,7 @@ class Room extends Emitter {
11760
11778
  Wazo.Phone.phone.on(Wazo.Phone.phone.client.ON_REINVITE, this._boundOnReinvite);
11761
11779
 
11762
11780
  this.on(this.ON_AUDIO_STREAM, stream => {
11763
- logger$9.info('on room audio stream');
11781
+ logger$3.info('on room audio stream');
11764
11782
 
11765
11783
  this.audioStream = stream;
11766
11784
  if (!this.roomAudioElement) {
@@ -11773,7 +11791,7 @@ class Room extends Emitter {
11773
11791
  });
11774
11792
 
11775
11793
  this.on(this.ON_VIDEO_STREAM, (stream, streamId, event, sipSession) => {
11776
- logger$9.info('on room video stream', { streamId });
11794
+ logger$3.info('on room video stream', { streamId });
11777
11795
 
11778
11796
  this._mapMsid(sipSession.body.body);
11779
11797
 
@@ -11788,7 +11806,7 @@ class Room extends Emitter {
11788
11806
  });
11789
11807
 
11790
11808
  this.on(this.ON_REMOVE_STREAM, stream => {
11791
- logger$9.info('on room remove stream');
11809
+ logger$3.info('on room remove stream');
11792
11810
 
11793
11811
  const participant = this.participants.find(someParticipant =>
11794
11812
  someParticipant.streams.find(someStream => someStream && someStream.id === stream.id));
@@ -11920,7 +11938,7 @@ class Room extends Emitter {
11920
11938
  const requester = this._getParticipantFromCallId(origin.callId);
11921
11939
  if (requester) {
11922
11940
  // @FIXME?: when need to trigger an update on join-in; this is a bit of a hack
11923
- logger$9.info('trigger room requester status', { origin });
11941
+ logger$3.info('trigger room requester status', { origin });
11924
11942
  requester.triggerUpdate('REQUESTER_UPDATE');
11925
11943
  }
11926
11944
  break;
@@ -11951,24 +11969,24 @@ class Room extends Emitter {
11951
11969
 
11952
11970
  // When we join the room, we can call `getConferenceParticipantsAsUser`, not before.
11953
11971
  if (participant.user_uuid === session.uuid) {
11954
- logger$9.info('room current user joined');
11972
+ logger$3.info('room current user joined');
11955
11973
 
11956
11974
  // Retrieve participants via an API calls
11957
11975
  const conferenceId = this.sourceId || payload.data.conference_id;
11958
11976
  let response;
11959
11977
  try {
11960
11978
  if (this.meetingUuid) {
11961
- logger$9.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
11979
+ logger$3.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
11962
11980
  response = await getApiClient().calld.getMeetingParticipantsAsUser(this.meetingUuid);
11963
11981
  } else {
11964
- logger$9.info('fetching conference participants', { conferenceId });
11982
+ logger$3.info('fetching conference participants', { conferenceId });
11965
11983
  response = await getApiClient().calld.getConferenceParticipantsAsUser(conferenceId);
11966
11984
  }
11967
11985
  } catch (e) {
11968
- logger$9.error('room participants fetching, error', e);
11986
+ logger$3.error('room participants fetching, error', e);
11969
11987
  }
11970
11988
  if (response) {
11971
- logger$9.info('conference participants fetched', { nb: response.items.length });
11989
+ logger$3.info('conference participants fetched', { nb: response.items.length });
11972
11990
  participants = response.items.map(item => {
11973
11991
  const isMe = item.call_id === this.callId;
11974
11992
 
@@ -11995,7 +12013,7 @@ class Room extends Emitter {
11995
12013
  ? new Wazo.RemoteParticipant(this, participant)
11996
12014
  : null;
11997
12015
 
11998
- logger$9.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
12016
+ logger$3.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
11999
12017
 
12000
12018
  if (remoteParticipant) {
12001
12019
  this.participants.push(remoteParticipant);
@@ -12160,12 +12178,12 @@ class Room extends Emitter {
12160
12178
 
12161
12179
  //
12162
12180
 
12163
- const logger$a = IssueReporter$1.loggerFor('sdk-sip-room');
12181
+ const logger$2 = IssueReporter$1.loggerFor('sdk-sip-room');
12164
12182
 
12165
- class SipRoom extends Room {
12183
+ class SipRoom extends Room$1 {
12166
12184
 
12167
12185
  static async connect({ extension, constraints, audioOnly = false, extra, room } ) {
12168
- logger$a.info('connecting to sip room', { extension, audioOnly, room: !!room });
12186
+ logger$2.info('connecting to sip room', { extension, audioOnly, room: !!room });
12169
12187
 
12170
12188
  if (!room) {
12171
12189
  await Wazo.Phone.connect();
@@ -12181,7 +12199,7 @@ class SipRoom extends Room {
12181
12199
  room.setCallId(room.callSession.call.id);
12182
12200
  }
12183
12201
 
12184
- logger$a.info('connected to room', {
12202
+ logger$2.info('connected to room', {
12185
12203
  extension: room.extension,
12186
12204
  });
12187
12205
 
@@ -12189,7 +12207,7 @@ class SipRoom extends Room {
12189
12207
  }
12190
12208
 
12191
12209
  mute() {
12192
- logger$a.info('mute sip room');
12210
+ logger$2.info('mute sip room');
12193
12211
 
12194
12212
  Wazo.Phone.mute(this.callSession, false);
12195
12213
 
@@ -12197,7 +12215,7 @@ class SipRoom extends Room {
12197
12215
  }
12198
12216
 
12199
12217
  unmute() {
12200
- logger$a.info('unmute sip room');
12218
+ logger$2.info('unmute sip room');
12201
12219
 
12202
12220
  Wazo.Phone.unmute(this.callSession, false);
12203
12221
 
@@ -12481,7 +12499,7 @@ class NotificationOptions {
12481
12499
 
12482
12500
 
12483
12501
  // Represents a conference room, like `9000`.
12484
- class Room$1 {
12502
+ class Room {
12485
12503
 
12486
12504
 
12487
12505
 
@@ -12502,7 +12520,7 @@ class Room$1 {
12502
12520
  }
12503
12521
 
12504
12522
  connect(callSession ) {
12505
- return new Room$1({ ...this, connectedCallSession: callSession });
12523
+ return new Room({ ...this, connectedCallSession: callSession });
12506
12524
  }
12507
12525
 
12508
12526
  has(callSession ) {
@@ -12511,7 +12529,7 @@ class Room$1 {
12511
12529
 
12512
12530
  addParticipant(uuid , extension , talking = null) {
12513
12531
  if (!this.participants.some(participant => participant.uuid === uuid || participant.extension === extension)) {
12514
- return new Room$1({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
12532
+ return new Room({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
12515
12533
  }
12516
12534
 
12517
12535
  return this;
@@ -12530,7 +12548,7 @@ class Room$1 {
12530
12548
  updatedParticipants.push(participant);
12531
12549
  }
12532
12550
 
12533
- return new Room$1({ ...this, participants: updatedParticipants });
12551
+ return new Room({ ...this, participants: updatedParticipants });
12534
12552
  }
12535
12553
 
12536
12554
  updateParticipantByExtension(extension , participant , shouldAdd = false) {
@@ -12546,7 +12564,7 @@ class Room$1 {
12546
12564
  updatedParticipants.push(participant);
12547
12565
  }
12548
12566
 
12549
- return new Room$1({ ...this, participants: updatedParticipants });
12567
+ return new Room({ ...this, participants: updatedParticipants });
12550
12568
  }
12551
12569
 
12552
12570
  hasCallWithId(id ) {
@@ -12554,18 +12572,18 @@ class Room$1 {
12554
12572
  }
12555
12573
 
12556
12574
  disconnect() {
12557
- return new Room$1({ ...this, connectedCallSession: null });
12575
+ return new Room({ ...this, connectedCallSession: null });
12558
12576
  }
12559
12577
 
12560
12578
  removeParticipantWithUUID(uuid ) {
12561
- return new Room$1({
12579
+ return new Room({
12562
12580
  ...this,
12563
12581
  participants: this.participants.filter(participant => participant.uuid !== uuid),
12564
12582
  });
12565
12583
  }
12566
12584
 
12567
12585
  removeParticipantWithExtension(extension ) {
12568
- return new Room$1({
12586
+ return new Room({
12569
12587
  ...this,
12570
12588
  participants: this.participants.filter(participant => participant.extension !== extension),
12571
12589
  });
@@ -12576,7 +12594,7 @@ class Room$1 {
12576
12594
  }
12577
12595
 
12578
12596
  static newFrom(room ) {
12579
- return newFrom(room, Room$1);
12597
+ return newFrom(room, Room);
12580
12598
  }
12581
12599
  }
12582
12600
 
@@ -12883,11 +12901,11 @@ var wazoWebsocket = {
12883
12901
  resolve();
12884
12902
  };
12885
12903
 
12886
- client.on(SOCKET_EVENTS.ON_ERROR, error => {
12904
+ client.on(SOCKET_EVENTS$1.ON_ERROR, error => {
12887
12905
  handleError(`Connection error : ${error}`);
12888
12906
  });
12889
12907
 
12890
- client.on(SOCKET_EVENTS.ON_OPEN, () => {
12908
+ client.on(SOCKET_EVENTS$1.ON_OPEN, () => {
12891
12909
  if (session.hasEngineVersionGte(HEARTBEAT_ENGINE_VERSION)) {
12892
12910
  client.setOnHeartbeatTimeout(() => {
12893
12911
  handleError('No response to heartbeat');
@@ -12988,7 +13006,7 @@ var webrtc = {
12988
13006
  }),
12989
13007
  };
12990
13008
 
12991
- const parseCandidate$1 = line => {
13009
+ const parseCandidate = line => {
12992
13010
  let parts;
12993
13011
  // Parse both variants.
12994
13012
  if (line.indexOf('a=candidate:') === 0) {
@@ -13079,7 +13097,7 @@ var SymmetricNat = {
13079
13097
  }
13080
13098
 
13081
13099
  if (e.candidate && e.candidate.candidate.indexOf('srflx') !== -1) {
13082
- const cand = parseCandidate$1(e.candidate.candidate);
13100
+ const cand = parseCandidate(e.candidate.candidate);
13083
13101
  if (!candidates[cand.relatedPort]) candidates[cand.relatedPort] = [];
13084
13102
  candidates[cand.relatedPort].push(cand.port);
13085
13103
  } else if (!e.candidate) {
@@ -13147,7 +13165,7 @@ var iceIpv4 = {
13147
13165
  const rawCandidate = e.candidate.candidate;
13148
13166
  if (rawCandidate.indexOf('srflx') !== -1 || rawCandidate.indexOf('relay') !== -1) {
13149
13167
  hasSrflxOrRelay = true;
13150
- const candidate = parseCandidate$1(e.candidate.candidate);
13168
+ const candidate = parseCandidate(e.candidate.candidate);
13151
13169
  ips.push(candidate.ip);
13152
13170
  }
13153
13171
  } else if (!e.candidate) {
@@ -13184,7 +13202,7 @@ var checks = [
13184
13202
 
13185
13203
  //
13186
13204
 
13187
- const logger$b = IssueReporter$1.loggerFor('engine-check');
13205
+ const logger$1 = IssueReporter$1.loggerFor('engine-check');
13188
13206
 
13189
13207
  class Checker {
13190
13208
 
@@ -13202,28 +13220,28 @@ class Checker {
13202
13220
  async check(onCheckBegin = () => {}, onCheckResult = () => {}) {
13203
13221
  await this._addEngineVersion();
13204
13222
 
13205
- logger$b.info('Engine check starting');
13223
+ logger$1.info('Engine check starting');
13206
13224
 
13207
13225
  for (let i = 0; i < this.checks.length; i++) {
13208
13226
  const { name, check } = this.checks[i];
13209
13227
 
13210
- logger$b.info(`Checking ${name} ...`);
13228
+ logger$1.info(`Checking ${name} ...`);
13211
13229
 
13212
13230
  onCheckBegin(name);
13213
13231
  try {
13214
13232
  // eslint-disable-next-line no-await-in-loop
13215
13233
  const result = await check(this.server, this.session, this.externalAppConfig);
13216
- logger$b.info(`Checking ${name} success.`, { result });
13234
+ logger$1.info(`Checking ${name} success.`, { result });
13217
13235
 
13218
13236
  onCheckResult(name, result);
13219
13237
  } catch (e) {
13220
- logger$b.info(`Checking ${name} failure`, { message: e.message });
13238
+ logger$1.info(`Checking ${name} failure`, { message: e.message });
13221
13239
 
13222
13240
  onCheckResult(name, e);
13223
13241
  }
13224
13242
  }
13225
13243
 
13226
- logger$b.info('Engine check done.');
13244
+ logger$1.info('Engine check done.');
13227
13245
  }
13228
13246
 
13229
13247
  addCheck(check ) {
@@ -13247,7 +13265,7 @@ const Wazo = {
13247
13265
  Auth: Auth$1,
13248
13266
  Phone: Phone$1,
13249
13267
  Websocket: Websocket$1,
13250
- Room,
13268
+ Room: Room$1,
13251
13269
  SipRoom,
13252
13270
  RemoteParticipant,
13253
13271
  LocalParticipant,
@@ -13280,7 +13298,7 @@ const Wazo = {
13280
13298
  Session,
13281
13299
  Voicemail,
13282
13300
  Relocation,
13283
- ConferenceRoom: Room$1,
13301
+ ConferenceRoom: Room,
13284
13302
  CallSession,
13285
13303
  IndirectTransfer,
13286
13304
  SwitchboardCall,
@@ -13316,7 +13334,7 @@ if (global) {
13316
13334
 
13317
13335
  //
13318
13336
 
13319
- const logger$c = IssueReporter$1.loggerFor('simple-phone');
13337
+ const logger = IssueReporter$1.loggerFor('simple-phone');
13320
13338
  const sipLogger = IssueReporter$1.loggerFor('sip.js');
13321
13339
  const protocolLogger = IssueReporter$1.loggerFor('sip');
13322
13340
 
@@ -13423,7 +13441,7 @@ class Phone extends Emitter {
13423
13441
  async disconnect() {
13424
13442
  if (this.phone) {
13425
13443
  if (this.phone.hasAnActiveCall()) {
13426
- logger$c.info('hangup call on disconnect');
13444
+ logger.info('hangup call on disconnect');
13427
13445
  // $FlowFixMe
13428
13446
  await this.phone.hangup();
13429
13447
  }
@@ -13446,13 +13464,13 @@ class Phone extends Emitter {
13446
13464
  }
13447
13465
 
13448
13466
  async hangup(callSession ) {
13449
- logger$c.info('hangup via simple phone', { callId: callSession.getId() });
13467
+ logger.info('hangup via simple phone', { callId: callSession.getId() });
13450
13468
 
13451
13469
  return this.phone && this.phone.hangup(callSession);
13452
13470
  }
13453
13471
 
13454
13472
  async accept(callSession , cameraEnabled ) {
13455
- logger$c.info('accept via simple phone', { callId: callSession.getId(), cameraEnabled });
13473
+ logger.info('accept via simple phone', { callId: callSession.getId(), cameraEnabled });
13456
13474
 
13457
13475
  return this.phone && this.phone.accept(callSession, cameraEnabled);
13458
13476
  }
@@ -13491,7 +13509,7 @@ class Phone extends Emitter {
13491
13509
  muteViaAPI(callSession ) {
13492
13510
  if (callSession && callSession.callId) {
13493
13511
  Wazo.getApiClient().calld.mute(callSession.callId).catch(e => {
13494
- logger$c.error('Mute via API, error', e);
13512
+ logger.error('Mute via API, error', e);
13495
13513
  });
13496
13514
  }
13497
13515
  }
@@ -13499,7 +13517,7 @@ class Phone extends Emitter {
13499
13517
  unmuteViaAPI(callSession ) {
13500
13518
  if (callSession && callSession.callId) {
13501
13519
  Wazo.getApiClient().calld.unmute(callSession.callId).catch(e => {
13502
- logger$c.error('Unmute via API, error', e);
13520
+ logger.error('Unmute via API, error', e);
13503
13521
  });
13504
13522
  }
13505
13523
  }
@@ -13607,7 +13625,7 @@ class Phone extends Emitter {
13607
13625
 
13608
13626
  // @Deprecated
13609
13627
  getLocalMediaStream(callSession ) {
13610
- logger$c.warn('Phone.getLocalMediaStream is deprecated, use Phone.getLocalStream instead');
13628
+ logger.warn('Phone.getLocalMediaStream is deprecated, use Phone.getLocalStream instead');
13611
13629
 
13612
13630
  return this.phone && this.phone.getLocalStream(callSession);
13613
13631
  }
@@ -13630,20 +13648,20 @@ class Phone extends Emitter {
13630
13648
 
13631
13649
  // @Deprecated
13632
13650
  getRemoteStreamForCall(callSession ) {
13633
- logger$c.warn('Phone.getRemoteStreamForCall is deprecated, use Phone.getRemoteStream instead');
13651
+ logger.warn('Phone.getRemoteStreamForCall is deprecated, use Phone.getRemoteStream instead');
13634
13652
  return this.getRemoteStream(callSession);
13635
13653
  }
13636
13654
 
13637
13655
  // Returns remote streams directly from the peerConnection
13638
13656
  // @Deprecated
13639
13657
  getRemoteStreamsForCall(callSession ) {
13640
- logger$c.warn('Phone.getRemoteStreamsForCall is deprecated, use Phone.getLocalStream instead');
13658
+ logger.warn('Phone.getRemoteStreamsForCall is deprecated, use Phone.getLocalStream instead');
13641
13659
  return this.getLocalStream(callSession);
13642
13660
  }
13643
13661
 
13644
13662
  // @Deprecated
13645
13663
  getRemoteVideoStreamForCall(callSession ) {
13646
- logger$c.warn('Phone.getRemoteVideoStreamForCall is deprecated, use Phone.getRemoteVideoStream instead');
13664
+ logger.warn('Phone.getRemoteVideoStreamForCall is deprecated, use Phone.getRemoteVideoStream instead');
13647
13665
 
13648
13666
  return this.getRemoteVideoStream(callSession);
13649
13667
  }
@@ -13704,7 +13722,7 @@ class Phone extends Emitter {
13704
13722
 
13705
13723
  _transferEvents() {
13706
13724
  this.unbind();
13707
- [...events, ...transportEvents].forEach(event => {
13725
+ [...events$1, ...transportEvents].forEach(event => {
13708
13726
  this.client.on(event, (...args) =>
13709
13727
  this.eventEmitter.emit.apply(this.eventEmitter.emit, [`client-${event}`, ...args]));
13710
13728
  });