@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
@@ -1957,7 +1957,7 @@ var IssueReporter$1 = new IssueReporter();
1957
1957
 
1958
1958
  const methods = ['head', 'get', 'post', 'put', 'delete'];
1959
1959
 
1960
- const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
1960
+ const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
1961
1961
 
1962
1962
  // Use a function here to be able to mock it in tests
1963
1963
  const realFetch = () => {
@@ -2096,7 +2096,7 @@ class ApiRequester {
2096
2096
  };
2097
2097
 
2098
2098
  if (this.refreshTokenPromise) {
2099
- logger.info('A token is already refreshing, waiting ...', { url });
2099
+ logger$c.info('A token is already refreshing, waiting ...', { url });
2100
2100
  await this.refreshTokenPromise;
2101
2101
  }
2102
2102
 
@@ -2116,7 +2116,7 @@ class ApiRequester {
2116
2116
  return promise.then(async (err ) => {
2117
2117
  // Check if the token is still valid
2118
2118
  if (firstCall && this._checkTokenExpired(response, err)) {
2119
- logger.warn('token expired', { error: err.reason });
2119
+ logger$c.warn('token expired', { error: err.reason });
2120
2120
  // Replay the call after refreshing the token
2121
2121
  return this._replayWithNewToken(err, path, method, body, headers, parse);
2122
2122
  }
@@ -2126,7 +2126,7 @@ class ApiRequester {
2126
2126
  : exceptionClass.fromResponse(err, response.status);
2127
2127
 
2128
2128
  if (this.shouldLogErrors) {
2129
- logger.error('API error', error);
2129
+ logger$c.error('API error', error);
2130
2130
  }
2131
2131
 
2132
2132
  throw error;
@@ -2136,7 +2136,7 @@ class ApiRequester {
2136
2136
  return newParse(response, isJson);
2137
2137
  }).catch(error => {
2138
2138
  if (this.shouldLogErrors) {
2139
- logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
2139
+ logger$c.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
2140
2140
  }
2141
2141
 
2142
2142
  throw error;
@@ -2164,13 +2164,13 @@ class ApiRequester {
2164
2164
  ) {
2165
2165
  const isTokenNotFound = this._isTokenNotFound(err);
2166
2166
  let newPath = path;
2167
- logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
2167
+ logger$c.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
2168
2168
 
2169
2169
  this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
2170
2170
 
2171
2171
  return this.refreshTokenPromise.then(() => {
2172
2172
  this.refreshTokenPromise = null;
2173
- logger.info('token refreshed', { isTokenNotFound });
2173
+ logger$c.info('token refreshed', { isTokenNotFound });
2174
2174
  if (isTokenNotFound) {
2175
2175
  const pathParts = path.split('/');
2176
2176
  pathParts.pop();
@@ -4063,7 +4063,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
4063
4063
 
4064
4064
  // const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
4065
4065
 
4066
- const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
4066
+ const logger$b = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
4067
4067
 
4068
4068
  class CTIPhone extends Emitter {
4069
4069
 
@@ -4076,7 +4076,7 @@ class CTIPhone extends Emitter {
4076
4076
 
4077
4077
  constructor(session , isMobile = false, callbackAllLines = false) {
4078
4078
  super();
4079
- logger$1.info('CTI Phone created');
4079
+ logger$b.info('CTI Phone created');
4080
4080
  this.session = session;
4081
4081
  this.isMobile = isMobile;
4082
4082
  this.callbackAllLines = callbackAllLines;
@@ -4137,7 +4137,7 @@ class CTIPhone extends Emitter {
4137
4137
  }
4138
4138
 
4139
4139
  async makeCall(number , line ) {
4140
- logger$1.info('make CTI call', { number });
4140
+ logger$b.info('make CTI call', { number });
4141
4141
 
4142
4142
  if (!number) {
4143
4143
  return null;
@@ -4160,7 +4160,7 @@ class CTIPhone extends Emitter {
4160
4160
  if (!callSession) {
4161
4161
  return Promise.resolve(null);
4162
4162
  }
4163
- logger$1.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
4163
+ logger$b.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
4164
4164
 
4165
4165
  if (!this.currentCall) {
4166
4166
  this.currentCall = callSession.call;
@@ -4173,7 +4173,7 @@ class CTIPhone extends Emitter {
4173
4173
  if (!callSession) {
4174
4174
  return;
4175
4175
  }
4176
- logger$1.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
4176
+ logger$b.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
4177
4177
 
4178
4178
  this.currentCall = undefined;
4179
4179
  this.eventEmitter.emit('onCallEnded', callSession);
@@ -4183,7 +4183,7 @@ class CTIPhone extends Emitter {
4183
4183
  if (!callSession) {
4184
4184
  return Promise.resolve(false);
4185
4185
  }
4186
- logger$1.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
4186
+ logger$b.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
4187
4187
 
4188
4188
  try {
4189
4189
  await CallApi.cancelCall(callSession);
@@ -4194,7 +4194,7 @@ class CTIPhone extends Emitter {
4194
4194
  this.eventEmitter.emit('onCallEnded', callSession);
4195
4195
  return true;
4196
4196
  } catch (e) {
4197
- logger$1.error('hangup CTI call, error', e);
4197
+ logger$b.error('hangup CTI call, error', e);
4198
4198
 
4199
4199
  this.eventEmitter.emit('onCallFailed', callSession);
4200
4200
  return false;
@@ -4207,7 +4207,7 @@ class CTIPhone extends Emitter {
4207
4207
  if (!callSession) {
4208
4208
  return;
4209
4209
  }
4210
- logger$1.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
4210
+ logger$b.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
4211
4211
 
4212
4212
  await CallApi.cancelCall(callSession);
4213
4213
  this.eventEmitter.emit('onCallEnded', callSession);
@@ -4217,7 +4217,7 @@ class CTIPhone extends Emitter {
4217
4217
  if (!callSession) {
4218
4218
  return;
4219
4219
  }
4220
- logger$1.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
4220
+ logger$b.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
4221
4221
 
4222
4222
  await CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_BLIND);
4223
4223
  }
@@ -4230,19 +4230,19 @@ class CTIPhone extends Emitter {
4230
4230
  if (!callSession) {
4231
4231
  return;
4232
4232
  }
4233
- logger$1.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
4233
+ logger$b.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
4234
4234
 
4235
4235
  return CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_ATTENDED);
4236
4236
  }
4237
4237
 
4238
4238
  async cancelCTIIndirectTransfer(transferId ) {
4239
- logger$1.info('cancel CTI transfer', { transferId });
4239
+ logger$b.info('cancel CTI transfer', { transferId });
4240
4240
 
4241
4241
  return CallApi.cancelCallTransfer(transferId);
4242
4242
  }
4243
4243
 
4244
4244
  async confirmCTIIndirectTransfer(transferId ) {
4245
- logger$1.info('confirm CTI transfer', { transferId });
4245
+ logger$b.info('confirm CTI transfer', { transferId });
4246
4246
 
4247
4247
  return CallApi.confirmCallTransfer(transferId);
4248
4248
  }
@@ -4251,19 +4251,19 @@ class CTIPhone extends Emitter {
4251
4251
  if (!callSession) {
4252
4252
  return;
4253
4253
  }
4254
- logger$1.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
4254
+ logger$b.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
4255
4255
 
4256
4256
  return CallApi.sendDTMF(callSession.callId, digits);
4257
4257
  }
4258
4258
 
4259
4259
  onConnectionMade() {
4260
- logger$1.info('on CTI connection made');
4260
+ logger$b.info('on CTI connection made');
4261
4261
 
4262
4262
  this.eventEmitter.emit('onCallAccepted');
4263
4263
  }
4264
4264
 
4265
4265
  async close() {
4266
- logger$1.info('CTI close');
4266
+ logger$b.info('CTI close');
4267
4267
 
4268
4268
  return Promise.resolve();
4269
4269
  }
@@ -4272,7 +4272,7 @@ class CTIPhone extends Emitter {
4272
4272
  if (!callSession) {
4273
4273
  return;
4274
4274
  }
4275
- logger$1.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
4275
+ logger$b.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
4276
4276
 
4277
4277
  return CallApi.hold(callSession.callId);
4278
4278
  }
@@ -4281,7 +4281,7 @@ class CTIPhone extends Emitter {
4281
4281
  if (!callSession) {
4282
4282
  return;
4283
4283
  }
4284
- logger$1.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
4284
+ logger$b.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
4285
4285
 
4286
4286
  return CallApi.resume(callSession.callId);
4287
4287
  }
@@ -4290,7 +4290,7 @@ class CTIPhone extends Emitter {
4290
4290
  if (!callSession) {
4291
4291
  return;
4292
4292
  }
4293
- logger$1.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
4293
+ logger$b.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
4294
4294
 
4295
4295
  return CallApi.mute(callSession.callId);
4296
4296
  }
@@ -4299,7 +4299,7 @@ class CTIPhone extends Emitter {
4299
4299
  if (!callSession) {
4300
4300
  return;
4301
4301
  }
4302
- logger$1.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
4302
+ logger$b.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
4303
4303
 
4304
4304
  return CallApi.unmute(callSession.callId);
4305
4305
  }
@@ -5308,7 +5308,7 @@ const AGENTD_VERSION = '1.0';
5308
5308
  const WEBHOOKD_VERSION = '1.0';
5309
5309
  const AMID_VERSION = '1.0';
5310
5310
 
5311
- const logger$2 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
5311
+ const logger$a = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
5312
5312
 
5313
5313
  class ApiClient {
5314
5314
 
@@ -5360,12 +5360,12 @@ class ApiClient {
5360
5360
  }
5361
5361
 
5362
5362
  async forceRefreshToken() {
5363
- logger$2.info('forcing refresh token, calling callback');
5363
+ logger$a.info('forcing refresh token, calling callback');
5364
5364
  return this.refreshTokenCallback();
5365
5365
  }
5366
5366
 
5367
5367
  async refreshTokenCallback() {
5368
- logger$2.info('refresh token callback called', {
5368
+ logger$a.info('refresh token callback called', {
5369
5369
  refreshToken: this.refreshToken,
5370
5370
  refreshBackend: this.refreshBackend,
5371
5371
  refreshExpiration: this.refreshExpiration,
@@ -5383,7 +5383,7 @@ class ApiClient {
5383
5383
  this.isMobile,
5384
5384
  );
5385
5385
 
5386
- logger$2.info('token refreshed', { token: session.token });
5386
+ logger$a.info('token refreshed', { token: session.token });
5387
5387
 
5388
5388
  if (this.onRefreshToken) {
5389
5389
  this.onRefreshToken(session.token, session);
@@ -5524,7 +5524,7 @@ var getApiClient = (forServer ) => {
5524
5524
  class InvalidSubscription extends Error {}
5525
5525
  class InvalidAuthorization extends Error {}
5526
5526
 
5527
- const logger$3 = IssueReporter$1.loggerFor('simple-auth');
5527
+ const logger$9 = IssueReporter$1.loggerFor('simple-auth');
5528
5528
 
5529
5529
  class Auth {
5530
5530
 
@@ -5559,7 +5559,7 @@ class Auth {
5559
5559
  setApiClientId(this.clientId);
5560
5560
  setRefreshExpiration(this.expiration);
5561
5561
  setOnRefreshToken((token , session ) => {
5562
- logger$3.info('on refresh token done', { token });
5562
+ logger$9.info('on refresh token done', { token });
5563
5563
  setApiToken(token);
5564
5564
  Wazo.Websocket.updateToken(token);
5565
5565
 
@@ -5604,7 +5604,7 @@ class Auth {
5604
5604
  const rawSession = await getApiClient().auth.authenticate(token);
5605
5605
  return this._onAuthenticated(rawSession);
5606
5606
  } catch (e) {
5607
- logger$3.error('on validate token error', e);
5607
+ logger$9.error('on validate token error', e);
5608
5608
  console.warn(e);
5609
5609
  return false;
5610
5610
  }
@@ -5960,7 +5960,7 @@ class AdHocAPIConference {
5960
5960
 
5961
5961
  /* */
5962
5962
 
5963
- const parseCandidate = (candidate ) => {
5963
+ const parseCandidate$1 = (candidate ) => {
5964
5964
  if (!candidate) {
5965
5965
  return null;
5966
5966
  }
@@ -6114,7 +6114,7 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
6114
6114
  this.peerConnectionDelegate.onicecandidate = event => {
6115
6115
  wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
6116
6116
  if (event.candidate) {
6117
- this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
6117
+ this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
6118
6118
  }
6119
6119
  };
6120
6120
 
@@ -6578,7 +6578,7 @@ const DEFAULT_ICE_TIMEOUT = 3000;
6578
6578
  const SEND_STATS_DELAY = 5000;
6579
6579
 
6580
6580
  const states = ['STATUS_NULL', 'STATUS_NEW', 'STATUS_CONNECTING', 'STATUS_CONNECTED', 'STATUS_COMPLETED'];
6581
- const logger$4 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
6581
+ const logger$8 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
6582
6582
  const statsLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-stats') : console;
6583
6583
 
6584
6584
  // events
@@ -6592,14 +6592,14 @@ const TRANSPORT_ERROR = 'transportError';
6592
6592
  const MESSAGE = 'message';
6593
6593
  const ACCEPTED = 'accepted';
6594
6594
  const REJECTED = 'rejected';
6595
- const ON_TRACK = 'onTrack';
6596
- const ON_REINVITE = 'reinvite';
6595
+ const ON_TRACK$1 = 'onTrack';
6596
+ const ON_REINVITE$1 = 'reinvite';
6597
6597
  const ON_ERROR = 'onError';
6598
6598
  const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
6599
- const ON_NETWORK_STATS = 'onNetworkStats';
6600
- const ON_DISCONNECTED = 'onDisconnected';
6599
+ const ON_NETWORK_STATS$1 = 'onNetworkStats';
6600
+ const ON_DISCONNECTED$1 = 'onDisconnected';
6601
6601
 
6602
- const events = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
6602
+ const events$1 = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
6603
6603
  const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
6604
6604
  class CanceledCallError extends Error {}
6605
6605
 
@@ -6735,12 +6735,12 @@ class WebRTCClient extends Emitter {
6735
6735
  this.MESSAGE = MESSAGE;
6736
6736
  this.ACCEPTED = ACCEPTED;
6737
6737
  this.REJECTED = REJECTED;
6738
- this.ON_TRACK = ON_TRACK;
6739
- this.ON_REINVITE = ON_REINVITE;
6738
+ this.ON_TRACK = ON_TRACK$1;
6739
+ this.ON_REINVITE = ON_REINVITE$1;
6740
6740
  this.ON_ERROR = ON_ERROR;
6741
6741
  this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
6742
- this.ON_NETWORK_STATS = ON_NETWORK_STATS;
6743
- this.ON_DISCONNECTED = ON_DISCONNECTED;
6742
+ this.ON_NETWORK_STATS = ON_NETWORK_STATS$1;
6743
+ this.ON_DISCONNECTED = ON_DISCONNECTED$1;
6744
6744
  }
6745
6745
 
6746
6746
  configureMedia(media ) {
@@ -6757,13 +6757,13 @@ class WebRTCClient extends Emitter {
6757
6757
 
6758
6758
  createUserAgent(configOverrides ) {
6759
6759
  const webRTCConfiguration = this._createWebRTCConfiguration(configOverrides);
6760
- logger$4.info('sdk webrtc, creating UA', { webRTCConfiguration });
6760
+ logger$8.info('sdk webrtc, creating UA', { webRTCConfiguration });
6761
6761
 
6762
6762
  webRTCConfiguration.delegate = {
6763
6763
  onConnect: this.onConnect.bind(this),
6764
6764
  onDisconnect: this.onDisconnect.bind(this),
6765
6765
  onInvite: (invitation ) => {
6766
- logger$4.info('sdk webrtc on invite', {
6766
+ logger$8.info('sdk webrtc on invite', {
6767
6767
  method: 'delegate.onInvite',
6768
6768
  id: invitation.id,
6769
6769
  remoteURI: invitation.remoteURI,
@@ -6806,7 +6806,7 @@ class WebRTCClient extends Emitter {
6806
6806
  }
6807
6807
 
6808
6808
  onConnect() {
6809
- logger$4.info('sdk webrtc connected', { method: 'delegate.onConnect' });
6809
+ logger$8.info('sdk webrtc connected', { method: 'delegate.onConnect' });
6810
6810
  this.eventEmitter.emit(CONNECTED);
6811
6811
  if (!this.isRegistered() && this.registerer && this.registerer.waiting) {
6812
6812
  this.registerer.waitingToggle(false);
@@ -6815,7 +6815,7 @@ class WebRTCClient extends Emitter {
6815
6815
  }
6816
6816
 
6817
6817
  async onDisconnect(error ) {
6818
- logger$4.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
6818
+ logger$8.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
6819
6819
  this.connectionPromise = null;
6820
6820
  // The UA will attempt to reconnect automatically when an error occurred
6821
6821
  this.eventEmitter.emit(DISCONNECTED, error);
@@ -6840,37 +6840,37 @@ class WebRTCClient extends Emitter {
6840
6840
  };
6841
6841
 
6842
6842
  if (this.skipRegister) {
6843
- logger$4.info('sdk webrtc skip register...', logInfo);
6843
+ logger$8.info('sdk webrtc skip register...', logInfo);
6844
6844
  return Promise.resolve();
6845
6845
  }
6846
6846
 
6847
- logger$4.info('sdk webrtc registering...', logInfo);
6847
+ logger$8.info('sdk webrtc registering...', logInfo);
6848
6848
 
6849
6849
  if (!this.userAgent) {
6850
- logger$4.info('sdk webrtc recreating User Agent');
6850
+ logger$8.info('sdk webrtc recreating User Agent');
6851
6851
  this.userAgent = this.createUserAgent(this.uaConfigOverrides);
6852
6852
  }
6853
6853
  if (!this.userAgent || this.isRegistered()) {
6854
- logger$4.info('sdk webrtc registering aborted, already registered or no UA can be created');
6854
+ logger$8.info('sdk webrtc registering aborted, already registered or no UA can be created');
6855
6855
  return Promise.resolve();
6856
6856
  }
6857
6857
 
6858
6858
  if (this.connectionPromise || (this.registerer && this.registerer.waiting)) {
6859
- logger$4.info('sdk webrtc registering aborted due to a registration in progress.');
6859
+ logger$8.info('sdk webrtc registering aborted due to a registration in progress.');
6860
6860
  return Promise.resolve();
6861
6861
  }
6862
6862
 
6863
6863
  const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
6864
6864
 
6865
6865
  const onRegisterFailed = () => {
6866
- logger$4.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
6866
+ logger$8.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
6867
6867
  this.connectionPromise = null;
6868
6868
  if (this.registerer && this.registerer.waiting) {
6869
6869
  this.registerer.waitingToggle(false);
6870
6870
  }
6871
6871
 
6872
6872
  if (tries <= MAX_REGISTER_TRIES) {
6873
- logger$4.info('sdk webrtc registering, retrying...', { tries });
6873
+ logger$8.info('sdk webrtc registering, retrying...', { tries });
6874
6874
  setTimeout(() => this.register(tries + 1), 300);
6875
6875
  }
6876
6876
  };
@@ -6879,18 +6879,18 @@ class WebRTCClient extends Emitter {
6879
6879
  // Avoid race condition with the close method called just before register and setting userAgent to null
6880
6880
  // during the resolution of the primise.
6881
6881
  if (!this.userAgent) {
6882
- logger$4.info('sdk webrtc recreating User Agent after connection');
6882
+ logger$8.info('sdk webrtc recreating User Agent after connection');
6883
6883
  this.userAgent = this.createUserAgent(this.uaConfigOverrides);
6884
6884
  }
6885
6885
 
6886
- logger$4.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
6886
+ logger$8.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
6887
6887
  this.registerer = new registerer.Registerer(this.userAgent, registerOptions);
6888
6888
  this.connectionPromise = null;
6889
6889
  this._monkeyPatchRegisterer(this.registerer);
6890
6890
 
6891
6891
  // Bind registerer events
6892
6892
  this.registerer.stateChange.addListener(newState => {
6893
- logger$4.info('sdk webrtc registering, state changed', { newState });
6893
+ logger$8.info('sdk webrtc registering, state changed', { newState });
6894
6894
 
6895
6895
  if (newState === registererState.RegistererState.Registered && this.registerer
6896
6896
  && this.registerer.state === registererState.RegistererState.Registered) {
@@ -6903,7 +6903,7 @@ class WebRTCClient extends Emitter {
6903
6903
  const options = {
6904
6904
  requestDelegate: {
6905
6905
  onReject: response => {
6906
- logger$4.error('sdk webrtc registering, rejected', { response });
6906
+ logger$8.error('sdk webrtc registering, rejected', { response });
6907
6907
 
6908
6908
  onRegisterFailed();
6909
6909
  },
@@ -6911,13 +6911,13 @@ class WebRTCClient extends Emitter {
6911
6911
  };
6912
6912
 
6913
6913
  return this.registerer.register(options).catch((e) => {
6914
- logger$4.error('sdk webrtc registering, error', e);
6914
+ logger$8.error('sdk webrtc registering, error', e);
6915
6915
 
6916
6916
  this.eventEmitter.emit(REGISTRATION_FAILED);
6917
6917
  return e;
6918
6918
  });
6919
6919
  }).catch(error => {
6920
- logger$4.error('sdk webrtc registering, transport error', error);
6920
+ logger$8.error('sdk webrtc registering, transport error', error);
6921
6921
  onRegisterFailed();
6922
6922
  });
6923
6923
  }
@@ -6946,21 +6946,21 @@ class WebRTCClient extends Emitter {
6946
6946
  }
6947
6947
 
6948
6948
  unregister() {
6949
- logger$4.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
6949
+ logger$8.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
6950
6950
  if (!this.registerer) {
6951
6951
  return Promise.resolve();
6952
6952
  }
6953
6953
 
6954
6954
  try {
6955
6955
  return this.registerer.unregister().then(() => {
6956
- logger$4.info('sdk webrtc unregistered');
6956
+ logger$8.info('sdk webrtc unregistered');
6957
6957
  this._cleanupRegister();
6958
6958
  }).catch(e => {
6959
- logger$4.error('sdk webrtc unregistering, promise error', e);
6959
+ logger$8.error('sdk webrtc unregistering, promise error', e);
6960
6960
  this._cleanupRegister();
6961
6961
  });
6962
6962
  } catch (e) {
6963
- logger$4.error('sdk webrtc unregistering, error', e);
6963
+ logger$8.error('sdk webrtc unregistering, error', e);
6964
6964
  // Avoid issue with `undefined is not an object (evaluating 'new.target.prototype')` when triggering a new
6965
6965
  // error when the registerer is in a bad state
6966
6966
  this._cleanupRegister();
@@ -6968,7 +6968,7 @@ class WebRTCClient extends Emitter {
6968
6968
  }
6969
6969
 
6970
6970
  stop() {
6971
- logger$4.info('sdk webrtc stop', { userAgent: !!this.userAgent });
6971
+ logger$8.info('sdk webrtc stop', { userAgent: !!this.userAgent });
6972
6972
  if (!this.userAgent) {
6973
6973
  return Promise.resolve();
6974
6974
  }
@@ -6976,12 +6976,12 @@ class WebRTCClient extends Emitter {
6976
6976
  return this.userAgent.stop().then(() => {
6977
6977
  return this._cleanupRegister();
6978
6978
  }).catch(e => {
6979
- logger$4.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
6979
+ logger$8.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
6980
6980
  });
6981
6981
  }
6982
6982
 
6983
6983
  call(number , enableVideo , audioOnly = false, conference = false) {
6984
- logger$4.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
6984
+ logger$8.info('sdk webrtc creating call', { number, enableVideo, audioOnly, conference });
6985
6985
  const inviterOptions = {
6986
6986
  sessionDescriptionHandlerOptionsReInvite: {
6987
6987
  conference,
@@ -7012,7 +7012,7 @@ class WebRTCClient extends Emitter {
7012
7012
  this._onAccepted(session, response.session, true);
7013
7013
  },
7014
7014
  onReject: (response ) => {
7015
- logger$4.info('on call rejected', { id: session.id, fromTag: session.fromTag });
7015
+ logger$8.info('on call rejected', { id: session.id, fromTag: session.fromTag });
7016
7016
  this._stopSendingStats(session);
7017
7017
  this.stopNetworkMonitoring(session);
7018
7018
 
@@ -7035,11 +7035,11 @@ class WebRTCClient extends Emitter {
7035
7035
  }
7036
7036
 
7037
7037
  answer(session , enableVideo ) {
7038
- logger$4.info('sdk webrtc answer call', { id: session.id, enableVideo });
7038
+ logger$8.info('sdk webrtc answer call', { id: session.id, enableVideo });
7039
7039
 
7040
7040
  if (!session || !session.accept) {
7041
7041
  const error = 'No session to answer, or not an invitation';
7042
- logger$4.warn(error);
7042
+ logger$8.warn(error);
7043
7043
  return Promise.reject(new Error(error));
7044
7044
  }
7045
7045
  const options = {
@@ -7049,15 +7049,15 @@ class WebRTCClient extends Emitter {
7049
7049
  return session.accept(options).then(() => {
7050
7050
  if (session.isCanceled) {
7051
7051
  const message = 'accepted a canceled session (or was canceled during the accept phase).';
7052
- logger$4.error(message, { id: session.id });
7052
+ logger$8.error(message, { id: session.id });
7053
7053
  this.onCallEnded(session);
7054
7054
 
7055
7055
  throw new CanceledCallError(message);
7056
7056
  }
7057
- logger$4.info('sdk webrtc answer, accepted.');
7057
+ logger$8.info('sdk webrtc answer, accepted.');
7058
7058
  this._onAccepted(session);
7059
7059
  }).catch(e => {
7060
- logger$4.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
7060
+ logger$8.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
7061
7061
 
7062
7062
  throw e;
7063
7063
  });
@@ -7065,7 +7065,7 @@ class WebRTCClient extends Emitter {
7065
7065
 
7066
7066
  hangup(session ) {
7067
7067
  const { state, id } = session;
7068
- logger$4.info('sdk webrtc hangup call', { id, state });
7068
+ logger$8.info('sdk webrtc hangup call', { id, state });
7069
7069
 
7070
7070
  try {
7071
7071
  this._stopSendingStats(session);
@@ -7094,7 +7094,7 @@ class WebRTCClient extends Emitter {
7094
7094
 
7095
7095
  return bye();
7096
7096
  } catch (error) {
7097
- logger$4.warn('sdk webrtc hangup, error', error);
7097
+ logger$8.warn('sdk webrtc hangup, error', error);
7098
7098
  }
7099
7099
 
7100
7100
  return null;
@@ -7112,7 +7112,7 @@ class WebRTCClient extends Emitter {
7112
7112
  // Fetch and emit an event at `interval` with session network stats
7113
7113
  startNetworkMonitoring(session , interval = 1000) {
7114
7114
  const sessionId = this.getSipSessionId(session);
7115
- logger$4.info('starting network inspection', { id: sessionId });
7115
+ logger$8.info('starting network inspection', { id: sessionId });
7116
7116
 
7117
7117
  this.sessionNetworkStats[sessionId] = [];
7118
7118
 
@@ -7122,7 +7122,7 @@ class WebRTCClient extends Emitter {
7122
7122
  stopNetworkMonitoring(session ) {
7123
7123
  const sessionId = this.getSipSessionId(session);
7124
7124
  const exists = sessionId in this.networkMonitoringInterval;
7125
- logger$4.info('stopping network inspection', { id: sessionId, exists });
7125
+ logger$8.info('stopping network inspection', { id: sessionId, exists });
7126
7126
 
7127
7127
  if (exists) {
7128
7128
  clearInterval(this.networkMonitoringInterval[sessionId]);
@@ -7132,17 +7132,17 @@ class WebRTCClient extends Emitter {
7132
7132
  }
7133
7133
 
7134
7134
  reject(session ) {
7135
- logger$4.info('sdk webrtc reject call', { id: session.id });
7135
+ logger$8.info('sdk webrtc reject call', { id: session.id });
7136
7136
 
7137
7137
  try {
7138
7138
  return session.reject ? session.reject() : session.cancel();
7139
7139
  } catch (e) {
7140
- logger$4.warn('Error when rejecting call', e.message, e.stack);
7140
+ logger$8.warn('Error when rejecting call', e.message, e.stack);
7141
7141
  }
7142
7142
  }
7143
7143
 
7144
7144
  async close() {
7145
- logger$4.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
7145
+ logger$8.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
7146
7146
  this._cleanupMedia();
7147
7147
  this.connectionPromise = null;
7148
7148
 
@@ -7173,7 +7173,7 @@ class WebRTCClient extends Emitter {
7173
7173
  // eg: "INVITE not rejectable in state Completed"
7174
7174
  }
7175
7175
  this.userAgent = null;
7176
- logger$4.info('sdk webrtc client closed');
7176
+ logger$8.info('sdk webrtc client closed');
7177
7177
  }
7178
7178
 
7179
7179
  getNumber(session ) {
@@ -7186,13 +7186,13 @@ class WebRTCClient extends Emitter {
7186
7186
  }
7187
7187
 
7188
7188
  mute(session ) {
7189
- logger$4.info('sdk webrtc mute', { id: session.id });
7189
+ logger$8.info('sdk webrtc mute', { id: session.id });
7190
7190
 
7191
7191
  this._toggleAudio(session, true);
7192
7192
  }
7193
7193
 
7194
7194
  unmute(session ) {
7195
- logger$4.info('sdk webrtc unmute', { id: session.id });
7195
+ logger$8.info('sdk webrtc unmute', { id: session.id });
7196
7196
 
7197
7197
  this._toggleAudio(session, false);
7198
7198
  }
@@ -7232,13 +7232,13 @@ class WebRTCClient extends Emitter {
7232
7232
  }
7233
7233
 
7234
7234
  toggleCameraOn(session ) {
7235
- logger$4.info('sdk webrtc toggle camera on', { id: session.id });
7235
+ logger$8.info('sdk webrtc toggle camera on', { id: session.id });
7236
7236
 
7237
7237
  this._toggleVideo(session, false);
7238
7238
  }
7239
7239
 
7240
7240
  toggleCameraOff(session ) {
7241
- logger$4.info('sdk webrtc toggle camera off', { id: session.id });
7241
+ logger$8.info('sdk webrtc toggle camera off', { id: session.id });
7242
7242
 
7243
7243
  this._toggleVideo(session, true);
7244
7244
  }
@@ -7247,7 +7247,7 @@ class WebRTCClient extends Emitter {
7247
7247
  const sessionId = this.getSipSessionId(session);
7248
7248
  const hasVideo = hadVideo || this.hasLocalVideo(sessionId);
7249
7249
 
7250
- logger$4.info('sdk webrtc hold', {
7250
+ logger$8.info('sdk webrtc hold', {
7251
7251
  sessionId,
7252
7252
  keys: Object.keys(this.heldSessions),
7253
7253
  pendingReinvite: !!session.pendingReinvite,
@@ -7296,7 +7296,7 @@ class WebRTCClient extends Emitter {
7296
7296
  const sessionId = this.getSipSessionId(session);
7297
7297
  const hasVideo = sessionId in this.heldSessions && this.heldSessions[sessionId].hasVideo;
7298
7298
 
7299
- logger$4.info('sdk webrtc unhold', {
7299
+ logger$8.info('sdk webrtc unhold', {
7300
7300
  sessionId,
7301
7301
  keys: Object.keys(this.heldSessions),
7302
7302
  pendingReinvite: !!session.pendingReinvite,
@@ -7444,7 +7444,7 @@ class WebRTCClient extends Emitter {
7444
7444
  if (!session.sessionDescriptionHandler) {
7445
7445
  return;
7446
7446
  }
7447
- logger$4.info('Sending DTMF', {
7447
+ logger$8.info('Sending DTMF', {
7448
7448
  id: this.getSipSessionId(session),
7449
7449
  tone,
7450
7450
  });
@@ -7460,7 +7460,7 @@ class WebRTCClient extends Emitter {
7460
7460
  transfer(session , target ) {
7461
7461
  this.hold(session);
7462
7462
 
7463
- logger$4.info('Transfering a session', {
7463
+ logger$8.info('Transfering a session', {
7464
7464
  id: this.getSipSessionId(session),
7465
7465
  target,
7466
7466
  });
@@ -7482,17 +7482,17 @@ class WebRTCClient extends Emitter {
7482
7482
  atxfer(session ) {
7483
7483
  this.hold(session);
7484
7484
 
7485
- logger$4.info('webrtc transfer started', { id: this.getSipSessionId(session) });
7485
+ logger$8.info('webrtc transfer started', { id: this.getSipSessionId(session) });
7486
7486
 
7487
7487
  const result = {
7488
7488
  newSession: null,
7489
7489
  init: async (target ) => {
7490
- logger$4.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
7490
+ logger$8.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
7491
7491
 
7492
7492
  result.newSession = await this.call(target);
7493
7493
  },
7494
7494
  complete: () => {
7495
- logger$4.info('webrtc transfer completed', {
7495
+ logger$8.info('webrtc transfer completed', {
7496
7496
  id: this.getSipSessionId(session),
7497
7497
  referId: this.getSipSessionId(result.newSession),
7498
7498
  });
@@ -7513,7 +7513,7 @@ class WebRTCClient extends Emitter {
7513
7513
  return;
7514
7514
  }
7515
7515
 
7516
- logger$4.info('send WebRTC message', { sipId: sipSession.id, contentType });
7516
+ logger$8.info('send WebRTC message', { sipId: sipSession.id, contentType });
7517
7517
 
7518
7518
  try {
7519
7519
  sipSession.message({
@@ -7555,7 +7555,7 @@ class WebRTCClient extends Emitter {
7555
7555
  }
7556
7556
 
7557
7557
  changeAudioOutputVolume(volume ) {
7558
- logger$4.info('Changing audio output volume', { volume });
7558
+ logger$8.info('Changing audio output volume', { volume });
7559
7559
 
7560
7560
  Object.values(this.audioElements).forEach(audioElement => {
7561
7561
  if (audioElement instanceof HTMLAudioElement) {
@@ -7567,7 +7567,7 @@ class WebRTCClient extends Emitter {
7567
7567
  }
7568
7568
 
7569
7569
  changeAudioOutputDevice(id ) {
7570
- logger$4.info('Changing audio output device', { id });
7570
+ logger$8.info('Changing audio output device', { id });
7571
7571
 
7572
7572
  Object.values(this.audioElements).forEach(audioElement => {
7573
7573
  // `setSinkId` method is not included in any flow type definitions for HTMLAudioElements but is a valid method
@@ -7584,7 +7584,7 @@ class WebRTCClient extends Emitter {
7584
7584
 
7585
7585
  changeAudioInputDevice(id , session ) {
7586
7586
  const currentId = this.getAudioDeviceId();
7587
- logger$4.info('setting audio input device', { id, currentId, session: !!session });
7587
+ logger$8.info('setting audio input device', { id, currentId, session: !!session });
7588
7588
 
7589
7589
  if (id === currentId) {
7590
7590
  return null;
@@ -7630,7 +7630,7 @@ class WebRTCClient extends Emitter {
7630
7630
 
7631
7631
  setVideoInputDevice(id ) {
7632
7632
  const currentId = this.getVideoDeviceId();
7633
- logger$4.info('setting video input device', { id, currentId });
7633
+ logger$8.info('setting video input device', { id, currentId });
7634
7634
 
7635
7635
  if (id === currentId) {
7636
7636
  return null;
@@ -7655,7 +7655,7 @@ class WebRTCClient extends Emitter {
7655
7655
  const sessionId = this.getSipSessionId(session);
7656
7656
  const localStream = this.getLocalStream(sessionId);
7657
7657
 
7658
- logger$4.info('changing video input device', { id, sessionId });
7658
+ logger$8.info('changing video input device', { id, sessionId });
7659
7659
 
7660
7660
  // Release old video stream
7661
7661
  if (localStream) {
@@ -7723,7 +7723,7 @@ class WebRTCClient extends Emitter {
7723
7723
  const shouldDoScreenSharing = newConstraints && newConstraints.screen;
7724
7724
  const desktop = newConstraints && newConstraints.desktop;
7725
7725
 
7726
- logger$4.info('Sending reinvite', {
7726
+ logger$8.info('Sending reinvite', {
7727
7727
  id: this.getSipSessionId(sipSession),
7728
7728
  newConstraints,
7729
7729
  conference,
@@ -7761,7 +7761,7 @@ class WebRTCClient extends Emitter {
7761
7761
  sipSession.incomingInviteRequest.message.body = response.message.body;
7762
7762
  }
7763
7763
 
7764
- logger$4.info('on re-INVITE accepted', {
7764
+ logger$8.info('on re-INVITE accepted', {
7765
7765
  id: this.getSipSessionId(sipSession),
7766
7766
  wasMuted,
7767
7767
  shouldDoScreenSharing,
@@ -7779,7 +7779,7 @@ class WebRTCClient extends Emitter {
7779
7779
  this.eventEmitter.emit(ON_SCREEN_SHARING_REINVITE, sipSession, response, desktop);
7780
7780
  }
7781
7781
 
7782
- return this.eventEmitter.emit(ON_REINVITE, sipSession, response);
7782
+ return this.eventEmitter.emit(ON_REINVITE$1, sipSession, response);
7783
7783
  },
7784
7784
  },
7785
7785
  sessionDescriptionHandlerModifiers: [replaceLocalIpModifier],
@@ -7936,7 +7936,7 @@ class WebRTCClient extends Emitter {
7936
7936
  }
7937
7937
 
7938
7938
  startHeartbeat() {
7939
- logger$4.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
7939
+ logger$8.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
7940
7940
  if (!this.userAgent) {
7941
7941
  this.heartbeat.stop();
7942
7942
  return;
@@ -7949,7 +7949,7 @@ class WebRTCClient extends Emitter {
7949
7949
  }
7950
7950
 
7951
7951
  stopHeartbeat() {
7952
- logger$4.info('sdk webrtc stop heartbeat');
7952
+ logger$8.info('sdk webrtc stop heartbeat');
7953
7953
  this.heartbeat.stop();
7954
7954
  }
7955
7955
 
@@ -7970,7 +7970,7 @@ class WebRTCClient extends Emitter {
7970
7970
  }
7971
7971
 
7972
7972
  attemptReconnection() {
7973
- logger$4.info('attempt reconnection', { userAgent: !!this.userAgent });
7973
+ logger$8.info('attempt reconnection', { userAgent: !!this.userAgent });
7974
7974
  if (!this.userAgent) {
7975
7975
  return;
7976
7976
  }
@@ -7995,7 +7995,7 @@ class WebRTCClient extends Emitter {
7995
7995
  return;
7996
7996
  }
7997
7997
 
7998
- logger$4.info('setting local media stream', {
7998
+ logger$8.info('setting local media stream', {
7999
7999
  sipSessionId,
8000
8000
  tracks: newStream ? newStream.getTracks() : null,
8001
8001
  });
@@ -8012,7 +8012,7 @@ class WebRTCClient extends Emitter {
8012
8012
 
8013
8013
  const oldStream = this.getLocalStream(sipSessionId);
8014
8014
 
8015
- logger$4.info('updating local stream', {
8015
+ logger$8.info('updating local stream', {
8016
8016
  sipSessionId,
8017
8017
  oldStream: !!oldStream,
8018
8018
  tracks: newStream.getTracks(),
@@ -8032,7 +8032,7 @@ class WebRTCClient extends Emitter {
8032
8032
  const remoteStream = this.getRemoteStream(sessionId);
8033
8033
  const pc = this.getPeerConnection(sessionId);
8034
8034
 
8035
- logger$4.info('Updating remote stream', {
8035
+ logger$8.info('Updating remote stream', {
8036
8036
  sessionId,
8037
8037
  tracks: remoteStream ? remoteStream.getTracks() : null,
8038
8038
  receiverTracks: pc && pc.getReceivers ? pc.getReceivers().map(receiver => receiver.track) : null,
@@ -8057,14 +8057,16 @@ class WebRTCClient extends Emitter {
8057
8057
  const screenSharing = constraints && 'screen' in constraints ? constraints.screen : false;
8058
8058
  const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
8059
8059
  const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
8060
+ const mandatoryVideo = constraints && typeof constraints.video === 'object' ? constraints.video.mandatory : {};
8060
8061
 
8061
- logger$4.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
8062
+ logger$8.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
8062
8063
 
8063
8064
  return {
8064
8065
  constraints: {
8065
8066
  // Exact constraint are not supported with `getDisplayMedia` and we must have a video=false in desktop screenshare
8066
8067
  audio: screenSharing ? !isDesktop : (withAudio ? this._getAudioConstraints() : false),
8067
- video: screenSharing ? (isDesktop ? ({ mandatory: { chromeMediaSource: 'desktop' } }) : { cursor: 'always' })
8068
+ video: screenSharing ? (isDesktop
8069
+ ? ({ mandatory: { chromeMediaSource: 'desktop', ...(mandatoryVideo || {}) } }) : { cursor: 'always' })
8068
8070
  : this._getVideoConstraints(enableVideo),
8069
8071
  screen: screenSharing,
8070
8072
  desktop: isDesktop,
@@ -8107,7 +8109,7 @@ class WebRTCClient extends Emitter {
8107
8109
  }
8108
8110
 
8109
8111
  _onTransportError() {
8110
- logger$4.error('on transport error');
8112
+ logger$8.error('on transport error');
8111
8113
  this.eventEmitter.emit(TRANSPORT_ERROR);
8112
8114
  this.attemptReconnection();
8113
8115
  }
@@ -8116,7 +8118,7 @@ class WebRTCClient extends Emitter {
8116
8118
  const body = message && typeof message === 'object' ? message.data : message;
8117
8119
  if (body && body.indexOf('200 OK') !== -1) {
8118
8120
  if (this.hasHeartbeat()) {
8119
- logger$4.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
8121
+ logger$8.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
8120
8122
 
8121
8123
  this.heartbeat.onHeartbeat();
8122
8124
  if (this.heartbeatCb) {
@@ -8127,7 +8129,7 @@ class WebRTCClient extends Emitter {
8127
8129
  }
8128
8130
 
8129
8131
  async _onHeartbeatTimeout() {
8130
- logger$4.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
8132
+ logger$8.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
8131
8133
 
8132
8134
  if (this.heartbeatTimeoutCb) {
8133
8135
  this.heartbeatTimeoutCb();
@@ -8139,7 +8141,7 @@ class WebRTCClient extends Emitter {
8139
8141
  try {
8140
8142
  await this.userAgent.transport.disconnect();
8141
8143
  } catch (e) {
8142
- logger$4.error('Transport disconnection after heartbeat timeout, error', e);
8144
+ logger$8.error('Transport disconnection after heartbeat timeout, error', e);
8143
8145
  }
8144
8146
  }
8145
8147
 
@@ -8172,31 +8174,31 @@ class WebRTCClient extends Emitter {
8172
8174
  }
8173
8175
 
8174
8176
  _connectIfNeeded() {
8175
- logger$4.info('connect if needed, checking', { connected: this.isConnected() });
8177
+ logger$8.info('connect if needed, checking', { connected: this.isConnected() });
8176
8178
  if (!this.userAgent) {
8177
- logger$4.info('need to recreate User Agent');
8179
+ logger$8.info('need to recreate User Agent');
8178
8180
  this.userAgent = this.createUserAgent(this.uaConfigOverrides);
8179
8181
  }
8180
8182
 
8181
8183
  if (this.isConnected()) {
8182
- logger$4.info('webrtc sdk, already connected');
8184
+ logger$8.info('webrtc sdk, already connected');
8183
8185
  return Promise.resolve();
8184
8186
  }
8185
8187
 
8186
8188
  if (this.isConnecting()) {
8187
- logger$4.info('webrtc sdk, already connecting...');
8189
+ logger$8.info('webrtc sdk, already connecting...');
8188
8190
 
8189
8191
  this.connectionPromise = this.userAgent.transport.connectPromise;
8190
8192
  return this.connectionPromise;
8191
8193
  }
8192
8194
 
8193
8195
  if (this.connectionPromise) {
8194
- logger$4.info('webrtc sdk, connection promise connecting...');
8196
+ logger$8.info('webrtc sdk, connection promise connecting...');
8195
8197
  // $FlowFixMe
8196
8198
  return this.connectionPromise;
8197
8199
  }
8198
8200
 
8199
- logger$4.info('WebRTC UA needs to connect');
8201
+ logger$8.info('WebRTC UA needs to connect');
8200
8202
 
8201
8203
  // Force UA to reconnect
8202
8204
  if (this.userAgent && this.userAgent.state !== userAgentState.UserAgentState.Stopped) {
@@ -8321,7 +8323,7 @@ class WebRTCClient extends Emitter {
8321
8323
 
8322
8324
  sdh.peerConnectionDelegate = {
8323
8325
  onicecandidateerror: (error ) => {
8324
- logger$4.error('on icecandidate error', {
8326
+ logger$8.error('on icecandidate error', {
8325
8327
  address: error.address,
8326
8328
  port: error.port,
8327
8329
  errorCode: error.errorCode,
@@ -8350,7 +8352,7 @@ class WebRTCClient extends Emitter {
8350
8352
  updatedNumber = session.assertedIdentity.uri.normal.user;
8351
8353
  updatedCalleeName = session.assertedIdentity.displayName || updatedNumber;
8352
8354
  }
8353
- logger$4.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
8355
+ logger$8.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
8354
8356
 
8355
8357
  // Useful to know if it's a video upgrade or an unhold from a remote peer with a video stream
8356
8358
 
@@ -8366,12 +8368,12 @@ class WebRTCClient extends Emitter {
8366
8368
 
8367
8369
  this._setupMedias(session);
8368
8370
 
8369
- return this.eventEmitter.emit(ON_REINVITE, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
8371
+ return this.eventEmitter.emit(ON_REINVITE$1, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
8370
8372
  };
8371
8373
  }
8372
8374
 
8373
8375
  _onAccepted(session , sessionDialog , withEvent = true) {
8374
- logger$4.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
8376
+ logger$8.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
8375
8377
 
8376
8378
  this.storeSipSession(session);
8377
8379
 
@@ -8383,14 +8385,14 @@ class WebRTCClient extends Emitter {
8383
8385
  const onTrack = (event ) => {
8384
8386
  const isAudioOnly = this._isAudioOnly(session);
8385
8387
  const { kind, label, readyState, id, muted } = event.track;
8386
- logger$4.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
8388
+ logger$8.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
8387
8389
 
8388
8390
  // Stop video track in audio only mode
8389
8391
  if (isAudioOnly && kind === 'video') {
8390
8392
  event.track.stop();
8391
8393
  }
8392
8394
 
8393
- this.eventEmitter.emit(ON_TRACK, session, event);
8395
+ this.eventEmitter.emit(ON_TRACK$1, session, event);
8394
8396
  };
8395
8397
 
8396
8398
  if (session.sessionDescriptionHandler.peerConnection) {
@@ -8399,12 +8401,14 @@ class WebRTCClient extends Emitter {
8399
8401
 
8400
8402
  session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
8401
8403
 
8402
- pc.oniceconnectionstatechange = () => {
8403
- logger$4.info('on ice connection state changed', { state: pc.iceConnectionState });
8404
- if (pc.iceConnectionState === 'disconnected') {
8405
- this.eventEmitter.emit(ON_DISCONNECTED);
8406
- }
8407
- };
8404
+ if (pc) {
8405
+ pc.oniceconnectionstatechange = () => {
8406
+ logger$8.info('on ice connection state changed', { state: pc.iceConnectionState });
8407
+ if (pc.iceConnectionState === 'disconnected') {
8408
+ this.eventEmitter.emit(ON_DISCONNECTED$1);
8409
+ }
8410
+ };
8411
+ }
8408
8412
 
8409
8413
  if (withEvent) {
8410
8414
  this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
@@ -8573,10 +8577,10 @@ class WebRTCClient extends Emitter {
8573
8577
 
8574
8578
  _stopSendingStats(session ) {
8575
8579
  const sessionId = this.getSipSessionId(session);
8576
- logger$4.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
8580
+ logger$8.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
8577
8581
 
8578
8582
  if (sessionId in this.statsIntervals) {
8579
- logger$4.trace('Stop sending stats for call', { sessionId });
8583
+ logger$8.trace('Stop sending stats for call', { sessionId });
8580
8584
  this.statsIntervals[sessionId]();
8581
8585
  delete this.statsIntervals[sessionId];
8582
8586
  }
@@ -8592,7 +8596,7 @@ class WebRTCClient extends Emitter {
8592
8596
  try {
8593
8597
  await this.userAgent.transport.disconnect();
8594
8598
  } catch (e) {
8595
- logger$4.error('WebRTC transport disconnect, error', e);
8599
+ logger$8.error('WebRTC transport disconnect, error', e);
8596
8600
  }
8597
8601
  }
8598
8602
  }
@@ -8614,13 +8618,17 @@ class WebRTCClient extends Emitter {
8614
8618
  const nbStats = this.sessionNetworkStats[sessionId].length;
8615
8619
  const lastNetworkStats = this.sessionNetworkStats[sessionId][nbStats - 1];
8616
8620
  const lastAudioSent = lastNetworkStats ? lastNetworkStats.audioBytesSent : 0;
8621
+ const lastAudioContentSent = lastNetworkStats ? lastNetworkStats.audioContentSent : 0;
8617
8622
  const lastVideoSent = lastNetworkStats ? lastNetworkStats.videoBytesSent : 0;
8618
8623
  const lastAudioReceived = lastNetworkStats ? lastNetworkStats.audioBytesReceived : 0;
8624
+ const lastAudioContentReceived = lastNetworkStats ? lastNetworkStats.audioContentReceived : 0;
8619
8625
  const lastVideoReceived = lastNetworkStats ? lastNetworkStats.videoBytesReceived : 0;
8620
8626
  const lastTransportSent = lastNetworkStats ? lastNetworkStats.transportSent : 0;
8621
8627
  const lastTransportReceived = lastNetworkStats ? lastNetworkStats.transportReceived : 0;
8622
- let audioBytesSent = 0;
8623
- let audioBytesReceived = 0;
8628
+ let audioBytesSent = 0; // content + header
8629
+ let audioBytesReceived = 0; // content + header
8630
+ let audioContentSent = 0; // useful to detect blank call
8631
+ let audioContentReceived = 0;
8624
8632
  let videoBytesSent = 0;
8625
8633
  let videoBytesReceived = 0;
8626
8634
  let transportSent = 0;
@@ -8630,6 +8638,7 @@ class WebRTCClient extends Emitter {
8630
8638
  stats.forEach(report => {
8631
8639
  if (report.type === 'outbound-rtp' && report.kind === 'audio') {
8632
8640
  audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
8641
+ audioContentSent += Number(report.bytesSent);
8633
8642
  }
8634
8643
  if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
8635
8644
  audioBytesSent += Number(report.bytesSent);
@@ -8641,6 +8650,7 @@ class WebRTCClient extends Emitter {
8641
8650
  packetsLost += Number(report.packetsLost);
8642
8651
  networkStats.packetsReceived = Number(report.packetsReceived);
8643
8652
  audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
8653
+ audioContentReceived += Number(report.bytesReceived);
8644
8654
  }
8645
8655
  if (report.type === 'inbound-rtp' && report.kind === 'video') {
8646
8656
  videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
@@ -8669,10 +8679,17 @@ class WebRTCClient extends Emitter {
8669
8679
  });
8670
8680
 
8671
8681
  networkStats.packetsLost = packetsLost;
8682
+
8672
8683
  networkStats.totalAudioBytesSent = audioBytesSent;
8673
8684
  networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
8674
8685
  networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
8675
8686
  networkStats.audioBytesReceived = audioBytesReceived;
8687
+
8688
+ networkStats.totalAudioContentSent = audioContentSent;
8689
+ networkStats.audioContentSent = audioContentSent - lastAudioContentSent;
8690
+ networkStats.totalAudioBytesReceived = audioContentReceived - lastAudioContentReceived;
8691
+ networkStats.audioContentReceived = audioContentReceived;
8692
+
8676
8693
  networkStats.totalVideoBytesSent = videoBytesSent;
8677
8694
  networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
8678
8695
  networkStats.totalVideoBytesReceived = videoBytesReceived;
@@ -8686,7 +8703,7 @@ class WebRTCClient extends Emitter {
8686
8703
  + networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
8687
8704
  + networkStats.transportSent;
8688
8705
 
8689
- this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
8706
+ this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
8690
8707
  this.sessionNetworkStats[sessionId].push(networkStats);
8691
8708
  }
8692
8709
 
@@ -8714,8 +8731,8 @@ const ON_CALL_FAILED = 'onCallFailed';
8714
8731
  const ON_CALL_ENDED = 'onCallEnded';
8715
8732
  const ON_CALL_ENDING = 'onCallEnding';
8716
8733
  const ON_MESSAGE = 'onMessage';
8717
- const ON_REINVITE$1 = 'reinvite';
8718
- const ON_TRACK$1 = 'onTrack';
8734
+ const ON_REINVITE = 'reinvite';
8735
+ const ON_TRACK = 'onTrack';
8719
8736
  const ON_AUDIO_STREAM = 'onAudioStream';
8720
8737
  const ON_VIDEO_STREAM = 'onVideoStream';
8721
8738
  const ON_REMOVE_STREAM = 'onRemoveStream';
@@ -8730,15 +8747,15 @@ const ON_PLAY_PROGRESS_SOUND = 'playProgressSound';
8730
8747
  const ON_VIDEO_INPUT_CHANGE = 'videoInputChange';
8731
8748
  const ON_CALL_ERROR = 'onCallError';
8732
8749
  const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
8733
- const ON_NETWORK_STATS$1 = 'onNetworkStats';
8750
+ const ON_NETWORK_STATS = 'onNetworkStats';
8734
8751
  const ON_CHAT = 'phone/ON_CHAT';
8735
8752
  const ON_SIGNAL = 'phone/ON_SIGNAL';
8736
- const ON_DISCONNECTED$1 = 'onDisconnected';
8753
+ const ON_DISCONNECTED = 'onDisconnected';
8737
8754
 
8738
8755
  const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
8739
8756
  const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
8740
8757
 
8741
- const events$1 = [
8758
+ const events = [
8742
8759
  ON_USER_AGENT,
8743
8760
  ON_REGISTERED,
8744
8761
  ON_UNREGISTERED,
@@ -8756,8 +8773,8 @@ const events$1 = [
8756
8773
  ON_CALL_FAILED,
8757
8774
  ON_CALL_ENDED,
8758
8775
  ON_MESSAGE,
8759
- ON_REINVITE$1,
8760
- ON_TRACK$1,
8776
+ ON_REINVITE,
8777
+ ON_TRACK,
8761
8778
  ON_AUDIO_STREAM,
8762
8779
  ON_VIDEO_STREAM,
8763
8780
  ON_REMOVE_STREAM,
@@ -8772,11 +8789,11 @@ const events$1 = [
8772
8789
  ON_CALL_ERROR,
8773
8790
  ON_CHAT,
8774
8791
  ON_SIGNAL,
8775
- ON_NETWORK_STATS$1,
8776
- ON_DISCONNECTED$1,
8792
+ ON_NETWORK_STATS,
8793
+ ON_DISCONNECTED,
8777
8794
  ];
8778
8795
 
8779
- const logger$5 = IssueReporter$1.loggerFor('webrtc-phone');
8796
+ const logger$7 = IssueReporter$1.loggerFor('webrtc-phone');
8780
8797
 
8781
8798
  class WebRTCPhone extends Emitter {
8782
8799
 
@@ -8849,7 +8866,7 @@ class WebRTCPhone extends Emitter {
8849
8866
  }).catch(error => {
8850
8867
  // Avoid exception on `t.server.scheme` in sip transport when losing the webrtc socket connection
8851
8868
  console.error('register error', error, error.message, error.stack);
8852
- logger$5.error('WebRTC register error', { message: error.message, stack: error.stack });
8869
+ logger$7.error('WebRTC register error', { message: error.message, stack: error.stack });
8853
8870
  });
8854
8871
  }
8855
8872
 
@@ -8864,7 +8881,7 @@ class WebRTCPhone extends Emitter {
8864
8881
  if (!this.client) {
8865
8882
  return;
8866
8883
  }
8867
- logger$5.info('WebRTC phone stop');
8884
+ logger$7.info('WebRTC phone stop');
8868
8885
  this.client.stop();
8869
8886
  }
8870
8887
 
@@ -8879,11 +8896,12 @@ class WebRTCPhone extends Emitter {
8879
8896
  async sendReinvite(callSession , constraints = null, conference = false,
8880
8897
  audioOnly = false, iceRestart = false) {
8881
8898
  const sipSession = this.findSipSession(callSession);
8882
- logger$5.info('WebRTC phone - send reinvite', {
8899
+ logger$7.info('WebRTC phone - send reinvite', {
8883
8900
  sessionId: sipSession ? sipSession.id : null,
8884
8901
  constraints,
8885
8902
  audioOnly,
8886
8903
  conference,
8904
+ iceRestart,
8887
8905
  });
8888
8906
 
8889
8907
  if (!sipSession) {
@@ -8916,7 +8934,7 @@ class WebRTCPhone extends Emitter {
8916
8934
  }
8917
8935
 
8918
8936
  startHeartbeat() {
8919
- logger$5.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
8937
+ logger$7.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
8920
8938
  if (!this.client || this.client.hasHeartbeat()) {
8921
8939
  return;
8922
8940
  }
@@ -8925,7 +8943,7 @@ class WebRTCPhone extends Emitter {
8925
8943
  }
8926
8944
 
8927
8945
  stopHeartbeat() {
8928
- logger$5.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
8946
+ logger$7.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
8929
8947
  if (!this.client) {
8930
8948
  return;
8931
8949
  }
@@ -8942,7 +8960,7 @@ class WebRTCPhone extends Emitter {
8942
8960
  }
8943
8961
 
8944
8962
  reconnect() {
8945
- logger$5.info('WebRTC phone - reconnect', { client: !!this.client });
8963
+ logger$7.info('WebRTC phone - reconnect', { client: !!this.client });
8946
8964
  if (!this.client) {
8947
8965
  return;
8948
8966
  }
@@ -8983,7 +9001,7 @@ class WebRTCPhone extends Emitter {
8983
9001
  return false;
8984
9002
  }
8985
9003
 
8986
- logger$5.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
9004
+ logger$7.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
8987
9005
 
8988
9006
  this.client.downgradeToAudio(sipSession);
8989
9007
 
@@ -9006,7 +9024,7 @@ class WebRTCPhone extends Emitter {
9006
9024
  return Promise.resolve(false);
9007
9025
  }
9008
9026
 
9009
- logger$5.info('Upgrade to video', {
9027
+ logger$7.info('Upgrade to video', {
9010
9028
  id: callSession ? callSession.getId() : null,
9011
9029
  constraints,
9012
9030
  isConference,
@@ -9046,7 +9064,7 @@ class WebRTCPhone extends Emitter {
9046
9064
 
9047
9065
  _sendReinviteMessage(callSession , isUpgrade ) {
9048
9066
  const sipSession = this.findSipSession(callSession);
9049
- logger$5.info('Sending reinvite message', {
9067
+ logger$7.info('Sending reinvite message', {
9050
9068
  id: callSession ? callSession.getId() : null,
9051
9069
  isUpgrade,
9052
9070
  });
@@ -9072,7 +9090,7 @@ class WebRTCPhone extends Emitter {
9072
9090
  // Monkey patch to know when canceled with the CANCEL message
9073
9091
  const onCancel = sipSession._onCancel.bind(sipSession);
9074
9092
  sipSession._onCancel = (message ) => {
9075
- logger$5.trace('on sip session canceled', { callId: message.callId });
9093
+ logger$7.trace('on sip session canceled', { callId: message.callId });
9076
9094
 
9077
9095
  onCancel(message);
9078
9096
  const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
@@ -9100,13 +9118,13 @@ class WebRTCPhone extends Emitter {
9100
9118
  this.audioOutputVolume,
9101
9119
  );
9102
9120
  case sessionState.SessionState.Terminating:
9103
- logger$5.info('WebRTC phone - call terminating', { sipId: sipSession.id });
9121
+ logger$7.info('WebRTC phone - call terminating', { sipId: sipSession.id });
9104
9122
 
9105
9123
  this.eventEmitter.emit(ON_CALL_ENDING, this._createCallSession(sipSession));
9106
9124
 
9107
9125
  break;
9108
9126
  case sessionState.SessionState.Terminated: {
9109
- logger$5.info('WebRTC phone - call terminated', { sipId: sipSession.id });
9127
+ logger$7.info('WebRTC phone - call terminated', { sipId: sipSession.id });
9110
9128
 
9111
9129
  // Should be called before `_onCallTerminated` or the callCount will not decrement...
9112
9130
  const callSession = this._createCallSession(sipSession);
@@ -9128,7 +9146,7 @@ class WebRTCPhone extends Emitter {
9128
9146
  const [stream] = event.streams;
9129
9147
  const kind = event && event.track && event.track.kind;
9130
9148
 
9131
- logger$5.info('on track stream called on the peer connection', {
9149
+ logger$7.info('on track stream called on the peer connection', {
9132
9150
  callId: this.getSipSessionId(sipSession),
9133
9151
  streamId: stream ? stream.id : null,
9134
9152
  tracks: stream ? stream.getTracks() : null,
@@ -9148,7 +9166,7 @@ class WebRTCPhone extends Emitter {
9148
9166
  };
9149
9167
 
9150
9168
  peerConnection.onremovestream = event => {
9151
- logger$5.info('on remove stream called on the peer connection', {
9169
+ logger$7.info('on remove stream called on the peer connection', {
9152
9170
  id: event.stream.id,
9153
9171
  tracks: event.stream.getTracks(),
9154
9172
  });
@@ -9158,7 +9176,7 @@ class WebRTCPhone extends Emitter {
9158
9176
  }
9159
9177
 
9160
9178
  async startScreenSharing(constraints , callSession ) {
9161
- logger$5.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
9179
+ logger$7.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
9162
9180
 
9163
9181
  const screenShareStream = await this.client.getStreamFromConstraints(constraints);
9164
9182
  if (!screenShareStream) {
@@ -9198,7 +9216,7 @@ class WebRTCPhone extends Emitter {
9198
9216
  return;
9199
9217
  }
9200
9218
 
9201
- logger$5.info('WebRTC phone - stop screen sharing', {
9219
+ logger$7.info('WebRTC phone - stop screen sharing', {
9202
9220
  restoreLocalStream,
9203
9221
  });
9204
9222
 
@@ -9254,7 +9272,7 @@ class WebRTCPhone extends Emitter {
9254
9272
  const pc = this.client.getPeerConnection(sipSessionId);
9255
9273
  const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
9256
9274
 
9257
- logger$5.info('WebRTC phone - on screensharing', {
9275
+ logger$7.info('WebRTC phone - on screensharing', {
9258
9276
  hadVideo,
9259
9277
  id: this.getSipSessionId(sipSession),
9260
9278
  screenTrack,
@@ -9262,7 +9280,7 @@ class WebRTCPhone extends Emitter {
9262
9280
 
9263
9281
  if (screenTrack) {
9264
9282
  screenTrack.onended = () => {
9265
- logger$5.info('WebRTC phone - on screenshare ended', {
9283
+ logger$7.info('WebRTC phone - on screenshare ended', {
9266
9284
  hadVideo,
9267
9285
  id: this.getSipSessionId(sipSession),
9268
9286
  screenTrack,
@@ -9293,7 +9311,7 @@ class WebRTCPhone extends Emitter {
9293
9311
  }
9294
9312
 
9295
9313
  _onCallAccepted(sipSession , cameraEnabled ) {
9296
- logger$5.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
9314
+ logger$7.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
9297
9315
 
9298
9316
  const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
9299
9317
  this.currentSipSession = sipSession;
@@ -9311,7 +9329,7 @@ class WebRTCPhone extends Emitter {
9311
9329
  }
9312
9330
 
9313
9331
  changeAudioDevice(id ) {
9314
- logger$5.info('WebRTC phone - change audio device', { deviceId: id });
9332
+ logger$7.info('WebRTC phone - change audio device', { deviceId: id });
9315
9333
  this.audioOutputDeviceId = id;
9316
9334
  this.client.changeAudioOutputDevice(id);
9317
9335
  }
@@ -9321,14 +9339,14 @@ class WebRTCPhone extends Emitter {
9321
9339
  }
9322
9340
 
9323
9341
  changeRingDevice(id ) {
9324
- logger$5.info('WebRTC phone - changing ring device', { id });
9342
+ logger$7.info('WebRTC phone - changing ring device', { id });
9325
9343
 
9326
9344
  this.audioRingDeviceId = id;
9327
9345
  }
9328
9346
 
9329
9347
  // volume is a value between 0 and 1
9330
9348
  changeAudioVolume(volume ) {
9331
- logger$5.info('WebRTC phone - changing audio volume', { volume });
9349
+ logger$7.info('WebRTC phone - changing audio volume', { volume });
9332
9350
 
9333
9351
  this.audioOutputVolume = volume;
9334
9352
  this.client.changeAudioOutputVolume(volume);
@@ -9336,31 +9354,31 @@ class WebRTCPhone extends Emitter {
9336
9354
 
9337
9355
  // volume is a value between 0 and 1
9338
9356
  changeRingVolume(volume ) {
9339
- logger$5.info('WebRTC phone - changing ring volume', { volume });
9357
+ logger$7.info('WebRTC phone - changing ring volume', { volume });
9340
9358
 
9341
9359
  this.audioRingVolume = volume;
9342
9360
  }
9343
9361
 
9344
9362
  changeAudioInputDevice(id ) {
9345
- logger$5.info('WebRTC phone - changeAudio input device', { deviceId: id });
9363
+ logger$7.info('WebRTC phone - changeAudio input device', { deviceId: id });
9346
9364
 
9347
9365
  return this.client.changeAudioInputDevice(id, this.currentSipSession);
9348
9366
  }
9349
9367
 
9350
9368
  changeVideoInputDevice(id ) {
9351
- logger$5.info('WebRTC phone - change video input device', { deviceId: id });
9369
+ logger$7.info('WebRTC phone - change video input device', { deviceId: id });
9352
9370
 
9353
9371
  return this.client.changeVideoInputDevice(id, this.currentSipSession);
9354
9372
  }
9355
9373
 
9356
9374
  changeSessionVideoInputDevice(id ) {
9357
- logger$5.info('WebRTC phone - change session video input device', { deviceId: id });
9375
+ logger$7.info('WebRTC phone - change session video input device', { deviceId: id });
9358
9376
 
9359
9377
  return this.client.changeSessionVideoInputDevice(id, this.currentSipSession);
9360
9378
  }
9361
9379
 
9362
9380
  _onCallTerminated(sipSession ) {
9363
- logger$5.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9381
+ logger$7.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9364
9382
 
9365
9383
  const callSession = this._createCallSession(sipSession);
9366
9384
  const isCurrentSession = this.isCurrentCallSipSession(callSession);
@@ -9394,7 +9412,7 @@ class WebRTCPhone extends Emitter {
9394
9412
  const hasIncomingCallSession = this.hasIncomingCallSession();
9395
9413
 
9396
9414
  // Re-trigger incoming call event for remaining incoming calls
9397
- logger$5.info('WebRTC phone - check to re-trigger incoming call', {
9415
+ logger$7.info('WebRTC phone - check to re-trigger incoming call', {
9398
9416
  sipId: sipSession.id,
9399
9417
  shouldRetrigger,
9400
9418
  hasIncomingCallSession,
@@ -9485,37 +9503,37 @@ class WebRTCPhone extends Emitter {
9485
9503
 
9486
9504
  // Deprecated
9487
9505
  getLocalStreamForCall(callSession ) {
9488
- logger$5.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
9506
+ logger$7.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
9489
9507
 
9490
9508
  return this.getLocalStream(callSession);
9491
9509
  }
9492
9510
 
9493
9511
  // Deprecated
9494
9512
  getRemoteStreamForCall(callSession ) {
9495
- logger$5.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
9513
+ logger$7.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
9496
9514
 
9497
9515
  return this.getRemoteVideoStream(callSession);
9498
9516
  }
9499
9517
 
9500
9518
  getRemoteStreamsForCall(callSession ) {
9501
- logger$5.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
9519
+ logger$7.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
9502
9520
 
9503
9521
  return this.getRemoteStream(callSession);
9504
9522
  }
9505
9523
 
9506
9524
  accept(callSession , cameraEnabled ) {
9507
- logger$5.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
9525
+ logger$7.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
9508
9526
  if (this.currentSipSession) {
9509
9527
  this.holdSipSession(this.currentSipSession, this.currentCallSession, true);
9510
9528
  }
9511
9529
 
9512
9530
  if (!callSession) {
9513
- logger$5.warn('no CallSession to accept.');
9531
+ logger$7.warn('no CallSession to accept.');
9514
9532
  return Promise.resolve(null);
9515
9533
  }
9516
9534
 
9517
9535
  if (callSession.getId() in this.acceptedSessions) {
9518
- logger$5.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
9536
+ logger$7.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
9519
9537
  return Promise.resolve(callSession.sipCallId);
9520
9538
  }
9521
9539
 
@@ -9527,24 +9545,24 @@ class WebRTCPhone extends Emitter {
9527
9545
  const sipSession = this.client.getSipSession(callSession.getId());
9528
9546
  if (sipSession) {
9529
9547
  if (sipSession.state === sessionState.SessionState.Terminated || sipSession.state === sessionState.SessionState.Terminating) {
9530
- logger$5.warn('Trying to answer a terminated sipSession.');
9548
+ logger$7.warn('Trying to answer a terminated sipSession.');
9531
9549
 
9532
9550
  return Promise.resolve(null);
9533
9551
  }
9534
9552
 
9535
- logger$5.info('accept call, session found', { sipId: sipSession.id });
9553
+ logger$7.info('accept call, session found', { sipId: sipSession.id });
9536
9554
 
9537
9555
  // $FlowFixMe
9538
9556
  return this.client.answer(sipSession, this.allowVideo ? cameraEnabled : false).then(() => {
9539
9557
  return callSession.sipCallId;
9540
9558
  }).catch(e => {
9541
- logger$5.error(e);
9559
+ logger$7.error(e);
9542
9560
  this.endCurrentCall(callSession);
9543
9561
  throw e;
9544
9562
  });
9545
9563
  }
9546
9564
 
9547
- logger$5.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
9565
+ logger$7.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
9548
9566
 
9549
9567
  return Promise.resolve(null);
9550
9568
  }
@@ -9554,7 +9572,7 @@ class WebRTCPhone extends Emitter {
9554
9572
  }
9555
9573
 
9556
9574
  async reject(callSession ) {
9557
- logger$5.info('reject WebRTC called', { id: callSession.getId() });
9575
+ logger$7.info('reject WebRTC called', { id: callSession.getId() });
9558
9576
 
9559
9577
  this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'call rejected locally');
9560
9578
  if (!callSession || callSession.getId() in this.rejectedSessions) {
@@ -9566,14 +9584,14 @@ class WebRTCPhone extends Emitter {
9566
9584
 
9567
9585
  const sipSession = this.findSipSession(callSession);
9568
9586
  if (sipSession) {
9569
- logger$5.info('WebRTC rejecting', { sipId: sipSession.id });
9587
+ logger$7.info('WebRTC rejecting', { sipId: sipSession.id });
9570
9588
 
9571
9589
  this.client.hangup(sipSession);
9572
9590
  }
9573
9591
  }
9574
9592
 
9575
9593
  async ignore(callSession ) {
9576
- logger$5.info('WebRTC ignore', { id: callSession.getId() });
9594
+ logger$7.info('WebRTC ignore', { id: callSession.getId() });
9577
9595
 
9578
9596
  // kill the ring
9579
9597
  this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'ignoring call');
@@ -9585,14 +9603,14 @@ class WebRTCPhone extends Emitter {
9585
9603
  const sipSession = this.findSipSession(callSession);
9586
9604
 
9587
9605
  if (sipSession) {
9588
- logger$5.info('WebRTC atxfer', { sipId: sipSession.id });
9606
+ logger$7.info('WebRTC atxfer', { sipId: sipSession.id });
9589
9607
 
9590
9608
  return this.client.atxfer(sipSession);
9591
9609
  }
9592
9610
  }
9593
9611
 
9594
9612
  hold(callSession , withEvent = true, isConference = false) {
9595
- logger$5.info('WebRTC hold', { id: callSession.getId() });
9613
+ logger$7.info('WebRTC hold', { id: callSession.getId() });
9596
9614
 
9597
9615
  const sipSession = this.findSipSession(callSession);
9598
9616
 
@@ -9607,18 +9625,18 @@ class WebRTCPhone extends Emitter {
9607
9625
  }
9608
9626
 
9609
9627
  resume(callSession , isConference = false, withEvent = true) {
9610
- logger$5.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
9628
+ logger$7.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
9611
9629
 
9612
9630
  const sipSession = this.findSipSession(callSession);
9613
9631
  if (!sipSession) {
9614
9632
  return new Promise((resolve, reject) => reject(new Error('No session to resume')));
9615
9633
  }
9616
9634
 
9617
- logger$5.info('WebRTC resuming', { sipId: sipSession.id });
9635
+ logger$7.info('WebRTC resuming', { sipId: sipSession.id });
9618
9636
 
9619
9637
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
9620
9638
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
9621
- logger$5.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9639
+ logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9622
9640
  this.holdSipSession(this.currentSipSession, callSession);
9623
9641
  }
9624
9642
 
@@ -9643,7 +9661,7 @@ class WebRTCPhone extends Emitter {
9643
9661
  const sessionId = this.getSipSessionId(sipSession);
9644
9662
  const hasVideo = this.client.hasLocalVideo(sessionId);
9645
9663
 
9646
- logger$5.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
9664
+ logger$7.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
9647
9665
 
9648
9666
  // Stop screenshre if needed
9649
9667
  if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
@@ -9674,7 +9692,7 @@ class WebRTCPhone extends Emitter {
9674
9692
  return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
9675
9693
  }
9676
9694
  const sessionId = this.getSipSessionId(sipSession);
9677
- logger$5.info('WebRTC unhold sip session', { sessionId, isConference });
9695
+ logger$7.info('WebRTC unhold sip session', { sessionId, isConference });
9678
9696
 
9679
9697
  const { hasVideo } = this.client.getHeldSession(sessionId) || {};
9680
9698
  const wasScreensharing = this.lastScreenShare && this.lastScreenShare.sipSessionId === sessionId;
@@ -9718,14 +9736,14 @@ class WebRTCPhone extends Emitter {
9718
9736
  }
9719
9737
 
9720
9738
  mute(callSession , withEvent = true) {
9721
- logger$5.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
9739
+ logger$7.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
9722
9740
 
9723
9741
  const sipSession = this.findSipSession(callSession);
9724
9742
  if (!sipSession) {
9725
9743
  return;
9726
9744
  }
9727
9745
 
9728
- logger$5.info('WebRTC muting', { sipId: sipSession.id });
9746
+ logger$7.info('WebRTC muting', { sipId: sipSession.id });
9729
9747
  this.client.mute(sipSession);
9730
9748
  const newCallSession = this._createCallSession(sipSession, callSession, { muted: true });
9731
9749
 
@@ -9739,14 +9757,14 @@ class WebRTCPhone extends Emitter {
9739
9757
  }
9740
9758
 
9741
9759
  unmute(callSession , withEvent = true) {
9742
- logger$5.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
9760
+ logger$7.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
9743
9761
 
9744
9762
  const sipSession = this.findSipSession(callSession);
9745
9763
  if (!sipSession) {
9746
9764
  return;
9747
9765
  }
9748
9766
 
9749
- logger$5.info('WebRTC unmuting', { sipId: sipSession.id });
9767
+ logger$7.info('WebRTC unmuting', { sipId: sipSession.id });
9750
9768
  this.client.unmute(sipSession);
9751
9769
  const newCallSession = this._createCallSession(sipSession, callSession, { muted: false });
9752
9770
 
@@ -9773,7 +9791,7 @@ class WebRTCPhone extends Emitter {
9773
9791
  if (!sipSession) {
9774
9792
  return;
9775
9793
  }
9776
- logger$5.info('WebRTC turn camera on', { sipId: sipSession.id });
9794
+ logger$7.info('WebRTC turn camera on', { sipId: sipSession.id });
9777
9795
 
9778
9796
  this.client.toggleCameraOn(sipSession);
9779
9797
 
@@ -9785,7 +9803,7 @@ class WebRTCPhone extends Emitter {
9785
9803
  if (!sipSession) {
9786
9804
  return;
9787
9805
  }
9788
- logger$5.info('WebRTC turn camera off', { sipId: sipSession.id });
9806
+ logger$7.info('WebRTC turn camera off', { sipId: sipSession.id });
9789
9807
 
9790
9808
  this.client.toggleCameraOff(sipSession);
9791
9809
  this.eventEmitter.emit(ON_CAMERA_DISABLED, this._createCameraDisabledCallSession(sipSession, callSession));
@@ -9797,7 +9815,7 @@ class WebRTCPhone extends Emitter {
9797
9815
  return;
9798
9816
  }
9799
9817
 
9800
- logger$5.info('WebRTC send key', { sipId: sipSession.id, tone });
9818
+ logger$7.info('WebRTC send key', { sipId: sipSession.id, tone });
9801
9819
  this.client.sendDTMF(sipSession, tone);
9802
9820
  }
9803
9821
 
@@ -9805,7 +9823,7 @@ class WebRTCPhone extends Emitter {
9805
9823
  // @TODO: line is not used here
9806
9824
  async makeCall(number , line , cameraEnabled ,
9807
9825
  audioOnly = false, conference = false) {
9808
- logger$5.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled });
9826
+ logger$7.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled, audioOnly, conference });
9809
9827
  if (!number) {
9810
9828
  return Promise.resolve(null);
9811
9829
  }
@@ -9815,7 +9833,7 @@ class WebRTCPhone extends Emitter {
9815
9833
  }
9816
9834
  if (this.currentSipSession) {
9817
9835
  this.holdSipSession(this.currentSipSession, this.currentCallSession, true).catch(e => {
9818
- logger$5.warn('Unable to hold current session when making another call', e);
9836
+ logger$7.warn('Unable to hold current session when making another call', e);
9819
9837
  });
9820
9838
  }
9821
9839
 
@@ -9825,7 +9843,7 @@ class WebRTCPhone extends Emitter {
9825
9843
  this._bindEvents(sipSession);
9826
9844
  } catch (error) {
9827
9845
  console.warn(error);
9828
- logger$5.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
9846
+ logger$7.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
9829
9847
  return Promise.resolve(null);
9830
9848
  }
9831
9849
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
@@ -9853,7 +9871,7 @@ class WebRTCPhone extends Emitter {
9853
9871
  return;
9854
9872
  }
9855
9873
 
9856
- logger$5.info('WebRTC transfer', { sipId: sipSession.id, target });
9874
+ logger$7.info('WebRTC transfer', { sipId: sipSession.id, target });
9857
9875
 
9858
9876
  this.client.transfer(sipSession, target);
9859
9877
  }
@@ -9862,7 +9880,7 @@ class WebRTCPhone extends Emitter {
9862
9880
  const sipSession = this.client.getSipSession(source.sipCallId);
9863
9881
  const sipSessionTarget = this.client.getSipSession(destination.sipCallId);
9864
9882
 
9865
- logger$5.info('WebRTC indirect transfer', {
9883
+ logger$7.info('WebRTC indirect transfer', {
9866
9884
  sipId: sipSession ? sipSession.id : null,
9867
9885
  target: sipSessionTarget ? sipSessionTarget.id : null,
9868
9886
  });
@@ -9901,7 +9919,7 @@ class WebRTCPhone extends Emitter {
9901
9919
  return false;
9902
9920
  }
9903
9921
 
9904
- logger$5.info('WebRTC hangup', { sipId: sipSession.id });
9922
+ logger$7.info('WebRTC hangup', { sipId: sipSession.id });
9905
9923
 
9906
9924
  const sipSessionId = this.getSipSessionId(sipSession);
9907
9925
 
@@ -9947,7 +9965,7 @@ class WebRTCPhone extends Emitter {
9947
9965
  endCurrentCall(callSession ) {
9948
9966
  const isCurrent = this.isCurrentCallSipSession(callSession);
9949
9967
 
9950
- logger$5.info('Ending current call', {
9968
+ logger$7.info('Ending current call', {
9951
9969
  id: callSession ? callSession.getId() : null,
9952
9970
  isCurrent,
9953
9971
  });
@@ -9971,7 +9989,7 @@ class WebRTCPhone extends Emitter {
9971
9989
  }
9972
9990
 
9973
9991
  async close() {
9974
- logger$5.info('WebRTC close');
9992
+ logger$7.info('WebRTC close');
9975
9993
 
9976
9994
  try {
9977
9995
  await Promise.race([
@@ -9979,7 +9997,7 @@ class WebRTCPhone extends Emitter {
9979
9997
  new Promise((resolve, reject) => setTimeout(() => reject(new Error('Unregister, timed out')), 3000)),
9980
9998
  ]);
9981
9999
  } catch (e) {
9982
- logger$5.error('WebRTC close, unregister error', e);
10000
+ logger$7.error('WebRTC close, unregister error', e);
9983
10001
  }
9984
10002
 
9985
10003
  this.client.close();
@@ -9997,12 +10015,12 @@ class WebRTCPhone extends Emitter {
9997
10015
  }
9998
10016
 
9999
10017
  enableRinging() {
10000
- logger$5.info('WebRTC enable ringing');
10018
+ logger$7.info('WebRTC enable ringing');
10001
10019
  this.ringingEnabled = true;
10002
10020
  }
10003
10021
 
10004
10022
  disableRinging() {
10005
- logger$5.info('WebRTC disable ringing');
10023
+ logger$7.info('WebRTC disable ringing');
10006
10024
  this.ringingEnabled = false;
10007
10025
  }
10008
10026
 
@@ -10042,7 +10060,7 @@ class WebRTCPhone extends Emitter {
10042
10060
 
10043
10061
  // Deprecated
10044
10062
  getLocalMediaStream(callSession ) {
10045
- logger$5.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
10063
+ logger$7.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
10046
10064
  return this.getLocalStream(callSession);
10047
10065
  }
10048
10066
 
@@ -10084,7 +10102,7 @@ class WebRTCPhone extends Emitter {
10084
10102
  this.client.on(this.client.INVITE, (sipSession , wantsToDoVideo ) => {
10085
10103
  const autoAnswer = sipSession.request.getHeader('Answer-Mode') === 'Auto';
10086
10104
  const withVideo = this.allowVideo ? wantsToDoVideo : false;
10087
- logger$5.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
10105
+ logger$7.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
10088
10106
 
10089
10107
  const callSession = this._createIncomingCallSession(sipSession, withVideo, null, autoAnswer);
10090
10108
  this.incomingSessions.push(callSession.getId());
@@ -10107,7 +10125,7 @@ class WebRTCPhone extends Emitter {
10107
10125
  });
10108
10126
 
10109
10127
  this.client.on(this.client.ON_REINVITE, (...args) => {
10110
- logger$5.info('WebRTC on reinvite', {
10128
+ logger$7.info('WebRTC on reinvite', {
10111
10129
  sessionId: args[0].id,
10112
10130
  inviteId: args[1].id,
10113
10131
  updatedCalleeName: args[2],
@@ -10127,7 +10145,7 @@ class WebRTCPhone extends Emitter {
10127
10145
  });
10128
10146
 
10129
10147
  this.client.on(this.client.ACCEPTED, (sipSession ) => {
10130
- logger$5.info('WebRTC call accepted', { sipId: sipSession.id });
10148
+ logger$7.info('WebRTC call accepted', { sipId: sipSession.id });
10131
10149
 
10132
10150
  this._onCallAccepted(sipSession, this.client.hasVideo(this.getSipSessionId(sipSession)));
10133
10151
 
@@ -10138,22 +10156,22 @@ class WebRTCPhone extends Emitter {
10138
10156
  this.client.on('ended', () => {});
10139
10157
 
10140
10158
  this.client.on(this.client.ON_ERROR, e => {
10141
- logger$5.error('WebRTC error', e);
10159
+ logger$7.error('WebRTC error', e);
10142
10160
  this.eventEmitter.emit(ON_CALL_ERROR, e);
10143
10161
  });
10144
10162
 
10145
10163
  this.client.on(this.client.UNREGISTERED, () => {
10146
- logger$5.info('WebRTC unregistered');
10164
+ logger$7.info('WebRTC unregistered');
10147
10165
  this.eventEmitter.emit(ON_UNREGISTERED);
10148
10166
  });
10149
10167
 
10150
10168
  this.client.on(this.client.ON_DISCONNECTED, () => {
10151
- logger$5.info('WebRTC disconnected');
10152
- this.eventEmitter.emit(ON_DISCONNECTED$1);
10169
+ logger$7.info('WebRTC disconnected');
10170
+ this.eventEmitter.emit(ON_DISCONNECTED);
10153
10171
  });
10154
10172
 
10155
10173
  this.client.on(this.client.REGISTERED, () => {
10156
- logger$5.info('WebRTC registered', {
10174
+ logger$7.info('WebRTC registered', {
10157
10175
  shouldSendReinvite: this.shouldSendReinvite,
10158
10176
  state: this.currentSipSession ? this.currentSipSession.state : null,
10159
10177
  currentSipSession: !!this.currentSipSession,
@@ -10174,19 +10192,19 @@ class WebRTCPhone extends Emitter {
10174
10192
  // Send reinvite with iceRestart
10175
10193
  this.sendReinvite(this.currentCallSession, null, isConference, !hasVideo, true);
10176
10194
  } catch (e) {
10177
- logger$5.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
10195
+ logger$7.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
10178
10196
  }
10179
10197
  }
10180
10198
  });
10181
10199
 
10182
10200
  this.client.on(this.client.CONNECTED, () => {
10183
- logger$5.info('WebRTC client connected');
10201
+ logger$7.info('WebRTC client connected');
10184
10202
 
10185
10203
  this.stopHeartbeat();
10186
10204
  });
10187
10205
 
10188
10206
  this.client.on(this.client.DISCONNECTED, () => {
10189
- logger$5.info('WebRTC client disconnected');
10207
+ logger$7.info('WebRTC client disconnected');
10190
10208
 
10191
10209
  this.eventEmitter.emit(ON_UNREGISTERED);
10192
10210
 
@@ -10200,7 +10218,7 @@ class WebRTCPhone extends Emitter {
10200
10218
  });
10201
10219
 
10202
10220
  this.client.on(this.client.ON_TRACK, (session, event) => {
10203
- this.eventEmitter.emit(ON_TRACK$1, session, event);
10221
+ this.eventEmitter.emit(ON_TRACK, session, event);
10204
10222
  });
10205
10223
 
10206
10224
  this.client.on('onVideoInputChange', stream => {
@@ -10215,7 +10233,7 @@ class WebRTCPhone extends Emitter {
10215
10233
  this.client.on(this.client.ON_NETWORK_STATS, (session, stats, previousStats) => {
10216
10234
  const callSession = this.getCallSession(this.getSipSessionId(session));
10217
10235
 
10218
- this.eventEmitter.emit(ON_NETWORK_STATS$1, callSession, stats, previousStats);
10236
+ this.eventEmitter.emit(ON_NETWORK_STATS, callSession, stats, previousStats);
10219
10237
  });
10220
10238
 
10221
10239
  // Used when upgrading directly in screenshare mode
@@ -10224,7 +10242,7 @@ class WebRTCPhone extends Emitter {
10224
10242
  const localStream = this.client.getLocalStream(sipSessionId);
10225
10243
  const callSession = this.callSessions[sipSessionId];
10226
10244
 
10227
- logger$5.info('Updrading directly in screensharing mode', {
10245
+ logger$7.info('Updrading directly in screensharing mode', {
10228
10246
  sipSessionId,
10229
10247
  tracks: localStream ? localStream.getTracks() : null,
10230
10248
  });
@@ -10402,8 +10420,8 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
10402
10420
  ON_CALL_ENDED: ON_CALL_ENDED,
10403
10421
  ON_CALL_ENDING: ON_CALL_ENDING,
10404
10422
  ON_MESSAGE: ON_MESSAGE,
10405
- ON_REINVITE: ON_REINVITE$1,
10406
- ON_TRACK: ON_TRACK$1,
10423
+ ON_REINVITE: ON_REINVITE,
10424
+ ON_TRACK: ON_TRACK,
10407
10425
  ON_AUDIO_STREAM: ON_AUDIO_STREAM,
10408
10426
  ON_VIDEO_STREAM: ON_VIDEO_STREAM,
10409
10427
  ON_REMOVE_STREAM: ON_REMOVE_STREAM,
@@ -10418,13 +10436,13 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
10418
10436
  ON_VIDEO_INPUT_CHANGE: ON_VIDEO_INPUT_CHANGE,
10419
10437
  ON_CALL_ERROR: ON_CALL_ERROR,
10420
10438
  ON_MESSAGE_TRACK_UPDATED: ON_MESSAGE_TRACK_UPDATED,
10421
- ON_NETWORK_STATS: ON_NETWORK_STATS$1,
10439
+ ON_NETWORK_STATS: ON_NETWORK_STATS,
10422
10440
  ON_CHAT: ON_CHAT,
10423
10441
  ON_SIGNAL: ON_SIGNAL,
10424
- ON_DISCONNECTED: ON_DISCONNECTED$1,
10442
+ ON_DISCONNECTED: ON_DISCONNECTED,
10425
10443
  MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
10426
10444
  MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
10427
- events: events$1,
10445
+ events: events,
10428
10446
  'default': WebRTCPhone
10429
10447
  });
10430
10448
 
@@ -10818,7 +10836,7 @@ class Phone extends Emitter {
10818
10836
 
10819
10837
  _transferEvents() {
10820
10838
  this.unbind();
10821
- [...events, ...transportEvents].forEach(event => {
10839
+ [...events$1, ...transportEvents].forEach(event => {
10822
10840
  this.client.on(event, (...args) =>
10823
10841
  this.eventEmitter.emit.apply(this.eventEmitter.emit, [`client-${event}`, ...args]));
10824
10842
  });
@@ -10840,7 +10858,7 @@ var Phone$1 = global.wazoTelephonyInstance;
10840
10858
 
10841
10859
  //
10842
10860
 
10843
- const SOCKET_EVENTS = {
10861
+ const SOCKET_EVENTS$1 = {
10844
10862
  ON_OPEN: 'onopen',
10845
10863
  ON_MESSAGE: 'onmessage',
10846
10864
  ON_ERROR: 'onerror',
@@ -10936,7 +10954,7 @@ const BLACKLIST_EVENTS = [
10936
10954
  ];
10937
10955
 
10938
10956
  const HEARTBEAT_ENGINE_VERSION = '20.09';
10939
- const logger$7 = IssueReporter$1.loggerFor('wazo-ws');
10957
+ const logger$5 = IssueReporter$1.loggerFor('wazo-ws');
10940
10958
  const messageLogger = IssueReporter$1.loggerFor('wazo-ws-message');
10941
10959
 
10942
10960
  class WebSocketClient extends Emitter {
@@ -10985,24 +11003,24 @@ class WebSocketClient extends Emitter {
10985
11003
  }
10986
11004
 
10987
11005
  connect() {
10988
- logger$7.info('connect method started', { host: this.host, token: this.token });
11006
+ logger$5.info('connect method started', { host: this.host, token: this.token });
10989
11007
  this.socket = new ReconnectingWebSocket__default['default'](this._getUrl.bind(this), [], this.options);
10990
11008
  if (this.options.binaryType) {
10991
11009
  this.socket.binaryType = this.options.binaryType;
10992
11010
  }
10993
11011
 
10994
11012
  this.socket.onopen = () => {
10995
- logger$7.info('on Wazo WS open', { method: 'connect', host: this.host });
10996
- this.eventEmitter.emit(SOCKET_EVENTS.ON_OPEN);
11013
+ logger$5.info('on Wazo WS open', { method: 'connect', host: this.host });
11014
+ this.eventEmitter.emit(SOCKET_EVENTS$1.ON_OPEN);
10997
11015
  };
10998
11016
 
10999
11017
  this.socket.onerror = event => {
11000
- logger$7.error('on Wazo WS error', event.target);
11001
- this.eventEmitter.emit(SOCKET_EVENTS.ON_ERROR, event);
11018
+ logger$5.error('on Wazo WS error', event.target);
11019
+ this.eventEmitter.emit(SOCKET_EVENTS$1.ON_ERROR, event);
11002
11020
  };
11003
11021
 
11004
11022
  this.socket.onmessage = (event ) => {
11005
- this.eventEmitter.emit(SOCKET_EVENTS.ON_MESSAGE, event.data);
11023
+ this.eventEmitter.emit(SOCKET_EVENTS$1.ON_MESSAGE, event.data);
11006
11024
 
11007
11025
  const message = JSON.parse(typeof event.data === 'string' ? event.data : '{}');
11008
11026
  let { name } = message;
@@ -11027,7 +11045,7 @@ class WebSocketClient extends Emitter {
11027
11045
 
11028
11046
  this.socket.onclose = event => {
11029
11047
  // Can't be converted to JSON (circular structure)
11030
- logger$7.info('on Wazo WS close', {
11048
+ logger$5.info('on Wazo WS close', {
11031
11049
  reason: event.reason,
11032
11050
  code: event.code,
11033
11051
  readyState: event.target.readyState,
@@ -11035,22 +11053,22 @@ class WebSocketClient extends Emitter {
11035
11053
  token: this.token,
11036
11054
  });
11037
11055
  this.initialized = false;
11038
- this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, event);
11056
+ this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, event);
11039
11057
 
11040
11058
  switch (event.code) {
11041
11059
  case 4002:
11042
- this.eventEmitter.emit(SOCKET_EVENTS.ON_AUTH_FAILED);
11060
+ this.eventEmitter.emit(SOCKET_EVENTS$1.ON_AUTH_FAILED);
11043
11061
  break;
11044
11062
  }
11045
11063
  };
11046
11064
 
11047
11065
  this.socket.onerror = event => {
11048
- logger$7.info('Wazo WS error', { message: event.message, code: event.code, readyState: event.target.readyState });
11066
+ logger$5.info('Wazo WS error', { message: event.message, code: event.code, readyState: event.target.readyState });
11049
11067
  };
11050
11068
  }
11051
11069
 
11052
11070
  close(force = false) {
11053
- logger$7.info('Wazo WS close', { socket: !!this.socket, host: this.host, token: this.token });
11071
+ logger$5.info('Wazo WS close', { socket: !!this.socket, host: this.host, token: this.token });
11054
11072
 
11055
11073
  if (!this.socket) {
11056
11074
  return;
@@ -11068,7 +11086,7 @@ class WebSocketClient extends Emitter {
11068
11086
 
11069
11087
  updateToken(token ) {
11070
11088
  this.token = token;
11071
- logger$7.info('Wazo WS updating token', { url: this._getUrl(), token, socket: !!this.socket });
11089
+ logger$5.info('Wazo WS updating token', { url: this._getUrl(), token, socket: !!this.socket });
11072
11090
 
11073
11091
  if (this.socket) {
11074
11092
  // If still connected, send the token to the WS
@@ -11086,7 +11104,7 @@ class WebSocketClient extends Emitter {
11086
11104
  }
11087
11105
 
11088
11106
  startHeartbeat() {
11089
- logger$7.info('Wazo WS start heartbeat', { host: this.host, token: this.token });
11107
+ logger$5.info('Wazo WS start heartbeat', { host: this.host, token: this.token });
11090
11108
 
11091
11109
  if (!this.socket) {
11092
11110
  this.heartbeat.stop();
@@ -11100,7 +11118,7 @@ class WebSocketClient extends Emitter {
11100
11118
  }
11101
11119
 
11102
11120
  stopHeartbeat() {
11103
- logger$7.info('Wazo WS stop heartbeat', { host: this.host, token: this.token });
11121
+ logger$5.info('Wazo WS stop heartbeat', { host: this.host, token: this.token });
11104
11122
 
11105
11123
  this.heartbeat.stop();
11106
11124
  }
@@ -11130,7 +11148,7 @@ class WebSocketClient extends Emitter {
11130
11148
  }
11131
11149
 
11132
11150
  reconnect(reason ) {
11133
- logger$7.info('Wazo WS reconnect', { reason, socket: !!this.socket, host: this.host, token: this.token });
11151
+ logger$5.info('Wazo WS reconnect', { reason, socket: !!this.socket, host: this.host, token: this.token });
11134
11152
  if (!this.socket) {
11135
11153
  return;
11136
11154
  }
@@ -11155,7 +11173,7 @@ class WebSocketClient extends Emitter {
11155
11173
  break;
11156
11174
  case 'start':
11157
11175
  this.initialized = true;
11158
- this.eventEmitter.emit(SOCKET_EVENTS.INITIALIZED);
11176
+ this.eventEmitter.emit(SOCKET_EVENTS$1.INITIALIZED);
11159
11177
  break;
11160
11178
  default:
11161
11179
  this.eventEmitter.emit('message', message);
@@ -11186,7 +11204,7 @@ class WebSocketClient extends Emitter {
11186
11204
  this.close();
11187
11205
  }
11188
11206
  const url = `wss://${this.host || ''}/api/websocketd/?token=${this.token || ''}&version=${this.version}`;
11189
- logger$7.log('Wazo WS url computed to reconnect', { url });
11207
+ logger$5.log('Wazo WS url computed to reconnect', { url });
11190
11208
 
11191
11209
  return url;
11192
11210
  }
@@ -11194,15 +11212,15 @@ class WebSocketClient extends Emitter {
11194
11212
  _onHeartbeat(message ) {
11195
11213
  if (message.payload === 'pong') {
11196
11214
  this.heartbeat.onHeartbeat();
11197
- logger$7.log('on heartbeat received from Wazo WS');
11215
+ logger$5.log('on heartbeat received from Wazo WS');
11198
11216
  }
11199
11217
  }
11200
11218
 
11201
11219
  async _onHeartbeatTimeout() {
11202
- logger$7.log('heartbeat timed out', { host: this.host, token: this.token });
11220
+ logger$5.log('heartbeat timed out', { host: this.host, token: this.token });
11203
11221
 
11204
11222
  this.close();
11205
- this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, new Error('Websocket ping failure.'));
11223
+ this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, new Error('Websocket ping failure.'));
11206
11224
 
11207
11225
  if (this.onHeartBeatTimeout) {
11208
11226
  this.onHeartBeatTimeout();
@@ -11282,7 +11300,7 @@ WebSocketClient.eventLists = [
11282
11300
 
11283
11301
  var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
11284
11302
  __proto__: null,
11285
- SOCKET_EVENTS: SOCKET_EVENTS,
11303
+ SOCKET_EVENTS: SOCKET_EVENTS$1,
11286
11304
  AUTH_SESSION_EXPIRE_SOON: AUTH_SESSION_EXPIRE_SOON,
11287
11305
  FAVORITE_ADDED: FAVORITE_ADDED,
11288
11306
  FAVORITE_DELETED: FAVORITE_DELETED,
@@ -11355,10 +11373,10 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
11355
11373
 
11356
11374
  //
11357
11375
 
11358
- const { SOCKET_EVENTS: SOCKET_EVENTS$1, ...OTHER_EVENTS } = WebSocketClient$1;
11359
- const ALL_EVENTS = [...Object.values(SOCKET_EVENTS$1), ...Object.values(OTHER_EVENTS)];
11376
+ const { SOCKET_EVENTS, ...OTHER_EVENTS } = WebSocketClient$1;
11377
+ const ALL_EVENTS = [...Object.values(SOCKET_EVENTS), ...Object.values(OTHER_EVENTS)];
11360
11378
 
11361
- const logger$8 = IssueReporter$1.loggerFor('simple-ws-client');
11379
+ const logger$4 = IssueReporter$1.loggerFor('simple-ws-client');
11362
11380
 
11363
11381
  class Websocket extends Emitter {
11364
11382
 
@@ -11372,9 +11390,9 @@ class Websocket extends Emitter {
11372
11390
  // $FlowFixMe
11373
11391
  this[key] = OTHER_EVENTS[key];
11374
11392
  });
11375
- Object.keys(SOCKET_EVENTS$1).forEach(key => {
11393
+ Object.keys(SOCKET_EVENTS).forEach(key => {
11376
11394
  // $FlowFixMe
11377
- this[key] = SOCKET_EVENTS$1[key];
11395
+ this[key] = SOCKET_EVENTS[key];
11378
11396
  });
11379
11397
  this.eventLists = WebSocketClient.eventLists;
11380
11398
 
@@ -11382,7 +11400,7 @@ class Websocket extends Emitter {
11382
11400
  }
11383
11401
 
11384
11402
  open(host , session ) {
11385
- logger$8.info('open simple WebSocket', { host, token: session.token });
11403
+ logger$4.info('open simple WebSocket', { host, token: session.token });
11386
11404
  this.ws = new WebSocketClient(
11387
11405
  {
11388
11406
  host,
@@ -11410,7 +11428,7 @@ class Websocket extends Emitter {
11410
11428
  }
11411
11429
 
11412
11430
  updateToken(token ) {
11413
- logger$8.info('update token via simple Websocket', { token, ws: !!this.ws });
11431
+ logger$4.info('update token via simple Websocket', { token, ws: !!this.ws });
11414
11432
 
11415
11433
  if (!this.ws) {
11416
11434
  return;
@@ -11438,7 +11456,7 @@ var Websocket$1 = global.wazoWebsocketInstance;
11438
11456
 
11439
11457
  //
11440
11458
 
11441
- const logger$9 = IssueReporter$1.loggerFor('room');
11459
+ const logger$3 = IssueReporter$1.loggerFor('room');
11442
11460
 
11443
11461
  class Participant extends Emitter {
11444
11462
 
@@ -11560,7 +11578,7 @@ class Participant extends Emitter {
11560
11578
  }
11561
11579
 
11562
11580
  onTalking(isTalking ) {
11563
- logger$9.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
11581
+ logger$3.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
11564
11582
  this.isTalking = isTalking;
11565
11583
  // you may notice we're not broadcasting: since all participants are getting this info
11566
11584
  // directly from asterisk, there's no need to do so
@@ -11663,7 +11681,7 @@ class Participant extends Emitter {
11663
11681
  }
11664
11682
 
11665
11683
  updateStatus(status , broadcast = true) {
11666
- logger$9.info('updating participant status', { name: this.name, status });
11684
+ logger$3.info('updating participant status', { name: this.name, status });
11667
11685
 
11668
11686
  if (typeof status.audioMuted !== 'undefined' && status.audioMuted !== this.audioMuted) {
11669
11687
  if (status.audioMuted) {
@@ -11711,7 +11729,7 @@ class Participant extends Emitter {
11711
11729
 
11712
11730
  broadcastStatus(inboundStatus = null) {
11713
11731
  const status = inboundStatus || this.getStatus();
11714
- logger$9.info('broadcasting participant status', { callId: this.callId, status });
11732
+ logger$3.info('broadcasting participant status', { callId: this.callId, status });
11715
11733
 
11716
11734
  this.room.sendSignal({
11717
11735
  type: SIGNAL_TYPE_PARTICIPANT_UPDATE,
@@ -11747,9 +11765,9 @@ class LocalParticipant extends Participant {
11747
11765
  const SIGNAL_TYPE_PARTICIPANT_UPDATE = 'signal/PARTICIPANT_UPDATE';
11748
11766
  const SIGNAL_TYPE_PARTICIPANT_REQUEST = 'signal/PARTICIPANT_REQUEST';
11749
11767
 
11750
- const logger$a = IssueReporter$1.loggerFor('sdk-room');
11768
+ const logger$2 = IssueReporter$1.loggerFor('sdk-room');
11751
11769
 
11752
- class Room extends Emitter {
11770
+ class Room$1 extends Emitter {
11753
11771
 
11754
11772
 
11755
11773
 
@@ -11807,7 +11825,7 @@ class Room extends Emitter {
11807
11825
  extra = {},
11808
11826
  ) {
11809
11827
  super();
11810
- logger$a.info('room initialized', { callId, extension, sourceId, meetingUuid });
11828
+ logger$2.info('room initialized', { callId, extension, sourceId, meetingUuid });
11811
11829
 
11812
11830
  // Represents the room callSession
11813
11831
  this.callSession = callSession;
@@ -11873,7 +11891,7 @@ class Room extends Emitter {
11873
11891
  * @returns {Promise<Room>}
11874
11892
  */
11875
11893
  static async connect({ extension, constraints, audioOnly = false, extra, room, meeting } ) {
11876
- logger$a.info('connecting to room', { extension, audioOnly, room: !!room });
11894
+ logger$2.info('connecting to room', { extension, audioOnly, room: !!room });
11877
11895
 
11878
11896
  if (!room) {
11879
11897
  await Wazo.Phone.connect();
@@ -11886,7 +11904,7 @@ class Room extends Emitter {
11886
11904
 
11887
11905
  // Call_created is triggered before call_accepted, so we have to listen for it here.
11888
11906
  Wazo.Websocket.once(Wazo.Websocket.CALL_CREATED, ({ data }) => {
11889
- logger$a.info('room call received via WS', { callId: data.call_id });
11907
+ logger$2.info('room call received via WS', { callId: data.call_id });
11890
11908
  if (room) {
11891
11909
  room.setCallId(data.call_id);
11892
11910
  }
@@ -11894,7 +11912,7 @@ class Room extends Emitter {
11894
11912
 
11895
11913
  const callSession = await Wazo.Phone.call(extension, withCamera, null, audioOnly, true);
11896
11914
  // eslint-disable-next-line no-param-reassign
11897
- room = new Room(callSession, extension, null, null, extra);
11915
+ room = new Room$1(callSession, extension, null, null, extra);
11898
11916
 
11899
11917
  // Wait for the call to be accepted
11900
11918
  await new Promise((resolve, reject) => {
@@ -11915,7 +11933,7 @@ class Room extends Emitter {
11915
11933
  // Retrieve conference
11916
11934
  const conference = contacts.find(contact => contact.numbers.find(number => number.number === extension));
11917
11935
 
11918
- logger$a.info('connected to room', {
11936
+ logger$2.info('connected to room', {
11919
11937
  sourceId: conference ? conference.sourceId : null,
11920
11938
  name: conference ? conference.name : null,
11921
11939
  });
@@ -11925,7 +11943,7 @@ class Room extends Emitter {
11925
11943
  room.setName(conference.name);
11926
11944
  }
11927
11945
  } else if (meeting) {
11928
- logger$a.info('Already connected to meeting', {
11946
+ logger$2.info('Already connected to meeting', {
11929
11947
  uuid: meeting.uuid,
11930
11948
  name: meeting.name,
11931
11949
  });
@@ -11938,13 +11956,13 @@ class Room extends Emitter {
11938
11956
  }
11939
11957
 
11940
11958
  static disconnect() {
11941
- logger$a.info('static disconnection to room');
11959
+ logger$2.info('static disconnection to room');
11942
11960
 
11943
11961
  Wazo.Phone.disconnect();
11944
11962
  }
11945
11963
 
11946
11964
  async disconnect() {
11947
- logger$a.info('disconnection to room called');
11965
+ logger$2.info('disconnection to room called');
11948
11966
 
11949
11967
  await Wazo.Phone.hangup(this.callSession);
11950
11968
  this.callSession = null;
@@ -11964,19 +11982,19 @@ class Room extends Emitter {
11964
11982
  }
11965
11983
 
11966
11984
  setSourceId(sourceId ) {
11967
- logger$a.info('set room source id', { sourceId });
11985
+ logger$2.info('set room source id', { sourceId });
11968
11986
 
11969
11987
  this.sourceId = sourceId;
11970
11988
  }
11971
11989
 
11972
11990
  setMeetingUuid(meetingUuid ) {
11973
- logger$a.info('set meeting uuid', { meetingUuid });
11991
+ logger$2.info('set meeting uuid', { meetingUuid });
11974
11992
 
11975
11993
  this.meetingUuid = meetingUuid;
11976
11994
  }
11977
11995
 
11978
11996
  setCallId(callId ) {
11979
- logger$a.info('set room call id', { callId });
11997
+ logger$2.info('set room call id', { callId });
11980
11998
 
11981
11999
  if (callId) {
11982
12000
  this.callId = callId;
@@ -11984,7 +12002,7 @@ class Room extends Emitter {
11984
12002
  }
11985
12003
 
11986
12004
  setName(name ) {
11987
- logger$a.info('set room name', { name });
12005
+ logger$2.info('set room name', { name });
11988
12006
 
11989
12007
  this.name = name;
11990
12008
  }
@@ -12003,7 +12021,7 @@ class Room extends Emitter {
12003
12021
  }
12004
12022
 
12005
12023
  async startScreenSharing(constraints ) {
12006
- logger$a.info('start room screen sharing', { constraints });
12024
+ logger$2.info('start room screen sharing', { constraints });
12007
12025
 
12008
12026
  const screensharingStream = await Wazo.Phone.startScreenSharing(constraints, this.callSession);
12009
12027
  if (!screensharingStream) {
@@ -12017,7 +12035,7 @@ class Room extends Emitter {
12017
12035
  }
12018
12036
 
12019
12037
  async stopScreenSharing(restoreLocalStream = true) {
12020
- logger$a.info('stop room screen sharing');
12038
+ logger$2.info('stop room screen sharing');
12021
12039
 
12022
12040
  await Wazo.Phone.stopScreenSharing(this.callSession, restoreLocalStream);
12023
12041
 
@@ -12029,7 +12047,7 @@ class Room extends Emitter {
12029
12047
  }
12030
12048
 
12031
12049
  turnCameraOff() {
12032
- logger$a.info('turn room camera off');
12050
+ logger$2.info('turn room camera off');
12033
12051
 
12034
12052
  Wazo.Phone.turnCameraOff(this.callSession);
12035
12053
 
@@ -12039,7 +12057,7 @@ class Room extends Emitter {
12039
12057
  }
12040
12058
 
12041
12059
  turnCameraOn() {
12042
- logger$a.info('turn room camera on');
12060
+ logger$2.info('turn room camera on');
12043
12061
 
12044
12062
  Wazo.Phone.turnCameraOn(this.callSession);
12045
12063
 
@@ -12049,7 +12067,7 @@ class Room extends Emitter {
12049
12067
  }
12050
12068
 
12051
12069
  mute() {
12052
- logger$a.info('mute room');
12070
+ logger$2.info('mute room');
12053
12071
 
12054
12072
  Wazo.Phone.mute(this.callSession);
12055
12073
 
@@ -12057,7 +12075,7 @@ class Room extends Emitter {
12057
12075
  }
12058
12076
 
12059
12077
  unmute() {
12060
- logger$a.info('unmute room');
12078
+ logger$2.info('unmute room');
12061
12079
 
12062
12080
  Wazo.Phone.unmute(this.callSession);
12063
12081
 
@@ -12077,7 +12095,7 @@ class Room extends Emitter {
12077
12095
  }
12078
12096
 
12079
12097
  hold() {
12080
- logger$a.info('hold room');
12098
+ logger$2.info('hold room');
12081
12099
 
12082
12100
  Wazo.Phone.hold(this.callSession, true);
12083
12101
 
@@ -12087,7 +12105,7 @@ class Room extends Emitter {
12087
12105
  }
12088
12106
 
12089
12107
  async resume() {
12090
- logger$a.info('resume room');
12108
+ logger$2.info('resume room');
12091
12109
 
12092
12110
  const newStream = await Wazo.Phone.resume(this.callSession, true);
12093
12111
 
@@ -12115,13 +12133,13 @@ class Room extends Emitter {
12115
12133
  }
12116
12134
 
12117
12135
  sendDTMF(tone ) {
12118
- logger$a.info('send room DTMF', { tone });
12136
+ logger$2.info('send room DTMF', { tone });
12119
12137
 
12120
12138
  Wazo.Phone.sendDTMF(tone, this.callSession);
12121
12139
  }
12122
12140
 
12123
12141
  async sendReinvite(newConstraints = null) {
12124
- logger$a.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
12142
+ logger$2.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
12125
12143
  const wasScreensharing = this.localParticipant && this.localParticipant.screensharing;
12126
12144
 
12127
12145
  Wazo.Phone.on(Wazo.Phone.ON_SHARE_SCREEN_STARTED, () => {
@@ -12180,7 +12198,7 @@ class Room extends Emitter {
12180
12198
  Wazo.Phone.phone.on(Wazo.Phone.phone.client.ON_REINVITE, this._boundOnReinvite);
12181
12199
 
12182
12200
  this.on(this.ON_AUDIO_STREAM, stream => {
12183
- logger$a.info('on room audio stream');
12201
+ logger$2.info('on room audio stream');
12184
12202
 
12185
12203
  this.audioStream = stream;
12186
12204
  if (!this.roomAudioElement) {
@@ -12193,7 +12211,7 @@ class Room extends Emitter {
12193
12211
  });
12194
12212
 
12195
12213
  this.on(this.ON_VIDEO_STREAM, (stream, streamId, event, sipSession) => {
12196
- logger$a.info('on room video stream', { streamId });
12214
+ logger$2.info('on room video stream', { streamId });
12197
12215
 
12198
12216
  this._mapMsid(sipSession.body.body);
12199
12217
 
@@ -12208,7 +12226,7 @@ class Room extends Emitter {
12208
12226
  });
12209
12227
 
12210
12228
  this.on(this.ON_REMOVE_STREAM, stream => {
12211
- logger$a.info('on room remove stream');
12229
+ logger$2.info('on room remove stream');
12212
12230
 
12213
12231
  const participant = this.participants.find(someParticipant =>
12214
12232
  someParticipant.streams.find(someStream => someStream && someStream.id === stream.id));
@@ -12340,7 +12358,7 @@ class Room extends Emitter {
12340
12358
  const requester = this._getParticipantFromCallId(origin.callId);
12341
12359
  if (requester) {
12342
12360
  // @FIXME?: when need to trigger an update on join-in; this is a bit of a hack
12343
- logger$a.info('trigger room requester status', { origin });
12361
+ logger$2.info('trigger room requester status', { origin });
12344
12362
  requester.triggerUpdate('REQUESTER_UPDATE');
12345
12363
  }
12346
12364
  break;
@@ -12371,24 +12389,24 @@ class Room extends Emitter {
12371
12389
 
12372
12390
  // When we join the room, we can call `getConferenceParticipantsAsUser`, not before.
12373
12391
  if (participant.user_uuid === session.uuid) {
12374
- logger$a.info('room current user joined');
12392
+ logger$2.info('room current user joined');
12375
12393
 
12376
12394
  // Retrieve participants via an API calls
12377
12395
  const conferenceId = this.sourceId || payload.data.conference_id;
12378
12396
  let response;
12379
12397
  try {
12380
12398
  if (this.meetingUuid) {
12381
- logger$a.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
12399
+ logger$2.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
12382
12400
  response = await getApiClient().calld.getMeetingParticipantsAsUser(this.meetingUuid);
12383
12401
  } else {
12384
- logger$a.info('fetching conference participants', { conferenceId });
12402
+ logger$2.info('fetching conference participants', { conferenceId });
12385
12403
  response = await getApiClient().calld.getConferenceParticipantsAsUser(conferenceId);
12386
12404
  }
12387
12405
  } catch (e) {
12388
- logger$a.error('room participants fetching, error', e);
12406
+ logger$2.error('room participants fetching, error', e);
12389
12407
  }
12390
12408
  if (response) {
12391
- logger$a.info('conference participants fetched', { nb: response.items.length });
12409
+ logger$2.info('conference participants fetched', { nb: response.items.length });
12392
12410
  participants = response.items.map(item => {
12393
12411
  const isMe = item.call_id === this.callId;
12394
12412
 
@@ -12415,7 +12433,7 @@ class Room extends Emitter {
12415
12433
  ? new Wazo.RemoteParticipant(this, participant)
12416
12434
  : null;
12417
12435
 
12418
- logger$a.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
12436
+ logger$2.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
12419
12437
 
12420
12438
  if (remoteParticipant) {
12421
12439
  this.participants.push(remoteParticipant);
@@ -12580,12 +12598,12 @@ class Room extends Emitter {
12580
12598
 
12581
12599
  //
12582
12600
 
12583
- const logger$b = IssueReporter$1.loggerFor('sdk-sip-room');
12601
+ const logger$1 = IssueReporter$1.loggerFor('sdk-sip-room');
12584
12602
 
12585
- class SipRoom extends Room {
12603
+ class SipRoom extends Room$1 {
12586
12604
 
12587
12605
  static async connect({ extension, constraints, audioOnly = false, extra, room } ) {
12588
- logger$b.info('connecting to sip room', { extension, audioOnly, room: !!room });
12606
+ logger$1.info('connecting to sip room', { extension, audioOnly, room: !!room });
12589
12607
 
12590
12608
  if (!room) {
12591
12609
  await Wazo.Phone.connect();
@@ -12601,7 +12619,7 @@ class SipRoom extends Room {
12601
12619
  room.setCallId(room.callSession.call.id);
12602
12620
  }
12603
12621
 
12604
- logger$b.info('connected to room', {
12622
+ logger$1.info('connected to room', {
12605
12623
  extension: room.extension,
12606
12624
  });
12607
12625
 
@@ -12609,7 +12627,7 @@ class SipRoom extends Room {
12609
12627
  }
12610
12628
 
12611
12629
  mute() {
12612
- logger$b.info('mute sip room');
12630
+ logger$1.info('mute sip room');
12613
12631
 
12614
12632
  Wazo.Phone.mute(this.callSession, false);
12615
12633
 
@@ -12617,7 +12635,7 @@ class SipRoom extends Room {
12617
12635
  }
12618
12636
 
12619
12637
  unmute() {
12620
- logger$b.info('unmute sip room');
12638
+ logger$1.info('unmute sip room');
12621
12639
 
12622
12640
  Wazo.Phone.unmute(this.callSession, false);
12623
12641
 
@@ -12901,7 +12919,7 @@ class NotificationOptions {
12901
12919
 
12902
12920
 
12903
12921
  // Represents a conference room, like `9000`.
12904
- class Room$1 {
12922
+ class Room {
12905
12923
 
12906
12924
 
12907
12925
 
@@ -12922,7 +12940,7 @@ class Room$1 {
12922
12940
  }
12923
12941
 
12924
12942
  connect(callSession ) {
12925
- return new Room$1({ ...this, connectedCallSession: callSession });
12943
+ return new Room({ ...this, connectedCallSession: callSession });
12926
12944
  }
12927
12945
 
12928
12946
  has(callSession ) {
@@ -12931,7 +12949,7 @@ class Room$1 {
12931
12949
 
12932
12950
  addParticipant(uuid , extension , talking = null) {
12933
12951
  if (!this.participants.some(participant => participant.uuid === uuid || participant.extension === extension)) {
12934
- return new Room$1({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
12952
+ return new Room({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
12935
12953
  }
12936
12954
 
12937
12955
  return this;
@@ -12950,7 +12968,7 @@ class Room$1 {
12950
12968
  updatedParticipants.push(participant);
12951
12969
  }
12952
12970
 
12953
- return new Room$1({ ...this, participants: updatedParticipants });
12971
+ return new Room({ ...this, participants: updatedParticipants });
12954
12972
  }
12955
12973
 
12956
12974
  updateParticipantByExtension(extension , participant , shouldAdd = false) {
@@ -12966,7 +12984,7 @@ class Room$1 {
12966
12984
  updatedParticipants.push(participant);
12967
12985
  }
12968
12986
 
12969
- return new Room$1({ ...this, participants: updatedParticipants });
12987
+ return new Room({ ...this, participants: updatedParticipants });
12970
12988
  }
12971
12989
 
12972
12990
  hasCallWithId(id ) {
@@ -12974,18 +12992,18 @@ class Room$1 {
12974
12992
  }
12975
12993
 
12976
12994
  disconnect() {
12977
- return new Room$1({ ...this, connectedCallSession: null });
12995
+ return new Room({ ...this, connectedCallSession: null });
12978
12996
  }
12979
12997
 
12980
12998
  removeParticipantWithUUID(uuid ) {
12981
- return new Room$1({
12999
+ return new Room({
12982
13000
  ...this,
12983
13001
  participants: this.participants.filter(participant => participant.uuid !== uuid),
12984
13002
  });
12985
13003
  }
12986
13004
 
12987
13005
  removeParticipantWithExtension(extension ) {
12988
- return new Room$1({
13006
+ return new Room({
12989
13007
  ...this,
12990
13008
  participants: this.participants.filter(participant => participant.extension !== extension),
12991
13009
  });
@@ -12996,7 +13014,7 @@ class Room$1 {
12996
13014
  }
12997
13015
 
12998
13016
  static newFrom(room ) {
12999
- return newFrom(room, Room$1);
13017
+ return newFrom(room, Room);
13000
13018
  }
13001
13019
  }
13002
13020
 
@@ -13303,11 +13321,11 @@ var wazoWebsocket = {
13303
13321
  resolve();
13304
13322
  };
13305
13323
 
13306
- client.on(SOCKET_EVENTS.ON_ERROR, error => {
13324
+ client.on(SOCKET_EVENTS$1.ON_ERROR, error => {
13307
13325
  handleError(`Connection error : ${error}`);
13308
13326
  });
13309
13327
 
13310
- client.on(SOCKET_EVENTS.ON_OPEN, () => {
13328
+ client.on(SOCKET_EVENTS$1.ON_OPEN, () => {
13311
13329
  if (session.hasEngineVersionGte(HEARTBEAT_ENGINE_VERSION)) {
13312
13330
  client.setOnHeartbeatTimeout(() => {
13313
13331
  handleError('No response to heartbeat');
@@ -13408,7 +13426,7 @@ var webrtc = {
13408
13426
  }),
13409
13427
  };
13410
13428
 
13411
- const parseCandidate$1 = line => {
13429
+ const parseCandidate = line => {
13412
13430
  let parts;
13413
13431
  // Parse both variants.
13414
13432
  if (line.indexOf('a=candidate:') === 0) {
@@ -13499,7 +13517,7 @@ var SymmetricNat = {
13499
13517
  }
13500
13518
 
13501
13519
  if (e.candidate && e.candidate.candidate.indexOf('srflx') !== -1) {
13502
- const cand = parseCandidate$1(e.candidate.candidate);
13520
+ const cand = parseCandidate(e.candidate.candidate);
13503
13521
  if (!candidates[cand.relatedPort]) candidates[cand.relatedPort] = [];
13504
13522
  candidates[cand.relatedPort].push(cand.port);
13505
13523
  } else if (!e.candidate) {
@@ -13567,7 +13585,7 @@ var iceIpv4 = {
13567
13585
  const rawCandidate = e.candidate.candidate;
13568
13586
  if (rawCandidate.indexOf('srflx') !== -1 || rawCandidate.indexOf('relay') !== -1) {
13569
13587
  hasSrflxOrRelay = true;
13570
- const candidate = parseCandidate$1(e.candidate.candidate);
13588
+ const candidate = parseCandidate(e.candidate.candidate);
13571
13589
  ips.push(candidate.ip);
13572
13590
  }
13573
13591
  } else if (!e.candidate) {
@@ -13604,7 +13622,7 @@ var checks = [
13604
13622
 
13605
13623
  //
13606
13624
 
13607
- const logger$c = IssueReporter$1.loggerFor('engine-check');
13625
+ const logger = IssueReporter$1.loggerFor('engine-check');
13608
13626
 
13609
13627
  class Checker {
13610
13628
 
@@ -13622,28 +13640,28 @@ class Checker {
13622
13640
  async check(onCheckBegin = () => {}, onCheckResult = () => {}) {
13623
13641
  await this._addEngineVersion();
13624
13642
 
13625
- logger$c.info('Engine check starting');
13643
+ logger.info('Engine check starting');
13626
13644
 
13627
13645
  for (let i = 0; i < this.checks.length; i++) {
13628
13646
  const { name, check } = this.checks[i];
13629
13647
 
13630
- logger$c.info(`Checking ${name} ...`);
13648
+ logger.info(`Checking ${name} ...`);
13631
13649
 
13632
13650
  onCheckBegin(name);
13633
13651
  try {
13634
13652
  // eslint-disable-next-line no-await-in-loop
13635
13653
  const result = await check(this.server, this.session, this.externalAppConfig);
13636
- logger$c.info(`Checking ${name} success.`, { result });
13654
+ logger.info(`Checking ${name} success.`, { result });
13637
13655
 
13638
13656
  onCheckResult(name, result);
13639
13657
  } catch (e) {
13640
- logger$c.info(`Checking ${name} failure`, { message: e.message });
13658
+ logger.info(`Checking ${name} failure`, { message: e.message });
13641
13659
 
13642
13660
  onCheckResult(name, e);
13643
13661
  }
13644
13662
  }
13645
13663
 
13646
- logger$c.info('Engine check done.');
13664
+ logger.info('Engine check done.');
13647
13665
  }
13648
13666
 
13649
13667
  addCheck(check ) {
@@ -13667,7 +13685,7 @@ const Wazo = {
13667
13685
  Auth: Auth$1,
13668
13686
  Phone: Phone$1,
13669
13687
  Websocket: Websocket$1,
13670
- Room,
13688
+ Room: Room$1,
13671
13689
  SipRoom,
13672
13690
  RemoteParticipant,
13673
13691
  LocalParticipant,
@@ -13700,7 +13718,7 @@ const Wazo = {
13700
13718
  Session,
13701
13719
  Voicemail,
13702
13720
  Relocation,
13703
- ConferenceRoom: Room$1,
13721
+ ConferenceRoom: Room,
13704
13722
  CallSession,
13705
13723
  IndirectTransfer,
13706
13724
  SwitchboardCall,