@wazo/sdk 0.37.23 → 0.37.24

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 (103) hide show
  1. package/dist/wazo-sdk.js +6 -6
  2. package/esm/__tests__/api-client.test.js +22 -17
  3. package/esm/__tests__/web-rtc-client.test.js +105 -100
  4. package/esm/api/amid.js +1 -1
  5. package/esm/api/call-logd.js +2 -2
  6. package/esm/api/confd.js +10 -5
  7. package/esm/api/ctid-ng.js +3 -3
  8. package/esm/api/dird.js +1 -1
  9. package/esm/api/webhookd.js +1 -1
  10. package/esm/api-client.js +22 -17
  11. package/esm/checker/Checker.js +130 -125
  12. package/esm/checker/checks/aor.js +22 -17
  13. package/esm/checker/checks/api.js +22 -17
  14. package/esm/checker/checks/index.js +120 -115
  15. package/esm/checker/checks/wazo-websocket.js +15 -15
  16. package/esm/checker/checks/webrtc-transport.js +105 -100
  17. package/esm/checker/checks/webrtc.js +105 -100
  18. package/esm/domain/AdHocAPIConference.js +22 -17
  19. package/esm/domain/CallLog.js +1 -1
  20. package/esm/domain/Contact.js +1 -1
  21. package/esm/domain/Features.js +22 -17
  22. package/esm/domain/Meeting.js +12 -5
  23. package/esm/domain/Phone/CTIPhone.js +36 -31
  24. package/esm/domain/Phone/WebRTCPhone.js +110 -87
  25. package/esm/domain/__tests__/CallLog.test.js +1 -1
  26. package/esm/domain/__tests__/Contact.test.js +1 -1
  27. package/esm/domain/__tests__/Meeting.test.js +144 -0
  28. package/esm/index.js +365 -337
  29. package/esm/lib/WazoSessionDescriptionHandler.js +1 -1
  30. package/esm/service/CallApi.js +22 -17
  31. package/esm/service/IssueReporter.js +1 -1
  32. package/esm/service/__tests__/IssueReporter.test.js +1 -1
  33. package/esm/service/getApiClient.js +22 -17
  34. package/esm/simple/Auth.js +355 -327
  35. package/esm/simple/Configuration.js +355 -327
  36. package/esm/simple/Directory.js +22 -17
  37. package/esm/simple/Phone.js +355 -327
  38. package/esm/simple/Websocket.js +17 -17
  39. package/esm/simple/index.js +359 -331
  40. package/esm/simple/room/LocalParticipant.js +359 -331
  41. package/esm/simple/room/Participant.js +359 -331
  42. package/esm/simple/room/RemoteParticipant.js +359 -331
  43. package/esm/simple/room/Room.js +360 -332
  44. package/esm/simple/room/SipRoom.js +359 -331
  45. package/esm/simple/room/Stream.js +359 -331
  46. package/esm/simple/room/__tests__/RemoteParticipant.test.js +359 -331
  47. package/esm/simple/utils.js +359 -331
  48. package/esm/types/WebSocketMessage.js +1 -1
  49. package/esm/web-rtc-client.js +105 -100
  50. package/esm/websocket-client.js +15 -15
  51. package/lib/__tests__/api-client.test.js +22 -17
  52. package/lib/__tests__/web-rtc-client.test.js +105 -100
  53. package/lib/api/amid.js +1 -1
  54. package/lib/api/call-logd.js +2 -2
  55. package/lib/api/confd.js +10 -5
  56. package/lib/api/ctid-ng.js +3 -3
  57. package/lib/api/dird.js +1 -1
  58. package/lib/api/webhookd.js +1 -1
  59. package/lib/api-client.js +22 -17
  60. package/lib/checker/Checker.js +130 -125
  61. package/lib/checker/checks/aor.js +22 -17
  62. package/lib/checker/checks/api.js +22 -17
  63. package/lib/checker/checks/index.js +120 -115
  64. package/lib/checker/checks/wazo-websocket.js +15 -15
  65. package/lib/checker/checks/webrtc-transport.js +105 -100
  66. package/lib/checker/checks/webrtc.js +105 -100
  67. package/lib/domain/AdHocAPIConference.js +22 -17
  68. package/lib/domain/CallLog.js +1 -1
  69. package/lib/domain/Contact.js +1 -1
  70. package/lib/domain/Features.js +22 -17
  71. package/lib/domain/Meeting.js +16 -5
  72. package/lib/domain/Phone/CTIPhone.js +36 -31
  73. package/lib/domain/Phone/WebRTCPhone.js +110 -87
  74. package/lib/domain/__tests__/CallLog.test.js +1 -1
  75. package/lib/domain/__tests__/Contact.test.js +1 -1
  76. package/lib/domain/__tests__/Meeting.test.js +150 -0
  77. package/lib/index.js +365 -337
  78. package/lib/lib/WazoSessionDescriptionHandler.js +1 -1
  79. package/lib/service/CallApi.js +22 -17
  80. package/lib/service/IssueReporter.js +1 -1
  81. package/lib/service/__tests__/IssueReporter.test.js +1 -1
  82. package/lib/service/getApiClient.js +22 -17
  83. package/lib/simple/Auth.js +355 -327
  84. package/lib/simple/Configuration.js +355 -327
  85. package/lib/simple/Directory.js +22 -17
  86. package/lib/simple/Phone.js +355 -327
  87. package/lib/simple/Websocket.js +17 -17
  88. package/lib/simple/index.js +359 -331
  89. package/lib/simple/room/LocalParticipant.js +359 -331
  90. package/lib/simple/room/Participant.js +359 -331
  91. package/lib/simple/room/RemoteParticipant.js +359 -331
  92. package/lib/simple/room/Room.js +360 -332
  93. package/lib/simple/room/SipRoom.js +359 -331
  94. package/lib/simple/room/Stream.js +359 -331
  95. package/lib/simple/room/__tests__/RemoteParticipant.test.js +359 -331
  96. package/lib/simple/utils.js +359 -331
  97. package/lib/types/WebSocketMessage.js +2 -0
  98. package/lib/web-rtc-client.js +105 -100
  99. package/lib/websocket-client.js +15 -15
  100. package/package.json +1 -1
  101. package/src/domain/Meeting.js +12 -5
  102. package/src/domain/Phone/WebRTCPhone.js +24 -1
  103. package/src/domain/__tests__/Meeting.test.js +50 -0
@@ -1947,7 +1947,7 @@ var IssueReporter$1 = new IssueReporter();
1947
1947
 
1948
1948
  const methods = ['head', 'get', 'post', 'put', 'delete'];
1949
1949
 
1950
- const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
1950
+ const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
1951
1951
 
1952
1952
  // Use a function here to be able to mock it in tests
