@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
@@ -1959,7 +1959,7 @@ var IssueReporter$1 = new IssueReporter();
1959
1959
 
1960
1960
  const methods = ['head', 'get', 'post', 'put', 'delete'];
1961
1961
 
1962
- const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
1962
+ const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
1963
1963
 
1964
1964
  // Use a function here to be able to mock it in tests
1965
1965
  const realFetch = () => {
@@ -2098,7 +2098,7 @@ class ApiRequester {
2098
2098
  };
2099
2099
 
2100
2100
  if (this.refreshTokenPromise) {
2101
- logger.info('A token is already refreshing, waiting ...', { url });
2101
+ logger$c.info('A token is already refreshing, waiting ...', { url });
2102
2102
  await this.refreshTokenPromise;
2103
2103
  }
2104
2104
 
@@ -2118,7 +2118,7 @@ class ApiRequester {
2118
2118
  return promise.then(async (err ) => {
2119
2119
  // Check if the token is still valid
2120
2120
  if (firstCall && this._checkTokenExpired(response, err)) {
2121
- logger.warn('token expired', { error: err.reason });
2121
+ logger$c.warn('token expired', { error: err.reason });
2122
2122
  // Replay the call after refreshing the token
2123
2123
  return this._replayWithNewToken(err, path, method, body, headers, parse);
2124
2124
  }
@@ -2128,7 +2128,7 @@ class ApiRequester {
2128
2128
  : exceptionClass.fromResponse(err, response.status);
2129
2129
 
2130
2130
  if (this.shouldLogErrors) {
2131
- logger.error('API error', error);
2131
+ logger$c.error('API error', error);
2132
2132
  }
2133
2133
 
2134
2134
  throw error;
@@ -2138,7 +2138,7 @@ class ApiRequester {
2138
2138
  return newParse(response, isJson);
2139
2139
  }).catch(error => {
2140
2140
  if (this.shouldLogErrors) {
2141
- logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
2141
+ logger$c.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
2142
2142
  }
2143
2143
 
2144
2144
  throw error;
@@ -2166,13 +2166,13 @@ class ApiRequester {
2166
2166
  ) {
2167
2167
  const isTokenNotFound = this._isTokenNotFound(err);
2168
2168
  let newPath = path;
2169
- logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
2169
+ logger$c.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
2170
2170
 
2171
2171
  this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
2172
2172
 
2173
2173
  return this.refreshTokenPromise.then(() => {
2174
2174
  this.refreshTokenPromise = null;
2175
- logger.info('token refreshed', { isTokenNotFound });
2175
+ logger$c.info('token refreshed', { isTokenNotFound });
2176
2176
  if (isTokenNotFound) {
2177
2177
  const pathParts = path.split('/');
2178
2178
  pathParts.pop();
@@ -4065,7 +4065,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
4065
4065
 
4066
4066
  // const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
4067
4067
 
4068
- const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
4068
+ const logger$b = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
4069
4069
 
4070
4070
  class CTIPhone extends Emitter {
4071
4071
 
@@ -4078,7 +4078,7 @@ class CTIPhone extends Emitter {
4078
4078
 
4079
4079
  constructor(session , isMobile = false, callbackAllLines = false) {
4080
4080
  super();
4081
- logger$1.info('CTI Phone created');
4081
+ logger$b.info('CTI Phone created');
4082
4082
  this.session = session;
4083
4083
  this.isMobile = isMobile;
4084
4084
  this.callbackAllLines = callbackAllLines;
@@ -4139,7 +4139,7 @@ class CTIPhone extends Emitter {
4139
4139
  }
4140
4140
 
4141
4141
  async makeCall(number , line ) {
4142
- logger$1.info('make CTI call', { number });
4142
+ logger$b.info('make CTI call', { number });
4143
4143
 
4144
4144
  if (!number) {
4145
4145
  return null;
@@ -4162,7 +4162,7 @@ class CTIPhone extends Emitter {
4162
4162
  if (!callSession) {
4163
4163
  return Promise.resolve(null);
4164
4164
  }
4165
- logger$1.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
4165
+ logger$b.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
4166
4166
 
4167
4167
  if (!this.currentCall) {
4168
4168
  this.currentCall = callSession.call;
@@ -4175,7 +4175,7 @@ class CTIPhone extends Emitter {
4175
4175
  if (!callSession) {
4176
4176
  return;
4177
4177
  }
4178
- logger$1.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
4178
+ logger$b.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
4179
4179
 
4180
4180
  this.currentCall = undefined;
4181
4181
  this.eventEmitter.emit('onCallEnded', callSession);
@@ -4185,7 +4185,7 @@ class CTIPhone extends Emitter {
4185
4185
  if (!callSession) {
4186
4186
  return Promise.resolve(false);
4187
4187
  }
4188
- logger$1.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
4188
+ logger$b.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
4189
4189
 
4190
4190
  try {
4191
4191
  await CallApi.cancelCall(callSession);
@@ -4196,7 +4196,7 @@ class CTIPhone extends Emitter {
4196
4196
  this.eventEmitter.emit('onCallEnded', callSession);
4197
4197
  return true;
4198
4198
  } catch (e) {
4199
- logger$1.error('hangup CTI call, error', e);
4199
+ logger$b.error('hangup CTI call, error', e);
4200
4200
 
4201
4201
  this.eventEmitter.emit('onCallFailed', callSession);
4202
4202
  return false;
@@ -4209,7 +4209,7 @@ class CTIPhone extends Emitter {
4209
4209
  if (!callSession) {
4210
4210
  return;
4211
4211
  }
4212
- logger$1.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
4212
+ logger$b.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
4213
4213
 
4214
4214
  await CallApi.cancelCall(callSession);
4215
4215
  this.eventEmitter.emit('onCallEnded', callSession);
@@ -4219,7 +4219,7 @@ class CTIPhone extends Emitter {
4219
4219
  if (!callSession) {
4220
4220
  return;
4221
4221
  }
4222
- logger$1.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
4222
+ logger$b.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
4223
4223
 
4224
4224
  await CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_BLIND);
4225
4225
  }
@@ -4232,19 +4232,19 @@ class CTIPhone extends Emitter {
4232
4232
  if (!callSession) {
4233
4233
  return;
4234
4234
  }
4235
- logger$1.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
4235
+ logger$b.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
4236
4236
 
4237
4237
  return CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_ATTENDED);
4238
4238
  }
4239
4239
 
4240
4240
  async cancelCTIIndirectTransfer(transferId ) {
4241
- logger$1.info('cancel CTI transfer', { transferId });
4241
+ logger$b.info('cancel CTI transfer', { transferId });
4242
4242
 
4243
4243
  return CallApi.cancelCallTransfer(transferId);
4244
4244
  }
4245
4245
 
4246
4246
  async confirmCTIIndirectTransfer(transferId ) {
4247
- logger$1.info('confirm CTI transfer', { transferId });
4247
+ logger$b.info('confirm CTI transfer', { transferId });
4248
4248
 
4249
4249
  return CallApi.confirmCallTransfer(transferId);
4250
4250
  }
@@ -4253,19 +4253,19 @@ class CTIPhone extends Emitter {
4253
4253
  if (!callSession) {
4254
4254
  return;
4255
4255
  }
4256
- logger$1.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
4256
+ logger$b.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
4257
4257
 
4258
4258
  return CallApi.sendDTMF(callSession.callId, digits);
4259
4259
  }
4260
4260
 
4261
4261
  onConnectionMade() {
4262
- logger$1.info('on CTI connection made');
4262
+ logger$b.info('on CTI connection made');
4263
4263
 
4264
4264
  this.eventEmitter.emit('onCallAccepted');
4265
4265
  }
4266
4266
 
4267
4267
  async close() {
4268
- logger$1.info('CTI close');
4268
+ logger$b.info('CTI close');
4269
4269
 
4270
4270
  return Promise.resolve();
4271
4271
  }
@@ -4274,7 +4274,7 @@ class CTIPhone extends Emitter {
4274
4274
  if (!callSession) {
4275
4275
  return;
4276
4276
  }
4277
- logger$1.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
4277
+ logger$b.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
4278
4278
 
4279
4279
  return CallApi.hold(callSession.callId);
4280
4280
  }
@@ -4283,7 +4283,7 @@ class CTIPhone extends Emitter {
4283
4283
  if (!callSession) {
4284
4284
  return;
4285
4285
  }
4286
- logger$1.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
4286
+ logger$b.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
4287
4287
 
4288
4288
  return CallApi.resume(callSession.callId);
4289
4289
  }
@@ -4292,7 +4292,7 @@ class CTIPhone extends Emitter {
4292
4292
  if (!callSession) {
4293
4293
  return;
4294
4294
  }
4295
- logger$1.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
4295
+ logger$b.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
4296
4296
 
4297
4297
  return CallApi.mute(callSession.callId);
4298
4298
  }
@@ -4301,7 +4301,7 @@ class CTIPhone extends Emitter {
4301
4301
  if (!callSession) {
4302
4302
  return;
4303
4303
  }
4304
- logger$1.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
4304
+ logger$b.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
4305
4305
 
4306
4306
  return CallApi.unmute(callSession.callId);
4307
4307
  }
@@ -5310,7 +5310,7 @@ const AGENTD_VERSION = '1.0';
5310
5310
  const WEBHOOKD_VERSION = '1.0';
5311
5311
  const AMID_VERSION = '1.0';
5312
5312
 
5313
- const logger$2 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
5313
+ const logger$a = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
5314
5314
 
5315
5315
  class ApiClient {
5316
5316
 
@@ -5362,12 +5362,12 @@ class ApiClient {
5362
5362
  }
5363
5363
 
5364
5364
  async forceRefreshToken() {
5365
- logger$2.info('forcing refresh token, calling callback');
5365
+ logger$a.info('forcing refresh token, calling callback');
5366
5366
  return this.refreshTokenCallback();
5367
5367
  }
5368
5368
 
5369
5369
  async refreshTokenCallback() {
5370
- logger$2.info('refresh token callback called', {
5370
+ logger$a.info('refresh token callback called', {
5371
5371
  refreshToken: this.refreshToken,
5372
5372
  refreshBackend: this.refreshBackend,
5373
5373
  refreshExpiration: this.refreshExpiration,
@@ -5385,7 +5385,7 @@ class ApiClient {
5385
5385
  this.isMobile,
5386
5386
  );
5387
5387
 
5388
- logger$2.info('token refreshed', { token: session.token });
5388
+ logger$a.info('token refreshed', { token: session.token });
5389
5389
 
5390
5390
  if (this.onRefreshToken) {
5391
5391
  this.onRefreshToken(session.token, session);
@@ -5526,7 +5526,7 @@ var getApiClient = (forServer ) => {
5526
5526
  class InvalidSubscription extends Error {}
5527
5527
  class InvalidAuthorization extends Error {}
5528
5528
 
5529
- const logger$3 = IssueReporter$1.loggerFor('simple-auth');
5529
+ const logger$9 = IssueReporter$1.loggerFor('simple-auth');
5530
5530
 
5531
5531
  class Auth {
5532
5532
 
@@ -5561,7 +5561,7 @@ class Auth {
5561
5561
  setApiClientId(this.clientId);
5562
5562
  setRefreshExpiration(this.expiration);
5563
5563
  setOnRefreshToken((token , session ) => {
5564
- logger$3.info('on refresh token done', { token });
5564
+ logger$9.info('on refresh token done', { token });
5565
5565
  setApiToken(token);
5566
5566
  Wazo.Websocket.updateToken(token);
5567
5567
 
@@ -5606,7 +5606,7 @@ class Auth {
5606
5606
  const rawSession = await getApiClient().auth.authenticate(token);
5607
5607
  return this._onAuthenticated(rawSession);
5608
5608
  } catch (e) {
5609
- logger$3.error('on validate token error', e);
5609
+ logger$9.error('on validate token error', e);
5610
5610
  console.warn(e);
5611
5611
  return false;
5612
5612
  }
@@ -5962,7 +5962,7 @@ class AdHocAPIConference {
5962
5962
 
5963
5963
  /* */
5964
5964
 
5965
- const parseCandidate = (candidate ) => {
5965
+ const parseCandidate$1 = (candidate ) => {
5966
5966
  if (!candidate) {
5967
5967
  return null;
5968
5968
  }
@@ -6116,7 +6116,7 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
6116
6116
  this.peerConnectionDelegate.onicecandidate = event => {
6117
6117
  wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
6118
6118
  if (event.candidate) {
6119
- this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
6119
+ this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
6120
6120
  }
6121
6121
  };
6122
6122
 
@@ -6580,7 +6580,7 @@ const DEFAULT_ICE_TIMEOUT = 3000;
6580
6580
  const SEND_STATS_DELAY = 5000;
6581
6581
 
6582
6582
  const states = ['STATUS_NULL', 'STATUS_NEW', 'STATUS_CONNECTING', 'STATUS_CONNECTED', 'STATUS_COMPLETED'];
6583
- const logger$4 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
6583
+ const logger$8 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
6584
6584
  const statsLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-stats') : console;
6585
6585
 
6586
6586
  // events
@@ -6594,14 +6594,14 @@ const TRANSPORT_ERROR = 'transportError';
6594
6594
  const MESSAGE = 'message';
6595
6595
  const ACCEPTED = 'accepted';
6596
6596
  const REJECTED = 'rejected';
6597
- const ON_TRACK = 'onTrack';
6598
- const ON_REINVITE = 'reinvite';
6597
+ const ON_TRACK$1 = 'onTrack';
6598
+ const ON_REINVITE$1 = 'reinvite';
6599
6599
  const ON_ERROR = 'onError';
6600
6600
  const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
6601
- const ON_NETWORK_STATS = 'onNetworkStats';
6602
- const ON_DISCONNECTED = 'onDisconnected';
6601
+ const ON_NETWORK_STATS$1 = 'onNetworkStats';
6602
+ const ON_DISCONNECTED$1 = 'onDisconnected';
6603
6603
 
6604
- const events = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
6604
+ const events$1 = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
6605
6605
  const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
6606
6606
  class CanceledCallError extends Error {}
6607
6607
 
@@ -6737,12 +6737,12 @@ class WebRTCClient extends Emitter {
6737
6737
  this.MESSAGE = MESSAGE;
6738
6738
  this.ACCEPTED = ACCEPTED;
6739
6739
  this.REJECTED = REJECTED;
6740
- this.ON_TRACK = ON_TRACK;
6741
- this.ON_REINVITE = ON_REINVITE;
6740
+ this.ON_TRACK = ON_TRACK$1;
6741
+ this.ON_REINVITE = ON_REINVITE$1;
6742
6742
  this.ON_ERROR = ON_ERROR;
6743
6743
  this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
6744
- this.ON_NETWORK_STATS = ON_NETWORK_STATS;
6745
- this.ON_DISCONNECTED = ON_DISCONNECTED;
6744
+ this.ON_NETWORK_STATS = ON_NETWORK_STATS$1;
6745
+ this.ON_DISCONNECTED = ON_DISCONNECTED$1;
6746
6746
  }
6747
6747
 
6748
6748
  configureMedia(media ) {
@@ -6759,13 +6759,13 @@ class WebRTCClient extends Emitter {
6759
6759
 
6760
6760
  createUserAgent(configOverrides ) {
6761
6761
  const webRTCConfiguration = this._createWebRTCConfiguration(configOverrides);
6762
- logger$4.info('sdk webrtc, creating UA', { webRTCConfiguration });
6762
+ logger$8.info('sdk webrtc, creating UA', { webRTCConfiguration });
6763
6763
 
6764
6764
  webRTCConfiguration.delegate = {
6765
6765
  onConnect: this.onConnect.bind(this),
6766
6766
  onDisconnect: this.onDisconnect.bind(this),
6767
6767
  onInvite: (invitation ) => {
6768
- logger$4.info('sdk webrtc on invite', {
6768
+ logger$8.info('sdk webrtc on invite', {
6769
6769
  method: 'delegate.onInvite',
6770
6770
  id: invitation.id,
6771
6771
  remoteURI: invitation.remoteURI,
@@ -6808,7 +6808,7 @@ class WebRTCClient extends Emitter {
6808
6808
  }
6809
6809
 
6810
6810
  onConnect() {
6811
- logger$4.info('sdk webrtc connected', { method: 'delegate.onConnect' });
6811
+ logger$8.info('sdk webrtc connected', { method: 'delegate.onConnect' });
6812
6812
  this.eventEmitter.emit(CONNECTED);
6813
6813
  if (!this.isRegistered() && this.registerer && this.registerer.waiting) {
6814
6814
  this.registerer.waitingToggle(false);
@@ -6817,7 +6817,7 @@ class WebRTCClient extends Emitter {
6817
6817
  }
6818
6818
 
6819
6819
  async onDisconnect(error ) {
6820
- logger$4.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
6820
+ logger$8.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
6821
6821
  this.connectionPromise = null;
6822
6822
  // The UA will attempt to reconnect automatically when an error occurred
6823
6823
  this.eventEmitter.emit(DISCONNECTED, error);
@@ -6842,37 +6842,37 @@ class WebRTCClient extends Emitter {
6842
6842
  };
6843
6843
 
6844
6844
  if (this.skipRegister) {
6845
- logger$4.info('sdk webrtc skip register...', logInfo);
6845
+ logger$8.info('sdk webrtc skip register...', logInfo);
6846
6846
  return Promise.resolve();
6847
6847
  }
6848
6848
 
6849
- logger$4.info('sdk webrtc registering...', logInfo);
6849
+ logger$8.info('sdk webrtc registering...', logInfo);
6850
6850
 
6851
6851
  if (!this.userAgent) {
6852
- logger$4.info('sdk webrtc recreating User Agent');
6852
+ logger$8.info('sdk webrtc recreating User Agent');
6853
6853
  this.userAgent = this.createUserAgent(this.uaConfigOverrides);
6854
6854
  }
6855
6855
  if (!this.userAgent || this.isRegistered()) {
6856
- logger$4.info('sdk webrtc registering aborted, already registered or no UA can be created');
6856
+ logger$8.info('sdk webrtc registering aborted, already registered or no UA can be created');
6857
6857
  return Promise.resolve();
6858
6858
  }
6859
6859
 
6860
6860
  if (this.connectionPromise || (this.registerer && this.registerer.waiting)) {
6861
- logger$4.info('sdk webrtc registering aborted due to a registration in progress.');
6861
+ logger$8.info('sdk webrtc registering aborted due to a registration in progress.');
6862
6862
  return Promise.resolve();
6863
6863
  }
6864
6864
 
6865
6865
  const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
6866
6866
 
6867
6867
  const onRegisterFailed = () => {
6868
- logger$4.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
6868
+ logger$8.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
6869
6869
  this.connectionPromise = null;
6870
6870
  if (this.registerer && this.registerer.waiting) {
6871
6871
  this.registerer.waitingToggle(false);
6872
6872
  }
6873
6873
 
6874
6874
  if (tries <= MAX_REGISTER_TRIES) {
6875
- logger$4.info('sdk webrtc registering, retrying...', { tries });
6875
+ logger$8.info('sdk webrtc registering, retrying...', { tries });
6876
6876
  setTimeout(() => this.register(tries + 1), 300);
6877
6877
  }
6878
6878
  };
@@ -6881,18 +6881,18 @@ class WebRTCClient extends Emitter {
6881
6881
  // Avoid race condition with the close method called just before register and setting userAgent to null
6882
6882
  // during the resolution of the primise.
6883
6883
  if (!this.userAgent) {
6884
- logger$4.info('sdk webrtc recreating User Agent after connection');
6884
+ logger$8.info('sdk webrtc recreating User Agent after connection');
6885
6885
  this.userAgent = this.createUserAgent(this.uaConfigOverrides);
6886
6886
  }
6887
6887
 
6888
- logger$4.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
6888
+ logger$8.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
6889
6889
  this.registerer = new registerer.Registerer(this.userAgent, registerOptions);
6890
6890
  this.connectionPromise = null;
6891
6891
  this._monkeyPatchRegisterer(this.registerer);
6892
6892
 
6893
6893
  // Bind registerer events
6894
6894
  this.registerer.stateChange.addListener(newState => {
6895
- logger$4.info('sdk webrtc registering, state changed', { newState });
6895
+ logger$8.info('sdk webrtc registering, state changed', { newState });
6896
6896
 
6897
6897
  if (newState === registererState.RegistererState.Registered && this.registerer
6898
6898
  && this.registerer.state === registererState.RegistererState.Registered) {
@@ -6905,7 +6905,7 @@ class WebRTCClient extends Emitter {
6905
6905
  const options = {
6906
6906
  requestDelegate: {
6907
6907
  onReject: response => {
6908
- logger$4.error('sdk webrtc registering, rejected', { response });
6908
+ logger$8.error('sdk webrtc registering, rejected', { response });
6909
6909
 
6910
6910
  onRegisterFailed();
6911
6911
  },
@@ -6913,13 +6913,13 @@ class WebRTCClient extends Emitter {
6913
6913
  };
6914
6914
 
6915
6915
  return this.registerer.register(options).catch((e) => {
6916
- logger$4.error('sdk webrtc registering, error', e);
6916
+ logger$8.error('sdk webrtc registering, error', e);
6917
6917
 
6918
6918
  this.eventEmitter.emit(REGISTRATION_FAILED);
6919
6919
  return e;
6920
6920
  });
6921
6921
  }).catch(error => {
6922
- logger$4.error('sdk webrtc registering, transport error', error);
6922
+ logger$8.error('sdk webrtc registering, transport error', error);
6923
6923
  onRegisterFailed();
6924
6924
  });
6925
6925
  }
@@ -6948,21 +6948,21 @@ class WebRTCClient extends Emitter {
6948
6948
  }
6949
6949
 
6950
6950
  unregister() {
6951
- logger$4.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
6951
+ logger$8.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
6952
6952
  if (!this.registerer) {
6953
6953
  return Promise.resolve();
6954
6954
  }
6955
6955
 
6956
6956
  try {
6957
6957
  return this.registerer.unregister().then(() => {
6958
- logger$4.info('sdk webrtc unregistered');
6958
+ logger$8.info('sdk webrtc unregistered');
6959
6959
  this._cleanupRegister();
6960
6960
  }).catch(e => {
6961
- logger$4.error('sdk webrtc unregistering, promise error', e);
6961
+ logger$8.error('sdk webrtc unregistering, promise error', e);
6962
6962
  this._cleanupRegister();
6963
6963
  });
6964
6964
  } catch (e) {
6965
- logger$4.error('sdk webrtc unregistering, error', e);
6965
+ logger$8.error('sdk webrtc unregistering, error', e);
6966
6966
  // Avoid issue with `undefined is not an object (evaluating 'new.target.prototype')` when triggering a new
6967
6967
  // error when the registerer is in a bad state
6968
6968
  this._cleanupRegister();
@@ -6970,7 +6970,7 @@ class WebRTCClient extends Emitter {
6970
6970
  }
6971
6971
 
6972
6972
  stop() {
6973
- logger$4.info('sdk webrtc stop', { userAgent: !!this.userAgent });
6973
+ logger$8.info('sdk webrtc stop', { userAgent: !!this.userAgent });
6974
6974
  if (!this.userAgent) {
6975
6975
  return Promise.resolve();
6976
6976
  }
@@ -6978,12 +6978,12 @@ class WebRTCClient extends Emitter {
6978
6978
  return this.userAgent.stop().then(() => {
6979
6979
  return this._cleanupRegister();
6980
6980
  }).catch(e => {
6981
- logger$4.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
6981
+ logger$8.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
6982
6982
  });
6983
6983
  }
6984
6984
 
6985
6985
  call(number , enableVideo , audioOnly = false, conference = false) {
6986
- logger$4.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
6986
+ logger$8.info('sdk webrtc creating call', { number, enableVideo, audioOnly, conference });
6987
6987
  const inviterOptions = {
6988
6988
  sessionDescriptionHandlerOptionsReInvite: {
6989
6989
  conference,
@@ -7014,7 +7014,7 @@ class WebRTCClient extends Emitter {
7014
7014
  this._onAccepted(session, response.session, true);
7015
7015
  },
7016
7016
  onReject: (response ) => {
7017
- logger$4.info('on call rejected', { id: session.id, fromTag: session.fromTag });
7017
+ logger$8.info('on call rejected', { id: session.id, fromTag: session.fromTag });
7018
7018
  this._stopSendingStats(session);
7019
7019
  this.stopNetworkMonitoring(session);
7020
7020
 
@@ -7037,11 +7037,11 @@ class WebRTCClient extends Emitter {
7037
7037
  }
7038
7038
 
7039
7039
  answer(session , enableVideo ) {
7040
- logger$4.info('sdk webrtc answer call', { id: session.id, enableVideo });
7040
+ logger$8.info('sdk webrtc answer call', { id: session.id, enableVideo });
7041
7041
 
7042
7042
  if (!session || !session.accept) {
7043
7043
  const error = 'No session to answer, or not an invitation';
7044
- logger$4.warn(error);
7044
+ logger$8.warn(error);
7045
7045
  return Promise.reject(new Error(error));
7046
7046
  }
7047
7047
  const options = {
@@ -7051,15 +7051,15 @@ class WebRTCClient extends Emitter {
7051
7051
  return session.accept(options).then(() => {
7052
7052
  if (session.isCanceled) {
7053
7053
  const message = 'accepted a canceled session (or was canceled during the accept phase).';
7054
- logger$4.error(message, { id: session.id });
7054
+ logger$8.error(message, { id: session.id });
7055
7055
  this.onCallEnded(session);
7056
7056
 
7057
7057
  throw new CanceledCallError(message);
7058
7058
  }
7059
- logger$4.info('sdk webrtc answer, accepted.');
7059
+ logger$8.info('sdk webrtc answer, accepted.');
7060
7060
  this._onAccepted(session);
7061
7061
  }).catch(e => {
7062
- logger$4.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
7062
+ logger$8.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
7063
7063
 
7064
7064
  throw e;
7065
7065
  });
@@ -7067,7 +7067,7 @@ class WebRTCClient extends Emitter {
7067
7067
 
7068
7068
  hangup(session ) {
7069
7069
  const { state, id } = session;
7070
- logger$4.info('sdk webrtc hangup call', { id, state });
7070
+ logger$8.info('sdk webrtc hangup call', { id, state });
7071
7071
 
7072
7072
  try {
7073
7073
  this._stopSendingStats(session);
@@ -7096,7 +7096,7 @@ class WebRTCClient extends Emitter {
7096
7096
 
7097
7097
  return bye();
7098
7098
  } catch (error) {
7099
- logger$4.warn('sdk webrtc hangup, error', error);
7099
+ logger$8.warn('sdk webrtc hangup, error', error);
7100
7100
  }
7101
7101
 
7102
7102
  return null;
@@ -7114,7 +7114,7 @@ class WebRTCClient extends Emitter {
7114
7114
  // Fetch and emit an event at `interval` with session network stats
7115
7115
  startNetworkMonitoring(session , interval = 1000) {
7116
7116
  const sessionId = this.getSipSessionId(session);
7117
- logger$4.info('starting network inspection', { id: sessionId });
7117
+ logger$8.info('starting network inspection', { id: sessionId });
7118
7118
 
7119
7119
  this.sessionNetworkStats[sessionId] = [];
7120
7120
 
@@ -7124,7 +7124,7 @@ class WebRTCClient extends Emitter {
7124
7124
  stopNetworkMonitoring(session ) {
7125
7125
  const sessionId = this.getSipSessionId(session);
7126
7126
  const exists = sessionId in this.networkMonitoringInterval;
7127
- logger$4.info('stopping network inspection', { id: sessionId, exists });
7127
+ logger$8.info('stopping network inspection', { id: sessionId, exists });
7128
7128
 
7129
7129
  if (exists) {
7130
7130
  clearInterval(this.networkMonitoringInterval[sessionId]);
@@ -7134,17 +7134,17 @@ class WebRTCClient extends Emitter {
7134
7134
  }
7135
7135
 
7136
7136
  reject(session ) {
7137
- logger$4.info('sdk webrtc reject call', { id: session.id });
7137
+ logger$8.info('sdk webrtc reject call', { id: session.id });
7138
7138
 
7139
7139
  try {
7140
7140
  return session.reject ? session.reject() : session.cancel();
7141
7141
  } catch (e) {
7142
- logger$4.warn('Error when rejecting call', e.message, e.stack);
7142
+ logger$8.warn('Error when rejecting call', e.message, e.stack);
7143
7143
  }
7144
7144
  }
7145
7145
 
7146
7146
  async close() {
7147
- logger$4.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
7147
+ logger$8.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
7148
7148
  this._cleanupMedia();
7149
7149
  this.connectionPromise = null;
7150
7150
 
@@ -7175,7 +7175,7 @@ class WebRTCClient extends Emitter {
7175
7175
  // eg: "INVITE not rejectable in state Completed"
7176
7176
  }
7177
7177
  this.userAgent = null;
7178
- logger$4.info('sdk webrtc client closed');
7178
+ logger$8.info('sdk webrtc client closed');
7179
7179
  }
7180
7180
 
7181
7181
  getNumber(session ) {
@@ -7188,13 +7188,13 @@ class WebRTCClient extends Emitter {
7188
7188
  }
7189
7189
 
7190
7190
  mute(session ) {
7191
- logger$4.info('sdk webrtc mute', { id: session.id });
7191
+ logger$8.info('sdk webrtc mute', { id: session.id });
7192
7192
 
7193
7193
  this._toggleAudio(session, true);
7194
7194
  }
7195
7195
 
7196
7196
  unmute(session ) {
7197
- logger$4.info('sdk webrtc unmute', { id: session.id });
7197
+ logger$8.info('sdk webrtc unmute', { id: session.id });
7198
7198
 
7199
7199
  this._toggleAudio(session, false);
7200
7200
  }
@@ -7234,13 +7234,13 @@ class WebRTCClient extends Emitter {
7234
7234
  }
7235
7235
 
7236
7236
  toggleCameraOn(session ) {
7237
- logger$4.info('sdk webrtc toggle camera on', { id: session.id });
7237
+ logger$8.info('sdk webrtc toggle camera on', { id: session.id });
7238
7238
 
7239
7239
  this._toggleVideo(session, false);
7240
7240
  }
7241
7241
 
7242
7242
  toggleCameraOff(session ) {
7243
- logger$4.info('sdk webrtc toggle camera off', { id: session.id });
7243
+ logger$8.info('sdk webrtc toggle camera off', { id: session.id });
7244
7244
 
7245
7245
  this._toggleVideo(session, true);
7246
7246
  }
@@ -7249,7 +7249,7 @@ class WebRTCClient extends Emitter {
7249
7249
  const sessionId = this.getSipSessionId(session);
7250
7250
  const hasVideo = hadVideo || this.hasLocalVideo(sessionId);
7251
7251
 
7252
- logger$4.info('sdk webrtc hold', {
7252
+ logger$8.info('sdk webrtc hold', {
7253
7253
  sessionId,
7254
7254
  keys: Object.keys(this.heldSessions),
7255
7255
  pendingReinvite: !!session.pendingReinvite,
@@ -7298,7 +7298,7 @@ class WebRTCClient extends Emitter {
7298
7298
  const sessionId = this.getSipSessionId(session);
7299
7299
  const hasVideo = sessionId in this.heldSessions && this.heldSessions[sessionId].hasVideo;
7300
7300
 
7301
- logger$4.info('sdk webrtc unhold', {
7301
+ logger$8.info('sdk webrtc unhold', {
7302
7302
  sessionId,
7303
7303
  keys: Object.keys(this.heldSessions),
7304
7304
  pendingReinvite: !!session.pendingReinvite,
@@ -7446,7 +7446,7 @@ class WebRTCClient extends Emitter {
7446
7446
  if (!session.sessionDescriptionHandler) {
7447
7447
  return;
7448
7448
  }
7449
- logger$4.info('Sending DTMF', {
7449
+ logger$8.info('Sending DTMF', {
7450
7450
  id: this.getSipSessionId(session),
7451
7451
  tone,
7452
7452
  });
@@ -7462,7 +7462,7 @@ class WebRTCClient extends Emitter {
7462
7462
  transfer(session , target ) {
7463
7463
  this.hold(session);
7464
7464
 
7465
- logger$4.info('Transfering a session', {
7465
+ logger$8.info('Transfering a session', {
7466
7466
  id: this.getSipSessionId(session),
7467
7467
  target,
7468
7468
  });
@@ -7484,17 +7484,17 @@ class WebRTCClient extends Emitter {
7484
7484
  atxfer(session ) {
7485
7485
  this.hold(session);
7486
7486
 
7487
- logger$4.info('webrtc transfer started', { id: this.getSipSessionId(session) });
7487
+ logger$8.info('webrtc transfer started', { id: this.getSipSessionId(session) });
7488
7488
 
7489
7489
  const result = {
7490
7490
  newSession: null,
7491
7491
  init: async (target ) => {
7492
- logger$4.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
7492
+ logger$8.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
7493
7493
 
7494
7494
  result.newSession = await this.call(target);
7495
7495
  },
7496
7496
  complete: () => {
7497
- logger$4.info('webrtc transfer completed', {
7497
+ logger$8.info('webrtc transfer completed', {
7498
7498
  id: this.getSipSessionId(session),
7499
7499
  referId: this.getSipSessionId(result.newSession),
7500
7500
  });
@@ -7515,7 +7515,7 @@ class WebRTCClient extends Emitter {
7515
7515
  return;
7516
7516
  }
7517
7517
 
7518
- logger$4.info('send WebRTC message', { sipId: sipSession.id, contentType });
7518
+ logger$8.info('send WebRTC message', { sipId: sipSession.id, contentType });
7519
7519
 
7520
7520
  try {
7521
7521
  sipSession.message({
@@ -7557,7 +7557,7 @@ class WebRTCClient extends Emitter {
7557
7557
  }
7558
7558
 
7559
7559
  changeAudioOutputVolume(volume ) {
7560
- logger$4.info('Changing audio output volume', { volume });
7560
+ logger$8.info('Changing audio output volume', { volume });
7561
7561
 
7562
7562
  Object.values(this.audioElements).forEach(audioElement => {
7563
7563
  if (audioElement instanceof HTMLAudioElement) {
@@ -7569,7 +7569,7 @@ class WebRTCClient extends Emitter {
7569
7569
  }
7570
7570
 
7571
7571
  changeAudioOutputDevice(id ) {
7572
- logger$4.info('Changing audio output device', { id });
7572
+ logger$8.info('Changing audio output device', { id });
7573
7573
 
7574
7574
  Object.values(this.audioElements).forEach(audioElement => {
7575
7575
  // `setSinkId` method is not included in any flow type definitions for HTMLAudioElements but is a valid method
@@ -7586,7 +7586,7 @@ class WebRTCClient extends Emitter {
7586
7586
 
7587
7587
  changeAudioInputDevice(id , session ) {
7588
7588
  const currentId = this.getAudioDeviceId();
7589
- logger$4.info('setting audio input device', { id, currentId, session: !!session });
7589
+ logger$8.info('setting audio input device', { id, currentId, session: !!session });
7590
7590
 
7591
7591
  if (id === currentId) {
7592
7592
  return null;
@@ -7632,7 +7632,7 @@ class WebRTCClient extends Emitter {
7632
7632
 
7633
7633
  setVideoInputDevice(id ) {
7634
7634
  const currentId = this.getVideoDeviceId();
7635
- logger$4.info('setting video input device', { id, currentId });
7635
+ logger$8.info('setting video input device', { id, currentId });
7636
7636
 
7637
7637
  if (id === currentId) {
7638
7638
  return null;
@@ -7657,7 +7657,7 @@ class WebRTCClient extends Emitter {
7657
7657
  const sessionId = this.getSipSessionId(session);
7658
7658
  const localStream = this.getLocalStream(sessionId);
7659
7659
 
7660
- logger$4.info('changing video input device', { id, sessionId });
7660
+ logger$8.info('changing video input device', { id, sessionId });
7661
7661
 
7662
7662
  // Release old video stream
7663
7663
  if (localStream) {
@@ -7725,7 +7725,7 @@ class WebRTCClient extends Emitter {
7725
7725
  const shouldDoScreenSharing = newConstraints && newConstraints.screen;
7726
7726
  const desktop = newConstraints && newConstraints.desktop;
7727
7727
 
7728
- logger$4.info('Sending reinvite', {
7728
+ logger$8.info('Sending reinvite', {
7729
7729
  id: this.getSipSessionId(sipSession),
7730
7730
  newConstraints,
7731
7731
  conference,
@@ -7763,7 +7763,7 @@ class WebRTCClient extends Emitter {
7763
7763
  sipSession.incomingInviteRequest.message.body = response.message.body;
7764
7764
  }
7765
7765
 
7766
- logger$4.info('on re-INVITE accepted', {
7766
+ logger$8.info('on re-INVITE accepted', {
7767
7767
  id: this.getSipSessionId(sipSession),
7768
7768
  wasMuted,
7769
7769
  shouldDoScreenSharing,
@@ -7781,7 +7781,7 @@ class WebRTCClient extends Emitter {
7781
7781
  this.eventEmitter.emit(ON_SCREEN_SHARING_REINVITE, sipSession, response, desktop);
7782
7782
  }
7783
7783
 
7784
- return this.eventEmitter.emit(ON_REINVITE, sipSession, response);
7784
+ return this.eventEmitter.emit(ON_REINVITE$1, sipSession, response);
7785
7785
  },
7786
7786
  },
7787
7787
  sessionDescriptionHandlerModifiers: [replaceLocalIpModifier],
@@ -7938,7 +7938,7 @@ class WebRTCClient extends Emitter {
7938
7938
  }
7939
7939
 
7940
7940
  startHeartbeat() {
7941
- logger$4.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
7941
+ logger$8.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
7942
7942
  if (!this.userAgent) {
7943
7943
  this.heartbeat.stop();
7944
7944
  return;
@@ -7951,7 +7951,7 @@ class WebRTCClient extends Emitter {
7951
7951
  }
7952
7952
 
7953
7953
  stopHeartbeat() {
7954
- logger$4.info('sdk webrtc stop heartbeat');
7954
+ logger$8.info('sdk webrtc stop heartbeat');
7955
7955
  this.heartbeat.stop();
7956
7956
  }
7957
7957
 
@@ -7972,7 +7972,7 @@ class WebRTCClient extends Emitter {
7972
7972
  }
7973
7973
 
7974
7974
  attemptReconnection() {
7975
- logger$4.info('attempt reconnection', { userAgent: !!this.userAgent });
7975
+ logger$8.info('attempt reconnection', { userAgent: !!this.userAgent });
7976
7976
  if (!this.userAgent) {
7977
7977
  return;
7978
7978
  }
@@ -7997,7 +7997,7 @@ class WebRTCClient extends Emitter {
7997
7997
  return;
7998
7998
  }
7999
7999
 
8000
- logger$4.info('setting local media stream', {
8000
+ logger$8.info('setting local media stream', {
8001
8001
  sipSessionId,
8002
8002
  tracks: newStream ? newStream.getTracks() : null,
8003
8003
  });
@@ -8014,7 +8014,7 @@ class WebRTCClient extends Emitter {
8014
8014
 
8015
8015
  const oldStream = this.getLocalStream(sipSessionId);
8016
8016
 
8017
- logger$4.info('updating local stream', {
8017
+ logger$8.info('updating local stream', {
8018
8018
  sipSessionId,
8019
8019
  oldStream: !!oldStream,
8020
8020
  tracks: newStream.getTracks(),
@@ -8034,7 +8034,7 @@ class WebRTCClient extends Emitter {
8034
8034
  const remoteStream = this.getRemoteStream(sessionId);
8035
8035
  const pc = this.getPeerConnection(sessionId);
8036
8036
 
8037
- logger$4.info('Updating remote stream', {
8037
+ logger$8.info('Updating remote stream', {
8038
8038
  sessionId,
8039
8039
  tracks: remoteStream ? remoteStream.getTracks() : null,
8040
8040
  receiverTracks: pc && pc.getReceivers ? pc.getReceivers().map(receiver => receiver.track) : null,
@@ -8059,14 +8059,16 @@ class WebRTCClient extends Emitter {
8059
8059
  const screenSharing = constraints && 'screen' in constraints ? constraints.screen : false;
8060
8060
  const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
8061
8061
  const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
8062
+ const mandatoryVideo = constraints && typeof constraints.video === 'object' ? constraints.video.mandatory : {};
8062
8063
 
8063
- logger$4.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
8064
+ logger$8.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
8064
8065
 
8065
8066
  return {
8066
8067
  constraints: {
8067
8068
  // Exact constraint are not supported with `getDisplayMedia` and we must have a video=false in desktop screenshare
8068
8069
  audio: screenSharing ? !isDesktop : (withAudio ? this._getAudioConstraints() : false),
8069
- video: screenSharing ? (isDesktop ? ({ mandatory: { chromeMediaSource: 'desktop' } }) : { cursor: 'always' })
8070
+ video: screenSharing ? (isDesktop
8071
+ ? ({ mandatory: { chromeMediaSource: 'desktop', ...(mandatoryVideo || {}) } }) : { cursor: 'always' })
8070
8072
  : this._getVideoConstraints(enableVideo),
8071
8073
  screen: screenSharing,
8072
8074
  desktop: isDesktop,
@@ -8109,7 +8111,7 @@ class WebRTCClient extends Emitter {
8109
8111
  }
8110
8112
 
8111
8113
  _onTransportError() {
8112
- logger$4.error('on transport error');
8114
+ logger$8.error('on transport error');
8113
8115
  this.eventEmitter.emit(TRANSPORT_ERROR);
8114
8116
  this.attemptReconnection();
8115
8117
  }
@@ -8118,7 +8120,7 @@ class WebRTCClient extends Emitter {
8118
8120
  const body = message && typeof message === 'object' ? message.data : message;
8119
8121
  if (body && body.indexOf('200 OK') !== -1) {
8120
8122
  if (this.hasHeartbeat()) {
8121
- logger$4.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
8123
+ logger$8.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
8122
8124
 
8123
8125
  this.heartbeat.onHeartbeat();
8124
8126
  if (this.heartbeatCb) {
@@ -8129,7 +8131,7 @@ class WebRTCClient extends Emitter {
8129
8131
  }
8130
8132
 
8131
8133
  async _onHeartbeatTimeout() {
8132
- logger$4.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
8134
+ logger$8.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
8133
8135
 
8134
8136
  if (this.heartbeatTimeoutCb) {
8135
8137
  this.heartbeatTimeoutCb();
@@ -8141,7 +8143,7 @@ class WebRTCClient extends Emitter {
8141
8143
  try {
8142
8144
  await this.userAgent.transport.disconnect();
8143
8145
  } catch (e) {
8144
- logger$4.error('Transport disconnection after heartbeat timeout, error', e);
8146
+ logger$8.error('Transport disconnection after heartbeat timeout, error', e);
8145
8147
  }
8146
8148
  }
8147
8149
 
@@ -8174,31 +8176,31 @@ class WebRTCClient extends Emitter {
8174
8176
  }
8175
8177
 
8176
8178
  _connectIfNeeded() {
8177
- logger$4.info('connect if needed, checking', { connected: this.isConnected() });
8179
+ logger$8.info('connect if needed, checking', { connected: this.isConnected() });
8178
8180
  if (!this.userAgent) {
8179
- logger$4.info('need to recreate User Agent');
8181
+ logger$8.info('need to recreate User Agent');
8180
8182
  this.userAgent = this.createUserAgent(this.uaConfigOverrides);
8181
8183
  }
8182
8184
 
8183
8185
  if (this.isConnected()) {
8184
- logger$4.info('webrtc sdk, already connected');
8186
+ logger$8.info('webrtc sdk, already connected');
8185
8187
  return Promise.resolve();
8186
8188
  }
8187
8189
 
8188
8190
  if (this.isConnecting()) {
8189
- logger$4.info('webrtc sdk, already connecting...');
8191
+ logger$8.info('webrtc sdk, already connecting...');
8190
8192
 
8191
8193
  this.connectionPromise = this.userAgent.transport.connectPromise;
8192
8194
  return this.connectionPromise;
8193
8195
  }
8194
8196
 
8195
8197
  if (this.connectionPromise) {
8196
- logger$4.info('webrtc sdk, connection promise connecting...');
8198
+ logger$8.info('webrtc sdk, connection promise connecting...');
8197
8199
  // $FlowFixMe
8198
8200
  return this.connectionPromise;
8199
8201
  }
8200
8202
 
8201
- logger$4.info('WebRTC UA needs to connect');
8203
+ logger$8.info('WebRTC UA needs to connect');
8202
8204
 
8203
8205
  // Force UA to reconnect
8204
8206
  if (this.userAgent && this.userAgent.state !== userAgentState.UserAgentState.Stopped) {
@@ -8323,7 +8325,7 @@ class WebRTCClient extends Emitter {
8323
8325
 
8324
8326
  sdh.peerConnectionDelegate = {
8325
8327
  onicecandidateerror: (error ) => {
8326
- logger$4.error('on icecandidate error', {
8328
+ logger$8.error('on icecandidate error', {
8327
8329
  address: error.address,
8328
8330
  port: error.port,
8329
8331
  errorCode: error.errorCode,
@@ -8352,7 +8354,7 @@ class WebRTCClient extends Emitter {
8352
8354
  updatedNumber = session.assertedIdentity.uri.normal.user;
8353
8355
  updatedCalleeName = session.assertedIdentity.displayName || updatedNumber;
8354
8356
  }
8355
- logger$4.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
8357
+ logger$8.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
8356
8358
 
8357
8359
  // Useful to know if it's a video upgrade or an unhold from a remote peer with a video stream
8358
8360
 
@@ -8368,12 +8370,12 @@ class WebRTCClient extends Emitter {
8368
8370
 
8369
8371
  this._setupMedias(session);
8370
8372
 
8371
- return this.eventEmitter.emit(ON_REINVITE, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
8373
+ return this.eventEmitter.emit(ON_REINVITE$1, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
8372
8374
  };
8373
8375
  }
8374
8376
 
8375
8377
  _onAccepted(session , sessionDialog , withEvent = true) {
8376
- logger$4.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
8378
+ logger$8.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
8377
8379
 
8378
8380
  this.storeSipSession(session);
8379
8381
 
@@ -8385,14 +8387,14 @@ class WebRTCClient extends Emitter {
8385
8387
  const onTrack = (event ) => {
8386
8388
  const isAudioOnly = this._isAudioOnly(session);
8387
8389
  const { kind, label, readyState, id, muted } = event.track;
8388
- logger$4.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
8390
+ logger$8.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
8389
8391
 
8390
8392
  // Stop video track in audio only mode
8391
8393
  if (isAudioOnly && kind === 'video') {
8392
8394
  event.track.stop();
8393
8395
  }
8394
8396
 
8395
- this.eventEmitter.emit(ON_TRACK, session, event);
8397
+ this.eventEmitter.emit(ON_TRACK$1, session, event);
8396
8398
  };
8397
8399
 
8398
8400
  if (session.sessionDescriptionHandler.peerConnection) {
@@ -8401,12 +8403,14 @@ class WebRTCClient extends Emitter {
8401
8403
 
8402
8404
  session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
8403
8405
 
8404
- pc.oniceconnectionstatechange = () => {
8405
- logger$4.info('on ice connection state changed', { state: pc.iceConnectionState });
8406
- if (pc.iceConnectionState === 'disconnected') {
8407
- this.eventEmitter.emit(ON_DISCONNECTED);
8408
- }
8409
- };
8406
+ if (pc) {
8407
+ pc.oniceconnectionstatechange = () => {
8408
+ logger$8.info('on ice connection state changed', { state: pc.iceConnectionState });
8409
+ if (pc.iceConnectionState === 'disconnected') {
8410
+ this.eventEmitter.emit(ON_DISCONNECTED$1);
8411
+ }
8412
+ };
8413
+ }
8410
8414
 
8411
8415
  if (withEvent) {
8412
8416
  this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
@@ -8575,10 +8579,10 @@ class WebRTCClient extends Emitter {
8575
8579
 
8576
8580
  _stopSendingStats(session ) {
8577
8581
  const sessionId = this.getSipSessionId(session);
8578
- logger$4.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
8582
+ logger$8.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
8579
8583
 
8580
8584
  if (sessionId in this.statsIntervals) {
8581
- logger$4.trace('Stop sending stats for call', { sessionId });
8585
+ logger$8.trace('Stop sending stats for call', { sessionId });
8582
8586
  this.statsIntervals[sessionId]();
8583
8587
  delete this.statsIntervals[sessionId];
8584
8588
  }
@@ -8594,7 +8598,7 @@ class WebRTCClient extends Emitter {
8594
8598
  try {
8595
8599
  await this.userAgent.transport.disconnect();
8596
8600
  } catch (e) {
8597
- logger$4.error('WebRTC transport disconnect, error', e);
8601
+ logger$8.error('WebRTC transport disconnect, error', e);
8598
8602
  }
8599
8603
  }
8600
8604
  }
@@ -8616,13 +8620,17 @@ class WebRTCClient extends Emitter {
8616
8620
  const nbStats = this.sessionNetworkStats[sessionId].length;
8617
8621
  const lastNetworkStats = this.sessionNetworkStats[sessionId][nbStats - 1];
8618
8622
  const lastAudioSent = lastNetworkStats ? lastNetworkStats.audioBytesSent : 0;
8623
+ const lastAudioContentSent = lastNetworkStats ? lastNetworkStats.audioContentSent : 0;
8619
8624
  const lastVideoSent = lastNetworkStats ? lastNetworkStats.videoBytesSent : 0;
8620
8625
  const lastAudioReceived = lastNetworkStats ? lastNetworkStats.audioBytesReceived : 0;
8626
+ const lastAudioContentReceived = lastNetworkStats ? lastNetworkStats.audioContentReceived : 0;
8621
8627
  const lastVideoReceived = lastNetworkStats ? lastNetworkStats.videoBytesReceived : 0;
8622
8628
  const lastTransportSent = lastNetworkStats ? lastNetworkStats.transportSent : 0;
8623
8629
  const lastTransportReceived = lastNetworkStats ? lastNetworkStats.transportReceived : 0;
8624
- let audioBytesSent = 0;
8625
- let audioBytesReceived = 0;
8630
+ let audioBytesSent = 0; // content + header
8631
+ let audioBytesReceived = 0; // content + header
8632
+ let audioContentSent = 0; // useful to detect blank call
8633
+ let audioContentReceived = 0;
8626
8634
  let videoBytesSent = 0;
8627
8635
  let videoBytesReceived = 0;
8628
8636
  let transportSent = 0;
@@ -8632,6 +8640,7 @@ class WebRTCClient extends Emitter {
8632
8640
  stats.forEach(report => {
8633
8641
  if (report.type === 'outbound-rtp' && report.kind === 'audio') {
8634
8642
  audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
8643
+ audioContentSent += Number(report.bytesSent);
8635
8644
  }
8636
8645
  if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
8637
8646
  audioBytesSent += Number(report.bytesSent);
@@ -8643,6 +8652,7 @@ class WebRTCClient extends Emitter {
8643
8652
  packetsLost += Number(report.packetsLost);
8644
8653
  networkStats.packetsReceived = Number(report.packetsReceived);
8645
8654
  audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
8655
+ audioContentReceived += Number(report.bytesReceived);
8646
8656
  }
8647
8657
  if (report.type === 'inbound-rtp' && report.kind === 'video') {
8648
8658
  videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
@@ -8671,10 +8681,17 @@ class WebRTCClient extends Emitter {
8671
8681
  });
8672
8682
 
8673
8683
  networkStats.packetsLost = packetsLost;
8684
+
8674
8685
  networkStats.totalAudioBytesSent = audioBytesSent;
8675
8686
  networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
8676
8687
  networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
8677
8688
  networkStats.audioBytesReceived = audioBytesReceived;
8689
+
8690
+ networkStats.totalAudioContentSent = audioContentSent;
8691
+ networkStats.audioContentSent = audioContentSent - lastAudioContentSent;
8692
+ networkStats.totalAudioBytesReceived = audioContentReceived - lastAudioContentReceived;
8693
+ networkStats.audioContentReceived = audioContentReceived;
8694
+
8678
8695
  networkStats.totalVideoBytesSent = videoBytesSent;
8679
8696
  networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
8680
8697
  networkStats.totalVideoBytesReceived = videoBytesReceived;
@@ -8688,7 +8705,7 @@ class WebRTCClient extends Emitter {
8688
8705
  + networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
8689
8706
  + networkStats.transportSent;
8690
8707
 
8691
- this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
8708
+ this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
8692
8709
  this.sessionNetworkStats[sessionId].push(networkStats);
8693
8710
  }
8694
8711
 
@@ -8716,8 +8733,8 @@ const ON_CALL_FAILED = 'onCallFailed';
8716
8733
  const ON_CALL_ENDED = 'onCallEnded';
8717
8734
  const ON_CALL_ENDING = 'onCallEnding';
8718
8735
  const ON_MESSAGE = 'onMessage';
8719
- const ON_REINVITE$1 = 'reinvite';
8720
- const ON_TRACK$1 = 'onTrack';
8736
+ const ON_REINVITE = 'reinvite';
8737
+ const ON_TRACK = 'onTrack';
8721
8738
  const ON_AUDIO_STREAM = 'onAudioStream';
8722
8739
  const ON_VIDEO_STREAM = 'onVideoStream';
8723
8740
  const ON_REMOVE_STREAM = 'onRemoveStream';
@@ -8732,15 +8749,15 @@ const ON_PLAY_PROGRESS_SOUND = 'playProgressSound';
8732
8749
  const ON_VIDEO_INPUT_CHANGE = 'videoInputChange';
8733
8750
  const ON_CALL_ERROR = 'onCallError';
8734
8751
  const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
8735
- const ON_NETWORK_STATS$1 = 'onNetworkStats';
8752
+ const ON_NETWORK_STATS = 'onNetworkStats';
8736
8753
  const ON_CHAT = 'phone/ON_CHAT';
8737
8754
  const ON_SIGNAL = 'phone/ON_SIGNAL';
8738
- const ON_DISCONNECTED$1 = 'onDisconnected';
8755
+ const ON_DISCONNECTED = 'onDisconnected';
8739
8756
 
8740
8757
  const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
8741
8758
  const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
8742
8759
 
8743
- const events$1 = [
8760
+ const events = [
8744
8761
  ON_USER_AGENT,
8745
8762
  ON_REGISTERED,
8746
8763
  ON_UNREGISTERED,
@@ -8758,8 +8775,8 @@ const events$1 = [
8758
8775
  ON_CALL_FAILED,
8759
8776
  ON_CALL_ENDED,
8760
8777
  ON_MESSAGE,
8761
- ON_REINVITE$1,
8762
- ON_TRACK$1,
8778
+ ON_REINVITE,
8779
+ ON_TRACK,
8763
8780
  ON_AUDIO_STREAM,
8764
8781
  ON_VIDEO_STREAM,
8765
8782
  ON_REMOVE_STREAM,
@@ -8774,11 +8791,11 @@ const events$1 = [
8774
8791
  ON_CALL_ERROR,
8775
8792
  ON_CHAT,
8776
8793
  ON_SIGNAL,
8777
- ON_NETWORK_STATS$1,
8778
- ON_DISCONNECTED$1,
8794
+ ON_NETWORK_STATS,
8795
+ ON_DISCONNECTED,
8779
8796
  ];
8780
8797
 
8781
- const logger$5 = IssueReporter$1.loggerFor('webrtc-phone');
8798
+ const logger$7 = IssueReporter$1.loggerFor('webrtc-phone');
8782
8799
 
8783
8800
  class WebRTCPhone extends Emitter {
8784
8801
 
@@ -8851,7 +8868,7 @@ class WebRTCPhone extends Emitter {
8851
8868
  }).catch(error => {
8852
8869
  // Avoid exception on `t.server.scheme` in sip transport when losing the webrtc socket connection
8853
8870
  console.error('register error', error, error.message, error.stack);
8854
- logger$5.error('WebRTC register error', { message: error.message, stack: error.stack });
8871
+ logger$7.error('WebRTC register error', { message: error.message, stack: error.stack });
8855
8872
  });
8856
8873
  }
8857
8874
 
@@ -8866,7 +8883,7 @@ class WebRTCPhone extends Emitter {
8866
8883
  if (!this.client) {
8867
8884
  return;
8868
8885
  }
8869
- logger$5.info('WebRTC phone stop');
8886
+ logger$7.info('WebRTC phone stop');
8870
8887
  this.client.stop();
8871
8888
  }
8872
8889
 
@@ -8881,11 +8898,12 @@ class WebRTCPhone extends Emitter {
8881
8898
  async sendReinvite(callSession , constraints = null, conference = false,
8882
8899
  audioOnly = false, iceRestart = false) {
8883
8900
  const sipSession = this.findSipSession(callSession);
8884
- logger$5.info('WebRTC phone - send reinvite', {
8901
+ logger$7.info('WebRTC phone - send reinvite', {
8885
8902
  sessionId: sipSession ? sipSession.id : null,
8886
8903
  constraints,
8887
8904
  audioOnly,
8888
8905
  conference,
8906
+ iceRestart,
8889
8907
  });
8890
8908
 
8891
8909
  if (!sipSession) {
@@ -8918,7 +8936,7 @@ class WebRTCPhone extends Emitter {
8918
8936
  }
8919
8937
 
8920
8938
  startHeartbeat() {
8921
- logger$5.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
8939
+ logger$7.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
8922
8940
  if (!this.client || this.client.hasHeartbeat()) {
8923
8941
  return;
8924
8942
  }
@@ -8927,7 +8945,7 @@ class WebRTCPhone extends Emitter {
8927
8945
  }
8928
8946
 
8929
8947
  stopHeartbeat() {
8930
- logger$5.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
8948
+ logger$7.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
8931
8949
  if (!this.client) {
8932
8950
  return;
8933
8951
  }
@@ -8944,7 +8962,7 @@ class WebRTCPhone extends Emitter {
8944
8962
  }
8945
8963
 
8946
8964
  reconnect() {
8947
- logger$5.info('WebRTC phone - reconnect', { client: !!this.client });
8965
+ logger$7.info('WebRTC phone - reconnect', { client: !!this.client });
8948
8966
  if (!this.client) {
8949
8967
  return;
8950
8968
  }
@@ -8985,7 +9003,7 @@ class WebRTCPhone extends Emitter {
8985
9003
  return false;
8986
9004
  }
8987
9005
 
8988
- logger$5.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
9006
+ logger$7.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
8989
9007
 
8990
9008
  this.client.downgradeToAudio(sipSession);
8991
9009
 
@@ -9008,7 +9026,7 @@ class WebRTCPhone extends Emitter {
9008
9026
  return Promise.resolve(false);
9009
9027
  }
9010
9028
 
9011
- logger$5.info('Upgrade to video', {
9029
+ logger$7.info('Upgrade to video', {
9012
9030
  id: callSession ? callSession.getId() : null,
9013
9031
  constraints,
9014
9032
  isConference,
@@ -9048,7 +9066,7 @@ class WebRTCPhone extends Emitter {
9048
9066
 
9049
9067
  _sendReinviteMessage(callSession , isUpgrade ) {
9050
9068
  const sipSession = this.findSipSession(callSession);
9051
- logger$5.info('Sending reinvite message', {
9069
+ logger$7.info('Sending reinvite message', {
9052
9070
  id: callSession ? callSession.getId() : null,
9053
9071
  isUpgrade,
9054
9072
  });
@@ -9074,7 +9092,7 @@ class WebRTCPhone extends Emitter {
9074
9092
  // Monkey patch to know when canceled with the CANCEL message
9075
9093
  const onCancel = sipSession._onCancel.bind(sipSession);
9076
9094
  sipSession._onCancel = (message ) => {
9077
- logger$5.trace('on sip session canceled', { callId: message.callId });
9095
+ logger$7.trace('on sip session canceled', { callId: message.callId });
9078
9096
 
9079
9097
  onCancel(message);
9080
9098
  const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
@@ -9102,13 +9120,13 @@ class WebRTCPhone extends Emitter {
9102
9120
  this.audioOutputVolume,
9103
9121
  );
9104
9122
  case sessionState.SessionState.Terminating:
9105
- logger$5.info('WebRTC phone - call terminating', { sipId: sipSession.id });
9123
+ logger$7.info('WebRTC phone - call terminating', { sipId: sipSession.id });
9106
9124
 
9107
9125
  this.eventEmitter.emit(ON_CALL_ENDING, this._createCallSession(sipSession));
9108
9126
 
9109
9127
  break;
9110
9128
  case sessionState.SessionState.Terminated: {
9111
- logger$5.info('WebRTC phone - call terminated', { sipId: sipSession.id });
9129
+ logger$7.info('WebRTC phone - call terminated', { sipId: sipSession.id });
9112
9130
 
9113
9131
  // Should be called before `_onCallTerminated` or the callCount will not decrement...
9114
9132
  const callSession = this._createCallSession(sipSession);
@@ -9130,7 +9148,7 @@ class WebRTCPhone extends Emitter {
9130
9148
  const [stream] = event.streams;
9131
9149
  const kind = event && event.track && event.track.kind;
9132
9150
 
9133
- logger$5.info('on track stream called on the peer connection', {
9151
+ logger$7.info('on track stream called on the peer connection', {
9134
9152
  callId: this.getSipSessionId(sipSession),
9135
9153
  streamId: stream ? stream.id : null,
9136
9154
  tracks: stream ? stream.getTracks() : null,
@@ -9150,7 +9168,7 @@ class WebRTCPhone extends Emitter {
9150
9168
  };
9151
9169
 
9152
9170
  peerConnection.onremovestream = event => {
9153
- logger$5.info('on remove stream called on the peer connection', {
9171
+ logger$7.info('on remove stream called on the peer connection', {
9154
9172
  id: event.stream.id,
9155
9173
  tracks: event.stream.getTracks(),
9156
9174
  });
@@ -9160,7 +9178,7 @@ class WebRTCPhone extends Emitter {
9160
9178
  }
9161
9179
 
9162
9180
  async startScreenSharing(constraints , callSession ) {
9163
- logger$5.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
9181
+ logger$7.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
9164
9182
 
9165
9183
  const screenShareStream = await this.client.getStreamFromConstraints(constraints);
9166
9184
  if (!screenShareStream) {
@@ -9200,7 +9218,7 @@ class WebRTCPhone extends Emitter {
9200
9218
  return;
9201
9219
  }
9202
9220
 
9203
- logger$5.info('WebRTC phone - stop screen sharing', {
9221
+ logger$7.info('WebRTC phone - stop screen sharing', {
9204
9222
  restoreLocalStream,
9205
9223
  });
9206
9224
 
@@ -9256,7 +9274,7 @@ class WebRTCPhone extends Emitter {
9256
9274
  const pc = this.client.getPeerConnection(sipSessionId);
9257
9275
  const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
9258
9276
 
9259
- logger$5.info('WebRTC phone - on screensharing', {
9277
+ logger$7.info('WebRTC phone - on screensharing', {
9260
9278
  hadVideo,
9261
9279
  id: this.getSipSessionId(sipSession),
9262
9280
  screenTrack,
@@ -9264,7 +9282,7 @@ class WebRTCPhone extends Emitter {
9264
9282
 
9265
9283
  if (screenTrack) {
9266
9284
  screenTrack.onended = () => {
9267
- logger$5.info('WebRTC phone - on screenshare ended', {
9285
+ logger$7.info('WebRTC phone - on screenshare ended', {
9268
9286
  hadVideo,
9269
9287
  id: this.getSipSessionId(sipSession),
9270
9288
  screenTrack,
@@ -9295,7 +9313,7 @@ class WebRTCPhone extends Emitter {
9295
9313
  }
9296
9314
 
9297
9315
  _onCallAccepted(sipSession , cameraEnabled ) {
9298
- logger$5.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
9316
+ logger$7.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
9299
9317
 
9300
9318
  const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
9301
9319
  this.currentSipSession = sipSession;
@@ -9313,7 +9331,7 @@ class WebRTCPhone extends Emitter {
9313
9331
  }
9314
9332
 
9315
9333
  changeAudioDevice(id ) {
9316
- logger$5.info('WebRTC phone - change audio device', { deviceId: id });
9334
+ logger$7.info('WebRTC phone - change audio device', { deviceId: id });
9317
9335
  this.audioOutputDeviceId = id;
9318
9336
  this.client.changeAudioOutputDevice(id);
9319
9337
  }
@@ -9323,14 +9341,14 @@ class WebRTCPhone extends Emitter {
9323
9341
  }
9324
9342
 
9325
9343
  changeRingDevice(id ) {
9326
- logger$5.info('WebRTC phone - changing ring device', { id });
9344
+ logger$7.info('WebRTC phone - changing ring device', { id });
9327
9345
 
9328
9346
  this.audioRingDeviceId = id;
9329
9347
  }
9330
9348
 
9331
9349
  // volume is a value between 0 and 1
9332
9350
  changeAudioVolume(volume ) {
9333
- logger$5.info('WebRTC phone - changing audio volume', { volume });
9351
+ logger$7.info('WebRTC phone - changing audio volume', { volume });
9334
9352
 
9335
9353
  this.audioOutputVolume = volume;
9336
9354
  this.client.changeAudioOutputVolume(volume);
@@ -9338,31 +9356,31 @@ class WebRTCPhone extends Emitter {
9338
9356
 
9339
9357
  // volume is a value between 0 and 1
9340
9358
  changeRingVolume(volume ) {
9341
- logger$5.info('WebRTC phone - changing ring volume', { volume });
9359
+ logger$7.info('WebRTC phone - changing ring volume', { volume });
9342
9360
 
9343
9361
  this.audioRingVolume = volume;
9344
9362
  }
9345
9363
 
9346
9364
  changeAudioInputDevice(id ) {
9347
- logger$5.info('WebRTC phone - changeAudio input device', { deviceId: id });
9365
+ logger$7.info('WebRTC phone - changeAudio input device', { deviceId: id });
9348
9366
 
9349
9367
  return this.client.changeAudioInputDevice(id, this.currentSipSession);
9350
9368
  }
9351
9369
 
9352
9370
  changeVideoInputDevice(id ) {
9353
- logger$5.info('WebRTC phone - change video input device', { deviceId: id });
9371
+ logger$7.info('WebRTC phone - change video input device', { deviceId: id });
9354
9372
 
9355
9373
  return this.client.changeVideoInputDevice(id, this.currentSipSession);
9356
9374
  }
9357
9375
 
9358
9376
  changeSessionVideoInputDevice(id ) {
9359
- logger$5.info('WebRTC phone - change session video input device', { deviceId: id });
9377
+ logger$7.info('WebRTC phone - change session video input device', { deviceId: id });
9360
9378
 
9361
9379
  return this.client.changeSessionVideoInputDevice(id, this.currentSipSession);
9362
9380
  }
9363
9381
 
9364
9382
  _onCallTerminated(sipSession ) {
9365
- logger$5.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9383
+ logger$7.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9366
9384
 
9367
9385
  const callSession = this._createCallSession(sipSession);
9368
9386
  const isCurrentSession = this.isCurrentCallSipSession(callSession);
@@ -9396,7 +9414,7 @@ class WebRTCPhone extends Emitter {
9396
9414
  const hasIncomingCallSession = this.hasIncomingCallSession();
9397
9415
 
9398
9416
  // Re-trigger incoming call event for remaining incoming calls
9399
- logger$5.info('WebRTC phone - check to re-trigger incoming call', {
9417
+ logger$7.info('WebRTC phone - check to re-trigger incoming call', {
9400
9418
  sipId: sipSession.id,
9401
9419
  shouldRetrigger,
9402
9420
  hasIncomingCallSession,
@@ -9487,37 +9505,37 @@ class WebRTCPhone extends Emitter {
9487
9505
 
9488
9506
  // Deprecated
9489
9507
  getLocalStreamForCall(callSession ) {
9490
- logger$5.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
9508
+ logger$7.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
9491
9509
 
9492
9510
  return this.getLocalStream(callSession);
9493
9511
  }
9494
9512
 
9495
9513
  // Deprecated
9496
9514
  getRemoteStreamForCall(callSession ) {
9497
- logger$5.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
9515
+ logger$7.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
9498
9516
 
9499
9517
  return this.getRemoteVideoStream(callSession);
9500
9518
  }
9501
9519
 
9502
9520
  getRemoteStreamsForCall(callSession ) {
9503
- logger$5.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
9521
+ logger$7.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
9504
9522
 
9505
9523
  return this.getRemoteStream(callSession);
9506
9524
  }
9507
9525
 
9508
9526
  accept(callSession , cameraEnabled ) {
9509
- logger$5.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
9527
+ logger$7.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
9510
9528
  if (this.currentSipSession) {
9511
9529
  this.holdSipSession(this.currentSipSession, this.currentCallSession, true);
9512
9530
  }
9513
9531
 
9514
9532
  if (!callSession) {
9515
- logger$5.warn('no CallSession to accept.');
9533
+ logger$7.warn('no CallSession to accept.');
9516
9534
  return Promise.resolve(null);
9517
9535
  }
9518
9536
 
9519
9537
  if (callSession.getId() in this.acceptedSessions) {
9520
- logger$5.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
9538
+ logger$7.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
9521
9539
  return Promise.resolve(callSession.sipCallId);
9522
9540
  }
9523
9541
 
@@ -9529,24 +9547,24 @@ class WebRTCPhone extends Emitter {
9529
9547
  const sipSession = this.client.getSipSession(callSession.getId());
9530
9548
  if (sipSession) {
9531
9549
  if (sipSession.state === sessionState.SessionState.Terminated || sipSession.state === sessionState.SessionState.Terminating) {
9532
- logger$5.warn('Trying to answer a terminated sipSession.');
9550
+ logger$7.warn('Trying to answer a terminated sipSession.');
9533
9551
 
9534
9552
  return Promise.resolve(null);
9535
9553
  }
9536
9554
 
9537
- logger$5.info('accept call, session found', { sipId: sipSession.id });
9555
+ logger$7.info('accept call, session found', { sipId: sipSession.id });
9538
9556
 
9539
9557
  // $FlowFixMe
9540
9558
  return this.client.answer(sipSession, this.allowVideo ? cameraEnabled : false).then(() => {
9541
9559
  return callSession.sipCallId;
9542
9560
  }).catch(e => {
9543
- logger$5.error(e);
9561
+ logger$7.error(e);
9544
9562
  this.endCurrentCall(callSession);
9545
9563
  throw e;
9546
9564
  });
9547
9565
  }
9548
9566
 
9549
- logger$5.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
9567
+ logger$7.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
9550
9568
 
9551
9569
  return Promise.resolve(null);
9552
9570
  }
@@ -9556,7 +9574,7 @@ class WebRTCPhone extends Emitter {
9556
9574
  }
9557
9575
 
9558
9576
  async reject(callSession ) {
9559
- logger$5.info('reject WebRTC called', { id: callSession.getId() });
9577
+ logger$7.info('reject WebRTC called', { id: callSession.getId() });
9560
9578
 
9561
9579
  this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'call rejected locally');
9562
9580
  if (!callSession || callSession.getId() in this.rejectedSessions) {
@@ -9568,14 +9586,14 @@ class WebRTCPhone extends Emitter {
9568
9586
 
9569
9587
  const sipSession = this.findSipSession(callSession);
9570
9588
  if (sipSession) {
9571
- logger$5.info('WebRTC rejecting', { sipId: sipSession.id });
9589
+ logger$7.info('WebRTC rejecting', { sipId: sipSession.id });
9572
9590
 
9573
9591
  this.client.hangup(sipSession);
9574
9592
  }
9575
9593
  }
9576
9594
 
9577
9595
  async ignore(callSession ) {
9578
- logger$5.info('WebRTC ignore', { id: callSession.getId() });
9596
+ logger$7.info('WebRTC ignore', { id: callSession.getId() });
9579
9597
 
9580
9598
  // kill the ring
9581
9599
  this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'ignoring call');
@@ -9587,14 +9605,14 @@ class WebRTCPhone extends Emitter {
9587
9605
  const sipSession = this.findSipSession(callSession);
9588
9606
 
9589
9607
  if (sipSession) {
9590
- logger$5.info('WebRTC atxfer', { sipId: sipSession.id });
9608
+ logger$7.info('WebRTC atxfer', { sipId: sipSession.id });
9591
9609
 
9592
9610
  return this.client.atxfer(sipSession);
9593
9611
  }
9594
9612
  }
9595
9613
 
9596
9614
  hold(callSession , withEvent = true, isConference = false) {
9597
- logger$5.info('WebRTC hold', { id: callSession.getId() });
9615
+ logger$7.info('WebRTC hold', { id: callSession.getId() });
9598
9616
 
9599
9617
  const sipSession = this.findSipSession(callSession);
9600
9618
 
@@ -9609,18 +9627,18 @@ class WebRTCPhone extends Emitter {
9609
9627
  }
9610
9628
 
9611
9629
  resume(callSession , isConference = false, withEvent = true) {
9612
- logger$5.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
9630
+ logger$7.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
9613
9631
 
9614
9632
  const sipSession = this.findSipSession(callSession);
9615
9633
  if (!sipSession) {
9616
9634
  return new Promise((resolve, reject) => reject(new Error('No session to resume')));
9617
9635
  }
9618
9636
 
9619
- logger$5.info('WebRTC resuming', { sipId: sipSession.id });
9637
+ logger$7.info('WebRTC resuming', { sipId: sipSession.id });
9620
9638
 
9621
9639
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
9622
9640
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
9623
- logger$5.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9641
+ logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9624
9642
  this.holdSipSession(this.currentSipSession, callSession);
9625
9643
  }
9626
9644
 
@@ -9645,7 +9663,7 @@ class WebRTCPhone extends Emitter {
9645
9663
  const sessionId = this.getSipSessionId(sipSession);
9646
9664
  const hasVideo = this.client.hasLocalVideo(sessionId);
9647
9665
 
9648
- logger$5.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
9666
+ logger$7.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
9649
9667
 
9650
9668
  // Stop screenshre if needed
9651
9669
  if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
@@ -9676,7 +9694,7 @@ class WebRTCPhone extends Emitter {
9676
9694
  return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
9677
9695
  }
9678
9696
  const sessionId = this.getSipSessionId(sipSession);
9679
- logger$5.info('WebRTC unhold sip session', { sessionId, isConference });
9697
+ logger$7.info('WebRTC unhold sip session', { sessionId, isConference });
9680
9698
 
9681
9699
  const { hasVideo } = this.client.getHeldSession(sessionId) || {};
9682
9700
  const wasScreensharing = this.lastScreenShare && this.lastScreenShare.sipSessionId === sessionId;
@@ -9720,14 +9738,14 @@ class WebRTCPhone extends Emitter {
9720
9738
  }
9721
9739
 
9722
9740
  mute(callSession , withEvent = true) {
9723
- logger$5.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
9741
+ logger$7.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
9724
9742
 
9725
9743
  const sipSession = this.findSipSession(callSession);
9726
9744
  if (!sipSession) {
9727
9745
  return;
9728
9746
  }
9729
9747
 
9730
- logger$5.info('WebRTC muting', { sipId: sipSession.id });
9748
+ logger$7.info('WebRTC muting', { sipId: sipSession.id });
9731
9749
  this.client.mute(sipSession);
9732
9750
  const newCallSession = this._createCallSession(sipSession, callSession, { muted: true });
9733
9751
 
@@ -9741,14 +9759,14 @@ class WebRTCPhone extends Emitter {
9741
9759
  }
9742
9760
 
9743
9761
  unmute(callSession , withEvent = true) {
9744
- logger$5.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
9762
+ logger$7.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
9745
9763
 
9746
9764
  const sipSession = this.findSipSession(callSession);
9747
9765
  if (!sipSession) {
9748
9766
  return;
9749
9767
  }
9750
9768
 
9751
- logger$5.info('WebRTC unmuting', { sipId: sipSession.id });
9769
+ logger$7.info('WebRTC unmuting', { sipId: sipSession.id });
9752
9770
  this.client.unmute(sipSession);
9753
9771
  const newCallSession = this._createCallSession(sipSession, callSession, { muted: false });
9754
9772
 
@@ -9775,7 +9793,7 @@ class WebRTCPhone extends Emitter {
9775
9793
  if (!sipSession) {
9776
9794
  return;
9777
9795
  }
9778
- logger$5.info('WebRTC turn camera on', { sipId: sipSession.id });
9796
+ logger$7.info('WebRTC turn camera on', { sipId: sipSession.id });
9779
9797
 
9780
9798
  this.client.toggleCameraOn(sipSession);
9781
9799
 
@@ -9787,7 +9805,7 @@ class WebRTCPhone extends Emitter {
9787
9805
  if (!sipSession) {
9788
9806
  return;
9789
9807
  }
9790
- logger$5.info('WebRTC turn camera off', { sipId: sipSession.id });
9808
+ logger$7.info('WebRTC turn camera off', { sipId: sipSession.id });
9791
9809
 
9792
9810
  this.client.toggleCameraOff(sipSession);
9793
9811
  this.eventEmitter.emit(ON_CAMERA_DISABLED, this._createCameraDisabledCallSession(sipSession, callSession));
@@ -9799,7 +9817,7 @@ class WebRTCPhone extends Emitter {
9799
9817
  return;
9800
9818
  }
9801
9819
 
9802
- logger$5.info('WebRTC send key', { sipId: sipSession.id, tone });
9820
+ logger$7.info('WebRTC send key', { sipId: sipSession.id, tone });
9803
9821
  this.client.sendDTMF(sipSession, tone);
9804
9822
  }
9805
9823
 
@@ -9807,7 +9825,7 @@ class WebRTCPhone extends Emitter {
9807
9825
  // @TODO: line is not used here
9808
9826
  async makeCall(number , line , cameraEnabled ,
9809
9827
  audioOnly = false, conference = false) {
9810
- logger$5.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled });
9828
+ logger$7.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled, audioOnly, conference });
9811
9829
  if (!number) {
9812
9830
  return Promise.resolve(null);
9813
9831
  }
@@ -9817,7 +9835,7 @@ class WebRTCPhone extends Emitter {
9817
9835
  }
9818
9836
  if (this.currentSipSession) {
9819
9837
  this.holdSipSession(this.currentSipSession, this.currentCallSession, true).catch(e => {
9820
- logger$5.warn('Unable to hold current session when making another call', e);
9838
+ logger$7.warn('Unable to hold current session when making another call', e);
9821
9839
  });
9822
9840
  }
9823
9841
 
@@ -9827,7 +9845,7 @@ class WebRTCPhone extends Emitter {
9827
9845
  this._bindEvents(sipSession);
9828
9846
  } catch (error) {
9829
9847
  console.warn(error);
9830
- logger$5.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
9848
+ logger$7.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
9831
9849
  return Promise.resolve(null);
9832
9850
  }
9833
9851
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
@@ -9855,7 +9873,7 @@ class WebRTCPhone extends Emitter {
9855
9873
  return;
9856
9874
  }
9857
9875
 
9858
- logger$5.info('WebRTC transfer', { sipId: sipSession.id, target });
9876
+ logger$7.info('WebRTC transfer', { sipId: sipSession.id, target });
9859
9877
 
9860
9878
  this.client.transfer(sipSession, target);
9861
9879
  }
@@ -9864,7 +9882,7 @@ class WebRTCPhone extends Emitter {
9864
9882
  const sipSession = this.client.getSipSession(source.sipCallId);
9865
9883
  const sipSessionTarget = this.client.getSipSession(destination.sipCallId);
9866
9884
 
9867
- logger$5.info('WebRTC indirect transfer', {
9885
+ logger$7.info('WebRTC indirect transfer', {
9868
9886
  sipId: sipSession ? sipSession.id : null,
9869
9887
  target: sipSessionTarget ? sipSessionTarget.id : null,
9870
9888
  });
@@ -9903,7 +9921,7 @@ class WebRTCPhone extends Emitter {
9903
9921
  return false;
9904
9922
  }
9905
9923
 
9906
- logger$5.info('WebRTC hangup', { sipId: sipSession.id });
9924
+ logger$7.info('WebRTC hangup', { sipId: sipSession.id });
9907
9925
 
9908
9926
  const sipSessionId = this.getSipSessionId(sipSession);
9909
9927
 
@@ -9949,7 +9967,7 @@ class WebRTCPhone extends Emitter {
9949
9967
  endCurrentCall(callSession ) {
9950
9968
  const isCurrent = this.isCurrentCallSipSession(callSession);
9951
9969
 
9952
- logger$5.info('Ending current call', {
9970
+ logger$7.info('Ending current call', {
9953
9971
  id: callSession ? callSession.getId() : null,
9954
9972
  isCurrent,
9955
9973
  });
@@ -9973,7 +9991,7 @@ class WebRTCPhone extends Emitter {
9973
9991
  }
9974
9992
 
9975
9993
  async close() {
9976
- logger$5.info('WebRTC close');
9994
+ logger$7.info('WebRTC close');
9977
9995
 
9978
9996
  try {
9979
9997
  await Promise.race([
@@ -9981,7 +9999,7 @@ class WebRTCPhone extends Emitter {
9981
9999
  new Promise((resolve, reject) => setTimeout(() => reject(new Error('Unregister, timed out')), 3000)),
9982
10000
  ]);
9983
10001
  } catch (e) {
9984
- logger$5.error('WebRTC close, unregister error', e);
10002
+ logger$7.error('WebRTC close, unregister error', e);
9985
10003
  }
9986
10004
 
9987
10005
  this.client.close();
@@ -9999,12 +10017,12 @@ class WebRTCPhone extends Emitter {
9999
10017
  }
10000
10018
 
10001
10019
  enableRinging() {
10002
- logger$5.info('WebRTC enable ringing');
10020
+ logger$7.info('WebRTC enable ringing');
10003
10021
  this.ringingEnabled = true;
10004
10022
  }
10005
10023
 
10006
10024
  disableRinging() {
10007
- logger$5.info('WebRTC disable ringing');
10025
+ logger$7.info('WebRTC disable ringing');
10008
10026
  this.ringingEnabled = false;
10009
10027
  }
10010
10028
 
@@ -10044,7 +10062,7 @@ class WebRTCPhone extends Emitter {
10044
10062
 
10045
10063
  // Deprecated
10046
10064
  getLocalMediaStream(callSession ) {
10047
- logger$5.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
10065
+ logger$7.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
10048
10066
  return this.getLocalStream(callSession);
10049
10067
  }
10050
10068
 
@@ -10086,7 +10104,7 @@ class WebRTCPhone extends Emitter {
10086
10104
  this.client.on(this.client.INVITE, (sipSession , wantsToDoVideo ) => {
10087
10105
  const autoAnswer = sipSession.request.getHeader('Answer-Mode') === 'Auto';
10088
10106
  const withVideo = this.allowVideo ? wantsToDoVideo : false;
10089
- logger$5.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
10107
+ logger$7.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
10090
10108
 
10091
10109
  const callSession = this._createIncomingCallSession(sipSession, withVideo, null, autoAnswer);
10092
10110
  this.incomingSessions.push(callSession.getId());
@@ -10109,7 +10127,7 @@ class WebRTCPhone extends Emitter {
10109
10127
  });
10110
10128
 
10111
10129
  this.client.on(this.client.ON_REINVITE, (...args) => {
10112
- logger$5.info('WebRTC on reinvite', {
10130
+ logger$7.info('WebRTC on reinvite', {
10113
10131
  sessionId: args[0].id,
10114
10132
  inviteId: args[1].id,
10115
10133
  updatedCalleeName: args[2],
@@ -10129,7 +10147,7 @@ class WebRTCPhone extends Emitter {
10129
10147
  });
10130
10148
 
10131
10149
  this.client.on(this.client.ACCEPTED, (sipSession ) => {
10132
- logger$5.info('WebRTC call accepted', { sipId: sipSession.id });
10150
+ logger$7.info('WebRTC call accepted', { sipId: sipSession.id });
10133
10151
 
10134
10152
  this._onCallAccepted(sipSession, this.client.hasVideo(this.getSipSessionId(sipSession)));
10135
10153
 
@@ -10140,22 +10158,22 @@ class WebRTCPhone extends Emitter {
10140
10158
  this.client.on('ended', () => {});
10141
10159
 
10142
10160
  this.client.on(this.client.ON_ERROR, e => {
10143
- logger$5.error('WebRTC error', e);
10161
+ logger$7.error('WebRTC error', e);
10144
10162
  this.eventEmitter.emit(ON_CALL_ERROR, e);
10145
10163
  });
10146
10164
 
10147
10165
  this.client.on(this.client.UNREGISTERED, () => {
10148
- logger$5.info('WebRTC unregistered');
10166
+ logger$7.info('WebRTC unregistered');
10149
10167
  this.eventEmitter.emit(ON_UNREGISTERED);
10150
10168
  });
10151
10169
 
10152
10170
  this.client.on(this.client.ON_DISCONNECTED, () => {
10153
- logger$5.info('WebRTC disconnected');
10154
- this.eventEmitter.emit(ON_DISCONNECTED$1);
10171
+ logger$7.info('WebRTC disconnected');
10172
+ this.eventEmitter.emit(ON_DISCONNECTED);
10155
10173
  });
10156
10174
 
10157
10175
  this.client.on(this.client.REGISTERED, () => {
10158
- logger$5.info('WebRTC registered', {
10176
+ logger$7.info('WebRTC registered', {
10159
10177
  shouldSendReinvite: this.shouldSendReinvite,
10160
10178
  state: this.currentSipSession ? this.currentSipSession.state : null,
10161
10179
  currentSipSession: !!this.currentSipSession,
@@ -10176,19 +10194,19 @@ class WebRTCPhone extends Emitter {
10176
10194
  // Send reinvite with iceRestart
10177
10195
  this.sendReinvite(this.currentCallSession, null, isConference, !hasVideo, true);
10178
10196
  } catch (e) {
10179
- logger$5.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
10197
+ logger$7.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
10180
10198
  }
10181
10199
  }
10182
10200
  });
10183
10201
 
10184
10202
  this.client.on(this.client.CONNECTED, () => {
10185
- logger$5.info('WebRTC client connected');
10203
+ logger$7.info('WebRTC client connected');
10186
10204
 
10187
10205
  this.stopHeartbeat();
10188
10206
  });
10189
10207
 
10190
10208
  this.client.on(this.client.DISCONNECTED, () => {
10191
- logger$5.info('WebRTC client disconnected');
10209
+ logger$7.info('WebRTC client disconnected');
10192
10210
 
10193
10211
  this.eventEmitter.emit(ON_UNREGISTERED);
10194
10212
 
@@ -10202,7 +10220,7 @@ class WebRTCPhone extends Emitter {
10202
10220
  });
10203
10221
 
10204
10222
  this.client.on(this.client.ON_TRACK, (session, event) => {
10205
- this.eventEmitter.emit(ON_TRACK$1, session, event);
10223
+ this.eventEmitter.emit(ON_TRACK, session, event);
10206
10224
  });
10207
10225
 
10208
10226
  this.client.on('onVideoInputChange', stream => {
@@ -10217,7 +10235,7 @@ class WebRTCPhone extends Emitter {
10217
10235
  this.client.on(this.client.ON_NETWORK_STATS, (session, stats, previousStats) => {
10218
10236
  const callSession = this.getCallSession(this.getSipSessionId(session));
10219
10237
 
10220
- this.eventEmitter.emit(ON_NETWORK_STATS$1, callSession, stats, previousStats);
10238
+ this.eventEmitter.emit(ON_NETWORK_STATS, callSession, stats, previousStats);
10221
10239
  });
10222
10240
 
10223
10241
  // Used when upgrading directly in screenshare mode
@@ -10226,7 +10244,7 @@ class WebRTCPhone extends Emitter {
10226
10244
  const localStream = this.client.getLocalStream(sipSessionId);
10227
10245
  const callSession = this.callSessions[sipSessionId];
10228
10246
 
10229
- logger$5.info('Updrading directly in screensharing mode', {
10247
+ logger$7.info('Updrading directly in screensharing mode', {
10230
10248
  sipSessionId,
10231
10249
  tracks: localStream ? localStream.getTracks() : null,
10232
10250
  });
@@ -10404,8 +10422,8 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
10404
10422
  ON_CALL_ENDED: ON_CALL_ENDED,
10405
10423
  ON_CALL_ENDING: ON_CALL_ENDING,
10406
10424
  ON_MESSAGE: ON_MESSAGE,
10407
- ON_REINVITE: ON_REINVITE$1,
10408
- ON_TRACK: ON_TRACK$1,
10425
+ ON_REINVITE: ON_REINVITE,
10426
+ ON_TRACK: ON_TRACK,
10409
10427
  ON_AUDIO_STREAM: ON_AUDIO_STREAM,
10410
10428
  ON_VIDEO_STREAM: ON_VIDEO_STREAM,
10411
10429
  ON_REMOVE_STREAM: ON_REMOVE_STREAM,
@@ -10420,13 +10438,13 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
10420
10438
  ON_VIDEO_INPUT_CHANGE: ON_VIDEO_INPUT_CHANGE,
10421
10439
  ON_CALL_ERROR: ON_CALL_ERROR,
10422
10440
  ON_MESSAGE_TRACK_UPDATED: ON_MESSAGE_TRACK_UPDATED,
10423
- ON_NETWORK_STATS: ON_NETWORK_STATS$1,
10441
+ ON_NETWORK_STATS: ON_NETWORK_STATS,
10424
10442
  ON_CHAT: ON_CHAT,
10425
10443
  ON_SIGNAL: ON_SIGNAL,
10426
- ON_DISCONNECTED: ON_DISCONNECTED$1,
10444
+ ON_DISCONNECTED: ON_DISCONNECTED,
10427
10445
  MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
10428
10446
  MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
10429
- events: events$1,
10447
+ events: events,
10430
10448
  'default': WebRTCPhone
10431
10449
  });
10432
10450
 
@@ -10820,7 +10838,7 @@ class Phone extends Emitter {
10820
10838
 
10821
10839
  _transferEvents() {
10822
10840
  this.unbind();
10823
- [...events, ...transportEvents].forEach(event => {
10841
+ [...events$1, ...transportEvents].forEach(event => {
10824
10842
  this.client.on(event, (...args) =>
10825
10843
  this.eventEmitter.emit.apply(this.eventEmitter.emit, [`client-${event}`, ...args]));
10826
10844
  });
@@ -10842,7 +10860,7 @@ var Phone$1 = global.wazoTelephonyInstance;
10842
10860
 
10843
10861
  //
10844
10862
 
10845
- const SOCKET_EVENTS = {
10863
+ const SOCKET_EVENTS$1 = {
10846
10864
  ON_OPEN: 'onopen',
10847
10865
  ON_MESSAGE: 'onmessage',
10848
10866
  ON_ERROR: 'onerror',
@@ -10938,7 +10956,7 @@ const BLACKLIST_EVENTS = [
10938
10956
  ];
10939
10957
 
10940
10958
  const HEARTBEAT_ENGINE_VERSION = '20.09';
10941
- const logger$7 = IssueReporter$1.loggerFor('wazo-ws');
10959
+ const logger$5 = IssueReporter$1.loggerFor('wazo-ws');
10942
10960
  const messageLogger = IssueReporter$1.loggerFor('wazo-ws-message');
10943
10961
 
10944
10962
  class WebSocketClient extends Emitter {
@@ -10987,24 +11005,24 @@ class WebSocketClient extends Emitter {
10987
11005
  }
10988
11006
 
10989
11007
  connect() {
10990
- logger$7.info('connect method started', { host: this.host, token: this.token });
11008
+ logger$5.info('connect method started', { host: this.host, token: this.token });
10991
11009
  this.socket = new ReconnectingWebSocket__default['default'](this._getUrl.bind(this), [], this.options);
10992
11010
  if (this.options.binaryType) {
10993
11011
  this.socket.binaryType = this.options.binaryType;
10994
11012
  }
10995
11013
 
10996
11014
  this.socket.onopen = () => {
10997
- logger$7.info('on Wazo WS open', { method: 'connect', host: this.host });
10998
- this.eventEmitter.emit(SOCKET_EVENTS.ON_OPEN);
11015
+ logger$5.info('on Wazo WS open', { method: 'connect', host: this.host });
11016
+ this.eventEmitter.emit(SOCKET_EVENTS$1.ON_OPEN);
10999
11017
  };
11000
11018
 
11001
11019
  this.socket.onerror = event => {
11002
- logger$7.error('on Wazo WS error', event.target);
11003
- this.eventEmitter.emit(SOCKET_EVENTS.ON_ERROR, event);
11020
+ logger$5.error('on Wazo WS error', event.target);
11021
+ this.eventEmitter.emit(SOCKET_EVENTS$1.ON_ERROR, event);
11004
11022
  };
11005
11023
 
11006
11024
  this.socket.onmessage = (event ) => {
11007
- this.eventEmitter.emit(SOCKET_EVENTS.ON_MESSAGE, event.data);
11025
+ this.eventEmitter.emit(SOCKET_EVENTS$1.ON_MESSAGE, event.data);
11008
11026
 
11009
11027
  const message = JSON.parse(typeof event.data === 'string' ? event.data : '{}');
11010
11028
  let { name } = message;
@@ -11029,7 +11047,7 @@ class WebSocketClient extends Emitter {
11029
11047
 
11030
11048
  this.socket.onclose = event => {
11031
11049
  // Can't be converted to JSON (circular structure)
11032
- logger$7.info('on Wazo WS close', {
11050
+ logger$5.info('on Wazo WS close', {
11033
11051
  reason: event.reason,
11034
11052
  code: event.code,
11035
11053
  readyState: event.target.readyState,
@@ -11037,22 +11055,22 @@ class WebSocketClient extends Emitter {
11037
11055
  token: this.token,
11038
11056
  });
11039
11057
  this.initialized = false;
11040
- this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, event);
11058
+ this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, event);
11041
11059
 
11042
11060
  switch (event.code) {
11043
11061
  case 4002:
11044
- this.eventEmitter.emit(SOCKET_EVENTS.ON_AUTH_FAILED);
11062
+ this.eventEmitter.emit(SOCKET_EVENTS$1.ON_AUTH_FAILED);
11045
11063
  break;
11046
11064
  }
11047
11065
  };
11048
11066
 
11049
11067
  this.socket.onerror = event => {
11050
- logger$7.info('Wazo WS error', { message: event.message, code: event.code, readyState: event.target.readyState });
11068
+ logger$5.info('Wazo WS error', { message: event.message, code: event.code, readyState: event.target.readyState });
11051
11069
  };
11052
11070
  }
11053
11071
 
11054
11072
  close(force = false) {
11055
- logger$7.info('Wazo WS close', { socket: !!this.socket, host: this.host, token: this.token });
11073
+ logger$5.info('Wazo WS close', { socket: !!this.socket, host: this.host, token: this.token });
11056
11074
 
11057
11075
  if (!this.socket) {
11058
11076
  return;
@@ -11070,7 +11088,7 @@ class WebSocketClient extends Emitter {
11070
11088
 
11071
11089
  updateToken(token ) {
11072
11090
  this.token = token;
11073
- logger$7.info('Wazo WS updating token', { url: this._getUrl(), token, socket: !!this.socket });
11091
+ logger$5.info('Wazo WS updating token', { url: this._getUrl(), token, socket: !!this.socket });
11074
11092
 
11075
11093
  if (this.socket) {
11076
11094
  // If still connected, send the token to the WS
@@ -11088,7 +11106,7 @@ class WebSocketClient extends Emitter {
11088
11106
  }
11089
11107
 
11090
11108
  startHeartbeat() {
11091
- logger$7.info('Wazo WS start heartbeat', { host: this.host, token: this.token });
11109
+ logger$5.info('Wazo WS start heartbeat', { host: this.host, token: this.token });
11092
11110
 
11093
11111
  if (!this.socket) {
11094
11112
  this.heartbeat.stop();
@@ -11102,7 +11120,7 @@ class WebSocketClient extends Emitter {
11102
11120
  }
11103
11121
 
11104
11122
  stopHeartbeat() {
11105
- logger$7.info('Wazo WS stop heartbeat', { host: this.host, token: this.token });
11123
+ logger$5.info('Wazo WS stop heartbeat', { host: this.host, token: this.token });
11106
11124
 
11107
11125
  this.heartbeat.stop();
11108
11126
  }
@@ -11132,7 +11150,7 @@ class WebSocketClient extends Emitter {
11132
11150
  }
11133
11151
 
11134
11152
  reconnect(reason ) {
11135
- logger$7.info('Wazo WS reconnect', { reason, socket: !!this.socket, host: this.host, token: this.token });
11153
+ logger$5.info('Wazo WS reconnect', { reason, socket: !!this.socket, host: this.host, token: this.token });
11136
11154
  if (!this.socket) {
11137
11155
  return;
11138
11156
  }
@@ -11157,7 +11175,7 @@ class WebSocketClient extends Emitter {
11157
11175
  break;
11158
11176
  case 'start':
11159
11177
  this.initialized = true;
11160
- this.eventEmitter.emit(SOCKET_EVENTS.INITIALIZED);
11178
+ this.eventEmitter.emit(SOCKET_EVENTS$1.INITIALIZED);
11161
11179
  break;
11162
11180
  default:
11163
11181
  this.eventEmitter.emit('message', message);
@@ -11188,7 +11206,7 @@ class WebSocketClient extends Emitter {
11188
11206
  this.close();
11189
11207
  }
11190
11208
  const url = `wss://${this.host || ''}/api/websocketd/?token=${this.token || ''}&version=${this.version}`;
11191
- logger$7.log('Wazo WS url computed to reconnect', { url });
11209
+ logger$5.log('Wazo WS url computed to reconnect', { url });
11192
11210
 
11193
11211
  return url;
11194
11212
  }
@@ -11196,15 +11214,15 @@ class WebSocketClient extends Emitter {
11196
11214
  _onHeartbeat(message ) {
11197
11215
  if (message.payload === 'pong') {
11198
11216
  this.heartbeat.onHeartbeat();
11199
- logger$7.log('on heartbeat received from Wazo WS');
11217
+ logger$5.log('on heartbeat received from Wazo WS');
11200
11218
  }
11201
11219
  }
11202
11220
 
11203
11221
  async _onHeartbeatTimeout() {
11204
- logger$7.log('heartbeat timed out', { host: this.host, token: this.token });
11222
+ logger$5.log('heartbeat timed out', { host: this.host, token: this.token });
11205
11223
 
11206
11224
  this.close();
11207
- this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, new Error('Websocket ping failure.'));
11225
+ this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, new Error('Websocket ping failure.'));
11208
11226
 
11209
11227
  if (this.onHeartBeatTimeout) {
11210
11228
  this.onHeartBeatTimeout();
@@ -11284,7 +11302,7 @@ WebSocketClient.eventLists = [
11284
11302
 
11285
11303
  var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
11286
11304
  __proto__: null,
11287
- SOCKET_EVENTS: SOCKET_EVENTS,
11305
+ SOCKET_EVENTS: SOCKET_EVENTS$1,
11288
11306
  AUTH_SESSION_EXPIRE_SOON: AUTH_SESSION_EXPIRE_SOON,
11289
11307
  FAVORITE_ADDED: FAVORITE_ADDED,
11290
11308
  FAVORITE_DELETED: FAVORITE_DELETED,
@@ -11357,10 +11375,10 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
11357
11375
 
11358
11376
  //
11359
11377
 
11360
- const { SOCKET_EVENTS: SOCKET_EVENTS$1, ...OTHER_EVENTS } = WebSocketClient$1;
11361
- const ALL_EVENTS = [...Object.values(SOCKET_EVENTS$1), ...Object.values(OTHER_EVENTS)];
11378
+ const { SOCKET_EVENTS, ...OTHER_EVENTS } = WebSocketClient$1;
11379
+ const ALL_EVENTS = [...Object.values(SOCKET_EVENTS), ...Object.values(OTHER_EVENTS)];
11362
11380
 
11363
- const logger$8 = IssueReporter$1.loggerFor('simple-ws-client');
11381
+ const logger$4 = IssueReporter$1.loggerFor('simple-ws-client');
11364
11382
 
11365
11383
  class Websocket extends Emitter {
11366
11384
 
@@ -11374,9 +11392,9 @@ class Websocket extends Emitter {
11374
11392
  // $FlowFixMe
11375
11393
  this[key] = OTHER_EVENTS[key];
11376
11394
  });
11377
- Object.keys(SOCKET_EVENTS$1).forEach(key => {
11395
+ Object.keys(SOCKET_EVENTS).forEach(key => {
11378
11396
  // $FlowFixMe
11379
- this[key] = SOCKET_EVENTS$1[key];
11397
+ this[key] = SOCKET_EVENTS[key];
11380
11398
  });
11381
11399
  this.eventLists = WebSocketClient.eventLists;
11382
11400
 
@@ -11384,7 +11402,7 @@ class Websocket extends Emitter {
11384
11402
  }
11385
11403
 
11386
11404
  open(host , session ) {
11387
- logger$8.info('open simple WebSocket', { host, token: session.token });
11405
+ logger$4.info('open simple WebSocket', { host, token: session.token });
11388
11406
  this.ws = new WebSocketClient(
11389
11407
  {
11390
11408
  host,
@@ -11412,7 +11430,7 @@ class Websocket extends Emitter {
11412
11430
  }
11413
11431
 
11414
11432
  updateToken(token ) {
11415
- logger$8.info('update token via simple Websocket', { token, ws: !!this.ws });
11433
+ logger$4.info('update token via simple Websocket', { token, ws: !!this.ws });
11416
11434
 
11417
11435
  if (!this.ws) {
11418
11436
  return;
@@ -11440,7 +11458,7 @@ var Websocket$1 = global.wazoWebsocketInstance;
11440
11458
 
11441
11459
  //
11442
11460
 
11443
- const logger$9 = IssueReporter$1.loggerFor('room');
11461
+ const logger$3 = IssueReporter$1.loggerFor('room');
11444
11462
 
11445
11463
  class Participant extends Emitter {
11446
11464
 
@@ -11562,7 +11580,7 @@ class Participant extends Emitter {
11562
11580
  }
11563
11581
 
11564
11582
  onTalking(isTalking ) {
11565
- logger$9.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
11583
+ logger$3.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
11566
11584
  this.isTalking = isTalking;
11567
11585
  // you may notice we're not broadcasting: since all participants are getting this info
11568
11586
  // directly from asterisk, there's no need to do so
@@ -11665,7 +11683,7 @@ class Participant extends Emitter {
11665
11683
  }
11666
11684
 
11667
11685
  updateStatus(status , broadcast = true) {
11668
- logger$9.info('updating participant status', { name: this.name, status });
11686
+ logger$3.info('updating participant status', { name: this.name, status });
11669
11687
 
11670
11688
  if (typeof status.audioMuted !== 'undefined' && status.audioMuted !== this.audioMuted) {
11671
11689
  if (status.audioMuted) {
@@ -11713,7 +11731,7 @@ class Participant extends Emitter {
11713
11731
 
11714
11732
  broadcastStatus(inboundStatus = null) {
11715
11733
  const status = inboundStatus || this.getStatus();
11716
- logger$9.info('broadcasting participant status', { callId: this.callId, status });
11734
+ logger$3.info('broadcasting participant status', { callId: this.callId, status });
11717
11735
 
11718
11736
  this.room.sendSignal({
11719
11737
  type: SIGNAL_TYPE_PARTICIPANT_UPDATE,
@@ -11749,9 +11767,9 @@ class LocalParticipant extends Participant {
11749
11767
  const SIGNAL_TYPE_PARTICIPANT_UPDATE = 'signal/PARTICIPANT_UPDATE';
11750
11768
  const SIGNAL_TYPE_PARTICIPANT_REQUEST = 'signal/PARTICIPANT_REQUEST';
11751
11769
 
11752
- const logger$a = IssueReporter$1.loggerFor('sdk-room');
11770
+ const logger$2 = IssueReporter$1.loggerFor('sdk-room');
11753
11771
 
11754
- class Room extends Emitter {
11772
+ class Room$1 extends Emitter {
11755
11773
 
11756
11774
 
11757
11775
 
@@ -11809,7 +11827,7 @@ class Room extends Emitter {
11809
11827
  extra = {},
11810
11828
  ) {
11811
11829
  super();
11812
- logger$a.info('room initialized', { callId, extension, sourceId, meetingUuid });
11830
+ logger$2.info('room initialized', { callId, extension, sourceId, meetingUuid });
11813
11831
 
11814
11832
  // Represents the room callSession
11815
11833
  this.callSession = callSession;
@@ -11875,7 +11893,7 @@ class Room extends Emitter {
11875
11893
  * @returns {Promise<Room>}
11876
11894
  */
11877
11895
  static async connect({ extension, constraints, audioOnly = false, extra, room, meeting } ) {
11878
- logger$a.info('connecting to room', { extension, audioOnly, room: !!room });
11896
+ logger$2.info('connecting to room', { extension, audioOnly, room: !!room });
11879
11897
 
11880
11898
  if (!room) {
11881
11899
  await Wazo.Phone.connect();
@@ -11888,7 +11906,7 @@ class Room extends Emitter {
11888
11906
 
11889
11907
  // Call_created is triggered before call_accepted, so we have to listen for it here.
11890
11908
  Wazo.Websocket.once(Wazo.Websocket.CALL_CREATED, ({ data }) => {
11891
- logger$a.info('room call received via WS', { callId: data.call_id });
11909
+ logger$2.info('room call received via WS', { callId: data.call_id });
11892
11910
  if (room) {
11893
11911
  room.setCallId(data.call_id);
11894
11912
  }
@@ -11896,7 +11914,7 @@ class Room extends Emitter {
11896
11914
 
11897
11915
  const callSession = await Wazo.Phone.call(extension, withCamera, null, audioOnly, true);
11898
11916
  // eslint-disable-next-line no-param-reassign
11899
- room = new Room(callSession, extension, null, null, extra);
11917
+ room = new Room$1(callSession, extension, null, null, extra);
11900
11918
 
11901
11919
  // Wait for the call to be accepted
11902
11920
  await new Promise((resolve, reject) => {
@@ -11917,7 +11935,7 @@ class Room extends Emitter {
11917
11935
  // Retrieve conference
11918
11936
  const conference = contacts.find(contact => contact.numbers.find(number => number.number === extension));
11919
11937
 
11920
- logger$a.info('connected to room', {
11938
+ logger$2.info('connected to room', {
11921
11939
  sourceId: conference ? conference.sourceId : null,
11922
11940
  name: conference ? conference.name : null,
11923
11941
  });
@@ -11927,7 +11945,7 @@ class Room extends Emitter {
11927
11945
  room.setName(conference.name);
11928
11946
  }
11929
11947
  } else if (meeting) {
11930
- logger$a.info('Already connected to meeting', {
11948
+ logger$2.info('Already connected to meeting', {
11931
11949
  uuid: meeting.uuid,
11932
11950
  name: meeting.name,
11933
11951
  });
@@ -11940,13 +11958,13 @@ class Room extends Emitter {
11940
11958
  }
11941
11959
 
11942
11960
  static disconnect() {
11943
- logger$a.info('static disconnection to room');
11961
+ logger$2.info('static disconnection to room');
11944
11962
 
11945
11963
  Wazo.Phone.disconnect();
11946
11964
  }
11947
11965
 
11948
11966
  async disconnect() {
11949
- logger$a.info('disconnection to room called');
11967
+ logger$2.info('disconnection to room called');
11950
11968
 
11951
11969
  await Wazo.Phone.hangup(this.callSession);
11952
11970
  this.callSession = null;
@@ -11966,19 +11984,19 @@ class Room extends Emitter {
11966
11984
  }
11967
11985
 
11968
11986
  setSourceId(sourceId ) {
11969
- logger$a.info('set room source id', { sourceId });
11987
+ logger$2.info('set room source id', { sourceId });
11970
11988
 
11971
11989
  this.sourceId = sourceId;
11972
11990
  }
11973
11991
 
11974
11992
  setMeetingUuid(meetingUuid ) {
11975
- logger$a.info('set meeting uuid', { meetingUuid });
11993
+ logger$2.info('set meeting uuid', { meetingUuid });
11976
11994
 
11977
11995
  this.meetingUuid = meetingUuid;
11978
11996
  }
11979
11997
 
11980
11998
  setCallId(callId ) {
11981
- logger$a.info('set room call id', { callId });
11999
+ logger$2.info('set room call id', { callId });
11982
12000
 
11983
12001
  if (callId) {
11984
12002
  this.callId = callId;
@@ -11986,7 +12004,7 @@ class Room extends Emitter {
11986
12004
  }
11987
12005
 
11988
12006
  setName(name ) {
11989
- logger$a.info('set room name', { name });
12007
+ logger$2.info('set room name', { name });
11990
12008
 
11991
12009
  this.name = name;
11992
12010
  }
@@ -12005,7 +12023,7 @@ class Room extends Emitter {
12005
12023
  }
12006
12024
 
12007
12025
  async startScreenSharing(constraints ) {
12008
- logger$a.info('start room screen sharing', { constraints });
12026
+ logger$2.info('start room screen sharing', { constraints });
12009
12027
 
12010
12028
  const screensharingStream = await Wazo.Phone.startScreenSharing(constraints, this.callSession);
12011
12029
  if (!screensharingStream) {
@@ -12019,7 +12037,7 @@ class Room extends Emitter {
12019
12037
  }
12020
12038
 
12021
12039
  async stopScreenSharing(restoreLocalStream = true) {
12022
- logger$a.info('stop room screen sharing');
12040
+ logger$2.info('stop room screen sharing');
12023
12041
 
12024
12042
  await Wazo.Phone.stopScreenSharing(this.callSession, restoreLocalStream);
12025
12043
 
@@ -12031,7 +12049,7 @@ class Room extends Emitter {
12031
12049
  }
12032
12050
 
12033
12051
  turnCameraOff() {
12034
- logger$a.info('turn room camera off');
12052
+ logger$2.info('turn room camera off');
12035
12053
 
12036
12054
  Wazo.Phone.turnCameraOff(this.callSession);
12037
12055
 
@@ -12041,7 +12059,7 @@ class Room extends Emitter {
12041
12059
  }
12042
12060
 
12043
12061
  turnCameraOn() {
12044
- logger$a.info('turn room camera on');
12062
+ logger$2.info('turn room camera on');
12045
12063
 
12046
12064
  Wazo.Phone.turnCameraOn(this.callSession);
12047
12065
 
@@ -12051,7 +12069,7 @@ class Room extends Emitter {
12051
12069
  }
12052
12070
 
12053
12071
  mute() {
12054
- logger$a.info('mute room');
12072
+ logger$2.info('mute room');
12055
12073
 
12056
12074
  Wazo.Phone.mute(this.callSession);
12057
12075
 
@@ -12059,7 +12077,7 @@ class Room extends Emitter {
12059
12077
  }
12060
12078
 
12061
12079
  unmute() {
12062
- logger$a.info('unmute room');
12080
+ logger$2.info('unmute room');
12063
12081
 
12064
12082
  Wazo.Phone.unmute(this.callSession);
12065
12083
 
@@ -12079,7 +12097,7 @@ class Room extends Emitter {
12079
12097
  }
12080
12098
 
12081
12099
  hold() {
12082
- logger$a.info('hold room');
12100
+ logger$2.info('hold room');
12083
12101
 
12084
12102
  Wazo.Phone.hold(this.callSession, true);
12085
12103
 
@@ -12089,7 +12107,7 @@ class Room extends Emitter {
12089
12107
  }
12090
12108
 
12091
12109
  async resume() {
12092
- logger$a.info('resume room');
12110
+ logger$2.info('resume room');
12093
12111
 
12094
12112
  const newStream = await Wazo.Phone.resume(this.callSession, true);
12095
12113
 
@@ -12117,13 +12135,13 @@ class Room extends Emitter {
12117
12135
  }
12118
12136
 
12119
12137
  sendDTMF(tone ) {
12120
- logger$a.info('send room DTMF', { tone });
12138
+ logger$2.info('send room DTMF', { tone });
12121
12139
 
12122
12140
  Wazo.Phone.sendDTMF(tone, this.callSession);
12123
12141
  }
12124
12142
 
12125
12143
  async sendReinvite(newConstraints = null) {
12126
- logger$a.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
12144
+ logger$2.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
12127
12145
  const wasScreensharing = this.localParticipant && this.localParticipant.screensharing;
12128
12146
 
12129
12147
  Wazo.Phone.on(Wazo.Phone.ON_SHARE_SCREEN_STARTED, () => {
@@ -12182,7 +12200,7 @@ class Room extends Emitter {
12182
12200
  Wazo.Phone.phone.on(Wazo.Phone.phone.client.ON_REINVITE, this._boundOnReinvite);
12183
12201
 
12184
12202
  this.on(this.ON_AUDIO_STREAM, stream => {
12185
- logger$a.info('on room audio stream');
12203
+ logger$2.info('on room audio stream');
12186
12204
 
12187
12205
  this.audioStream = stream;
12188
12206
  if (!this.roomAudioElement) {
@@ -12195,7 +12213,7 @@ class Room extends Emitter {
12195
12213
  });
12196
12214
 
12197
12215
  this.on(this.ON_VIDEO_STREAM, (stream, streamId, event, sipSession) => {
12198
- logger$a.info('on room video stream', { streamId });
12216
+ logger$2.info('on room video stream', { streamId });
12199
12217
 
12200
12218
  this._mapMsid(sipSession.body.body);
12201
12219
 
@@ -12210,7 +12228,7 @@ class Room extends Emitter {
12210
12228
  });
12211
12229
 
12212
12230
  this.on(this.ON_REMOVE_STREAM, stream => {
12213
- logger$a.info('on room remove stream');
12231
+ logger$2.info('on room remove stream');
12214
12232
 
12215
12233
  const participant = this.participants.find(someParticipant =>
12216
12234
  someParticipant.streams.find(someStream => someStream && someStream.id === stream.id));
@@ -12342,7 +12360,7 @@ class Room extends Emitter {
12342
12360
  const requester = this._getParticipantFromCallId(origin.callId);
12343
12361
  if (requester) {
12344
12362
  // @FIXME?: when need to trigger an update on join-in; this is a bit of a hack
12345
- logger$a.info('trigger room requester status', { origin });
12363
+ logger$2.info('trigger room requester status', { origin });
12346
12364
  requester.triggerUpdate('REQUESTER_UPDATE');
12347
12365
  }
12348
12366
  break;
@@ -12373,24 +12391,24 @@ class Room extends Emitter {
12373
12391
 
12374
12392
  // When we join the room, we can call `getConferenceParticipantsAsUser`, not before.
12375
12393
  if (participant.user_uuid === session.uuid) {
12376
- logger$a.info('room current user joined');
12394
+ logger$2.info('room current user joined');
12377
12395
 
12378
12396
  // Retrieve participants via an API calls
12379
12397
  const conferenceId = this.sourceId || payload.data.conference_id;
12380
12398
  let response;
12381
12399
  try {
12382
12400
  if (this.meetingUuid) {
12383
- logger$a.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
12401
+ logger$2.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
12384
12402
  response = await getApiClient().calld.getMeetingParticipantsAsUser(this.meetingUuid);
12385
12403
  } else {
12386
- logger$a.info('fetching conference participants', { conferenceId });
12404
+ logger$2.info('fetching conference participants', { conferenceId });
12387
12405
  response = await getApiClient().calld.getConferenceParticipantsAsUser(conferenceId);
12388
12406
  }
12389
12407
  } catch (e) {
12390
- logger$a.error('room participants fetching, error', e);
12408
+ logger$2.error('room participants fetching, error', e);
12391
12409
  }
12392
12410
  if (response) {
12393
- logger$a.info('conference participants fetched', { nb: response.items.length });
12411
+ logger$2.info('conference participants fetched', { nb: response.items.length });
12394
12412
  participants = response.items.map(item => {
12395
12413
  const isMe = item.call_id === this.callId;
12396
12414
 
@@ -12417,7 +12435,7 @@ class Room extends Emitter {
12417
12435
  ? new Wazo.RemoteParticipant(this, participant)
12418
12436
  : null;
12419
12437
 
12420
- logger$a.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
12438
+ logger$2.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
12421
12439
 
12422
12440
  if (remoteParticipant) {
12423
12441
  this.participants.push(remoteParticipant);
@@ -12582,12 +12600,12 @@ class Room extends Emitter {
12582
12600
 
12583
12601
  //
12584
12602
 
12585
- const logger$b = IssueReporter$1.loggerFor('sdk-sip-room');
12603
+ const logger$1 = IssueReporter$1.loggerFor('sdk-sip-room');
12586
12604
 
12587
- class SipRoom extends Room {
12605
+ class SipRoom extends Room$1 {
12588
12606
 
12589
12607
  static async connect({ extension, constraints, audioOnly = false, extra, room } ) {
12590
- logger$b.info('connecting to sip room', { extension, audioOnly, room: !!room });
12608
+ logger$1.info('connecting to sip room', { extension, audioOnly, room: !!room });
12591
12609
 
12592
12610
  if (!room) {
12593
12611
  await Wazo.Phone.connect();
@@ -12603,7 +12621,7 @@ class SipRoom extends Room {
12603
12621
  room.setCallId(room.callSession.call.id);
12604
12622
  }
12605
12623
 
12606
- logger$b.info('connected to room', {
12624
+ logger$1.info('connected to room', {
12607
12625
  extension: room.extension,
12608
12626
  });
12609
12627
 
@@ -12611,7 +12629,7 @@ class SipRoom extends Room {
12611
12629
  }
12612
12630
 
12613
12631
  mute() {
12614
- logger$b.info('mute sip room');
12632
+ logger$1.info('mute sip room');
12615
12633
 
12616
12634
  Wazo.Phone.mute(this.callSession, false);
12617
12635
 
@@ -12619,7 +12637,7 @@ class SipRoom extends Room {
12619
12637
  }
12620
12638
 
12621
12639
  unmute() {
12622
- logger$b.info('unmute sip room');
12640
+ logger$1.info('unmute sip room');
12623
12641
 
12624
12642
  Wazo.Phone.unmute(this.callSession, false);
12625
12643
 
@@ -12887,7 +12905,7 @@ class NotificationOptions {
12887
12905
 
12888
12906
 
12889
12907
  // Represents a conference room, like `9000`.
12890
- class Room$1 {
12908
+ class Room {
12891
12909
 
12892
12910
 
12893
12911
 
@@ -12908,7 +12926,7 @@ class Room$1 {
12908
12926
  }
12909
12927
 
12910
12928
  connect(callSession ) {
12911
- return new Room$1({ ...this, connectedCallSession: callSession });
12929
+ return new Room({ ...this, connectedCallSession: callSession });
12912
12930
  }
12913
12931
 
12914
12932
  has(callSession ) {
@@ -12917,7 +12935,7 @@ class Room$1 {
12917
12935
 
12918
12936
  addParticipant(uuid , extension , talking = null) {
12919
12937
  if (!this.participants.some(participant => participant.uuid === uuid || participant.extension === extension)) {
12920
- return new Room$1({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
12938
+ return new Room({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
12921
12939
  }
12922
12940
 
12923
12941
  return this;
@@ -12936,7 +12954,7 @@ class Room$1 {
12936
12954
  updatedParticipants.push(participant);
12937
12955
  }
12938
12956
 
12939
- return new Room$1({ ...this, participants: updatedParticipants });
12957
+ return new Room({ ...this, participants: updatedParticipants });
12940
12958
  }
12941
12959
 
12942
12960
  updateParticipantByExtension(extension , participant , shouldAdd = false) {
@@ -12952,7 +12970,7 @@ class Room$1 {
12952
12970
  updatedParticipants.push(participant);
12953
12971
  }
12954
12972
 
12955
- return new Room$1({ ...this, participants: updatedParticipants });
12973
+ return new Room({ ...this, participants: updatedParticipants });
12956
12974
  }
12957
12975
 
12958
12976
  hasCallWithId(id ) {
@@ -12960,18 +12978,18 @@ class Room$1 {
12960
12978
  }
12961
12979
 
12962
12980
  disconnect() {
12963
- return new Room$1({ ...this, connectedCallSession: null });
12981
+ return new Room({ ...this, connectedCallSession: null });
12964
12982
  }
12965
12983
 
12966
12984
  removeParticipantWithUUID(uuid ) {
12967
- return new Room$1({
12985
+ return new Room({
12968
12986
  ...this,
12969
12987
  participants: this.participants.filter(participant => participant.uuid !== uuid),
12970
12988
  });
12971
12989
  }
12972
12990
 
12973
12991
  removeParticipantWithExtension(extension ) {
12974
- return new Room$1({
12992
+ return new Room({
12975
12993
  ...this,
12976
12994
  participants: this.participants.filter(participant => participant.extension !== extension),
12977
12995
  });
@@ -12982,7 +13000,7 @@ class Room$1 {
12982
13000
  }
12983
13001
 
12984
13002
  static newFrom(room ) {
12985
- return newFrom(room, Room$1);
13003
+ return newFrom(room, Room);
12986
13004
  }
12987
13005
  }
12988
13006
 
@@ -13289,11 +13307,11 @@ var wazoWebsocket = {
13289
13307
  resolve();
13290
13308
  };
13291
13309
 
13292
- client.on(SOCKET_EVENTS.ON_ERROR, error => {
13310
+ client.on(SOCKET_EVENTS$1.ON_ERROR, error => {
13293
13311
  handleError(`Connection error : ${error}`);
13294
13312
  });
13295
13313
 
13296
- client.on(SOCKET_EVENTS.ON_OPEN, () => {
13314
+ client.on(SOCKET_EVENTS$1.ON_OPEN, () => {
13297
13315
  if (session.hasEngineVersionGte(HEARTBEAT_ENGINE_VERSION)) {
13298
13316
  client.setOnHeartbeatTimeout(() => {
13299
13317
  handleError('No response to heartbeat');
@@ -13394,7 +13412,7 @@ var webrtc = {
13394
13412
  }),
13395
13413
  };
13396
13414
 
13397
- const parseCandidate$1 = line => {
13415
+ const parseCandidate = line => {
13398
13416
  let parts;
13399
13417
  // Parse both variants.
13400
13418
  if (line.indexOf('a=candidate:') === 0) {
@@ -13485,7 +13503,7 @@ var SymmetricNat = {
13485
13503
  }
13486
13504
 
13487
13505
  if (e.candidate && e.candidate.candidate.indexOf('srflx') !== -1) {
13488
- const cand = parseCandidate$1(e.candidate.candidate);
13506
+ const cand = parseCandidate(e.candidate.candidate);
13489
13507
  if (!candidates[cand.relatedPort]) candidates[cand.relatedPort] = [];
13490
13508
  candidates[cand.relatedPort].push(cand.port);
13491
13509
  } else if (!e.candidate) {
@@ -13553,7 +13571,7 @@ var iceIpv4 = {
13553
13571
  const rawCandidate = e.candidate.candidate;
13554
13572
  if (rawCandidate.indexOf('srflx') !== -1 || rawCandidate.indexOf('relay') !== -1) {
13555
13573
  hasSrflxOrRelay = true;
13556
- const candidate = parseCandidate$1(e.candidate.candidate);
13574
+ const candidate = parseCandidate(e.candidate.candidate);
13557
13575
  ips.push(candidate.ip);
13558
13576
  }
13559
13577
  } else if (!e.candidate) {
@@ -13590,7 +13608,7 @@ var checks = [
13590
13608
 
13591
13609
  //
13592
13610
 
13593
- const logger$c = IssueReporter$1.loggerFor('engine-check');
13611
+ const logger = IssueReporter$1.loggerFor('engine-check');
13594
13612
 
13595
13613
  class Checker {
13596
13614
 
@@ -13608,28 +13626,28 @@ class Checker {
13608
13626
  async check(onCheckBegin = () => {}, onCheckResult = () => {}) {
13609
13627
  await this._addEngineVersion();
13610
13628
 
13611
- logger$c.info('Engine check starting');
13629
+ logger.info('Engine check starting');
13612
13630
 
13613
13631
  for (let i = 0; i < this.checks.length; i++) {
13614
13632
  const { name, check } = this.checks[i];
13615
13633
 
13616
- logger$c.info(`Checking ${name} ...`);
13634
+ logger.info(`Checking ${name} ...`);
13617
13635
 
13618
13636
  onCheckBegin(name);
13619
13637
  try {
13620
13638
  // eslint-disable-next-line no-await-in-loop
13621
13639
  const result = await check(this.server, this.session, this.externalAppConfig);
13622
- logger$c.info(`Checking ${name} success.`, { result });
13640
+ logger.info(`Checking ${name} success.`, { result });
13623
13641
 
13624
13642
  onCheckResult(name, result);
13625
13643
  } catch (e) {
13626
- logger$c.info(`Checking ${name} failure`, { message: e.message });
13644
+ logger.info(`Checking ${name} failure`, { message: e.message });
13627
13645
 
13628
13646
  onCheckResult(name, e);
13629
13647
  }
13630
13648
  }
13631
13649
 
13632
- logger$c.info('Engine check done.');
13650
+ logger.info('Engine check done.');
13633
13651
  }
13634
13652
 
13635
13653
  addCheck(check ) {
@@ -13653,7 +13671,7 @@ const Wazo = {
13653
13671
  Auth: Auth$1,
13654
13672
  Phone: Phone$1,
13655
13673
  Websocket: Websocket$1,
13656
- Room,
13674
+ Room: Room$1,
13657
13675
  SipRoom,
13658
13676
  RemoteParticipant,
13659
13677
  LocalParticipant,
@@ -13686,7 +13704,7 @@ const Wazo = {
13686
13704
  Session,
13687
13705
  Voicemail,
13688
13706
  Relocation,
13689
- ConferenceRoom: Room$1,
13707
+ ConferenceRoom: Room,
13690
13708
  CallSession,
13691
13709
  IndirectTransfer,
13692
13710
  SwitchboardCall,