1953
1953
  const realFetch = () => {
@@ -2086,7 +2086,7 @@ class ApiRequester {
2086
2086
  };
2087
2087
 
2088
2088
  if (this.refreshTokenPromise) {
2089
- logger$c.info('A token is already refreshing, waiting ...', { url });
2089
+ logger.info('A token is already refreshing, waiting ...', { url });
2090
2090
  await this.refreshTokenPromise;
2091
2091
  }
2092
2092
 
@@ -2106,7 +2106,7 @@ class ApiRequester {
2106
2106
  return promise.then(async (err ) => {
2107
2107
  // Check if the token is still valid
2108
2108
  if (firstCall && this._checkTokenExpired(response, err)) {
2109
- logger$c.warn('token expired', { error: err.reason });
2109
+ logger.warn('token expired', { error: err.reason });
2110
2110
  // Replay the call after refreshing the token
2111
2111
  return this._replayWithNewToken(err, path, method, body, headers, parse);
2112
2112
  }
@@ -2116,7 +2116,7 @@ class ApiRequester {
2116
2116
  : exceptionClass.fromResponse(err, response.status);
2117
2117
 
2118
2118
  if (this.shouldLogErrors) {
2119
- logger$c.error('API error', error);
2119
+ logger.error('API error', error);
2120
2120
  }
2121
2121
 
2122
2122
  throw error;
@@ -2126,7 +2126,7 @@ class ApiRequester {
2126
2126
  return newParse(response, isJson);
2127
2127
  }).catch(error => {
2128
2128
  if (this.shouldLogErrors) {
2129
- logger$c.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
2129
+ logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
2130
2130
  }
2131
2131
 
2132
2132
  throw error;
@@ -2154,13 +2154,13 @@ class ApiRequester {
2154
2154
  ) {
2155
2155
  const isTokenNotFound = this._isTokenNotFound(err);
2156
2156
  let newPath = path;
2157
- logger$c.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
2157
+ logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
2158
2158
 
2159
2159
  this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
2160
2160
 
2161
2161
  return this.refreshTokenPromise.then(() => {
2162
2162
  this.refreshTokenPromise = null;
2163
- logger$c.info('token refreshed', { isTokenNotFound });
2163
+ logger.info('token refreshed', { isTokenNotFound });
2164
2164
  if (isTokenNotFound) {
2165
2165
  const pathParts = path.split('/');
2166
2166
  pathParts.pop();
@@ -2630,8 +2630,9 @@ class ExternalApp {
2630
2630
 
2631
2631
 
2632
2632
 
2633
-
2633
+
2634
2634
 
2635
+
2635
2636
 
2636
2637
 
2637
2638
  class Meeting {
@@ -2642,9 +2643,10 @@ class Meeting {
2642
2643
 
2643
2644
 
2644
2645
 
2645
-
2646
+
2646
2647
 
2647
2648
 
2649
+
2648
2650
 
2649
2651
  static parse(plain ) {
2650
2652
  return new Meeting({
@@ -2654,8 +2656,9 @@ class Meeting {
2654
2656
  ownerUuids: plain.owner_uuids,
2655
2657
  port: plain.port,
2656
2658
  uuid: plain.uuid,
2657
- number: plain.number,
2659
+ extension: plain.exten,
2658
2660
  persistent: plain.persistent,
2661
+ creationTime: moment(plain.creation_time).toDate(),
2659
2662
  });
2660
2663
  }
2661
2664
 
@@ -2677,8 +2680,9 @@ class Meeting {
2677
2680
  ownerUuids,
2678
2681
  port,
2679
2682
  uri,
2680
- number,
2683
+ extension,
2681
2684
  persistent,
2685
+ creationTime,
2682
2686
  } = {}) {
2683
2687
  this.guestSipAuthorization = guestSipAuthorization;
2684
2688
  this.uri = uri;
@@ -2686,8 +2690,9 @@ class Meeting {
2686
2690
  this.ownerUuids = ownerUuids;
2687
2691
  this.port = port;
2688
2692
  this.uuid = uuid;
2689
- this.number = number;
2693
+ this.extension = extension;
2690
2694
  this.persistent = persistent;
2695
+ this.creationTime = creationTime;
2691
2696
 
2692
2697
  // Useful to compare instead of instanceof with minified code
2693
2698
  this.type = 'Meeting';
@@ -4048,7 +4053,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
4048
4053
 
4049
4054
  // const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
4050
4055
 
4051
- const logger$b = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
4056
+ const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
4052
4057
 
4053
4058
  class CTIPhone extends Emitter {
4054
4059
 
@@ -4061,7 +4066,7 @@ class CTIPhone extends Emitter {
4061
4066
 
4062
4067
  constructor(session , isMobile = false, callbackAllLines = false) {
4063
4068
  super();
4064
- logger$b.info('CTI Phone created');
4069
+ logger$1.info('CTI Phone created');
4065
4070
  this.session = session;
4066
4071
  this.isMobile = isMobile;
4067
4072
  this.callbackAllLines = callbackAllLines;
@@ -4122,7 +4127,7 @@ class CTIPhone extends Emitter {
4122
4127
  }
4123
4128
 
4124
4129
  async makeCall(number , line ) {
4125
- logger$b.info('make CTI call', { number });
4130
+ logger$1.info('make CTI call', { number });
4126
4131
 
4127
4132
  if (!number) {
4128
4133
  return null;
@@ -4145,7 +4150,7 @@ class CTIPhone extends Emitter {
4145
4150
  if (!callSession) {
4146
4151
  return Promise.resolve(null);
4147
4152
  }
4148
- logger$b.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
4153
+ logger$1.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
4149
4154
 
4150
4155
  if (!this.currentCall) {
4151
4156
  this.currentCall = callSession.call;
@@ -4158,7 +4163,7 @@ class CTIPhone extends Emitter {
4158
4163
  if (!callSession) {
4159
4164
  return;
4160
4165
  }
4161
- logger$b.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
4166
+ logger$1.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
4162
4167
 
4163
4168
  this.currentCall = undefined;
4164
4169
  this.eventEmitter.emit('onCallEnded', callSession);
@@ -4168,7 +4173,7 @@ class CTIPhone extends Emitter {
4168
4173
  if (!callSession) {
4169
4174
  return Promise.resolve(false);
4170
4175
  }
4171
- logger$b.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
4176
+ logger$1.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
4172
4177
 
4173
4178
  try {
4174
4179
  await CallApi.cancelCall(callSession);
@@ -4179,7 +4184,7 @@ class CTIPhone extends Emitter {
4179
4184
  this.eventEmitter.emit('onCallEnded', callSession);
4180
4185
  return true;
4181
4186
  } catch (e) {
4182
- logger$b.error('hangup CTI call, error', e);
4187
+ logger$1.error('hangup CTI call, error', e);
4183
4188
 
4184
4189
  this.eventEmitter.emit('onCallFailed', callSession);
4185
4190
  return false;
@@ -4192,7 +4197,7 @@ class CTIPhone extends Emitter {
4192
4197
  if (!callSession) {
4193
4198
  return;
4194
4199
  }
4195
- logger$b.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
4200
+ logger$1.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
4196
4201
 
4197
4202
  await CallApi.cancelCall(callSession);
4198
4203
  this.eventEmitter.emit('onCallEnded', callSession);
@@ -4202,7 +4207,7 @@ class CTIPhone extends Emitter {
4202
4207
  if (!callSession) {
4203
4208
  return;
4204
4209
  }
4205
- logger$b.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
4210
+ logger$1.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
4206
4211
 
4207
4212
  await CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_BLIND);
4208
4213
  }
@@ -4215,19 +4220,19 @@ class CTIPhone extends Emitter {
4215
4220
  if (!callSession) {
4216
4221
  return;
4217
4222
  }
4218
- logger$b.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
4223
+ logger$1.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
4219
4224
 
4220
4225
  return CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_ATTENDED);
4221
4226
  }
4222
4227
 
4223
4228
  async cancelCTIIndirectTransfer(transferId ) {
4224
- logger$b.info('cancel CTI transfer', { transferId });
4229
+ logger$1.info('cancel CTI transfer', { transferId });
4225
4230
 
4226
4231
  return CallApi.cancelCallTransfer(transferId);
4227
4232
  }
4228
4233
 
4229
4234
  async confirmCTIIndirectTransfer(transferId ) {
4230
- logger$b.info('confirm CTI transfer', { transferId });
4235
+ logger$1.info('confirm CTI transfer', { transferId });
4231
4236
 
4232
4237
  return CallApi.confirmCallTransfer(transferId);
4233
4238
  }
@@ -4236,19 +4241,19 @@ class CTIPhone extends Emitter {
4236
4241
  if (!callSession) {
4237
4242
  return;
4238
4243
  }
4239
- logger$b.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
4244
+ logger$1.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
4240
4245
 
4241
4246
  return CallApi.sendDTMF(callSession.callId, digits);
4242
4247
  }
4243
4248
 
4244
4249
  onConnectionMade() {
4245
- logger$b.info('on CTI connection made');
4250
+ logger$1.info('on CTI connection made');
4246
4251
 
4247
4252
  this.eventEmitter.emit('onCallAccepted');
4248
4253
  }
4249
4254
 
4250
4255
  async close() {
4251
- logger$b.info('CTI close');
4256
+ logger$1.info('CTI close');
4252
4257
 
4253
4258
  return Promise.resolve();
4254
4259
  }
@@ -4257,7 +4262,7 @@ class CTIPhone extends Emitter {
4257
4262
  if (!callSession) {
4258
4263
  return;
4259
4264
  }
4260
- logger$b.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
4265
+ logger$1.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
4261
4266
 
4262
4267
  return CallApi.hold(callSession.callId);
4263
4268
  }
@@ -4266,7 +4271,7 @@ class CTIPhone extends Emitter {
4266
4271
  if (!callSession) {
4267
4272
  return;
4268
4273
  }
4269
- logger$b.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
4274
+ logger$1.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
4270
4275
 
4271
4276
  return CallApi.resume(callSession.callId);
4272
4277
  }
@@ -4275,7 +4280,7 @@ class CTIPhone extends Emitter {
4275
4280
  if (!callSession) {
4276
4281
  return;
4277
4282
  }
4278
- logger$b.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
4283
+ logger$1.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
4279
4284
 
4280
4285
  return CallApi.mute(callSession.callId);
4281
4286
  }
@@ -4284,7 +4289,7 @@ class CTIPhone extends Emitter {
4284
4289
  if (!callSession) {
4285
4290
  return;
4286
4291
  }
4287
- logger$b.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
4292
+ logger$1.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
4288
4293
 
4289
4294
  return CallApi.unmute(callSession.callId);
4290
4295
  }
@@ -5293,7 +5298,7 @@ const AGENTD_VERSION = '1.0';
5293
5298
  const WEBHOOKD_VERSION = '1.0';
5294
5299
  const AMID_VERSION = '1.0';
5295
5300
 
5296
- const logger$a = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
5301
+ const logger$2 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
5297
5302
 
5298
5303
  class ApiClient {
5299
5304
 
@@ -5345,12 +5350,12 @@ class ApiClient {
5345
5350
  }
5346
5351
 
5347
5352
  async forceRefreshToken() {
5348
- logger$a.info('forcing refresh token, calling callback');
5353
+ logger$2.info('forcing refresh token, calling callback');
5349
5354
  return this.refreshTokenCallback();
5350
5355
  }
5351
5356
 
5352
5357
  async refreshTokenCallback() {
5353
- logger$a.info('refresh token callback called', {
5358
+ logger$2.info('refresh token callback called', {
5354
5359
  refreshToken: this.refreshToken,
5355
5360
  refreshBackend: this.refreshBackend,
5356
5361
  refreshExpiration: this.refreshExpiration,
@@ -5368,7 +5373,7 @@ class ApiClient {
5368
5373
  this.isMobile,
5369
5374
  );
5370
5375
 
5371
- logger$a.info('token refreshed', { token: session.token });
5376
+ logger$2.info('token refreshed', { token: session.token });
5372
5377
 
5373
5378
  if (this.onRefreshToken) {
5374
5379
  this.onRefreshToken(session.token, session);
@@ -5681,7 +5686,7 @@ class AdHocAPIConference {
5681
5686
 
5682
5687
  /* */
5683
5688
 
5684
- const parseCandidate$1 = (candidate ) => {
5689
+ const parseCandidate = (candidate ) => {
5685
5690
  if (!candidate) {
5686
5691
  return null;
5687
5692
  }
@@ -5835,7 +5840,7 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
5835
5840
  this.peerConnectionDelegate.onicecandidate = event => {
5836
5841
  wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
5837
5842
  if (event.candidate) {
5838
- this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
5843
+ this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
5839
5844
  }
5840
5845
  };
5841
5846
 
@@ -6299,7 +6304,7 @@ const DEFAULT_ICE_TIMEOUT = 3000;
6299
6304
  const SEND_STATS_DELAY = 5000;
6300
6305
 
6301
6306
  const states = ['STATUS_NULL', 'STATUS_NEW', 'STATUS_CONNECTING', 'STATUS_CONNECTED', 'STATUS_COMPLETED'];
6302
- const logger$9 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
6307
+ const logger$3 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
6303
6308
  const statsLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-stats') : console;
6304
6309
 
6305
6310
  // events
@@ -6313,14 +6318,14 @@ const TRANSPORT_ERROR = 'transportError';
6313
6318
  const MESSAGE = 'message';
6314
6319
  const ACCEPTED = 'accepted';
6315
6320
  const REJECTED = 'rejected';
6316
- const ON_TRACK$1 = 'onTrack';
6317
- const ON_REINVITE$1 = 'reinvite';
6321
+ const ON_TRACK = 'onTrack';
6322
+ const ON_REINVITE = 'reinvite';
6318
6323
  const ON_ERROR = 'onError';
6319
6324
  const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
6320
- const ON_NETWORK_STATS$1 = 'onNetworkStats';
6321
- const ON_DISCONNECTED$1 = 'onDisconnected';
6325
+ const ON_NETWORK_STATS = 'onNetworkStats';
6326
+ const ON_DISCONNECTED = 'onDisconnected';
6322
6327
 
6323
- const events$1 = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
6328
+ const events = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
6324
6329
  const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
6325
6330
  class CanceledCallError extends Error {}
6326
6331
 
@@ -6456,12 +6461,12 @@ class WebRTCClient extends Emitter {
6456
6461
  this.MESSAGE = MESSAGE;
6457
6462
  this.ACCEPTED = ACCEPTED;
6458
6463
  this.REJECTED = REJECTED;
6459
- this.ON_TRACK = ON_TRACK$1;
6460
- this.ON_REINVITE = ON_REINVITE$1;
6464
+ this.ON_TRACK = ON_TRACK;
6465
+ this.ON_REINVITE = ON_REINVITE;
6461
6466
  this.ON_ERROR = ON_ERROR;
6462
6467
  this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
6463
- this.ON_NETWORK_STATS = ON_NETWORK_STATS$1;
6464
- this.ON_DISCONNECTED = ON_DISCONNECTED$1;
6468
+ this.ON_NETWORK_STATS = ON_NETWORK_STATS;
6469
+ this.ON_DISCONNECTED = ON_DISCONNECTED;
6465
6470
  }
6466
6471
 
6467
6472
  configureMedia(media ) {
@@ -6478,13 +6483,13 @@ class WebRTCClient extends Emitter {
6478
6483
 
6479
6484
  createUserAgent(configOverrides ) {
6480
6485
  const webRTCConfiguration = this._createWebRTCConfiguration(configOverrides);
6481
- logger$9.info('sdk webrtc, creating UA', { webRTCConfiguration });
6486
+ logger$3.info('sdk webrtc, creating UA', { webRTCConfiguration });
6482
6487
 
6483
6488
  webRTCConfiguration.delegate = {
6484
6489
  onConnect: this.onConnect.bind(this),
6485
6490
  onDisconnect: this.onDisconnect.bind(this),
6486
6491
  onInvite: (invitation ) => {
6487
- logger$9.info('sdk webrtc on invite', {
6492
+ logger$3.info('sdk webrtc on invite', {
6488
6493
  method: 'delegate.onInvite',
6489
6494
  id: invitation.id,
6490
6495
  remoteURI: invitation.remoteURI,
@@ -6527,7 +6532,7 @@ class WebRTCClient extends Emitter {
6527
6532
  }
6528
6533
 
6529
6534
  onConnect() {
6530
- logger$9.info('sdk webrtc connected', { method: 'delegate.onConnect' });
6535
+ logger$3.info('sdk webrtc connected', { method: 'delegate.onConnect' });
6531
6536
  this.eventEmitter.emit(CONNECTED);
6532
6537
  if (!this.isRegistered() && this.registerer && this.registerer.waiting) {
6533
6538
  this.registerer.waitingToggle(false);
@@ -6536,7 +6541,7 @@ class WebRTCClient extends Emitter {
6536
6541
  }
6537
6542
 
6538
6543
  async onDisconnect(error ) {
6539
- logger$9.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
6544
+ logger$3.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
6540
6545
  this.connectionPromise = null;
6541
6546
  // The UA will attempt to reconnect automatically when an error occurred
6542
6547
  this.eventEmitter.emit(DISCONNECTED, error);
@@ -6561,37 +6566,37 @@ class WebRTCClient extends Emitter {
6561
6566
  };
6562
6567
 
6563
6568
  if (this.skipRegister) {
6564
- logger$9.info('sdk webrtc skip register...', logInfo);
6569
+ logger$3.info('sdk webrtc skip register...', logInfo);
6565
6570
  return Promise.resolve();
6566
6571
  }
6567
6572
 
6568
- logger$9.info('sdk webrtc registering...', logInfo);
6573
+ logger$3.info('sdk webrtc registering...', logInfo);
6569
6574
 
6570
6575
  if (!this.userAgent) {
6571
- logger$9.info('sdk webrtc recreating User Agent');
6576
+ logger$3.info('sdk webrtc recreating User Agent');
6572
6577
  this.userAgent = this.createUserAgent(this.uaConfigOverrides);
6573
6578
  }
6574
6579
  if (!this.userAgent || this.isRegistered()) {
6575
- logger$9.info('sdk webrtc registering aborted, already registered or no UA can be created');
6580
+ logger$3.info('sdk webrtc registering aborted, already registered or no UA can be created');
6576
6581
  return Promise.resolve();
6577
6582
  }
6578
6583
 
6579
6584
  if (this.connectionPromise || (this.registerer && this.registerer.waiting)) {
6580
- logger$9.info('sdk webrtc registering aborted due to a registration in progress.');
6585
+ logger$3.info('sdk webrtc registering aborted due to a registration in progress.');
6581
6586
  return Promise.resolve();
6582
6587
  }
6583
6588
 
6584
6589
  const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
6585
6590
 
6586
6591
  const onRegisterFailed = () => {
6587
- logger$9.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
6592
+ logger$3.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
6588
6593
  this.connectionPromise = null;
6589
6594
  if (this.registerer && this.registerer.waiting) {
6590
6595
  this.registerer.waitingToggle(false);
6591
6596
  }
6592
6597
 
6593
6598
  if (tries <= MAX_REGISTER_TRIES) {
6594
- logger$9.info('sdk webrtc registering, retrying...', { tries });
6599
+ logger$3.info('sdk webrtc registering, retrying...', { tries });
6595
6600
  setTimeout(() => this.register(tries + 1), 300);
6596
6601
  }
6597
6602
  };
@@ -6600,18 +6605,18 @@ class WebRTCClient extends Emitter {
6600
6605
  // Avoid race condition with the close method called just before register and setting userAgent to null
6601
6606
  // during the resolution of the primise.
6602
6607
  if (!this.userAgent) {
6603
- logger$9.info('sdk webrtc recreating User Agent after connection');
6608
+ logger$3.info('sdk webrtc recreating User Agent after connection');
6604
6609
  this.userAgent = this.createUserAgent(this.uaConfigOverrides);
6605
6610
  }
6606
6611
 
6607
- logger$9.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
6612
+ logger$3.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
6608
6613
  this.registerer = new Registerer(this.userAgent, registerOptions);
6609
6614
  this.connectionPromise = null;
6610
6615
  this._monkeyPatchRegisterer(this.registerer);
6611
6616
 
6612
6617
  // Bind registerer events
6613
6618
  this.registerer.stateChange.addListener(newState => {
6614
- logger$9.info('sdk webrtc registering, state changed', { newState });
6619
+ logger$3.info('sdk webrtc registering, state changed', { newState });
6615
6620
 
6616
6621
  if (newState === RegistererState.Registered && this.registerer
6617
6622
  && this.registerer.state === RegistererState.Registered) {
@@ -6624,7 +6629,7 @@ class WebRTCClient extends Emitter {
6624
6629
  const options = {
6625
6630
  requestDelegate: {
6626
6631
  onReject: response => {
6627
- logger$9.error('sdk webrtc registering, rejected', { response });
6632
+ logger$3.error('sdk webrtc registering, rejected', { response });
6628
6633
 
6629
6634
  onRegisterFailed();
6630
6635
  },
@@ -6632,13 +6637,13 @@ class WebRTCClient extends Emitter {
6632
6637
  };
6633
6638
 
6634
6639
  return this.registerer.register(options).catch((e) => {
6635
- logger$9.error('sdk webrtc registering, error', e);
6640
+ logger$3.error('sdk webrtc registering, error', e);
6636
6641
 
6637
6642
  this.eventEmitter.emit(REGISTRATION_FAILED);
6638
6643
  return e;
6639
6644
  });
6640
6645
  }).catch(error => {
6641
- logger$9.error('sdk webrtc registering, transport error', error);
6646
+ logger$3.error('sdk webrtc registering, transport error', error);
6642
6647
  onRegisterFailed();
6643
6648
  });
6644
6649
  }
@@ -6667,21 +6672,21 @@ class WebRTCClient extends Emitter {
6667
6672
  }
6668
6673
 
6669
6674
  unregister() {
6670
- logger$9.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
6675
+ logger$3.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
6671
6676
  if (!this.registerer) {
6672
6677
  return Promise.resolve();
6673
6678
  }
6674
6679
 
6675
6680
  try {
6676
6681
  return this.registerer.unregister().then(() => {
6677
- logger$9.info('sdk webrtc unregistered');
6682
+ logger$3.info('sdk webrtc unregistered');
6678
6683
  this._cleanupRegister();
6679
6684
  }).catch(e => {
6680
- logger$9.error('sdk webrtc unregistering, promise error', e);
6685
+ logger$3.error('sdk webrtc unregistering, promise error', e);
6681
6686
  this._cleanupRegister();
6682
6687
  });
6683
6688
  } catch (e) {
6684
- logger$9.error('sdk webrtc unregistering, error', e);
6689
+ logger$3.error('sdk webrtc unregistering, error', e);
6685
6690
  // Avoid issue with `undefined is not an object (evaluating 'new.target.prototype')` when triggering a new
6686
6691
  // error when the registerer is in a bad state
6687
6692
  this._cleanupRegister();
@@ -6689,7 +6694,7 @@ class WebRTCClient extends Emitter {
6689
6694
  }
6690
6695
 
6691
6696
  stop() {
6692
- logger$9.info('sdk webrtc stop', { userAgent: !!this.userAgent });
6697
+ logger$3.info('sdk webrtc stop', { userAgent: !!this.userAgent });
6693
6698
  if (!this.userAgent) {
6694
6699
  return Promise.resolve();
6695
6700
  }
@@ -6697,12 +6702,12 @@ class WebRTCClient extends Emitter {
6697
6702
  return this.userAgent.stop().then(() => {
6698
6703
  return this._cleanupRegister();
6699
6704
  }).catch(e => {
6700
- logger$9.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
6705
+ logger$3.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
6701
6706
  });
6702
6707
  }
6703
6708
 
6704
6709
  call(number , enableVideo , audioOnly = false, conference = false) {
6705
- logger$9.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
6710
+ logger$3.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
6706
6711
  const inviterOptions = {
6707
6712
  sessionDescriptionHandlerOptionsReInvite: {
6708
6713
  conference,
@@ -6733,7 +6738,7 @@ class WebRTCClient extends Emitter {
6733
6738
  this._onAccepted(session, response.session, true);
6734
6739
  },
6735
6740
  onReject: (response ) => {
6736
- logger$9.info('on call rejected', { id: session.id, fromTag: session.fromTag });
6741
+ logger$3.info('on call rejected', { id: session.id, fromTag: session.fromTag });
6737
6742
  this._stopSendingStats(session);
6738
6743
  this.stopNetworkMonitoring(session);
6739
6744
 
@@ -6756,11 +6761,11 @@ class WebRTCClient extends Emitter {
6756
6761
  }
6757
6762
 
6758
6763
  answer(session , enableVideo ) {
6759
- logger$9.info('sdk webrtc answer call', { id: session.id, enableVideo });
6764
+ logger$3.info('sdk webrtc answer call', { id: session.id, enableVideo });
6760
6765
 
6761
6766
  if (!session || !session.accept) {
6762
6767
  const error = 'No session to answer, or not an invitation';
6763
- logger$9.warn(error);
6768
+ logger$3.warn(error);
6764
6769
  return Promise.reject(new Error(error));
6765
6770
  }
6766
6771
  const options = {
@@ -6770,15 +6775,15 @@ class WebRTCClient extends Emitter {
6770
6775
  return session.accept(options).then(() => {
6771
6776
  if (session.isCanceled) {
6772
6777
  const message = 'accepted a canceled session (or was canceled during the accept phase).';
6773
- logger$9.error(message, { id: session.id });
6778
+ logger$3.error(message, { id: session.id });
6774
6779
  this.onCallEnded(session);
6775
6780
 
6776
6781
  throw new CanceledCallError(message);
6777
6782
  }
6778
- logger$9.info('sdk webrtc answer, accepted.');
6783
+ logger$3.info('sdk webrtc answer, accepted.');
6779
6784
  this._onAccepted(session);
6780
6785
  }).catch(e => {
6781
- logger$9.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
6786
+ logger$3.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
6782
6787
 
6783
6788
  throw e;
6784
6789
  });
@@ -6786,7 +6791,7 @@ class WebRTCClient extends Emitter {
6786
6791
 
6787
6792
  hangup(session ) {
6788
6793
  const { state, id } = session;
6789
- logger$9.info('sdk webrtc hangup call', { id, state });
6794
+ logger$3.info('sdk webrtc hangup call', { id, state });
6790
6795
 
6791
6796
  try {
6792
6797
  this._stopSendingStats(session);
@@ -6815,7 +6820,7 @@ class WebRTCClient extends Emitter {
6815
6820
 
6816
6821
  return bye();
6817
6822
  } catch (error) {
6818
- logger$9.warn('sdk webrtc hangup, error', error);
6823
+ logger$3.warn('sdk webrtc hangup, error', error);
6819
6824
  }
6820
6825
 
6821
6826
  return null;
@@ -6833,7 +6838,7 @@ class WebRTCClient extends Emitter {
6833
6838
  // Fetch and emit an event at `interval` with session network stats
6834
6839
  startNetworkMonitoring(session , interval = 1000) {
6835
6840
  const sessionId = this.getSipSessionId(session);
6836
- logger$9.info('starting network inspection', { id: sessionId });
6841
+ logger$3.info('starting network inspection', { id: sessionId });
6837
6842
 
6838
6843
  this.sessionNetworkStats[sessionId] = [];
6839
6844
 
@@ -6843,7 +6848,7 @@ class WebRTCClient extends Emitter {
6843
6848
  stopNetworkMonitoring(session ) {
6844
6849
  const sessionId = this.getSipSessionId(session);
6845
6850
  const exists = sessionId in this.networkMonitoringInterval;
6846
- logger$9.info('stopping network inspection', { id: sessionId, exists });
6851
+ logger$3.info('stopping network inspection', { id: sessionId, exists });
6847
6852
 
6848
6853
  if (exists) {
6849
6854
  clearInterval(this.networkMonitoringInterval[sessionId]);
@@ -6853,17 +6858,17 @@ class WebRTCClient extends Emitter {
6853
6858
  }
6854
6859
 
6855
6860
  reject(session ) {
6856
- logger$9.info('sdk webrtc reject call', { id: session.id });
6861
+ logger$3.info('sdk webrtc reject call', { id: session.id });
6857
6862
 
6858
6863
  try {
6859
6864
  return session.reject ? session.reject() : session.cancel();
6860
6865
  } catch (e) {
6861
- logger$9.warn('Error when rejecting call', e.message, e.stack);
6866
+ logger$3.warn('Error when rejecting call', e.message, e.stack);
6862
6867
  }
6863
6868
  }
6864
6869
 
6865
6870
  async close() {
6866
- logger$9.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
6871
+ logger$3.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
6867
6872
  this._cleanupMedia();
6868
6873
  this.connectionPromise = null;
6869
6874
 
@@ -6894,7 +6899,7 @@ class WebRTCClient extends Emitter {
6894
6899
  // eg: "INVITE not rejectable in state Completed"
6895
6900
  }
6896
6901
  this.userAgent = null;
6897
- logger$9.info('sdk webrtc client closed');
6902
+ logger$3.info('sdk webrtc client closed');
6898
6903
  }
6899
6904
 
6900
6905
  getNumber(session ) {
@@ -6907,13 +6912,13 @@ class WebRTCClient extends Emitter {
6907
6912
  }
6908
6913
 
6909
6914
  mute(session ) {
6910
- logger$9.info('sdk webrtc mute', { id: session.id });
6915
+ logger$3.info('sdk webrtc mute', { id: session.id });
6911
6916
 
6912
6917
  this._toggleAudio(session, true);
6913
6918
  }
6914
6919
 
6915
6920
  unmute(session ) {
6916
- logger$9.info('sdk webrtc unmute', { id: session.id });
6921
+ logger$3.info('sdk webrtc unmute', { id: session.id });
6917
6922
 
6918
6923
  this._toggleAudio(session, false);
6919
6924
  }
@@ -6953,13 +6958,13 @@ class WebRTCClient extends Emitter {
6953
6958
  }
6954
6959
 
6955
6960
  toggleCameraOn(session ) {
6956
- logger$9.info('sdk webrtc toggle camera on', { id: session.id });
6961
+ logger$3.info('sdk webrtc toggle camera on', { id: session.id });
6957
6962
 
6958
6963
  this._toggleVideo(session, false);
6959
6964
  }
6960
6965
 
6961
6966
  toggleCameraOff(session ) {
6962
- logger$9.info('sdk webrtc toggle camera off', { id: session.id });
6967
+ logger$3.info('sdk webrtc toggle camera off', { id: session.id });
6963
6968
 
6964
6969
  this._toggleVideo(session, true);
6965
6970
  }
@@ -6968,7 +6973,7 @@ class WebRTCClient extends Emitter {
6968
6973
  const sessionId = this.getSipSessionId(session);
6969
6974
  const hasVideo = hadVideo || this.hasLocalVideo(sessionId);
6970
6975
 
6971
- logger$9.info('sdk webrtc hold', {
6976
+ logger$3.info('sdk webrtc hold', {
6972
6977
  sessionId,
6973
6978
  keys: Object.keys(this.heldSessions),
6974
6979
  pendingReinvite: !!session.pendingReinvite,
@@ -7017,7 +7022,7 @@ class WebRTCClient extends Emitter {
7017
7022
  const sessionId = this.getSipSessionId(session);
7018
7023
  const hasVideo = sessionId in this.heldSessions && this.heldSessions[sessionId].hasVideo;
7019
7024
 
7020
- logger$9.info('sdk webrtc unhold', {
7025
+ logger$3.info('sdk webrtc unhold', {
7021
7026
  sessionId,
7022
7027
  keys: Object.keys(this.heldSessions),
7023
7028
  pendingReinvite: !!session.pendingReinvite,
@@ -7165,7 +7170,7 @@ class WebRTCClient extends Emitter {
7165
7170
  if (!session.sessionDescriptionHandler) {
7166
7171
  return;
7167
7172
  }
7168
- logger$9.info('Sending DTMF', {
7173
+ logger$3.info('Sending DTMF', {
7169
7174
  id: this.getSipSessionId(session),
7170
7175
  tone,
7171
7176
  });
@@ -7181,7 +7186,7 @@ class WebRTCClient extends Emitter {
7181
7186
  transfer(session , target ) {
7182
7187
  this.hold(session);
7183
7188
 
7184
- logger$9.info('Transfering a session', {
7189
+ logger$3.info('Transfering a session', {
7185
7190
  id: this.getSipSessionId(session),
7186
7191
  target,
7187
7192
  });
@@ -7203,17 +7208,17 @@ class WebRTCClient extends Emitter {
7203
7208
  atxfer(session ) {
7204
7209
  this.hold(session);
7205
7210
 
7206
- logger$9.info('webrtc transfer started', { id: this.getSipSessionId(session) });
7211
+ logger$3.info('webrtc transfer started', { id: this.getSipSessionId(session) });
7207
7212
 
7208
7213
  const result = {
7209
7214
  newSession: null,
7210
7215
  init: async (target ) => {
7211
- logger$9.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
7216
+ logger$3.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
7212
7217
 
7213
7218
  result.newSession = await this.call(target);
7214
7219
  },
7215
7220
  complete: () => {
7216
- logger$9.info('webrtc transfer completed', {
7221
+ logger$3.info('webrtc transfer completed', {
7217
7222
  id: this.getSipSessionId(session),
7218
7223
  referId: this.getSipSessionId(result.newSession),
7219
7224
  });
@@ -7234,7 +7239,7 @@ class WebRTCClient extends Emitter {
7234
7239
  return;
7235
7240
  }
7236
7241
 
7237
- logger$9.info('send WebRTC message', { sipId: sipSession.id, contentType });
7242
+ logger$3.info('send WebRTC message', { sipId: sipSession.id, contentType });
7238
7243
 
7239
7244
  try {
7240
7245
  sipSession.message({
@@ -7276,7 +7281,7 @@ class WebRTCClient extends Emitter {
7276
7281
  }
7277
7282
 
7278
7283
  changeAudioOutputVolume(volume ) {
7279
- logger$9.info('Changing audio output volume', { volume });
7284
+ logger$3.info('Changing audio output volume', { volume });
7280
7285
 
7281
7286
  Object.values(this.audioElements).forEach(audioElement => {
7282
7287
  if (audioElement instanceof HTMLAudioElement) {
@@ -7288,7 +7293,7 @@ class WebRTCClient extends Emitter {
7288
7293
  }
7289
7294
 
7290
7295
  changeAudioOutputDevice(id ) {
7291
- logger$9.info('Changing audio output device', { id });
7296
+ logger$3.info('Changing audio output device', { id });
7292
7297
 
7293
7298
  Object.values(this.audioElements).forEach(audioElement => {
7294
7299
  // `setSinkId` method is not included in any flow type definitions for HTMLAudioElements but is a valid method
@@ -7305,7 +7310,7 @@ class WebRTCClient extends Emitter {
7305
7310
 
7306
7311
  changeAudioInputDevice(id , session ) {
7307
7312
  const currentId = this.getAudioDeviceId();
7308
- logger$9.info('setting audio input device', { id, currentId, session: !!session });
7313
+ logger$3.info('setting audio input device', { id, currentId, session: !!session });
7309
7314
 
7310
7315
  if (id === currentId) {
7311
7316
  return null;
@@ -7351,7 +7356,7 @@ class WebRTCClient extends Emitter {
7351
7356
 
7352
7357
  setVideoInputDevice(id ) {
7353
7358
  const currentId = this.getVideoDeviceId();
7354
- logger$9.info('setting video input device', { id, currentId });
7359
+ logger$3.info('setting video input device', { id, currentId });
7355
7360
 
7356
7361
  if (id === currentId) {
7357
7362
  return null;
@@ -7376,7 +7381,7 @@ class WebRTCClient extends Emitter {
7376
7381
  const sessionId = this.getSipSessionId(session);
7377
7382
  const localStream = this.getLocalStream(sessionId);
7378
7383
 
7379
- logger$9.info('changing video input device', { id, sessionId });
7384
+ logger$3.info('changing video input device', { id, sessionId });
7380
7385
 
7381
7386
  // Release old video stream
7382
7387
  if (localStream) {
@@ -7444,7 +7449,7 @@ class WebRTCClient extends Emitter {
7444
7449
  const shouldDoScreenSharing = newConstraints && newConstraints.screen;
7445
7450
  const desktop = newConstraints && newConstraints.desktop;
7446
7451
 
7447
- logger$9.info('Sending reinvite', {
7452
+ logger$3.info('Sending reinvite', {
7448
7453
  id: this.getSipSessionId(sipSession),
7449
7454
  newConstraints,
7450
7455
  conference,
@@ -7482,7 +7487,7 @@ class WebRTCClient extends Emitter {
7482
7487
  sipSession.incomingInviteRequest.message.body = response.message.body;
7483
7488
  }
7484
7489
 
7485
- logger$9.info('on re-INVITE accepted', {
7490
+ logger$3.info('on re-INVITE accepted', {
7486
7491
  id: this.getSipSessionId(sipSession),
7487
7492
  wasMuted,
7488
7493
  shouldDoScreenSharing,
@@ -7500,7 +7505,7 @@ class WebRTCClient extends Emitter {
7500
7505
  this.eventEmitter.emit(ON_SCREEN_SHARING_REINVITE, sipSession, response, desktop);
7501
7506
  }
7502
7507
 
7503
- return this.eventEmitter.emit(ON_REINVITE$1, sipSession, response);
7508
+ return this.eventEmitter.emit(ON_REINVITE, sipSession, response);
7504
7509
  },
7505
7510
  },
7506
7511
  sessionDescriptionHandlerModifiers: [replaceLocalIpModifier],
@@ -7657,7 +7662,7 @@ class WebRTCClient extends Emitter {
7657
7662
  }
7658
7663
 
7659
7664
  startHeartbeat() {
7660
- logger$9.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
7665
+ logger$3.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
7661
7666
  if (!this.userAgent) {
7662
7667
  this.heartbeat.stop();
7663
7668
  return;
@@ -7670,7 +7675,7 @@ class WebRTCClient extends Emitter {
7670
7675
  }
7671
7676
 
7672
7677
  stopHeartbeat() {
7673
- logger$9.info('sdk webrtc stop heartbeat');
7678
+ logger$3.info('sdk webrtc stop heartbeat');
7674
7679
  this.heartbeat.stop();
7675
7680
  }
7676
7681
 
@@ -7691,7 +7696,7 @@ class WebRTCClient extends Emitter {
7691
7696
  }
7692
7697
 
7693
7698
  attemptReconnection() {
7694
- logger$9.info('attempt reconnection', { userAgent: !!this.userAgent });
7699
+ logger$3.info('attempt reconnection', { userAgent: !!this.userAgent });
7695
7700
  if (!this.userAgent) {
7696
7701
  return;
7697
7702
  }
@@ -7716,7 +7721,7 @@ class WebRTCClient extends Emitter {
7716
7721
  return;
7717
7722
  }
7718
7723
 
7719
- logger$9.info('setting local media stream', {
7724
+ logger$3.info('setting local media stream', {
7720
7725
  sipSessionId,
7721
7726
  tracks: newStream ? newStream.getTracks() : null,
7722
7727
  });
@@ -7733,7 +7738,7 @@ class WebRTCClient extends Emitter {
7733
7738
 
7734
7739
  const oldStream = this.getLocalStream(sipSessionId);
7735
7740
 
7736
- logger$9.info('updating local stream', {
7741
+ logger$3.info('updating local stream', {
7737
7742
  sipSessionId,
7738
7743
  oldStream: !!oldStream,
7739
7744
  tracks: newStream.getTracks(),
@@ -7753,7 +7758,7 @@ class WebRTCClient extends Emitter {
7753
7758
  const remoteStream = this.getRemoteStream(sessionId);
7754
7759
  const pc = this.getPeerConnection(sessionId);
7755
7760
 
7756
- logger$9.info('Updating remote stream', {
7761
+ logger$3.info('Updating remote stream', {
7757
7762
  sessionId,
7758
7763
  tracks: remoteStream ? remoteStream.getTracks() : null,
7759
7764
  receiverTracks: pc && pc.getReceivers ? pc.getReceivers().map(receiver => receiver.track) : null,
@@ -7779,7 +7784,7 @@ class WebRTCClient extends Emitter {
7779
7784
  const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
7780
7785
  const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
7781
7786
 
7782
- logger$9.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
7787
+ logger$3.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
7783
7788
 
7784
7789
  return {
7785
7790
  constraints: {
@@ -7828,7 +7833,7 @@ class WebRTCClient extends Emitter {
7828
7833
  }
7829
7834
 
7830
7835
  _onTransportError() {
7831
- logger$9.error('on transport error');
7836
+ logger$3.error('on transport error');
7832
7837
  this.eventEmitter.emit(TRANSPORT_ERROR);
7833
7838
  this.attemptReconnection();
7834
7839
  }
@@ -7837,7 +7842,7 @@ class WebRTCClient extends Emitter {
7837
7842
  const body = message && typeof message === 'object' ? message.data : message;
7838
7843
  if (body && body.indexOf('200 OK') !== -1) {
7839
7844
  if (this.hasHeartbeat()) {
7840
- logger$9.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
7845
+ logger$3.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
7841
7846
 
7842
7847
  this.heartbeat.onHeartbeat();
7843
7848
  if (this.heartbeatCb) {
@@ -7848,7 +7853,7 @@ class WebRTCClient extends Emitter {
7848
7853
  }
7849
7854
 
7850
7855
  async _onHeartbeatTimeout() {
7851
- logger$9.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
7856
+ logger$3.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
7852
7857
 
7853
7858
  if (this.heartbeatTimeoutCb) {
7854
7859
  this.heartbeatTimeoutCb();
@@ -7860,7 +7865,7 @@ class WebRTCClient extends Emitter {
7860
7865
  try {
7861
7866
  await this.userAgent.transport.disconnect();
7862
7867
  } catch (e) {
7863
- logger$9.error('Transport disconnection after heartbeat timeout, error', e);
7868
+ logger$3.error('Transport disconnection after heartbeat timeout, error', e);
7864
7869
  }
7865
7870
  }
7866
7871
 
@@ -7893,31 +7898,31 @@ class WebRTCClient extends Emitter {
7893
7898
  }
7894
7899
 
7895
7900
  _connectIfNeeded() {
7896
- logger$9.info('connect if needed, checking', { connected: this.isConnected() });
7901
+ logger$3.info('connect if needed, checking', { connected: this.isConnected() });
7897
7902
  if (!this.userAgent) {
7898
- logger$9.info('need to recreate User Agent');
7903
+ logger$3.info('need to recreate User Agent');
7899
7904
  this.userAgent = this.createUserAgent(this.uaConfigOverrides);
7900
7905
  }
7901
7906
 
7902
7907
  if (this.isConnected()) {
7903
- logger$9.info('webrtc sdk, already connected');
7908
+ logger$3.info('webrtc sdk, already connected');
7904
7909
  return Promise.resolve();
7905
7910
  }
7906
7911
 
7907
7912
  if (this.isConnecting()) {
7908
- logger$9.info('webrtc sdk, already connecting...');
7913
+ logger$3.info('webrtc sdk, already connecting...');
7909
7914
 
7910
7915
  this.connectionPromise = this.userAgent.transport.connectPromise;
7911
7916
  return this.connectionPromise;
7912
7917
  }
7913
7918
 
7914
7919
  if (this.connectionPromise) {
7915
- logger$9.info('webrtc sdk, connection promise connecting...');
7920
+ logger$3.info('webrtc sdk, connection promise connecting...');
7916
7921
  // $FlowFixMe
7917
7922
  return this.connectionPromise;
7918
7923
  }
7919
7924
 
7920
- logger$9.info('WebRTC UA needs to connect');
7925
+ logger$3.info('WebRTC UA needs to connect');
7921
7926
 
7922
7927
  // Force UA to reconnect
7923
7928
  if (this.userAgent && this.userAgent.state !== UserAgentState.Stopped) {
@@ -8042,7 +8047,7 @@ class WebRTCClient extends Emitter {
8042
8047
 
8043
8048
  sdh.peerConnectionDelegate = {
8044
8049
  onicecandidateerror: (error ) => {
8045
- logger$9.error('on icecandidate error', {
8050
+ logger$3.error('on icecandidate error', {
8046
8051
  address: error.address,
8047
8052
  port: error.port,
8048
8053
  errorCode: error.errorCode,
@@ -8071,7 +8076,7 @@ class WebRTCClient extends Emitter {
8071
8076
  updatedNumber = session.assertedIdentity.uri.normal.user;
8072
8077
  updatedCalleeName = session.assertedIdentity.displayName || updatedNumber;
8073
8078
  }
8074
- logger$9.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
8079
+ logger$3.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
8075
8080
 
8076
8081
  // Useful to know if it's a video upgrade or an unhold from a remote peer with a video stream
8077
8082
 
@@ -8087,12 +8092,12 @@ class WebRTCClient extends Emitter {
8087
8092
 
8088
8093
  this._setupMedias(session);
8089
8094
 
8090
- return this.eventEmitter.emit(ON_REINVITE$1, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
8095
+ return this.eventEmitter.emit(ON_REINVITE, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
8091
8096
  };
8092
8097
  }
8093
8098
 
8094
8099
  _onAccepted(session , sessionDialog , withEvent = true) {
8095
- logger$9.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
8100
+ logger$3.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
8096
8101
 
8097
8102
  this.storeSipSession(session);
8098
8103
 
@@ -8104,14 +8109,14 @@ class WebRTCClient extends Emitter {
8104
8109
  const onTrack = (event ) => {
8105
8110
  const isAudioOnly = this._isAudioOnly(session);
8106
8111
  const { kind, label, readyState, id, muted } = event.track;
8107
- logger$9.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
8112
+ logger$3.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
8108
8113
 
8109
8114
  // Stop video track in audio only mode
8110
8115
  if (isAudioOnly && kind === 'video') {
8111
8116
  event.track.stop();
8112
8117
  }
8113
8118
 
8114
- this.eventEmitter.emit(ON_TRACK$1, session, event);
8119
+ this.eventEmitter.emit(ON_TRACK, session, event);
8115
8120
  };
8116
8121
 
8117
8122
  if (session.sessionDescriptionHandler.peerConnection) {
@@ -8121,9 +8126,9 @@ class WebRTCClient extends Emitter {
8121
8126
  session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
8122
8127
 
8123
8128
  pc.oniceconnectionstatechange = () => {
8124
- logger$9.info('on ice connection state changed', { state: pc.iceConnectionState });
8129
+ logger$3.info('on ice connection state changed', { state: pc.iceConnectionState });
8125
8130
  if (pc.iceConnectionState === 'disconnected') {
8126
- this.eventEmitter.emit(ON_DISCONNECTED$1);
8131
+ this.eventEmitter.emit(ON_DISCONNECTED);
8127
8132
  }
8128
8133
  };
8129
8134
 
@@ -8294,10 +8299,10 @@ class WebRTCClient extends Emitter {
8294
8299
 
8295
8300
  _stopSendingStats(session ) {
8296
8301
  const sessionId = this.getSipSessionId(session);
8297
- logger$9.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
8302
+ logger$3.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
8298
8303
 
8299
8304
  if (sessionId in this.statsIntervals) {
8300
- logger$9.trace('Stop sending stats for call', { sessionId });
8305
+ logger$3.trace('Stop sending stats for call', { sessionId });
8301
8306
  this.statsIntervals[sessionId]();
8302
8307
  delete this.statsIntervals[sessionId];
8303
8308
  }
@@ -8313,7 +8318,7 @@ class WebRTCClient extends Emitter {
8313
8318
  try {
8314
8319
  await this.userAgent.transport.disconnect();
8315
8320
  } catch (e) {
8316
- logger$9.error('WebRTC transport disconnect, error', e);
8321
+ logger$3.error('WebRTC transport disconnect, error', e);
8317
8322
  }
8318
8323
  }
8319
8324
  }
@@ -8407,7 +8412,7 @@ class WebRTCClient extends Emitter {
8407
8412
  + networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
8408
8413
  + networkStats.transportSent;
8409
8414
 
8410
- this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
8415
+ this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
8411
8416
  this.sessionNetworkStats[sessionId].push(networkStats);
8412
8417
  }
8413
8418
 
@@ -8435,8 +8440,8 @@ const ON_CALL_FAILED = 'onCallFailed';
8435
8440
  const ON_CALL_ENDED = 'onCallEnded';
8436
8441
  const ON_CALL_ENDING = 'onCallEnding';
8437
8442
  const ON_MESSAGE = 'onMessage';
8438
- const ON_REINVITE = 'reinvite';
8439
- const ON_TRACK = 'onTrack';
8443
+ const ON_REINVITE$1 = 'reinvite';
8444
+ const ON_TRACK$1 = 'onTrack';
8440
8445
  const ON_AUDIO_STREAM = 'onAudioStream';
8441
8446
  const ON_VIDEO_STREAM = 'onVideoStream';
8442
8447
  const ON_REMOVE_STREAM = 'onRemoveStream';
@@ -8451,15 +8456,15 @@ const ON_PLAY_PROGRESS_SOUND = 'playProgressSound';
8451
8456
  const ON_VIDEO_INPUT_CHANGE = 'videoInputChange';
8452
8457
  const ON_CALL_ERROR = 'onCallError';
8453
8458
  const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
8454
- const ON_NETWORK_STATS = 'onNetworkStats';
8459
+ const ON_NETWORK_STATS$1 = 'onNetworkStats';
8455
8460
  const ON_CHAT = 'phone/ON_CHAT';
8456
8461
  const ON_SIGNAL = 'phone/ON_SIGNAL';
8457
- const ON_DISCONNECTED = 'onDisconnected';
8462
+ const ON_DISCONNECTED$1 = 'onDisconnected';
8458
8463
 
8459
8464
  const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
8460
8465
  const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
8461
8466
 
8462
- const events = [
8467
+ const events$1 = [
8463
8468
  ON_USER_AGENT,
8464
8469
  ON_REGISTERED,
8465
8470
  ON_UNREGISTERED,
@@ -8477,8 +8482,8 @@ const events = [
8477
8482
  ON_CALL_FAILED,
8478
8483
  ON_CALL_ENDED,
8479
8484
  ON_MESSAGE,
8480
- ON_REINVITE,
8481
- ON_TRACK,
8485
+ ON_REINVITE$1,
8486
+ ON_TRACK$1,
8482
8487
  ON_AUDIO_STREAM,
8483
8488
  ON_VIDEO_STREAM,
8484
8489
  ON_REMOVE_STREAM,
@@ -8493,11 +8498,11 @@ const events = [
8493
8498
  ON_CALL_ERROR,
8494
8499
  ON_CHAT,
8495
8500
  ON_SIGNAL,
8496
- ON_NETWORK_STATS,
8497
- ON_DISCONNECTED,
8501
+ ON_NETWORK_STATS$1,
8502
+ ON_DISCONNECTED$1,
8498
8503
  ];
8499
8504
 
8500
- const logger$8 = IssueReporter$1.loggerFor('webrtc-phone');
8505
+ const logger$4 = IssueReporter$1.loggerFor('webrtc-phone');
8501
8506
 
8502
8507
  class WebRTCPhone extends Emitter {
8503
8508
 
@@ -8570,7 +8575,7 @@ class WebRTCPhone extends Emitter {
8570
8575
  }).catch(error => {
8571
8576
  // Avoid exception on `t.server.scheme` in sip transport when losing the webrtc socket connection
8572
8577
  console.error('register error', error, error.message, error.stack);
8573
- logger$8.error('WebRTC register error', { message: error.message, stack: error.stack });
8578
+ logger$4.error('WebRTC register error', { message: error.message, stack: error.stack });
8574
8579
  });
8575
8580
  }
8576
8581
 
@@ -8585,7 +8590,7 @@ class WebRTCPhone extends Emitter {
8585
8590
  if (!this.client) {
8586
8591
  return;
8587
8592
  }
8588
- logger$8.info('WebRTC phone stop');
8593
+ logger$4.info('WebRTC phone stop');
8589
8594
  this.client.stop();
8590
8595
  }
8591
8596
 
@@ -8600,7 +8605,7 @@ class WebRTCPhone extends Emitter {
8600
8605
  async sendReinvite(callSession , constraints = null, conference = false,
8601
8606
  audioOnly = false, iceRestart = false) {
8602
8607
  const sipSession = this.findSipSession(callSession);
8603
- logger$8.info('WebRTC phone - send reinvite', {
8608
+ logger$4.info('WebRTC phone - send reinvite', {
8604
8609
  sessionId: sipSession ? sipSession.id : null,
8605
8610
  constraints,
8606
8611
  audioOnly,
@@ -8637,7 +8642,7 @@ class WebRTCPhone extends Emitter {
8637
8642
  }
8638
8643
 
8639
8644
  startHeartbeat() {
8640
- logger$8.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
8645
+ logger$4.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
8641
8646
  if (!this.client || this.client.hasHeartbeat()) {
8642
8647
  return;
8643
8648
  }
@@ -8646,7 +8651,7 @@ class WebRTCPhone extends Emitter {
8646
8651
  }
8647
8652
 
8648
8653
  stopHeartbeat() {
8649
- logger$8.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
8654
+ logger$4.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
8650
8655
  if (!this.client) {
8651
8656
  return;
8652
8657
  }
@@ -8663,7 +8668,7 @@ class WebRTCPhone extends Emitter {
8663
8668
  }
8664
8669
 
8665
8670
  reconnect() {
8666
- logger$8.info('WebRTC phone - reconnect', { client: !!this.client });
8671
+ logger$4.info('WebRTC phone - reconnect', { client: !!this.client });
8667
8672
  if (!this.client) {
8668
8673
  return;
8669
8674
  }
@@ -8704,10 +8709,15 @@ class WebRTCPhone extends Emitter {
8704
8709
  return false;
8705
8710
  }
8706
8711
 
8707
- logger$8.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
8712
+ logger$4.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
8708
8713
 
8709
8714
  this.client.downgradeToAudio(sipSession);
8710
8715
 
8716
+ if (callSession) {
8717
+ callSession.cameraEnabled = false;
8718
+ this._updateCallSession(callSession);
8719
+ }
8720
+
8711
8721
  if (withMessage) {
8712
8722
  this._sendReinviteMessage(callSession, false);
8713
8723
  }
@@ -8722,7 +8732,7 @@ class WebRTCPhone extends Emitter {
8722
8732
  return Promise.resolve(false);
8723
8733
  }
8724
8734
 
8725
- logger$8.info('Upgrade to video', {
8735
+ logger$4.info('Upgrade to video', {
8726
8736
  id: callSession ? callSession.getId() : null,
8727
8737
  constraints,
8728
8738
  isConference,
@@ -8735,6 +8745,11 @@ class WebRTCPhone extends Emitter {
8735
8745
 
8736
8746
  const newStream = await this.client.upgradeToVideo(sipSession, constraints, isConference);
8737
8747
 
8748
+ if (callSession) {
8749
+ callSession.cameraEnabled = true;
8750
+ this._updateCallSession(callSession);
8751
+ }
8752
+
8738
8753
  // If no stream is returned, it means we have to reinvite
8739
8754
  if (!newStream) {
8740
8755
  return true;
@@ -8757,7 +8772,7 @@ class WebRTCPhone extends Emitter {
8757
8772
 
8758
8773
  _sendReinviteMessage(callSession , isUpgrade ) {
8759
8774
  const sipSession = this.findSipSession(callSession);
8760
- logger$8.info('Sending reinvite message', {
8775
+ logger$4.info('Sending reinvite message', {
8761
8776
  id: callSession ? callSession.getId() : null,
8762
8777
  isUpgrade,
8763
8778
  });
@@ -8783,7 +8798,7 @@ class WebRTCPhone extends Emitter {
8783
8798
  // Monkey patch to know when canceled with the CANCEL message
8784
8799
  const onCancel = sipSession._onCancel.bind(sipSession);
8785
8800
  sipSession._onCancel = (message ) => {
8786
- logger$8.trace('on sip session canceled', { callId: message.callId });
8801
+ logger$4.trace('on sip session canceled', { callId: message.callId });
8787
8802
 
8788
8803
  onCancel(message);
8789
8804
  const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
@@ -8811,13 +8826,13 @@ class WebRTCPhone extends Emitter {
8811
8826
  this.audioOutputVolume,
8812
8827
  );
8813
8828
  case SessionState.Terminating:
8814
- logger$8.info('WebRTC phone - call terminating', { sipId: sipSession.id });
8829
+ logger$4.info('WebRTC phone - call terminating', { sipId: sipSession.id });
8815
8830
 
8816
8831
  this.eventEmitter.emit(ON_CALL_ENDING, this._createCallSession(sipSession));
8817
8832
 
8818
8833
  break;
8819
8834
  case SessionState.Terminated: {
8820
- logger$8.info('WebRTC phone - call terminated', { sipId: sipSession.id });
8835
+ logger$4.info('WebRTC phone - call terminated', { sipId: sipSession.id });
8821
8836
 
8822
8837
  // Should be called before `_onCallTerminated` or the callCount will not decrement...
8823
8838
  const callSession = this._createCallSession(sipSession);
@@ -8839,7 +8854,7 @@ class WebRTCPhone extends Emitter {
8839
8854
  const [stream] = event.streams;
8840
8855
  const kind = event && event.track && event.track.kind;
8841
8856
 
8842
- logger$8.info('on track stream called on the peer connection', {
8857
+ logger$4.info('on track stream called on the peer connection', {
8843
8858
  callId: this.getSipSessionId(sipSession),
8844
8859
  streamId: stream ? stream.id : null,
8845
8860
  tracks: stream ? stream.getTracks() : null,
@@ -8859,7 +8874,7 @@ class WebRTCPhone extends Emitter {
8859
8874
  };
8860
8875
 
8861
8876
  peerConnection.onremovestream = event => {
8862
- logger$8.info('on remove stream called on the peer connection', {
8877
+ logger$4.info('on remove stream called on the peer connection', {
8863
8878
  id: event.stream.id,
8864
8879
  tracks: event.stream.getTracks(),
8865
8880
  });
@@ -8869,7 +8884,7 @@ class WebRTCPhone extends Emitter {
8869
8884
  }
8870
8885
 
8871
8886
  async startScreenSharing(constraints , callSession ) {
8872
- logger$8.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
8887
+ logger$4.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
8873
8888
 
8874
8889
  const screenShareStream = await this.client.getStreamFromConstraints(constraints);
8875
8890
  if (!screenShareStream) {
@@ -8909,7 +8924,7 @@ class WebRTCPhone extends Emitter {
8909
8924
  return;
8910
8925
  }
8911
8926
 
8912
- logger$8.info('WebRTC phone - stop screen sharing', {
8927
+ logger$4.info('WebRTC phone - stop screen sharing', {
8913
8928
  restoreLocalStream,
8914
8929
  });
8915
8930
 
@@ -8965,7 +8980,7 @@ class WebRTCPhone extends Emitter {
8965
8980
  const pc = this.client.getPeerConnection(sipSessionId);
8966
8981
  const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
8967
8982
 
8968
- logger$8.info('WebRTC phone - on screensharing', {
8983
+ logger$4.info('WebRTC phone - on screensharing', {
8969
8984
  hadVideo,
8970
8985
  id: this.getSipSessionId(sipSession),
8971
8986
  screenTrack,
@@ -8973,7 +8988,7 @@ class WebRTCPhone extends Emitter {
8973
8988
 
8974
8989
  if (screenTrack) {
8975
8990
  screenTrack.onended = () => {
8976
- logger$8.info('WebRTC phone - on screenshare ended', {
8991
+ logger$4.info('WebRTC phone - on screenshare ended', {
8977
8992
  hadVideo,
8978
8993
  id: this.getSipSessionId(sipSession),
8979
8994
  screenTrack,
@@ -9004,7 +9019,7 @@ class WebRTCPhone extends Emitter {
9004
9019
  }
9005
9020
 
9006
9021
  _onCallAccepted(sipSession , cameraEnabled ) {
9007
- logger$8.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
9022
+ logger$4.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
9008
9023
 
9009
9024
  const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
9010
9025
  this.currentSipSession = sipSession;
@@ -9022,7 +9037,7 @@ class WebRTCPhone extends Emitter {
9022
9037
  }
9023
9038
 
9024
9039
  changeAudioDevice(id ) {
9025
- logger$8.info('WebRTC phone - change audio device', { deviceId: id });
9040
+ logger$4.info('WebRTC phone - change audio device', { deviceId: id });
9026
9041
  this.audioOutputDeviceId = id;
9027
9042
  this.client.changeAudioOutputDevice(id);
9028
9043
  }
@@ -9032,14 +9047,14 @@ class WebRTCPhone extends Emitter {
9032
9047
  }
9033
9048
 
9034
9049
  changeRingDevice(id ) {
9035
- logger$8.info('WebRTC phone - changing ring device', { id });
9050
+ logger$4.info('WebRTC phone - changing ring device', { id });
9036
9051
 
9037
9052
  this.audioRingDeviceId = id;
9038
9053
  }
9039
9054
 
9040
9055
  // volume is a value between 0 and 1
9041
9056
  changeAudioVolume(volume ) {
9042
- logger$8.info('WebRTC phone - changing audio volume', { volume });
9057
+ logger$4.info('WebRTC phone - changing audio volume', { volume });
9043
9058
 
9044
9059
  this.audioOutputVolume = volume;
9045
9060
  this.client.changeAudioOutputVolume(volume);
@@ -9047,31 +9062,31 @@ class WebRTCPhone extends Emitter {
9047
9062
 
9048
9063
  // volume is a value between 0 and 1
9049
9064
  changeRingVolume(volume ) {
9050
- logger$8.info('WebRTC phone - changing ring volume', { volume });
9065
+ logger$4.info('WebRTC phone - changing ring volume', { volume });
9051
9066
 
9052
9067
  this.audioRingVolume = volume;
9053
9068
  }
9054
9069
 
9055
9070
  changeAudioInputDevice(id ) {
9056
- logger$8.info('WebRTC phone - changeAudio input device', { deviceId: id });
9071
+ logger$4.info('WebRTC phone - changeAudio input device', { deviceId: id });
9057
9072
 
9058
9073
  return this.client.changeAudioInputDevice(id, this.currentSipSession);
9059
9074
  }
9060
9075
 
9061
9076
  changeVideoInputDevice(id ) {
9062
- logger$8.info('WebRTC phone - change video input device', { deviceId: id });
9077
+ logger$4.info('WebRTC phone - change video input device', { deviceId: id });
9063
9078
 
9064
9079
  return this.client.changeVideoInputDevice(id, this.currentSipSession);
9065
9080
  }
9066
9081
 
9067
9082
  changeSessionVideoInputDevice(id ) {
9068
- logger$8.info('WebRTC phone - change session video input device', { deviceId: id });
9083
+ logger$4.info('WebRTC phone - change session video input device', { deviceId: id });
9069
9084
 
9070
9085
  return this.client.changeSessionVideoInputDevice(id, this.currentSipSession);
9071
9086
  }
9072
9087
 
9073
9088
  _onCallTerminated(sipSession ) {
9074
- logger$8.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9089
+ logger$4.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9075
9090
 
9076
9091
  const callSession = this._createCallSession(sipSession);
9077
9092
  const isCurrentSession = this.isCurrentCallSipSession(callSession);
@@ -9105,7 +9120,7 @@ class WebRTCPhone extends Emitter {
9105
9120
  const hasIncomingCallSession = this.hasIncomingCallSession();
9106
9121
 
9107
9122
  // Re-trigger incoming call event for remaining incoming calls
9108
- logger$8.info('WebRTC phone - check to re-trigger incoming call', {
9123
+ logger$4.info('WebRTC phone - check to re-trigger incoming call', {
9109
9124
  sipId: sipSession.id,
9110
9125
  shouldRetrigger,
9111
9126
  hasIncomingCallSession,
@@ -9196,37 +9211,37 @@ class WebRTCPhone extends Emitter {
9196
9211
 
9197
9212
  // Deprecated
9198
9213
  getLocalStreamForCall(callSession ) {
9199
- logger$8.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
9214
+ logger$4.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
9200
9215
 
9201
9216
  return this.getLocalStream(callSession);
9202
9217
  }
9203
9218
 
9204
9219
  // Deprecated
9205
9220
  getRemoteStreamForCall(callSession ) {
9206
- logger$8.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
9221
+ logger$4.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
9207
9222
 
9208
9223
  return this.getRemoteVideoStream(callSession);
9209
9224
  }
9210
9225
 
9211
9226
  getRemoteStreamsForCall(callSession ) {
9212
- logger$8.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
9227
+ logger$4.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
9213
9228
 
9214
9229
  return this.getRemoteStream(callSession);
9215
9230
  }
9216
9231
 
9217
9232
  accept(callSession , cameraEnabled ) {
9218
- logger$8.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
9233
+ logger$4.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
9219
9234
  if (this.currentSipSession) {
9220
9235
  this.holdSipSession(this.currentSipSession, this.currentCallSession, true);
9221
9236
  }
9222
9237
 
9223
9238
  if (!callSession) {
9224
- logger$8.warn('no CallSession to accept.');
9239
+ logger$4.warn('no CallSession to accept.');
9225
9240
  return Promise.resolve(null);
9226
9241
  }
9227
9242
 
9228
9243
  if (callSession.getId() in this.acceptedSessions) {
9229
- logger$8.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
9244
+ logger$4.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
9230
9245
  return Promise.resolve(callSession.sipCallId);
9231
9246
  }
9232
9247
 
@@ -9238,24 +9253,24 @@ class WebRTCPhone extends Emitter {
9238
9253
  const sipSession = this.client.getSipSession(callSession.getId());
9239
9254
  if (sipSession) {
9240
9255
  if (sipSession.state === SessionState.Terminated || sipSession.state === SessionState.Terminating) {
9241
- logger$8.warn('Trying to answer a terminated sipSession.');
9256
+ logger$4.warn('Trying to answer a terminated sipSession.');
9242
9257
 
9243
9258
  return Promise.resolve(null);
9244
9259
  }
9245
9260
 
9246
- logger$8.info('accept call, session found', { sipId: sipSession.id });
9261
+ logger$4.info('accept call, session found', { sipId: sipSession.id });
9247
9262
 
9248
9263
  // $FlowFixMe
9249
9264
  return this.client.answer(sipSession, this.allowVideo ? cameraEnabled : false).then(() => {
9250
9265
  return callSession.sipCallId;
9251
9266
  }).catch(e => {
9252
- logger$8.error(e);
9267
+ logger$4.error(e);
9253
9268
  this.endCurrentCall(callSession);
9254
9269
  throw e;
9255
9270
  });
9256
9271
  }
9257
9272
 
9258
- logger$8.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
9273
+ logger$4.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
9259
9274
 
9260
9275
  return Promise.resolve(null);
9261
9276
  }
@@ -9265,7 +9280,7 @@ class WebRTCPhone extends Emitter {
9265
9280
  }
9266
9281
 
9267
9282
  async reject(callSession ) {
9268
- logger$8.info('reject WebRTC called', { id: callSession.getId() });
9283
+ logger$4.info('reject WebRTC called', { id: callSession.getId() });
9269
9284
 
9270
9285
  this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'call rejected locally');
9271
9286
  if (!callSession || callSession.getId() in this.rejectedSessions) {
@@ -9277,14 +9292,14 @@ class WebRTCPhone extends Emitter {
9277
9292
 
9278
9293
  const sipSession = this.findSipSession(callSession);
9279
9294
  if (sipSession) {
9280
- logger$8.info('WebRTC rejecting', { sipId: sipSession.id });
9295
+ logger$4.info('WebRTC rejecting', { sipId: sipSession.id });
9281
9296
 
9282
9297
  this.client.hangup(sipSession);
9283
9298
  }
9284
9299
  }
9285
9300
 
9286
9301
  async ignore(callSession ) {
9287
- logger$8.info('WebRTC ignore', { id: callSession.getId() });
9302
+ logger$4.info('WebRTC ignore', { id: callSession.getId() });
9288
9303
 
9289
9304
  // kill the ring
9290
9305
  this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'ignoring call');
@@ -9296,14 +9311,14 @@ class WebRTCPhone extends Emitter {
9296
9311
  const sipSession = this.findSipSession(callSession);
9297
9312
 
9298
9313
  if (sipSession) {
9299
- logger$8.info('WebRTC atxfer', { sipId: sipSession.id });
9314
+ logger$4.info('WebRTC atxfer', { sipId: sipSession.id });
9300
9315
 
9301
9316
  return this.client.atxfer(sipSession);
9302
9317
  }
9303
9318
  }
9304
9319
 
9305
9320
  hold(callSession , withEvent = true, isConference = false) {
9306
- logger$8.info('WebRTC hold', { id: callSession.getId() });
9321
+ logger$4.info('WebRTC hold', { id: callSession.getId() });
9307
9322
 
9308
9323
  const sipSession = this.findSipSession(callSession);
9309
9324
 
@@ -9318,18 +9333,18 @@ class WebRTCPhone extends Emitter {
9318
9333
  }
9319
9334
 
9320
9335
  resume(callSession , isConference = false, withEvent = true) {
9321
- logger$8.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
9336
+ logger$4.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
9322
9337
 
9323
9338
  const sipSession = this.findSipSession(callSession);
9324
9339
  if (!sipSession) {
9325
9340
  return new Promise((resolve, reject) => reject(new Error('No session to resume')));
9326
9341
  }
9327
9342
 
9328
- logger$8.info('WebRTC resuming', { sipId: sipSession.id });
9343
+ logger$4.info('WebRTC resuming', { sipId: sipSession.id });
9329
9344
 
9330
9345
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
9331
9346
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
9332
- logger$8.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9347
+ logger$4.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9333
9348
  this.holdSipSession(this.currentSipSession, callSession);
9334
9349
  }
9335
9350
 
@@ -9354,7 +9369,7 @@ class WebRTCPhone extends Emitter {
9354
9369
  const sessionId = this.getSipSessionId(sipSession);
9355
9370
  const hasVideo = this.client.hasLocalVideo(sessionId);
9356
9371
 
9357
- logger$8.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
9372
+ logger$4.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
9358
9373
 
9359
9374
  // Stop screenshre if needed
9360
9375
  if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
@@ -9385,7 +9400,7 @@ class WebRTCPhone extends Emitter {
9385
9400
  return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
9386
9401
  }
9387
9402
  const sessionId = this.getSipSessionId(sipSession);
9388
- logger$8.info('WebRTC unhold sip session', { sessionId, isConference });
9403
+ logger$4.info('WebRTC unhold sip session', { sessionId, isConference });
9389
9404
 
9390
9405
  const { hasVideo } = this.client.getHeldSession(sessionId) || {};
9391
9406
  const wasScreensharing = this.lastScreenShare && this.lastScreenShare.sipSessionId === sessionId;
@@ -9429,14 +9444,14 @@ class WebRTCPhone extends Emitter {
9429
9444
  }
9430
9445
 
9431
9446
  mute(callSession , withEvent = true) {
9432
- logger$8.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
9447
+ logger$4.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
9433
9448
 
9434
9449
  const sipSession = this.findSipSession(callSession);
9435
9450
  if (!sipSession) {
9436
9451
  return;
9437
9452
  }
9438
9453
 
9439
- logger$8.info('WebRTC muting', { sipId: sipSession.id });
9454
+ logger$4.info('WebRTC muting', { sipId: sipSession.id });
9440
9455
  this.client.mute(sipSession);
9441
9456
  const newCallSession = this._createCallSession(sipSession, callSession, { muted: true });
9442
9457
 
@@ -9450,14 +9465,14 @@ class WebRTCPhone extends Emitter {
9450
9465
  }
9451
9466
 
9452
9467
  unmute(callSession , withEvent = true) {
9453
- logger$8.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
9468
+ logger$4.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
9454
9469
 
9455
9470
  const sipSession = this.findSipSession(callSession);
9456
9471
  if (!sipSession) {
9457
9472
  return;
9458
9473
  }
9459
9474
 
9460
- logger$8.info('WebRTC unmuting', { sipId: sipSession.id });
9475
+ logger$4.info('WebRTC unmuting', { sipId: sipSession.id });
9461
9476
  this.client.unmute(sipSession);
9462
9477
  const newCallSession = this._createCallSession(sipSession, callSession, { muted: false });
9463
9478
 
@@ -9484,7 +9499,7 @@ class WebRTCPhone extends Emitter {
9484
9499
  if (!sipSession) {
9485
9500
  return;
9486
9501
  }
9487
- logger$8.info('WebRTC turn camera on', { sipId: sipSession.id });
9502
+ logger$4.info('WebRTC turn camera on', { sipId: sipSession.id });
9488
9503
 
9489
9504
  this.client.toggleCameraOn(sipSession);
9490
9505
 
@@ -9496,7 +9511,7 @@ class WebRTCPhone extends Emitter {
9496
9511
  if (!sipSession) {
9497
9512
  return;
9498
9513
  }
9499
- logger$8.info('WebRTC turn camera off', { sipId: sipSession.id });
9514
+ logger$4.info('WebRTC turn camera off', { sipId: sipSession.id });
9500
9515
 
9501
9516
  this.client.toggleCameraOff(sipSession);
9502
9517
  this.eventEmitter.emit(ON_CAMERA_DISABLED, this._createCameraDisabledCallSession(sipSession, callSession));
@@ -9508,7 +9523,7 @@ class WebRTCPhone extends Emitter {
9508
9523
  return;
9509
9524
  }
9510
9525
 
9511
- logger$8.info('WebRTC send key', { sipId: sipSession.id, tone });
9526
+ logger$4.info('WebRTC send key', { sipId: sipSession.id, tone });
9512
9527
  this.client.sendDTMF(sipSession, tone);
9513
9528
  }
9514
9529
 
@@ -9516,7 +9531,7 @@ class WebRTCPhone extends Emitter {
9516
9531
  // @TODO: line is not used here
9517
9532
  async makeCall(number , line , cameraEnabled ,
9518
9533
  audioOnly = false, conference = false) {
9519
- logger$8.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled });
9534
+ logger$4.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled });
9520
9535
  if (!number) {
9521
9536
  return Promise.resolve(null);
9522
9537
  }
@@ -9526,7 +9541,7 @@ class WebRTCPhone extends Emitter {
9526
9541
  }
9527
9542
  if (this.currentSipSession) {
9528
9543
  this.holdSipSession(this.currentSipSession, this.currentCallSession, true).catch(e => {
9529
- logger$8.warn('Unable to hold current session when making another call', e);
9544
+ logger$4.warn('Unable to hold current session when making another call', e);
9530
9545
  });
9531
9546
  }
9532
9547
 
@@ -9536,7 +9551,7 @@ class WebRTCPhone extends Emitter {
9536
9551
  this._bindEvents(sipSession);
9537
9552
  } catch (error) {
9538
9553
  console.warn(error);
9539
- logger$8.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
9554
+ logger$4.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
9540
9555
  return Promise.resolve(null);
9541
9556
  }
9542
9557
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
@@ -9564,7 +9579,7 @@ class WebRTCPhone extends Emitter {
9564
9579
  return;
9565
9580
  }
9566
9581
 
9567
- logger$8.info('WebRTC transfer', { sipId: sipSession.id, target });
9582
+ logger$4.info('WebRTC transfer', { sipId: sipSession.id, target });
9568
9583
 
9569
9584
  this.client.transfer(sipSession, target);
9570
9585
  }
@@ -9573,7 +9588,7 @@ class WebRTCPhone extends Emitter {
9573
9588
  const sipSession = this.client.getSipSession(source.sipCallId);
9574
9589
  const sipSessionTarget = this.client.getSipSession(destination.sipCallId);
9575
9590
 
9576
- logger$8.info('WebRTC indirect transfer', {
9591
+ logger$4.info('WebRTC indirect transfer', {
9577
9592
  sipId: sipSession ? sipSession.id : null,
9578
9593
  target: sipSessionTarget ? sipSessionTarget.id : null,
9579
9594
  });
@@ -9612,7 +9627,7 @@ class WebRTCPhone extends Emitter {
9612
9627
  return false;
9613
9628
  }
9614
9629
 
9615
- logger$8.info('WebRTC hangup', { sipId: sipSession.id });
9630
+ logger$4.info('WebRTC hangup', { sipId: sipSession.id });
9616
9631
 
9617
9632
  const sipSessionId = this.getSipSessionId(sipSession);
9618
9633
 
@@ -9658,7 +9673,7 @@ class WebRTCPhone extends Emitter {
9658
9673
  endCurrentCall(callSession ) {
9659
9674
  const isCurrent = this.isCurrentCallSipSession(callSession);
9660
9675
 
9661
- logger$8.info('Ending current call', {
9676
+ logger$4.info('Ending current call', {
9662
9677
  id: callSession ? callSession.getId() : null,
9663
9678
  isCurrent,
9664
9679
  });
@@ -9682,7 +9697,7 @@ class WebRTCPhone extends Emitter {
9682
9697
  }
9683
9698
 
9684
9699
  async close() {
9685
- logger$8.info('WebRTC close');
9700
+ logger$4.info('WebRTC close');
9686
9701
 
9687
9702
  try {
9688
9703
  await Promise.race([
@@ -9690,7 +9705,7 @@ class WebRTCPhone extends Emitter {
9690
9705
  new Promise((resolve, reject) => setTimeout(() => reject(new Error('Unregister, timed out')), 3000)),
9691
9706
  ]);
9692
9707
  } catch (e) {
9693
- logger$8.error('WebRTC close, unregister error', e);
9708
+ logger$4.error('WebRTC close, unregister error', e);
9694
9709
  }
9695
9710
 
9696
9711
  this.client.close();
@@ -9708,12 +9723,12 @@ class WebRTCPhone extends Emitter {
9708
9723
  }
9709
9724
 
9710
9725
  enableRinging() {
9711
- logger$8.info('WebRTC enable ringing');
9726
+ logger$4.info('WebRTC enable ringing');
9712
9727
  this.ringingEnabled = true;
9713
9728
  }
9714
9729
 
9715
9730
  disableRinging() {
9716
- logger$8.info('WebRTC disable ringing');
9731
+ logger$4.info('WebRTC disable ringing');
9717
9732
  this.ringingEnabled = false;
9718
9733
  }
9719
9734
 
@@ -9753,7 +9768,7 @@ class WebRTCPhone extends Emitter {
9753
9768
 
9754
9769
  // Deprecated
9755
9770
  getLocalMediaStream(callSession ) {
9756
- logger$8.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
9771
+ logger$4.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
9757
9772
  return this.getLocalStream(callSession);
9758
9773
  }
9759
9774
 
@@ -9795,7 +9810,7 @@ class WebRTCPhone extends Emitter {
9795
9810
  this.client.on(this.client.INVITE, (sipSession , wantsToDoVideo ) => {
9796
9811
  const autoAnswer = sipSession.request.getHeader('Answer-Mode') === 'Auto';
9797
9812
  const withVideo = this.allowVideo ? wantsToDoVideo : false;
9798
- logger$8.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
9813
+ logger$4.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
9799
9814
 
9800
9815
  const callSession = this._createIncomingCallSession(sipSession, withVideo, null, autoAnswer);
9801
9816
  this.incomingSessions.push(callSession.getId());
@@ -9818,7 +9833,7 @@ class WebRTCPhone extends Emitter {
9818
9833
  });
9819
9834
 
9820
9835
  this.client.on(this.client.ON_REINVITE, (...args) => {
9821
- logger$8.info('WebRTC on reinvite', {
9836
+ logger$4.info('WebRTC on reinvite', {
9822
9837
  sessionId: args[0].id,
9823
9838
  inviteId: args[1].id,
9824
9839
  updatedCalleeName: args[2],
@@ -9838,7 +9853,7 @@ class WebRTCPhone extends Emitter {
9838
9853
  });
9839
9854
 
9840
9855
  this.client.on(this.client.ACCEPTED, (sipSession ) => {
9841
- logger$8.info('WebRTC call accepted', { sipId: sipSession.id });
9856
+ logger$4.info('WebRTC call accepted', { sipId: sipSession.id });
9842
9857
 
9843
9858
  this._onCallAccepted(sipSession, this.client.hasVideo(this.getSipSessionId(sipSession)));
9844
9859
 
@@ -9849,22 +9864,22 @@ class WebRTCPhone extends Emitter {
9849
9864
  this.client.on('ended', () => {});
9850
9865
 
9851
9866
  this.client.on(this.client.ON_ERROR, e => {
9852
- logger$8.error('WebRTC error', e);
9867
+ logger$4.error('WebRTC error', e);
9853
9868
  this.eventEmitter.emit(ON_CALL_ERROR, e);
9854
9869
  });
9855
9870
 
9856
9871
  this.client.on(this.client.UNREGISTERED, () => {
9857
- logger$8.info('WebRTC unregistered');
9872
+ logger$4.info('WebRTC unregistered');
9858
9873
  this.eventEmitter.emit(ON_UNREGISTERED);
9859
9874
  });
9860
9875
 
9861
9876
  this.client.on(this.client.ON_DISCONNECTED, () => {
9862
- logger$8.info('WebRTC disconnected');
9863
- this.eventEmitter.emit(ON_DISCONNECTED);
9877
+ logger$4.info('WebRTC disconnected');
9878
+ this.eventEmitter.emit(ON_DISCONNECTED$1);
9864
9879
  });
9865
9880
 
9866
9881
  this.client.on(this.client.REGISTERED, () => {
9867
- logger$8.info('WebRTC registered', {
9882
+ logger$4.info('WebRTC registered', {
9868
9883
  shouldSendReinvite: this.shouldSendReinvite,
9869
9884
  state: this.currentSipSession ? this.currentSipSession.state : null,
9870
9885
  currentSipSession: !!this.currentSipSession,
@@ -9877,23 +9892,27 @@ class WebRTCPhone extends Emitter {
9877
9892
  if (this.shouldSendReinvite && this.currentSipSession
9878
9893
  && this.currentSipSession.state === SessionState.Established) {
9879
9894
  this.shouldSendReinvite = false;
9895
+ const pc = this.currentSipSession.sessionDescriptionHandler.peerConnection;
9896
+ const isConference = pc ? pc.sfu : false;
9897
+ const hasVideo = this.currentCallSession && this.currentCallSession.cameraEnabled;
9898
+
9880
9899
  try {
9881
9900
  // Send reinvite with iceRestart
9882
- this.sendReinvite(this.currentCallSession, null, false, false, true);
9901
+ this.sendReinvite(this.currentCallSession, null, isConference, !hasVideo, true);
9883
9902
  } catch (e) {
9884
- logger$8.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
9903
+ logger$4.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
9885
9904
  }
9886
9905
  }
9887
9906
  });
9888
9907
 
9889
9908
  this.client.on(this.client.CONNECTED, () => {
9890
- logger$8.info('WebRTC client connected');
9909
+ logger$4.info('WebRTC client connected');
9891
9910
 
9892
9911
  this.stopHeartbeat();
9893
9912
  });
9894
9913
 
9895
9914
  this.client.on(this.client.DISCONNECTED, () => {
9896
- logger$8.info('WebRTC client disconnected');
9915
+ logger$4.info('WebRTC client disconnected');
9897
9916
 
9898
9917
  this.eventEmitter.emit(ON_UNREGISTERED);
9899
9918
 
@@ -9907,7 +9926,7 @@ class WebRTCPhone extends Emitter {
9907
9926
  });
9908
9927
 
9909
9928
  this.client.on(this.client.ON_TRACK, (session, event) => {
9910
- this.eventEmitter.emit(ON_TRACK, session, event);
9929
+ this.eventEmitter.emit(ON_TRACK$1, session, event);
9911
9930
  });
9912
9931
 
9913
9932
  this.client.on('onVideoInputChange', stream => {
@@ -9922,7 +9941,7 @@ class WebRTCPhone extends Emitter {
9922
9941
  this.client.on(this.client.ON_NETWORK_STATS, (session, stats, previousStats) => {
9923
9942
  const callSession = this.getCallSession(this.getSipSessionId(session));
9924
9943
 
9925
- this.eventEmitter.emit(ON_NETWORK_STATS, callSession, stats, previousStats);
9944
+ this.eventEmitter.emit(ON_NETWORK_STATS$1, callSession, stats, previousStats);
9926
9945
  });
9927
9946
 
9928
9947
  // Used when upgrading directly in screenshare mode
@@ -9931,7 +9950,7 @@ class WebRTCPhone extends Emitter {
9931
9950
  const localStream = this.client.getLocalStream(sipSessionId);
9932
9951
  const callSession = this.callSessions[sipSessionId];
9933
9952
 
9934
- logger$8.info('Updrading directly in screensharing mode', {
9953
+ logger$4.info('Updrading directly in screensharing mode', {
9935
9954
  sipSessionId,
9936
9955
  tracks: localStream ? localStream.getTracks() : null,
9937
9956
  });
@@ -9963,6 +9982,15 @@ class WebRTCPhone extends Emitter {
9963
9982
  return this.client.getSipSessionId(sipSession);
9964
9983
  }
9965
9984
 
9985
+ _updateCallSession(callSession ) {
9986
+ const sipSession = this.findSipSession(callSession);
9987
+ const sipSessionId = sipSession ? this.getSipSessionId(sipSession) : null;
9988
+
9989
+ if (sipSessionId) {
9990
+ this.callSessions[sipSessionId] = callSession;
9991
+ }
9992
+ }
9993
+
9966
9994
  _onMessage(message ) {
9967
9995
  if (!message || message.method !== 'MESSAGE') {
9968
9996
  return;
@@ -10100,8 +10128,8 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
10100
10128
  ON_CALL_ENDED: ON_CALL_ENDED,
10101
10129
  ON_CALL_ENDING: ON_CALL_ENDING,
10102
10130
  ON_MESSAGE: ON_MESSAGE,
10103
- ON_REINVITE: ON_REINVITE,
10104
- ON_TRACK: ON_TRACK,
10131
+ ON_REINVITE: ON_REINVITE$1,
10132
+ ON_TRACK: ON_TRACK$1,
10105
10133
  ON_AUDIO_STREAM: ON_AUDIO_STREAM,
10106
10134
  ON_VIDEO_STREAM: ON_VIDEO_STREAM,
10107
10135
  ON_REMOVE_STREAM: ON_REMOVE_STREAM,
@@ -10116,19 +10144,19 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
10116
10144
  ON_VIDEO_INPUT_CHANGE: ON_VIDEO_INPUT_CHANGE,
10117
10145
  ON_CALL_ERROR: ON_CALL_ERROR,
10118
10146
  ON_MESSAGE_TRACK_UPDATED: ON_MESSAGE_TRACK_UPDATED,
10119
- ON_NETWORK_STATS: ON_NETWORK_STATS,
10147
+ ON_NETWORK_STATS: ON_NETWORK_STATS$1,
10120
10148
  ON_CHAT: ON_CHAT,
10121
10149
  ON_SIGNAL: ON_SIGNAL,
10122
- ON_DISCONNECTED: ON_DISCONNECTED,
10150
+ ON_DISCONNECTED: ON_DISCONNECTED$1,
10123
10151
  MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
10124
10152
  MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
10125
- events: events,
10153
+ events: events$1,
10126
10154
  'default': WebRTCPhone
10127
10155
  });
10128
10156
 
10129
10157
  //
10130
10158
 
10131
- const logger$7 = IssueReporter$1.loggerFor('simple-phone');
10159
+ const logger$5 = IssueReporter$1.loggerFor('simple-phone');
10132
10160
  const sipLogger = IssueReporter$1.loggerFor('sip.js');
10133
10161
  const protocolLogger = IssueReporter$1.loggerFor('sip');
10134
10162
 
@@ -10235,7 +10263,7 @@ class Phone extends Emitter {
10235
10263
  async disconnect() {
10236
10264
  if (this.phone) {
10237
10265
  if (this.phone.hasAnActiveCall()) {
10238
- logger$7.info('hangup call on disconnect');
10266
+ logger$5.info('hangup call on disconnect');
10239
10267
  // $FlowFixMe
10240
10268
  await this.phone.hangup();
10241
10269
  }
@@ -10258,13 +10286,13 @@ class Phone extends Emitter {
10258
10286
  }
10259
10287
 
10260
10288
  async hangup(callSession ) {
10261
- logger$7.info('hangup via simple phone', { callId: callSession.getId() });
10289
+ logger$5.info('hangup via simple phone', { callId: callSession.getId() });
10262
10290
 
10263
10291
  return this.phone && this.phone.hangup(callSession);
10264
10292
  }
10265
10293
 
10266
10294
  async accept(callSession , cameraEnabled ) {
10267
- logger$7.info('accept via simple phone', { callId: callSession.getId(), cameraEnabled });
10295
+ logger$5.info('accept via simple phone', { callId: callSession.getId(), cameraEnabled });
10268
10296
 
10269
10297
  return this.phone && this.phone.accept(callSession, cameraEnabled);
10270
10298
  }
@@ -10303,7 +10331,7 @@ class Phone extends Emitter {
10303
10331
  muteViaAPI(callSession ) {
10304
10332
  if (callSession && callSession.callId) {
10305
10333
  Wazo.getApiClient().calld.mute(callSession.callId).catch(e => {
10306
- logger$7.error('Mute via API, error', e);
10334
+ logger$5.error('Mute via API, error', e);
10307
10335
  });
10308
10336
  }
10309
10337
  }
@@ -10311,7 +10339,7 @@ class Phone extends Emitter {
10311
10339
  unmuteViaAPI(callSession ) {
10312
10340
  if (callSession && callSession.callId) {
10313
10341
  Wazo.getApiClient().calld.unmute(callSession.callId).catch(e => {
10314
- logger$7.error('Unmute via API, error', e);
10342
+ logger$5.error('Unmute via API, error', e);
10315
10343
  });
10316
10344
  }
10317
10345
  }
@@ -10419,7 +10447,7 @@ class Phone extends Emitter {
10419
10447
 
10420
10448
  // @Deprecated
10421
10449
  getLocalMediaStream(callSession ) {
10422
- logger$7.warn('Phone.getLocalMediaStream is deprecated, use Phone.getLocalStream instead');
10450
+ logger$5.warn('Phone.getLocalMediaStream is deprecated, use Phone.getLocalStream instead');
10423
10451
 
10424
10452
  return this.phone && this.phone.getLocalStream(callSession);
10425
10453
  }
@@ -10442,20 +10470,20 @@ class Phone extends Emitter {
10442
10470
 
10443
10471
  // @Deprecated
10444
10472
  getRemoteStreamForCall(callSession ) {
10445
- logger$7.warn('Phone.getRemoteStreamForCall is deprecated, use Phone.getRemoteStream instead');
10473
+ logger$5.warn('Phone.getRemoteStreamForCall is deprecated, use Phone.getRemoteStream instead');
10446
10474
  return this.getRemoteStream(callSession);
10447
10475
  }
10448
10476
 
10449
10477
  // Returns remote streams directly from the peerConnection
10450
10478
  // @Deprecated
10451
10479
  getRemoteStreamsForCall(callSession ) {
10452
- logger$7.warn('Phone.getRemoteStreamsForCall is deprecated, use Phone.getLocalStream instead');
10480
+ logger$5.warn('Phone.getRemoteStreamsForCall is deprecated, use Phone.getLocalStream instead');
10453
10481
  return this.getLocalStream(callSession);
10454
10482
  }
10455
10483
 
10456
10484
  // @Deprecated
10457
10485
  getRemoteVideoStreamForCall(callSession ) {
10458
- logger$7.warn('Phone.getRemoteVideoStreamForCall is deprecated, use Phone.getRemoteVideoStream instead');
10486
+ logger$5.warn('Phone.getRemoteVideoStreamForCall is deprecated, use Phone.getRemoteVideoStream instead');
10459
10487
 
10460
10488
  return this.getRemoteVideoStream(callSession);
10461
10489
  }
@@ -10516,7 +10544,7 @@ class Phone extends Emitter {
10516
10544
 
10517
10545
  _transferEvents() {
10518
10546
  this.unbind();
10519
- [...events$1, ...transportEvents].forEach(event => {
10547
+ [...events, ...transportEvents].forEach(event => {
10520
10548
  this.client.on(event, (...args) =>
10521
10549
  this.eventEmitter.emit.apply(this.eventEmitter.emit, [`client-${event}`, ...args]));
10522
10550
  });
@@ -10538,7 +10566,7 @@ var Phone$1 = global.wazoTelephonyInstance;
10538
10566
 
10539
10567
  //
10540
10568
 
10541
- const SOCKET_EVENTS$1 = {
10569
+ const SOCKET_EVENTS = {
10542
10570
  ON_OPEN: 'onopen',
10543
10571
  ON_MESSAGE: 'onmessage',
10544
10572
  ON_ERROR: 'onerror',
@@ -10691,16 +10719,16 @@ class WebSocketClient extends Emitter {
10691
10719
 
10692
10720
  this.socket.onopen = () => {
10693
10721
  logger$6.info('on Wazo WS open', { method: 'connect', host: this.host });
10694
- this.eventEmitter.emit(SOCKET_EVENTS$1.ON_OPEN);
10722
+ this.eventEmitter.emit(SOCKET_EVENTS.ON_OPEN);
10695
10723
  };
10696
10724
 
10697
10725
  this.socket.onerror = event => {
10698
10726
  logger$6.error('on Wazo WS error', event.target);
10699
- this.eventEmitter.emit(SOCKET_EVENTS$1.ON_ERROR, event);
10727
+ this.eventEmitter.emit(SOCKET_EVENTS.ON_ERROR, event);
10700
10728
  };
10701
10729
 
10702
10730
  this.socket.onmessage = (event ) => {
10703
- this.eventEmitter.emit(SOCKET_EVENTS$1.ON_MESSAGE, event.data);
10731
+ this.eventEmitter.emit(SOCKET_EVENTS.ON_MESSAGE, event.data);
10704
10732
 
10705
10733
  const message = JSON.parse(typeof event.data === 'string' ? event.data : '{}');
10706
10734
  let { name } = message;
@@ -10733,11 +10761,11 @@ class WebSocketClient extends Emitter {
10733
10761
  token: this.token,
10734
10762
  });
10735
10763
  this.initialized = false;
10736
- this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, event);
10764
+ this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, event);
10737
10765
 
10738
10766
  switch (event.code) {
10739
10767
  case 4002:
10740
- this.eventEmitter.emit(SOCKET_EVENTS$1.ON_AUTH_FAILED);
10768
+ this.eventEmitter.emit(SOCKET_EVENTS.ON_AUTH_FAILED);
10741
10769
  break;
10742
10770
  }
10743
10771
  };
@@ -10853,7 +10881,7 @@ class WebSocketClient extends Emitter {
10853
10881
  break;
10854
10882
  case 'start':
10855
10883
  this.initialized = true;
10856
- this.eventEmitter.emit(SOCKET_EVENTS$1.INITIALIZED);
10884
+ this.eventEmitter.emit(SOCKET_EVENTS.INITIALIZED);
10857
10885
  break;
10858
10886
  default:
10859
10887
  this.eventEmitter.emit('message', message);
@@ -10900,7 +10928,7 @@ class WebSocketClient extends Emitter {
10900
10928
  logger$6.log('heartbeat timed out', { host: this.host, token: this.token });
10901
10929
 
10902
10930
  this.close();
10903
- this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, new Error('Websocket ping failure.'));
10931
+ this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, new Error('Websocket ping failure.'));
10904
10932
 
10905
10933
  if (this.onHeartBeatTimeout) {
10906
10934
  this.onHeartBeatTimeout();
@@ -10980,7 +11008,7 @@ WebSocketClient.eventLists = [
10980
11008
 
10981
11009
  var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
10982
11010
  __proto__: null,
10983
- SOCKET_EVENTS: SOCKET_EVENTS$1,
11011
+ SOCKET_EVENTS: SOCKET_EVENTS,
10984
11012
  AUTH_SESSION_EXPIRE_SOON: AUTH_SESSION_EXPIRE_SOON,
10985
11013
  FAVORITE_ADDED: FAVORITE_ADDED,
10986
11014
  FAVORITE_DELETED: FAVORITE_DELETED,
@@ -11053,10 +11081,10 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
11053
11081
 
11054
11082
  //
11055
11083
 
11056
- const { SOCKET_EVENTS, ...OTHER_EVENTS } = WebSocketClient$1;
11057
- const ALL_EVENTS = [...Object.values(SOCKET_EVENTS), ...Object.values(OTHER_EVENTS)];
11084
+ const { SOCKET_EVENTS: SOCKET_EVENTS$1, ...OTHER_EVENTS } = WebSocketClient$1;
11085
+ const ALL_EVENTS = [...Object.values(SOCKET_EVENTS$1), ...Object.values(OTHER_EVENTS)];
11058
11086
 
11059
- const logger$5 = IssueReporter$1.loggerFor('simple-ws-client');
11087
+ const logger$7 = IssueReporter$1.loggerFor('simple-ws-client');
11060
11088
 
11061
11089
  class Websocket extends Emitter {
11062
11090
 
@@ -11070,9 +11098,9 @@ class Websocket extends Emitter {
11070
11098
  // $FlowFixMe
11071
11099
  this[key] = OTHER_EVENTS[key];
11072
11100
  });
11073
- Object.keys(SOCKET_EVENTS).forEach(key => {
11101
+ Object.keys(SOCKET_EVENTS$1).forEach(key => {
11074
11102
  // $FlowFixMe
11075
- this[key] = SOCKET_EVENTS[key];
11103
+ this[key] = SOCKET_EVENTS$1[key];
11076
11104
  });
11077
11105
  this.eventLists = WebSocketClient.eventLists;
11078
11106
 
@@ -11080,7 +11108,7 @@ class Websocket extends Emitter {
11080
11108
  }
11081
11109
 
11082
11110
  open(host , session ) {
11083
- logger$5.info('open simple WebSocket', { host, token: session.token });
11111
+ logger$7.info('open simple WebSocket', { host, token: session.token });
11084
11112
  this.ws = new WebSocketClient(
11085
11113
  {
11086
11114
  host,
@@ -11108,7 +11136,7 @@ class Websocket extends Emitter {
11108
11136
  }
11109
11137
 
11110
11138
  updateToken(token ) {
11111
- logger$5.info('update token via simple Websocket', { token, ws: !!this.ws });
11139
+ logger$7.info('update token via simple Websocket', { token, ws: !!this.ws });
11112
11140
 
11113
11141
  if (!this.ws) {
11114
11142
  return;
@@ -11136,7 +11164,7 @@ var Websocket$1 = global.wazoWebsocketInstance;
11136
11164
 
11137
11165
  //
11138
11166
 
11139
- const logger$4 = IssueReporter$1.loggerFor('room');
11167
+ const logger$8 = IssueReporter$1.loggerFor('room');
11140
11168
 
11141
11169
  class Participant extends Emitter {
11142
11170
 
@@ -11258,7 +11286,7 @@ class Participant extends Emitter {
11258
11286
  }
11259
11287
 
11260
11288
  onTalking(isTalking ) {
11261
- logger$4.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
11289
+ logger$8.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
11262
11290
  this.isTalking = isTalking;
11263
11291
  // you may notice we're not broadcasting: since all participants are getting this info
11264
11292
  // directly from asterisk, there's no need to do so
@@ -11361,7 +11389,7 @@ class Participant extends Emitter {
11361
11389
  }
11362
11390
 
11363
11391
  updateStatus(status , broadcast = true) {
11364
- logger$4.info('updating participant status', { name: this.name, status });
11392
+ logger$8.info('updating participant status', { name: this.name, status });
11365
11393
 
11366
11394
  if (typeof status.audioMuted !== 'undefined' && status.audioMuted !== this.audioMuted) {
11367
11395
  if (status.audioMuted) {
@@ -11409,7 +11437,7 @@ class Participant extends Emitter {
11409
11437
 
11410
11438
  broadcastStatus(inboundStatus = null) {
11411
11439
  const status = inboundStatus || this.getStatus();
11412
- logger$4.info('broadcasting participant status', { callId: this.callId, status });
11440
+ logger$8.info('broadcasting participant status', { callId: this.callId, status });
11413
11441
 
11414
11442
  this.room.sendSignal({
11415
11443
  type: SIGNAL_TYPE_PARTICIPANT_UPDATE,
@@ -11445,9 +11473,9 @@ class LocalParticipant extends Participant {
11445
11473
  const SIGNAL_TYPE_PARTICIPANT_UPDATE = 'signal/PARTICIPANT_UPDATE';
11446
11474
  const SIGNAL_TYPE_PARTICIPANT_REQUEST = 'signal/PARTICIPANT_REQUEST';
11447
11475
 
11448
- const logger$3 = IssueReporter$1.loggerFor('sdk-room');
11476
+ const logger$9 = IssueReporter$1.loggerFor('sdk-room');
11449
11477
 
11450
- class Room$1 extends Emitter {
11478
+ class Room extends Emitter {
11451
11479
 
11452
11480
 
11453
11481
 
@@ -11505,7 +11533,7 @@ class Room$1 extends Emitter {
11505
11533
  extra = {},
11506
11534
  ) {
11507
11535
  super();
11508
- logger$3.info('room initialized', { callId, extension, sourceId, meetingUuid });
11536
+ logger$9.info('room initialized', { callId, extension, sourceId, meetingUuid });
11509
11537
 
11510
11538
  // Represents the room callSession
11511
11539
  this.callSession = callSession;
@@ -11571,7 +11599,7 @@ class Room$1 extends Emitter {
11571
11599
  * @returns {Promise<Room>}
11572
11600
  */
11573
11601
  static async connect({ extension, constraints, audioOnly = false, extra, room, meeting } ) {
11574
- logger$3.info('connecting to room', { extension, audioOnly, room: !!room });
11602
+ logger$9.info('connecting to room', { extension, audioOnly, room: !!room });
11575
11603
 
11576
11604
  if (!room) {
11577
11605
  await Wazo.Phone.connect();
@@ -11584,7 +11612,7 @@ class Room$1 extends Emitter {
11584
11612
 
11585
11613
  // Call_created is triggered before call_accepted, so we have to listen for it here.
11586
11614
  Wazo.Websocket.once(Wazo.Websocket.CALL_CREATED, ({ data }) => {
11587
- logger$3.info('room call received via WS', { callId: data.call_id });
11615
+ logger$9.info('room call received via WS', { callId: data.call_id });
11588
11616
  if (room) {
11589
11617
  room.setCallId(data.call_id);
11590
11618
  }
@@ -11592,7 +11620,7 @@ class Room$1 extends Emitter {
11592
11620
 
11593
11621
  const callSession = await Wazo.Phone.call(extension, withCamera, null, audioOnly, true);
11594
11622
  // eslint-disable-next-line no-param-reassign
11595
- room = new Room$1(callSession, extension, null, null, extra);
11623
+ room = new Room(callSession, extension, null, null, extra);
11596
11624
 
11597
11625
  // Wait for the call to be accepted
11598
11626
  await new Promise((resolve, reject) => {
@@ -11613,7 +11641,7 @@ class Room$1 extends Emitter {
11613
11641
  // Retrieve conference
11614
11642
  const conference = contacts.find(contact => contact.numbers.find(number => number.number === extension));
11615
11643
 
11616
- logger$3.info('connected to room', {
11644
+ logger$9.info('connected to room', {
11617
11645
  sourceId: conference ? conference.sourceId : null,
11618
11646
  name: conference ? conference.name : null,
11619
11647
  });
@@ -11623,7 +11651,7 @@ class Room$1 extends Emitter {
11623
11651
  room.setName(conference.name);
11624
11652
  }
11625
11653
  } else if (meeting) {
11626
- logger$3.info('Already connected to meeting', {
11654
+ logger$9.info('Already connected to meeting', {
11627
11655
  uuid: meeting.uuid,
11628
11656
  name: meeting.name,
11629
11657
  });
@@ -11636,13 +11664,13 @@ class Room$1 extends Emitter {
11636
11664
  }
11637
11665
 
11638
11666
  static disconnect() {
11639
- logger$3.info('static disconnection to room');
11667
+ logger$9.info('static disconnection to room');
11640
11668
 
11641
11669
  Wazo.Phone.disconnect();
11642
11670
  }
11643
11671
 
11644
11672
  async disconnect() {
11645
- logger$3.info('disconnection to room called');
11673
+ logger$9.info('disconnection to room called');
11646
11674
 
11647
11675
  await Wazo.Phone.hangup(this.callSession);
11648
11676
  this.callSession = null;
@@ -11662,19 +11690,19 @@ class Room$1 extends Emitter {
11662
11690
  }
11663
11691
 
11664
11692
  setSourceId(sourceId ) {
11665
- logger$3.info('set room source id', { sourceId });
11693
+ logger$9.info('set room source id', { sourceId });
11666
11694
 
11667
11695
  this.sourceId = sourceId;
11668
11696
  }
11669
11697
 
11670
11698
  setMeetingUuid(meetingUuid ) {
11671
- logger$3.info('set meeting uuid', { meetingUuid });
11699
+ logger$9.info('set meeting uuid', { meetingUuid });
11672
11700
 
11673
11701
  this.meetingUuid = meetingUuid;
11674
11702
  }
11675
11703
 
11676
11704
  setCallId(callId ) {
11677
- logger$3.info('set room call id', { callId });
11705
+ logger$9.info('set room call id', { callId });
11678
11706
 
11679
11707
  if (callId) {
11680
11708
  this.callId = callId;
@@ -11682,7 +11710,7 @@ class Room$1 extends Emitter {
11682
11710
  }
11683
11711
 
11684
11712
  setName(name ) {
11685
- logger$3.info('set room name', { name });
11713
+ logger$9.info('set room name', { name });
11686
11714
 
11687
11715
  this.name = name;
11688
11716
  }
@@ -11701,7 +11729,7 @@ class Room$1 extends Emitter {
11701
11729
  }
11702
11730
 
11703
11731
  async startScreenSharing(constraints ) {
11704
- logger$3.info('start room screen sharing', { constraints });
11732
+ logger$9.info('start room screen sharing', { constraints });
11705
11733
 
11706
11734
  const screensharingStream = await Wazo.Phone.startScreenSharing(constraints, this.callSession);
11707
11735
  if (!screensharingStream) {
@@ -11715,7 +11743,7 @@ class Room$1 extends Emitter {
11715
11743
  }
11716
11744
 
11717
11745
  async stopScreenSharing(restoreLocalStream = true) {
11718
- logger$3.info('stop room screen sharing');
11746
+ logger$9.info('stop room screen sharing');
11719
11747
 
11720
11748
  await Wazo.Phone.stopScreenSharing(this.callSession, restoreLocalStream);
11721
11749
 
@@ -11727,7 +11755,7 @@ class Room$1 extends Emitter {
11727
11755
  }
11728
11756
 
11729
11757
  turnCameraOff() {
11730
- logger$3.info('turn room camera off');
11758
+ logger$9.info('turn room camera off');
11731
11759
 
11732
11760
  Wazo.Phone.turnCameraOff(this.callSession);
11733
11761
 
@@ -11737,7 +11765,7 @@ class Room$1 extends Emitter {
11737
11765
  }
11738
11766
 
11739
11767
  turnCameraOn() {
11740
- logger$3.info('turn room camera on');
11768
+ logger$9.info('turn room camera on');
11741
11769
 
11742
11770
  Wazo.Phone.turnCameraOn(this.callSession);
11743
11771
 
@@ -11747,7 +11775,7 @@ class Room$1 extends Emitter {
11747
11775
  }
11748
11776
 
11749
11777
  mute() {
11750
- logger$3.info('mute room');
11778
+ logger$9.info('mute room');
11751
11779
 
11752
11780
  Wazo.Phone.mute(this.callSession);
11753
11781
 
@@ -11755,7 +11783,7 @@ class Room$1 extends Emitter {
11755
11783
  }
11756
11784
 
11757
11785
  unmute() {
11758
- logger$3.info('unmute room');
11786
+ logger$9.info('unmute room');
11759
11787
 
11760
11788
  Wazo.Phone.unmute(this.callSession);
11761
11789
 
@@ -11775,7 +11803,7 @@ class Room$1 extends Emitter {
11775
11803
  }
11776
11804
 
11777
11805
  hold() {
11778
- logger$3.info('hold room');
11806
+ logger$9.info('hold room');
11779
11807
 
11780
11808
  Wazo.Phone.hold(this.callSession, true);
11781
11809
 
@@ -11785,7 +11813,7 @@ class Room$1 extends Emitter {
11785
11813
  }
11786
11814
 
11787
11815
  async resume() {
11788
- logger$3.info('resume room');
11816
+ logger$9.info('resume room');
11789
11817
 
11790
11818
  const newStream = await Wazo.Phone.resume(this.callSession, true);
11791
11819
 
@@ -11813,13 +11841,13 @@ class Room$1 extends Emitter {
11813
11841
  }
11814
11842
 
11815
11843
  sendDTMF(tone ) {
11816
- logger$3.info('send room DTMF', { tone });
11844
+ logger$9.info('send room DTMF', { tone });
11817
11845
 
11818
11846
  Wazo.Phone.sendDTMF(tone, this.callSession);
11819
11847
  }
11820
11848
 
11821
11849
  async sendReinvite(newConstraints = null) {
11822
- logger$3.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
11850
+ logger$9.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
11823
11851
  const wasScreensharing = this.localParticipant && this.localParticipant.screensharing;
11824
11852
 
11825
11853
  Wazo.Phone.on(Wazo.Phone.ON_SHARE_SCREEN_STARTED, () => {
@@ -11878,7 +11906,7 @@ class Room$1 extends Emitter {
11878
11906
  Wazo.Phone.phone.on(Wazo.Phone.phone.client.ON_REINVITE, this._boundOnReinvite);
11879
11907
 
11880
11908
  this.on(this.ON_AUDIO_STREAM, stream => {
11881
- logger$3.info('on room audio stream');
11909
+ logger$9.info('on room audio stream');
11882
11910
 
11883
11911
  this.audioStream = stream;
11884
11912
  if (!this.roomAudioElement) {
@@ -11891,7 +11919,7 @@ class Room$1 extends Emitter {
11891
11919
  });
11892
11920
 
11893
11921
  this.on(this.ON_VIDEO_STREAM, (stream, streamId, event, sipSession) => {
11894
- logger$3.info('on room video stream', { streamId });
11922
+ logger$9.info('on room video stream', { streamId });
11895
11923
 
11896
11924
  this._mapMsid(sipSession.body.body);
11897
11925
 
@@ -11906,7 +11934,7 @@ class Room$1 extends Emitter {
11906
11934
  });
11907
11935
 
11908
11936
  this.on(this.ON_REMOVE_STREAM, stream => {
11909
- logger$3.info('on room remove stream');
11937
+ logger$9.info('on room remove stream');
11910
11938
 
11911
11939
  const participant = this.participants.find(someParticipant =>
11912
11940
  someParticipant.streams.find(someStream => someStream && someStream.id === stream.id));
@@ -12038,7 +12066,7 @@ class Room$1 extends Emitter {
12038
12066
  const requester = this._getParticipantFromCallId(origin.callId);
12039
12067
  if (requester) {
12040
12068
  // @FIXME?: when need to trigger an update on join-in; this is a bit of a hack
12041
- logger$3.info('trigger room requester status', { origin });
12069
+ logger$9.info('trigger room requester status', { origin });
12042
12070
  requester.triggerUpdate('REQUESTER_UPDATE');
12043
12071
  }
12044
12072
  break;
@@ -12069,24 +12097,24 @@ class Room$1 extends Emitter {
12069
12097
 
12070
12098
  // When we join the room, we can call `getConferenceParticipantsAsUser`, not before.
12071
12099
  if (participant.user_uuid === session.uuid) {
12072
- logger$3.info('room current user joined');
12100
+ logger$9.info('room current user joined');
12073
12101
 
12074
12102
  // Retrieve participants via an API calls
12075
12103
  const conferenceId = this.sourceId || payload.data.conference_id;
12076
12104
  let response;
12077
12105
  try {
12078
12106
  if (this.meetingUuid) {
12079
- logger$3.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
12107
+ logger$9.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
12080
12108
  response = await getApiClient().calld.getMeetingParticipantsAsUser(this.meetingUuid);
12081
12109
  } else {
12082
- logger$3.info('fetching conference participants', { conferenceId });
12110
+ logger$9.info('fetching conference participants', { conferenceId });
12083
12111
  response = await getApiClient().calld.getConferenceParticipantsAsUser(conferenceId);
12084
12112
  }
12085
12113
  } catch (e) {
12086
- logger$3.error('room participants fetching, error', e);
12114
+ logger$9.error('room participants fetching, error', e);
12087
12115
  }
12088
12116
  if (response) {
12089
- logger$3.info('conference participants fetched', { nb: response.items.length });
12117
+ logger$9.info('conference participants fetched', { nb: response.items.length });
12090
12118
  participants = response.items.map(item => {
12091
12119
  const isMe = item.call_id === this.callId;
12092
12120
 
@@ -12113,7 +12141,7 @@ class Room$1 extends Emitter {
12113
12141
  ? new Wazo.RemoteParticipant(this, participant)
12114
12142
  : null;
12115
12143
 
12116
- logger$3.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
12144
+ logger$9.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
12117
12145
 
12118
12146
  if (remoteParticipant) {
12119
12147
  this.participants.push(remoteParticipant);
@@ -12278,12 +12306,12 @@ class Room$1 extends Emitter {
12278
12306
 
12279
12307
  //
12280
12308
 
12281
- const logger$2 = IssueReporter$1.loggerFor('sdk-sip-room');
12309
+ const logger$a = IssueReporter$1.loggerFor('sdk-sip-room');
12282
12310
 
12283
- class SipRoom extends Room$1 {
12311
+ class SipRoom extends Room {
12284
12312
 
12285
12313
  static async connect({ extension, constraints, audioOnly = false, extra, room } ) {
12286
- logger$2.info('connecting to sip room', { extension, audioOnly, room: !!room });
12314
+ logger$a.info('connecting to sip room', { extension, audioOnly, room: !!room });
12287
12315
 
12288
12316
  if (!room) {
12289
12317
  await Wazo.Phone.connect();
@@ -12299,7 +12327,7 @@ class SipRoom extends Room$1 {
12299
12327
  room.setCallId(room.callSession.call.id);
12300
12328
  }
12301
12329
 
12302
- logger$2.info('connected to room', {
12330
+ logger$a.info('connected to room', {
12303
12331
  extension: room.extension,
12304
12332
  });
12305
12333
 
@@ -12307,7 +12335,7 @@ class SipRoom extends Room$1 {
12307
12335
  }
12308
12336
 
12309
12337
  mute() {
12310
- logger$2.info('mute sip room');
12338
+ logger$a.info('mute sip room');
12311
12339
 
12312
12340
  Wazo.Phone.mute(this.callSession, false);
12313
12341
 
@@ -12315,7 +12343,7 @@ class SipRoom extends Room$1 {
12315
12343
  }
12316
12344
 
12317
12345
  unmute() {
12318
- logger$2.info('unmute sip room');
12346
+ logger$a.info('unmute sip room');
12319
12347
 
12320
12348
  Wazo.Phone.unmute(this.callSession, false);
12321
12349
 
@@ -12582,7 +12610,7 @@ class NotificationOptions {
12582
12610
 
12583
12611
 
12584
12612
  // Represents a conference room, like `9000`.
12585
- class Room {
12613
+ class Room$1 {
12586
12614
 
12587
12615
 
12588
12616
 
@@ -12603,7 +12631,7 @@ class Room {
12603
12631
  }
12604
12632
 
12605
12633
  connect(callSession ) {
12606
- return new Room({ ...this, connectedCallSession: callSession });
12634
+ return new Room$1({ ...this, connectedCallSession: callSession });
12607
12635
  }
12608
12636
 
12609
12637
  has(callSession ) {
@@ -12612,7 +12640,7 @@ class Room {
12612
12640
 
12613
12641
  addParticipant(uuid , extension , talking = null) {
12614
12642
  if (!this.participants.some(participant => participant.uuid === uuid || participant.extension === extension)) {
12615
- return new Room({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
12643
+ return new Room$1({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
12616
12644
  }
12617
12645
 
12618
12646
  return this;
@@ -12631,7 +12659,7 @@ class Room {
12631
12659
  updatedParticipants.push(participant);
12632
12660
  }
12633
12661
 
12634
- return new Room({ ...this, participants: updatedParticipants });
12662
+ return new Room$1({ ...this, participants: updatedParticipants });
12635
12663
  }
12636
12664
 
12637
12665
  updateParticipantByExtension(extension , participant , shouldAdd = false) {
@@ -12647,7 +12675,7 @@ class Room {
12647
12675
  updatedParticipants.push(participant);
12648
12676
  }
12649
12677
 
12650
- return new Room({ ...this, participants: updatedParticipants });
12678
+ return new Room$1({ ...this, participants: updatedParticipants });
12651
12679
  }
12652
12680
 
12653
12681
  hasCallWithId(id ) {
@@ -12655,18 +12683,18 @@ class Room {
12655
12683
  }
12656
12684
 
12657
12685
  disconnect() {
12658
- return new Room({ ...this, connectedCallSession: null });
12686
+ return new Room$1({ ...this, connectedCallSession: null });
12659
12687
  }
12660
12688
 
12661
12689
  removeParticipantWithUUID(uuid ) {
12662
- return new Room({
12690
+ return new Room$1({
12663
12691
  ...this,
12664
12692
  participants: this.participants.filter(participant => participant.uuid !== uuid),
12665
12693
  });
12666
12694
  }
12667
12695
 
12668
12696
  removeParticipantWithExtension(extension ) {
12669
- return new Room({
12697
+ return new Room$1({
12670
12698
  ...this,
12671
12699
  participants: this.participants.filter(participant => participant.extension !== extension),
12672
12700
  });
@@ -12677,7 +12705,7 @@ class Room {
12677
12705
  }
12678
12706
 
12679
12707
  static newFrom(room ) {
12680
- return newFrom(room, Room);
12708
+ return newFrom(room, Room$1);
12681
12709
  }
12682
12710
  }
12683
12711
 
@@ -12984,11 +13012,11 @@ var wazoWebsocket = {
12984
13012
  resolve();
12985
13013
  };
12986
13014
 
12987
- client.on(SOCKET_EVENTS$1.ON_ERROR, error => {
13015
+ client.on(SOCKET_EVENTS.ON_ERROR, error => {
12988
13016
  handleError(`Connection error : ${error}`);
12989
13017
  });
12990
13018
 
12991
- client.on(SOCKET_EVENTS$1.ON_OPEN, () => {
13019
+ client.on(SOCKET_EVENTS.ON_OPEN, () => {
12992
13020
  if (session.hasEngineVersionGte(HEARTBEAT_ENGINE_VERSION)) {
12993
13021
  client.setOnHeartbeatTimeout(() => {
12994
13022
  handleError('No response to heartbeat');
@@ -13089,7 +13117,7 @@ var webrtc = {
13089
13117
  }),
13090
13118
  };
13091
13119
 
13092
- const parseCandidate = line => {
13120
+ const parseCandidate$1 = line => {
13093
13121
  let parts;
13094
13122
  // Parse both variants.
13095
13123
  if (line.indexOf('a=candidate:') === 0) {
@@ -13180,7 +13208,7 @@ var SymmetricNat = {
13180
13208
  }
13181
13209
 
13182
13210
  if (e.candidate && e.candidate.candidate.indexOf('srflx') !== -1) {
13183
- const cand = parseCandidate(e.candidate.candidate);
13211
+ const cand = parseCandidate$1(e.candidate.candidate);
13184
13212
  if (!candidates[cand.relatedPort]) candidates[cand.relatedPort] = [];
13185
13213
  candidates[cand.relatedPort].push(cand.port);
13186
13214
  } else if (!e.candidate) {
@@ -13248,7 +13276,7 @@ var iceIpv4 = {
13248
13276
  const rawCandidate = e.candidate.candidate;
13249
13277
  if (rawCandidate.indexOf('srflx') !== -1 || rawCandidate.indexOf('relay') !== -1) {
13250
13278
  hasSrflxOrRelay = true;
13251
- const candidate = parseCandidate(e.candidate.candidate);
13279
+ const candidate = parseCandidate$1(e.candidate.candidate);
13252
13280
  ips.push(candidate.ip);
13253
13281
  }
13254
13282
  } else if (!e.candidate) {
@@ -13285,7 +13313,7 @@ var checks = [
13285
13313
 
13286
13314
  //
13287
13315
 
13288
- const logger$1 = IssueReporter$1.loggerFor('engine-check');
13316
+ const logger$b = IssueReporter$1.loggerFor('engine-check');
13289
13317
 
13290
13318
  class Checker {
13291
13319
 
@@ -13303,28 +13331,28 @@ class Checker {
13303
13331
  async check(onCheckBegin = () => {}, onCheckResult = () => {}) {
13304
13332
  await this._addEngineVersion();
13305
13333
 
13306
- logger$1.info('Engine check starting');
13334
+ logger$b.info('Engine check starting');
13307
13335
 
13308
13336
  for (let i = 0; i < this.checks.length; i++) {
13309
13337
  const { name, check } = this.checks[i];
13310
13338
 
13311
- logger$1.info(`Checking ${name} ...`);
13339
+ logger$b.info(`Checking ${name} ...`);
13312
13340
 
13313
13341
  onCheckBegin(name);
13314
13342
  try {
13315
13343
  // eslint-disable-next-line no-await-in-loop
13316
13344
  const result = await check(this.server, this.session, this.externalAppConfig);
13317
- logger$1.info(`Checking ${name} success.`, { result });
13345
+ logger$b.info(`Checking ${name} success.`, { result });
13318
13346
 
13319
13347
  onCheckResult(name, result);
13320
13348
  } catch (e) {
13321
- logger$1.info(`Checking ${name} failure`, { message: e.message });
13349
+ logger$b.info(`Checking ${name} failure`, { message: e.message });
13322
13350
 
13323
13351
  onCheckResult(name, e);
13324
13352
  }
13325
13353
  }
13326
13354
 
13327
- logger$1.info('Engine check done.');
13355
+ logger$b.info('Engine check done.');
13328
13356
  }
13329
13357
 
13330
13358
  addCheck(check ) {
@@ -13348,7 +13376,7 @@ const Wazo = {
13348
13376
  Auth: Auth$1,
13349
13377
  Phone: Phone$1,
13350
13378
  Websocket: Websocket$1,
13351
- Room: Room$1,
13379
+ Room,
13352
13380
  SipRoom,
13353
13381
  RemoteParticipant,
13354
13382
  LocalParticipant,
@@ -13381,7 +13409,7 @@ const Wazo = {
13381
13409
  Session,
13382
13410
  Voicemail,
13383
13411
  Relocation,
13384
- ConferenceRoom: Room,
13412
+ ConferenceRoom: Room$1,
13385
13413
  CallSession,
13386
13414
  IndirectTransfer,
13387
13415
  SwitchboardCall,
@@ -13420,7 +13448,7 @@ if (global) {
13420
13448
  class InvalidSubscription extends Error {}
13421
13449
  class InvalidAuthorization extends Error {}
13422
13450
 
13423
- const logger = IssueReporter$1.loggerFor('simple-auth');
13451
+ const logger$c = IssueReporter$1.loggerFor('simple-auth');
13424
13452
 
13425
13453
  class Auth {
13426
13454
 
@@ -13455,7 +13483,7 @@ class Auth {
13455
13483
  setApiClientId(this.clientId);
13456
13484
  setRefreshExpiration(this.expiration);
13457
13485
  setOnRefreshToken((token , session ) => {
13458
- logger.info('on refresh token done', { token });
13486
+ logger$c.info('on refresh token done', { token });
13459
13487
  setApiToken(token);
13460
13488
  Wazo.Websocket.updateToken(token);
13461
13489
 
@@ -13500,7 +13528,7 @@ class Auth {
13500
13528
  const rawSession = await getApiClient().auth.authenticate(token);
13501
13529
  return this._onAuthenticated(rawSession);
13502
13530
  } catch (e) {
13503
- logger.error('on validate token error', e);
13531
+ logger$c.error('on validate token error', e);
13504
13532
  console.warn(e);
13505
13533
  return false;
13506
13534
  }