@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);
@@ -5509,7 +5514,7 @@ var getApiClient = (forServer ) => {
5509
5514
  class InvalidSubscription extends Error {}
5510
5515
  class InvalidAuthorization extends Error {}
5511
5516
 
5512
- const logger$9 = IssueReporter$1.loggerFor('simple-auth');
5517
+ const logger$3 = IssueReporter$1.loggerFor('simple-auth');
5513
5518
 
5514
5519
  class Auth {
5515
5520
 
@@ -5544,7 +5549,7 @@ class Auth {
5544
5549
  setApiClientId(this.clientId);
5545
5550
  setRefreshExpiration(this.expiration);
5546
5551
  setOnRefreshToken((token , session ) => {
5547
- logger$9.info('on refresh token done', { token });
5552
+ logger$3.info('on refresh token done', { token });
5548
5553
  setApiToken(token);
5549
5554
  Wazo.Websocket.updateToken(token);
5550
5555
 
@@ -5589,7 +5594,7 @@ class Auth {
5589
5594
  const rawSession = await getApiClient().auth.authenticate(token);
5590
5595
  return this._onAuthenticated(rawSession);
5591
5596
  } catch (e) {
5592
- logger$9.error('on validate token error', e);
5597
+ logger$3.error('on validate token error', e);
5593
5598
  console.warn(e);
5594
5599
  return false;
5595
5600
  }
@@ -5945,7 +5950,7 @@ class AdHocAPIConference {
5945
5950
 
5946
5951
  /* */
5947
5952
 
5948
- const parseCandidate$1 = (candidate ) => {
5953
+ const parseCandidate = (candidate ) => {
5949
5954
  if (!candidate) {
5950
5955
  return null;
5951
5956
  }
@@ -6099,7 +6104,7 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
6099
6104
  this.peerConnectionDelegate.onicecandidate = event => {
6100
6105
  wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
6101
6106
  if (event.candidate) {
6102
- this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
6107
+ this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
6103
6108
  }
6104
6109
  };
6105
6110
 
@@ -6563,7 +6568,7 @@ const DEFAULT_ICE_TIMEOUT = 3000;
6563
6568
  const SEND_STATS_DELAY = 5000;
6564
6569
 
6565
6570
  const states = ['STATUS_NULL', 'STATUS_NEW', 'STATUS_CONNECTING', 'STATUS_CONNECTED', 'STATUS_COMPLETED'];
6566
- const logger$8 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
6571
+ const logger$4 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
6567
6572
  const statsLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-stats') : console;
6568
6573
 
6569
6574
  // events
@@ -6577,14 +6582,14 @@ const TRANSPORT_ERROR = 'transportError';
6577
6582
  const MESSAGE = 'message';
6578
6583
  const ACCEPTED = 'accepted';
6579
6584
  const REJECTED = 'rejected';
6580
- const ON_TRACK$1 = 'onTrack';
6581
- const ON_REINVITE$1 = 'reinvite';
6585
+ const ON_TRACK = 'onTrack';
6586
+ const ON_REINVITE = 'reinvite';
6582
6587
  const ON_ERROR = 'onError';
6583
6588
  const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
6584
- const ON_NETWORK_STATS$1 = 'onNetworkStats';
6585
- const ON_DISCONNECTED$1 = 'onDisconnected';
6589
+ const ON_NETWORK_STATS = 'onNetworkStats';
6590
+ const ON_DISCONNECTED = 'onDisconnected';
6586
6591
 
6587
- const events$1 = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
6592
+ const events = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
6588
6593
  const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
6589
6594
  class CanceledCallError extends Error {}
6590
6595
 
@@ -6720,12 +6725,12 @@ class WebRTCClient extends Emitter {
6720
6725
  this.MESSAGE = MESSAGE;
6721
6726
  this.ACCEPTED = ACCEPTED;
6722
6727
  this.REJECTED = REJECTED;
6723
- this.ON_TRACK = ON_TRACK$1;
6724
- this.ON_REINVITE = ON_REINVITE$1;
6728
+ this.ON_TRACK = ON_TRACK;
6729
+ this.ON_REINVITE = ON_REINVITE;
6725
6730
  this.ON_ERROR = ON_ERROR;
6726
6731
  this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
6727
- this.ON_NETWORK_STATS = ON_NETWORK_STATS$1;
6728
- this.ON_DISCONNECTED = ON_DISCONNECTED$1;
6732
+ this.ON_NETWORK_STATS = ON_NETWORK_STATS;
6733
+ this.ON_DISCONNECTED = ON_DISCONNECTED;
6729
6734
  }
6730
6735
 
6731
6736
  configureMedia(media ) {
@@ -6742,13 +6747,13 @@ class WebRTCClient extends Emitter {
6742
6747
 
6743
6748
  createUserAgent(configOverrides ) {
6744
6749
  const webRTCConfiguration = this._createWebRTCConfiguration(configOverrides);
6745
- logger$8.info('sdk webrtc, creating UA', { webRTCConfiguration });
6750
+ logger$4.info('sdk webrtc, creating UA', { webRTCConfiguration });
6746
6751
 
6747
6752
  webRTCConfiguration.delegate = {
6748
6753
  onConnect: this.onConnect.bind(this),
6749
6754
  onDisconnect: this.onDisconnect.bind(this),
6750
6755
  onInvite: (invitation ) => {
6751
- logger$8.info('sdk webrtc on invite', {
6756
+ logger$4.info('sdk webrtc on invite', {
6752
6757
  method: 'delegate.onInvite',
6753
6758
  id: invitation.id,
6754
6759
  remoteURI: invitation.remoteURI,
@@ -6791,7 +6796,7 @@ class WebRTCClient extends Emitter {
6791
6796
  }
6792
6797
 
6793
6798
  onConnect() {
6794
- logger$8.info('sdk webrtc connected', { method: 'delegate.onConnect' });
6799
+ logger$4.info('sdk webrtc connected', { method: 'delegate.onConnect' });
6795
6800
  this.eventEmitter.emit(CONNECTED);
6796
6801
  if (!this.isRegistered() && this.registerer && this.registerer.waiting) {
6797
6802
  this.registerer.waitingToggle(false);
@@ -6800,7 +6805,7 @@ class WebRTCClient extends Emitter {
6800
6805
  }
6801
6806
 
6802
6807
  async onDisconnect(error ) {
6803
- logger$8.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
6808
+ logger$4.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
6804
6809
  this.connectionPromise = null;
6805
6810
  // The UA will attempt to reconnect automatically when an error occurred
6806
6811
  this.eventEmitter.emit(DISCONNECTED, error);
@@ -6825,37 +6830,37 @@ class WebRTCClient extends Emitter {
6825
6830
  };
6826
6831
 
6827
6832
  if (this.skipRegister) {
6828
- logger$8.info('sdk webrtc skip register...', logInfo);
6833
+ logger$4.info('sdk webrtc skip register...', logInfo);
6829
6834
  return Promise.resolve();
6830
6835
  }
6831
6836
 
6832
- logger$8.info('sdk webrtc registering...', logInfo);
6837
+ logger$4.info('sdk webrtc registering...', logInfo);
6833
6838
 
6834
6839
  if (!this.userAgent) {
6835
- logger$8.info('sdk webrtc recreating User Agent');
6840
+ logger$4.info('sdk webrtc recreating User Agent');
6836
6841
  this.userAgent = this.createUserAgent(this.uaConfigOverrides);
6837
6842
  }
6838
6843
  if (!this.userAgent || this.isRegistered()) {
6839
- logger$8.info('sdk webrtc registering aborted, already registered or no UA can be created');
6844
+ logger$4.info('sdk webrtc registering aborted, already registered or no UA can be created');
6840
6845
  return Promise.resolve();
6841
6846
  }
6842
6847
 
6843
6848
  if (this.connectionPromise || (this.registerer && this.registerer.waiting)) {
6844
- logger$8.info('sdk webrtc registering aborted due to a registration in progress.');
6849
+ logger$4.info('sdk webrtc registering aborted due to a registration in progress.');
6845
6850
  return Promise.resolve();
6846
6851
  }
6847
6852
 
6848
6853
  const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
6849
6854
 
6850
6855
  const onRegisterFailed = () => {
6851
- logger$8.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
6856
+ logger$4.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
6852
6857
  this.connectionPromise = null;
6853
6858
  if (this.registerer && this.registerer.waiting) {
6854
6859
  this.registerer.waitingToggle(false);
6855
6860
  }
6856
6861
 
6857
6862
  if (tries <= MAX_REGISTER_TRIES) {
6858
- logger$8.info('sdk webrtc registering, retrying...', { tries });
6863
+ logger$4.info('sdk webrtc registering, retrying...', { tries });
6859
6864
  setTimeout(() => this.register(tries + 1), 300);
6860
6865
  }
6861
6866
  };
@@ -6864,18 +6869,18 @@ class WebRTCClient extends Emitter {
6864
6869
  // Avoid race condition with the close method called just before register and setting userAgent to null
6865
6870
  // during the resolution of the primise.
6866
6871
  if (!this.userAgent) {
6867
- logger$8.info('sdk webrtc recreating User Agent after connection');
6872
+ logger$4.info('sdk webrtc recreating User Agent after connection');
6868
6873
  this.userAgent = this.createUserAgent(this.uaConfigOverrides);
6869
6874
  }
6870
6875
 
6871
- logger$8.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
6876
+ logger$4.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
6872
6877
  this.registerer = new Registerer(this.userAgent, registerOptions);
6873
6878
  this.connectionPromise = null;
6874
6879
  this._monkeyPatchRegisterer(this.registerer);
6875
6880
 
6876
6881
  // Bind registerer events
6877
6882
  this.registerer.stateChange.addListener(newState => {
6878
- logger$8.info('sdk webrtc registering, state changed', { newState });
6883
+ logger$4.info('sdk webrtc registering, state changed', { newState });
6879
6884
 
6880
6885
  if (newState === RegistererState.Registered && this.registerer
6881
6886
  && this.registerer.state === RegistererState.Registered) {
@@ -6888,7 +6893,7 @@ class WebRTCClient extends Emitter {
6888
6893
  const options = {
6889
6894
  requestDelegate: {
6890
6895
  onReject: response => {
6891
- logger$8.error('sdk webrtc registering, rejected', { response });
6896
+ logger$4.error('sdk webrtc registering, rejected', { response });
6892
6897
 
6893
6898
  onRegisterFailed();
6894
6899
  },
@@ -6896,13 +6901,13 @@ class WebRTCClient extends Emitter {
6896
6901
  };
6897
6902
 
6898
6903
  return this.registerer.register(options).catch((e) => {
6899
- logger$8.error('sdk webrtc registering, error', e);
6904
+ logger$4.error('sdk webrtc registering, error', e);
6900
6905
 
6901
6906
  this.eventEmitter.emit(REGISTRATION_FAILED);
6902
6907
  return e;
6903
6908
  });
6904
6909
  }).catch(error => {
6905
- logger$8.error('sdk webrtc registering, transport error', error);
6910
+ logger$4.error('sdk webrtc registering, transport error', error);
6906
6911
  onRegisterFailed();
6907
6912
  });
6908
6913
  }
@@ -6931,21 +6936,21 @@ class WebRTCClient extends Emitter {
6931
6936
  }
6932
6937
 
6933
6938
  unregister() {
6934
- logger$8.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
6939
+ logger$4.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
6935
6940
  if (!this.registerer) {
6936
6941
  return Promise.resolve();
6937
6942
  }
6938
6943
 
6939
6944
  try {
6940
6945
  return this.registerer.unregister().then(() => {
6941
- logger$8.info('sdk webrtc unregistered');
6946
+ logger$4.info('sdk webrtc unregistered');
6942
6947
  this._cleanupRegister();
6943
6948
  }).catch(e => {
6944
- logger$8.error('sdk webrtc unregistering, promise error', e);
6949
+ logger$4.error('sdk webrtc unregistering, promise error', e);
6945
6950
  this._cleanupRegister();
6946
6951
  });
6947
6952
  } catch (e) {
6948
- logger$8.error('sdk webrtc unregistering, error', e);
6953
+ logger$4.error('sdk webrtc unregistering, error', e);
6949
6954
  // Avoid issue with `undefined is not an object (evaluating 'new.target.prototype')` when triggering a new
6950
6955
  // error when the registerer is in a bad state
6951
6956
  this._cleanupRegister();
@@ -6953,7 +6958,7 @@ class WebRTCClient extends Emitter {
6953
6958
  }
6954
6959
 
6955
6960
  stop() {
6956
- logger$8.info('sdk webrtc stop', { userAgent: !!this.userAgent });
6961
+ logger$4.info('sdk webrtc stop', { userAgent: !!this.userAgent });
6957
6962
  if (!this.userAgent) {
6958
6963
  return Promise.resolve();
6959
6964
  }
@@ -6961,12 +6966,12 @@ class WebRTCClient extends Emitter {
6961
6966
  return this.userAgent.stop().then(() => {
6962
6967
  return this._cleanupRegister();
6963
6968
  }).catch(e => {
6964
- logger$8.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
6969
+ logger$4.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
6965
6970
  });
6966
6971
  }
6967
6972
 
6968
6973
  call(number , enableVideo , audioOnly = false, conference = false) {
6969
- logger$8.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
6974
+ logger$4.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
6970
6975
  const inviterOptions = {
6971
6976
  sessionDescriptionHandlerOptionsReInvite: {
6972
6977
  conference,
@@ -6997,7 +7002,7 @@ class WebRTCClient extends Emitter {
6997
7002
  this._onAccepted(session, response.session, true);
6998
7003
  },
6999
7004
  onReject: (response ) => {
7000
- logger$8.info('on call rejected', { id: session.id, fromTag: session.fromTag });
7005
+ logger$4.info('on call rejected', { id: session.id, fromTag: session.fromTag });
7001
7006
  this._stopSendingStats(session);
7002
7007
  this.stopNetworkMonitoring(session);
7003
7008
 
@@ -7020,11 +7025,11 @@ class WebRTCClient extends Emitter {
7020
7025
  }
7021
7026
 
7022
7027
  answer(session , enableVideo ) {
7023
- logger$8.info('sdk webrtc answer call', { id: session.id, enableVideo });
7028
+ logger$4.info('sdk webrtc answer call', { id: session.id, enableVideo });
7024
7029
 
7025
7030
  if (!session || !session.accept) {
7026
7031
  const error = 'No session to answer, or not an invitation';
7027
- logger$8.warn(error);
7032
+ logger$4.warn(error);
7028
7033
  return Promise.reject(new Error(error));
7029
7034
  }
7030
7035
  const options = {
@@ -7034,15 +7039,15 @@ class WebRTCClient extends Emitter {
7034
7039
  return session.accept(options).then(() => {
7035
7040
  if (session.isCanceled) {
7036
7041
  const message = 'accepted a canceled session (or was canceled during the accept phase).';
7037
- logger$8.error(message, { id: session.id });
7042
+ logger$4.error(message, { id: session.id });
7038
7043
  this.onCallEnded(session);
7039
7044
 
7040
7045
  throw new CanceledCallError(message);
7041
7046
  }
7042
- logger$8.info('sdk webrtc answer, accepted.');
7047
+ logger$4.info('sdk webrtc answer, accepted.');
7043
7048
  this._onAccepted(session);
7044
7049
  }).catch(e => {
7045
- logger$8.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
7050
+ logger$4.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
7046
7051
 
7047
7052
  throw e;
7048
7053
  });
@@ -7050,7 +7055,7 @@ class WebRTCClient extends Emitter {
7050
7055
 
7051
7056
  hangup(session ) {
7052
7057
  const { state, id } = session;
7053
- logger$8.info('sdk webrtc hangup call', { id, state });
7058
+ logger$4.info('sdk webrtc hangup call', { id, state });
7054
7059
 
7055
7060
  try {
7056
7061
  this._stopSendingStats(session);
@@ -7079,7 +7084,7 @@ class WebRTCClient extends Emitter {
7079
7084
 
7080
7085
  return bye();
7081
7086
  } catch (error) {
7082
- logger$8.warn('sdk webrtc hangup, error', error);
7087
+ logger$4.warn('sdk webrtc hangup, error', error);
7083
7088
  }
7084
7089
 
7085
7090
  return null;
@@ -7097,7 +7102,7 @@ class WebRTCClient extends Emitter {
7097
7102
  // Fetch and emit an event at `interval` with session network stats
7098
7103
  startNetworkMonitoring(session , interval = 1000) {
7099
7104
  const sessionId = this.getSipSessionId(session);
7100
- logger$8.info('starting network inspection', { id: sessionId });
7105
+ logger$4.info('starting network inspection', { id: sessionId });
7101
7106
 
7102
7107
  this.sessionNetworkStats[sessionId] = [];
7103
7108
 
@@ -7107,7 +7112,7 @@ class WebRTCClient extends Emitter {
7107
7112
  stopNetworkMonitoring(session ) {
7108
7113
  const sessionId = this.getSipSessionId(session);
7109
7114
  const exists = sessionId in this.networkMonitoringInterval;
7110
- logger$8.info('stopping network inspection', { id: sessionId, exists });
7115
+ logger$4.info('stopping network inspection', { id: sessionId, exists });
7111
7116
 
7112
7117
  if (exists) {
7113
7118
  clearInterval(this.networkMonitoringInterval[sessionId]);
@@ -7117,17 +7122,17 @@ class WebRTCClient extends Emitter {
7117
7122
  }
7118
7123
 
7119
7124
  reject(session ) {
7120
- logger$8.info('sdk webrtc reject call', { id: session.id });
7125
+ logger$4.info('sdk webrtc reject call', { id: session.id });
7121
7126
 
7122
7127
  try {
7123
7128
  return session.reject ? session.reject() : session.cancel();
7124
7129
  } catch (e) {
7125
- logger$8.warn('Error when rejecting call', e.message, e.stack);
7130
+ logger$4.warn('Error when rejecting call', e.message, e.stack);
7126
7131
  }
7127
7132
  }
7128
7133
 
7129
7134
  async close() {
7130
- logger$8.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
7135
+ logger$4.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
7131
7136
  this._cleanupMedia();
7132
7137
  this.connectionPromise = null;
7133
7138
 
@@ -7158,7 +7163,7 @@ class WebRTCClient extends Emitter {
7158
7163
  // eg: "INVITE not rejectable in state Completed"
7159
7164
  }
7160
7165
  this.userAgent = null;
7161
- logger$8.info('sdk webrtc client closed');
7166
+ logger$4.info('sdk webrtc client closed');
7162
7167
  }
7163
7168
 
7164
7169
  getNumber(session ) {
@@ -7171,13 +7176,13 @@ class WebRTCClient extends Emitter {
7171
7176
  }
7172
7177
 
7173
7178
  mute(session ) {
7174
- logger$8.info('sdk webrtc mute', { id: session.id });
7179
+ logger$4.info('sdk webrtc mute', { id: session.id });
7175
7180
 
7176
7181
  this._toggleAudio(session, true);
7177
7182
  }
7178
7183
 
7179
7184
  unmute(session ) {
7180
- logger$8.info('sdk webrtc unmute', { id: session.id });
7185
+ logger$4.info('sdk webrtc unmute', { id: session.id });
7181
7186
 
7182
7187
  this._toggleAudio(session, false);
7183
7188
  }
@@ -7217,13 +7222,13 @@ class WebRTCClient extends Emitter {
7217
7222
  }
7218
7223
 
7219
7224
  toggleCameraOn(session ) {
7220
- logger$8.info('sdk webrtc toggle camera on', { id: session.id });
7225
+ logger$4.info('sdk webrtc toggle camera on', { id: session.id });
7221
7226
 
7222
7227
  this._toggleVideo(session, false);
7223
7228
  }
7224
7229
 
7225
7230
  toggleCameraOff(session ) {
7226
- logger$8.info('sdk webrtc toggle camera off', { id: session.id });
7231
+ logger$4.info('sdk webrtc toggle camera off', { id: session.id });
7227
7232
 
7228
7233
  this._toggleVideo(session, true);
7229
7234
  }
@@ -7232,7 +7237,7 @@ class WebRTCClient extends Emitter {
7232
7237
  const sessionId = this.getSipSessionId(session);
7233
7238
  const hasVideo = hadVideo || this.hasLocalVideo(sessionId);
7234
7239
 
7235
- logger$8.info('sdk webrtc hold', {
7240
+ logger$4.info('sdk webrtc hold', {
7236
7241
  sessionId,
7237
7242
  keys: Object.keys(this.heldSessions),
7238
7243
  pendingReinvite: !!session.pendingReinvite,
@@ -7281,7 +7286,7 @@ class WebRTCClient extends Emitter {
7281
7286
  const sessionId = this.getSipSessionId(session);
7282
7287
  const hasVideo = sessionId in this.heldSessions && this.heldSessions[sessionId].hasVideo;
7283
7288
 
7284
- logger$8.info('sdk webrtc unhold', {
7289
+ logger$4.info('sdk webrtc unhold', {
7285
7290
  sessionId,
7286
7291
  keys: Object.keys(this.heldSessions),
7287
7292
  pendingReinvite: !!session.pendingReinvite,
@@ -7429,7 +7434,7 @@ class WebRTCClient extends Emitter {
7429
7434
  if (!session.sessionDescriptionHandler) {
7430
7435
  return;
7431
7436
  }
7432
- logger$8.info('Sending DTMF', {
7437
+ logger$4.info('Sending DTMF', {
7433
7438
  id: this.getSipSessionId(session),
7434
7439
  tone,
7435
7440
  });
@@ -7445,7 +7450,7 @@ class WebRTCClient extends Emitter {
7445
7450
  transfer(session , target ) {
7446
7451
  this.hold(session);
7447
7452
 
7448
- logger$8.info('Transfering a session', {
7453
+ logger$4.info('Transfering a session', {
7449
7454
  id: this.getSipSessionId(session),
7450
7455
  target,
7451
7456
  });
@@ -7467,17 +7472,17 @@ class WebRTCClient extends Emitter {
7467
7472
  atxfer(session ) {
7468
7473
  this.hold(session);
7469
7474
 
7470
- logger$8.info('webrtc transfer started', { id: this.getSipSessionId(session) });
7475
+ logger$4.info('webrtc transfer started', { id: this.getSipSessionId(session) });
7471
7476
 
7472
7477
  const result = {
7473
7478
  newSession: null,
7474
7479
  init: async (target ) => {
7475
- logger$8.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
7480
+ logger$4.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
7476
7481
 
7477
7482
  result.newSession = await this.call(target);
7478
7483
  },
7479
7484
  complete: () => {
7480
- logger$8.info('webrtc transfer completed', {
7485
+ logger$4.info('webrtc transfer completed', {
7481
7486
  id: this.getSipSessionId(session),
7482
7487
  referId: this.getSipSessionId(result.newSession),
7483
7488
  });
@@ -7498,7 +7503,7 @@ class WebRTCClient extends Emitter {
7498
7503
  return;
7499
7504
  }
7500
7505
 
7501
- logger$8.info('send WebRTC message', { sipId: sipSession.id, contentType });
7506
+ logger$4.info('send WebRTC message', { sipId: sipSession.id, contentType });
7502
7507
 
7503
7508
  try {
7504
7509
  sipSession.message({
@@ -7540,7 +7545,7 @@ class WebRTCClient extends Emitter {
7540
7545
  }
7541
7546
 
7542
7547
  changeAudioOutputVolume(volume ) {
7543
- logger$8.info('Changing audio output volume', { volume });
7548
+ logger$4.info('Changing audio output volume', { volume });
7544
7549
 
7545
7550
  Object.values(this.audioElements).forEach(audioElement => {
7546
7551
  if (audioElement instanceof HTMLAudioElement) {
@@ -7552,7 +7557,7 @@ class WebRTCClient extends Emitter {
7552
7557
  }
7553
7558
 
7554
7559
  changeAudioOutputDevice(id ) {
7555
- logger$8.info('Changing audio output device', { id });
7560
+ logger$4.info('Changing audio output device', { id });
7556
7561
 
7557
7562
  Object.values(this.audioElements).forEach(audioElement => {
7558
7563
  // `setSinkId` method is not included in any flow type definitions for HTMLAudioElements but is a valid method
@@ -7569,7 +7574,7 @@ class WebRTCClient extends Emitter {
7569
7574
 
7570
7575
  changeAudioInputDevice(id , session ) {
7571
7576
  const currentId = this.getAudioDeviceId();
7572
- logger$8.info('setting audio input device', { id, currentId, session: !!session });
7577
+ logger$4.info('setting audio input device', { id, currentId, session: !!session });
7573
7578
 
7574
7579
  if (id === currentId) {
7575
7580
  return null;
@@ -7615,7 +7620,7 @@ class WebRTCClient extends Emitter {
7615
7620
 
7616
7621
  setVideoInputDevice(id ) {
7617
7622
  const currentId = this.getVideoDeviceId();
7618
- logger$8.info('setting video input device', { id, currentId });
7623
+ logger$4.info('setting video input device', { id, currentId });
7619
7624
 
7620
7625
  if (id === currentId) {
7621
7626
  return null;
@@ -7640,7 +7645,7 @@ class WebRTCClient extends Emitter {
7640
7645
  const sessionId = this.getSipSessionId(session);
7641
7646
  const localStream = this.getLocalStream(sessionId);
7642
7647
 
7643
- logger$8.info('changing video input device', { id, sessionId });
7648
+ logger$4.info('changing video input device', { id, sessionId });
7644
7649
 
7645
7650
  // Release old video stream
7646
7651
  if (localStream) {
@@ -7708,7 +7713,7 @@ class WebRTCClient extends Emitter {
7708
7713
  const shouldDoScreenSharing = newConstraints && newConstraints.screen;
7709
7714
  const desktop = newConstraints && newConstraints.desktop;
7710
7715
 
7711
- logger$8.info('Sending reinvite', {
7716
+ logger$4.info('Sending reinvite', {
7712
7717
  id: this.getSipSessionId(sipSession),
7713
7718
  newConstraints,
7714
7719
  conference,
@@ -7746,7 +7751,7 @@ class WebRTCClient extends Emitter {
7746
7751
  sipSession.incomingInviteRequest.message.body = response.message.body;
7747
7752
  }
7748
7753
 
7749
- logger$8.info('on re-INVITE accepted', {
7754
+ logger$4.info('on re-INVITE accepted', {
7750
7755
  id: this.getSipSessionId(sipSession),
7751
7756
  wasMuted,
7752
7757
  shouldDoScreenSharing,
@@ -7764,7 +7769,7 @@ class WebRTCClient extends Emitter {
7764
7769
  this.eventEmitter.emit(ON_SCREEN_SHARING_REINVITE, sipSession, response, desktop);
7765
7770
  }
7766
7771
 
7767
- return this.eventEmitter.emit(ON_REINVITE$1, sipSession, response);
7772
+ return this.eventEmitter.emit(ON_REINVITE, sipSession, response);
7768
7773
  },
7769
7774
  },
7770
7775
  sessionDescriptionHandlerModifiers: [replaceLocalIpModifier],
@@ -7921,7 +7926,7 @@ class WebRTCClient extends Emitter {
7921
7926
  }
7922
7927
 
7923
7928
  startHeartbeat() {
7924
- logger$8.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
7929
+ logger$4.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
7925
7930
  if (!this.userAgent) {
7926
7931
  this.heartbeat.stop();
7927
7932
  return;
@@ -7934,7 +7939,7 @@ class WebRTCClient extends Emitter {
7934
7939
  }
7935
7940
 
7936
7941
  stopHeartbeat() {
7937
- logger$8.info('sdk webrtc stop heartbeat');
7942
+ logger$4.info('sdk webrtc stop heartbeat');
7938
7943
  this.heartbeat.stop();
7939
7944
  }
7940
7945
 
@@ -7955,7 +7960,7 @@ class WebRTCClient extends Emitter {
7955
7960
  }
7956
7961
 
7957
7962
  attemptReconnection() {
7958
- logger$8.info('attempt reconnection', { userAgent: !!this.userAgent });
7963
+ logger$4.info('attempt reconnection', { userAgent: !!this.userAgent });
7959
7964
  if (!this.userAgent) {
7960
7965
  return;
7961
7966
  }
@@ -7980,7 +7985,7 @@ class WebRTCClient extends Emitter {
7980
7985
  return;
7981
7986
  }
7982
7987
 
7983
- logger$8.info('setting local media stream', {
7988
+ logger$4.info('setting local media stream', {
7984
7989
  sipSessionId,
7985
7990
  tracks: newStream ? newStream.getTracks() : null,
7986
7991
  });
@@ -7997,7 +8002,7 @@ class WebRTCClient extends Emitter {
7997
8002
 
7998
8003
  const oldStream = this.getLocalStream(sipSessionId);
7999
8004
 
8000
- logger$8.info('updating local stream', {
8005
+ logger$4.info('updating local stream', {
8001
8006
  sipSessionId,
8002
8007
  oldStream: !!oldStream,
8003
8008
  tracks: newStream.getTracks(),
@@ -8017,7 +8022,7 @@ class WebRTCClient extends Emitter {
8017
8022
  const remoteStream = this.getRemoteStream(sessionId);
8018
8023
  const pc = this.getPeerConnection(sessionId);
8019
8024
 
8020
- logger$8.info('Updating remote stream', {
8025
+ logger$4.info('Updating remote stream', {
8021
8026
  sessionId,
8022
8027
  tracks: remoteStream ? remoteStream.getTracks() : null,
8023
8028
  receiverTracks: pc && pc.getReceivers ? pc.getReceivers().map(receiver => receiver.track) : null,
@@ -8043,7 +8048,7 @@ class WebRTCClient extends Emitter {
8043
8048
  const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
8044
8049
  const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
8045
8050
 
8046
- logger$8.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
8051
+ logger$4.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
8047
8052
 
8048
8053
  return {
8049
8054
  constraints: {
@@ -8092,7 +8097,7 @@ class WebRTCClient extends Emitter {
8092
8097
  }
8093
8098
 
8094
8099
  _onTransportError() {
8095
- logger$8.error('on transport error');
8100
+ logger$4.error('on transport error');
8096
8101
  this.eventEmitter.emit(TRANSPORT_ERROR);
8097
8102
  this.attemptReconnection();
8098
8103
  }
@@ -8101,7 +8106,7 @@ class WebRTCClient extends Emitter {
8101
8106
  const body = message && typeof message === 'object' ? message.data : message;
8102
8107
  if (body && body.indexOf('200 OK') !== -1) {
8103
8108
  if (this.hasHeartbeat()) {
8104
- logger$8.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
8109
+ logger$4.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
8105
8110
 
8106
8111
  this.heartbeat.onHeartbeat();
8107
8112
  if (this.heartbeatCb) {
@@ -8112,7 +8117,7 @@ class WebRTCClient extends Emitter {
8112
8117
  }
8113
8118
 
8114
8119
  async _onHeartbeatTimeout() {
8115
- logger$8.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
8120
+ logger$4.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
8116
8121
 
8117
8122
  if (this.heartbeatTimeoutCb) {
8118
8123
  this.heartbeatTimeoutCb();
@@ -8124,7 +8129,7 @@ class WebRTCClient extends Emitter {
8124
8129
  try {
8125
8130
  await this.userAgent.transport.disconnect();
8126
8131
  } catch (e) {
8127
- logger$8.error('Transport disconnection after heartbeat timeout, error', e);
8132
+ logger$4.error('Transport disconnection after heartbeat timeout, error', e);
8128
8133
  }
8129
8134
  }
8130
8135
 
@@ -8157,31 +8162,31 @@ class WebRTCClient extends Emitter {
8157
8162
  }
8158
8163
 
8159
8164
  _connectIfNeeded() {
8160
- logger$8.info('connect if needed, checking', { connected: this.isConnected() });
8165
+ logger$4.info('connect if needed, checking', { connected: this.isConnected() });
8161
8166
  if (!this.userAgent) {
8162
- logger$8.info('need to recreate User Agent');
8167
+ logger$4.info('need to recreate User Agent');
8163
8168
  this.userAgent = this.createUserAgent(this.uaConfigOverrides);
8164
8169
  }
8165
8170
 
8166
8171
  if (this.isConnected()) {
8167
- logger$8.info('webrtc sdk, already connected');
8172
+ logger$4.info('webrtc sdk, already connected');
8168
8173
  return Promise.resolve();
8169
8174
  }
8170
8175
 
8171
8176
  if (this.isConnecting()) {
8172
- logger$8.info('webrtc sdk, already connecting...');
8177
+ logger$4.info('webrtc sdk, already connecting...');
8173
8178
 
8174
8179
  this.connectionPromise = this.userAgent.transport.connectPromise;
8175
8180
  return this.connectionPromise;
8176
8181
  }
8177
8182
 
8178
8183
  if (this.connectionPromise) {
8179
- logger$8.info('webrtc sdk, connection promise connecting...');
8184
+ logger$4.info('webrtc sdk, connection promise connecting...');
8180
8185
  // $FlowFixMe
8181
8186
  return this.connectionPromise;
8182
8187
  }
8183
8188
 
8184
- logger$8.info('WebRTC UA needs to connect');
8189
+ logger$4.info('WebRTC UA needs to connect');
8185
8190
 
8186
8191
  // Force UA to reconnect
8187
8192
  if (this.userAgent && this.userAgent.state !== UserAgentState.Stopped) {
@@ -8306,7 +8311,7 @@ class WebRTCClient extends Emitter {
8306
8311
 
8307
8312
  sdh.peerConnectionDelegate = {
8308
8313
  onicecandidateerror: (error ) => {
8309
- logger$8.error('on icecandidate error', {
8314
+ logger$4.error('on icecandidate error', {
8310
8315
  address: error.address,
8311
8316
  port: error.port,
8312
8317
  errorCode: error.errorCode,
@@ -8335,7 +8340,7 @@ class WebRTCClient extends Emitter {
8335
8340
  updatedNumber = session.assertedIdentity.uri.normal.user;
8336
8341
  updatedCalleeName = session.assertedIdentity.displayName || updatedNumber;
8337
8342
  }
8338
- logger$8.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
8343
+ logger$4.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
8339
8344
 
8340
8345
  // Useful to know if it's a video upgrade or an unhold from a remote peer with a video stream
8341
8346
 
@@ -8351,12 +8356,12 @@ class WebRTCClient extends Emitter {
8351
8356
 
8352
8357
  this._setupMedias(session);
8353
8358
 
8354
- return this.eventEmitter.emit(ON_REINVITE$1, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
8359
+ return this.eventEmitter.emit(ON_REINVITE, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
8355
8360
  };
8356
8361
  }
8357
8362
 
8358
8363
  _onAccepted(session , sessionDialog , withEvent = true) {
8359
- logger$8.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
8364
+ logger$4.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
8360
8365
 
8361
8366
  this.storeSipSession(session);
8362
8367
 
@@ -8368,14 +8373,14 @@ class WebRTCClient extends Emitter {
8368
8373
  const onTrack = (event ) => {
8369
8374
  const isAudioOnly = this._isAudioOnly(session);
8370
8375
  const { kind, label, readyState, id, muted } = event.track;
8371
- logger$8.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
8376
+ logger$4.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
8372
8377
 
8373
8378
  // Stop video track in audio only mode
8374
8379
  if (isAudioOnly && kind === 'video') {
8375
8380
  event.track.stop();
8376
8381
  }
8377
8382
 
8378
- this.eventEmitter.emit(ON_TRACK$1, session, event);
8383
+ this.eventEmitter.emit(ON_TRACK, session, event);
8379
8384
  };
8380
8385
 
8381
8386
  if (session.sessionDescriptionHandler.peerConnection) {
@@ -8385,9 +8390,9 @@ class WebRTCClient extends Emitter {
8385
8390
  session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
8386
8391
 
8387
8392
  pc.oniceconnectionstatechange = () => {
8388
- logger$8.info('on ice connection state changed', { state: pc.iceConnectionState });
8393
+ logger$4.info('on ice connection state changed', { state: pc.iceConnectionState });
8389
8394
  if (pc.iceConnectionState === 'disconnected') {
8390
- this.eventEmitter.emit(ON_DISCONNECTED$1);
8395
+ this.eventEmitter.emit(ON_DISCONNECTED);
8391
8396
  }
8392
8397
  };
8393
8398
 
@@ -8558,10 +8563,10 @@ class WebRTCClient extends Emitter {
8558
8563
 
8559
8564
  _stopSendingStats(session ) {
8560
8565
  const sessionId = this.getSipSessionId(session);
8561
- logger$8.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
8566
+ logger$4.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
8562
8567
 
8563
8568
  if (sessionId in this.statsIntervals) {
8564
- logger$8.trace('Stop sending stats for call', { sessionId });
8569
+ logger$4.trace('Stop sending stats for call', { sessionId });
8565
8570
  this.statsIntervals[sessionId]();
8566
8571
  delete this.statsIntervals[sessionId];
8567
8572
  }
@@ -8577,7 +8582,7 @@ class WebRTCClient extends Emitter {
8577
8582
  try {
8578
8583
  await this.userAgent.transport.disconnect();
8579
8584
  } catch (e) {
8580
- logger$8.error('WebRTC transport disconnect, error', e);
8585
+ logger$4.error('WebRTC transport disconnect, error', e);
8581
8586
  }
8582
8587
  }
8583
8588
  }
@@ -8671,7 +8676,7 @@ class WebRTCClient extends Emitter {
8671
8676
  + networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
8672
8677
  + networkStats.transportSent;
8673
8678
 
8674
- this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
8679
+ this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
8675
8680
  this.sessionNetworkStats[sessionId].push(networkStats);
8676
8681
  }
8677
8682
 
@@ -8699,8 +8704,8 @@ const ON_CALL_FAILED = 'onCallFailed';
8699
8704
  const ON_CALL_ENDED = 'onCallEnded';
8700
8705
  const ON_CALL_ENDING = 'onCallEnding';
8701
8706
  const ON_MESSAGE = 'onMessage';
8702
- const ON_REINVITE = 'reinvite';
8703
- const ON_TRACK = 'onTrack';
8707
+ const ON_REINVITE$1 = 'reinvite';
8708
+ const ON_TRACK$1 = 'onTrack';
8704
8709
  const ON_AUDIO_STREAM = 'onAudioStream';
8705
8710
  const ON_VIDEO_STREAM = 'onVideoStream';
8706
8711
  const ON_REMOVE_STREAM = 'onRemoveStream';
@@ -8715,15 +8720,15 @@ const ON_PLAY_PROGRESS_SOUND = 'playProgressSound';
8715
8720
  const ON_VIDEO_INPUT_CHANGE = 'videoInputChange';
8716
8721
  const ON_CALL_ERROR = 'onCallError';
8717
8722
  const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
8718
- const ON_NETWORK_STATS = 'onNetworkStats';
8723
+ const ON_NETWORK_STATS$1 = 'onNetworkStats';
8719
8724
  const ON_CHAT = 'phone/ON_CHAT';
8720
8725
  const ON_SIGNAL = 'phone/ON_SIGNAL';
8721
- const ON_DISCONNECTED = 'onDisconnected';
8726
+ const ON_DISCONNECTED$1 = 'onDisconnected';
8722
8727
 
8723
8728
  const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
8724
8729
  const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
8725
8730
 
8726
- const events = [
8731
+ const events$1 = [
8727
8732
  ON_USER_AGENT,
8728
8733
  ON_REGISTERED,
8729
8734
  ON_UNREGISTERED,
@@ -8741,8 +8746,8 @@ const events = [
8741
8746
  ON_CALL_FAILED,
8742
8747
  ON_CALL_ENDED,
8743
8748
  ON_MESSAGE,
8744
- ON_REINVITE,
8745
- ON_TRACK,
8749
+ ON_REINVITE$1,
8750
+ ON_TRACK$1,
8746
8751
  ON_AUDIO_STREAM,
8747
8752
  ON_VIDEO_STREAM,
8748
8753
  ON_REMOVE_STREAM,
@@ -8757,11 +8762,11 @@ const events = [
8757
8762
  ON_CALL_ERROR,
8758
8763
  ON_CHAT,
8759
8764
  ON_SIGNAL,
8760
- ON_NETWORK_STATS,
8761
- ON_DISCONNECTED,
8765
+ ON_NETWORK_STATS$1,
8766
+ ON_DISCONNECTED$1,
8762
8767
  ];
8763
8768
 
8764
- const logger$7 = IssueReporter$1.loggerFor('webrtc-phone');
8769
+ const logger$5 = IssueReporter$1.loggerFor('webrtc-phone');
8765
8770
 
8766
8771
  class WebRTCPhone extends Emitter {
8767
8772
 
@@ -8834,7 +8839,7 @@ class WebRTCPhone extends Emitter {
8834
8839
  }).catch(error => {
8835
8840
  // Avoid exception on `t.server.scheme` in sip transport when losing the webrtc socket connection
8836
8841
  console.error('register error', error, error.message, error.stack);
8837
- logger$7.error('WebRTC register error', { message: error.message, stack: error.stack });
8842
+ logger$5.error('WebRTC register error', { message: error.message, stack: error.stack });
8838
8843
  });
8839
8844
  }
8840
8845
 
@@ -8849,7 +8854,7 @@ class WebRTCPhone extends Emitter {
8849
8854
  if (!this.client) {
8850
8855
  return;
8851
8856
  }
8852
- logger$7.info('WebRTC phone stop');
8857
+ logger$5.info('WebRTC phone stop');
8853
8858
  this.client.stop();
8854
8859
  }
8855
8860
 
@@ -8864,7 +8869,7 @@ class WebRTCPhone extends Emitter {
8864
8869
  async sendReinvite(callSession , constraints = null, conference = false,
8865
8870
  audioOnly = false, iceRestart = false) {
8866
8871
  const sipSession = this.findSipSession(callSession);
8867
- logger$7.info('WebRTC phone - send reinvite', {
8872
+ logger$5.info('WebRTC phone - send reinvite', {
8868
8873
  sessionId: sipSession ? sipSession.id : null,
8869
8874
  constraints,
8870
8875
  audioOnly,
@@ -8901,7 +8906,7 @@ class WebRTCPhone extends Emitter {
8901
8906
  }
8902
8907
 
8903
8908
  startHeartbeat() {
8904
- logger$7.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
8909
+ logger$5.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
8905
8910
  if (!this.client || this.client.hasHeartbeat()) {
8906
8911
  return;
8907
8912
  }
@@ -8910,7 +8915,7 @@ class WebRTCPhone extends Emitter {
8910
8915
  }
8911
8916
 
8912
8917
  stopHeartbeat() {
8913
- logger$7.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
8918
+ logger$5.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
8914
8919
  if (!this.client) {
8915
8920
  return;
8916
8921
  }
@@ -8927,7 +8932,7 @@ class WebRTCPhone extends Emitter {
8927
8932
  }
8928
8933
 
8929
8934
  reconnect() {
8930
- logger$7.info('WebRTC phone - reconnect', { client: !!this.client });
8935
+ logger$5.info('WebRTC phone - reconnect', { client: !!this.client });
8931
8936
  if (!this.client) {
8932
8937
  return;
8933
8938
  }
@@ -8968,10 +8973,15 @@ class WebRTCPhone extends Emitter {
8968
8973
  return false;
8969
8974
  }
8970
8975
 
8971
- logger$7.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
8976
+ logger$5.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
8972
8977
 
8973
8978
  this.client.downgradeToAudio(sipSession);
8974
8979
 
8980
+ if (callSession) {
8981
+ callSession.cameraEnabled = false;
8982
+ this._updateCallSession(callSession);
8983
+ }
8984
+
8975
8985
  if (withMessage) {
8976
8986
  this._sendReinviteMessage(callSession, false);
8977
8987
  }
@@ -8986,7 +8996,7 @@ class WebRTCPhone extends Emitter {
8986
8996
  return Promise.resolve(false);
8987
8997
  }
8988
8998
 
8989
- logger$7.info('Upgrade to video', {
8999
+ logger$5.info('Upgrade to video', {
8990
9000
  id: callSession ? callSession.getId() : null,
8991
9001
  constraints,
8992
9002
  isConference,
@@ -8999,6 +9009,11 @@ class WebRTCPhone extends Emitter {
8999
9009
 
9000
9010
  const newStream = await this.client.upgradeToVideo(sipSession, constraints, isConference);
9001
9011
 
9012
+ if (callSession) {
9013
+ callSession.cameraEnabled = true;
9014
+ this._updateCallSession(callSession);
9015
+ }
9016
+
9002
9017
  // If no stream is returned, it means we have to reinvite
9003
9018
  if (!newStream) {
9004
9019
  return true;
@@ -9021,7 +9036,7 @@ class WebRTCPhone extends Emitter {
9021
9036
 
9022
9037
  _sendReinviteMessage(callSession , isUpgrade ) {
9023
9038
  const sipSession = this.findSipSession(callSession);
9024
- logger$7.info('Sending reinvite message', {
9039
+ logger$5.info('Sending reinvite message', {
9025
9040
  id: callSession ? callSession.getId() : null,
9026
9041
  isUpgrade,
9027
9042
  });
@@ -9047,7 +9062,7 @@ class WebRTCPhone extends Emitter {
9047
9062
  // Monkey patch to know when canceled with the CANCEL message
9048
9063
  const onCancel = sipSession._onCancel.bind(sipSession);
9049
9064
  sipSession._onCancel = (message ) => {
9050
- logger$7.trace('on sip session canceled', { callId: message.callId });
9065
+ logger$5.trace('on sip session canceled', { callId: message.callId });
9051
9066
 
9052
9067
  onCancel(message);
9053
9068
  const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
@@ -9075,13 +9090,13 @@ class WebRTCPhone extends Emitter {
9075
9090
  this.audioOutputVolume,
9076
9091
  );
9077
9092
  case SessionState.Terminating:
9078
- logger$7.info('WebRTC phone - call terminating', { sipId: sipSession.id });
9093
+ logger$5.info('WebRTC phone - call terminating', { sipId: sipSession.id });
9079
9094
 
9080
9095
  this.eventEmitter.emit(ON_CALL_ENDING, this._createCallSession(sipSession));
9081
9096
 
9082
9097
  break;
9083
9098
  case SessionState.Terminated: {
9084
- logger$7.info('WebRTC phone - call terminated', { sipId: sipSession.id });
9099
+ logger$5.info('WebRTC phone - call terminated', { sipId: sipSession.id });
9085
9100
 
9086
9101
  // Should be called before `_onCallTerminated` or the callCount will not decrement...
9087
9102
  const callSession = this._createCallSession(sipSession);
@@ -9103,7 +9118,7 @@ class WebRTCPhone extends Emitter {
9103
9118
  const [stream] = event.streams;
9104
9119
  const kind = event && event.track && event.track.kind;
9105
9120
 
9106
- logger$7.info('on track stream called on the peer connection', {
9121
+ logger$5.info('on track stream called on the peer connection', {
9107
9122
  callId: this.getSipSessionId(sipSession),
9108
9123
  streamId: stream ? stream.id : null,
9109
9124
  tracks: stream ? stream.getTracks() : null,
@@ -9123,7 +9138,7 @@ class WebRTCPhone extends Emitter {
9123
9138
  };
9124
9139
 
9125
9140
  peerConnection.onremovestream = event => {
9126
- logger$7.info('on remove stream called on the peer connection', {
9141
+ logger$5.info('on remove stream called on the peer connection', {
9127
9142
  id: event.stream.id,
9128
9143
  tracks: event.stream.getTracks(),
9129
9144
  });
@@ -9133,7 +9148,7 @@ class WebRTCPhone extends Emitter {
9133
9148
  }
9134
9149
 
9135
9150
  async startScreenSharing(constraints , callSession ) {
9136
- logger$7.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
9151
+ logger$5.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
9137
9152
 
9138
9153
  const screenShareStream = await this.client.getStreamFromConstraints(constraints);
9139
9154
  if (!screenShareStream) {
@@ -9173,7 +9188,7 @@ class WebRTCPhone extends Emitter {
9173
9188
  return;
9174
9189
  }
9175
9190
 
9176
- logger$7.info('WebRTC phone - stop screen sharing', {
9191
+ logger$5.info('WebRTC phone - stop screen sharing', {
9177
9192
  restoreLocalStream,
9178
9193
  });
9179
9194
 
@@ -9229,7 +9244,7 @@ class WebRTCPhone extends Emitter {
9229
9244
  const pc = this.client.getPeerConnection(sipSessionId);
9230
9245
  const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
9231
9246
 
9232
- logger$7.info('WebRTC phone - on screensharing', {
9247
+ logger$5.info('WebRTC phone - on screensharing', {
9233
9248
  hadVideo,
9234
9249
  id: this.getSipSessionId(sipSession),
9235
9250
  screenTrack,
@@ -9237,7 +9252,7 @@ class WebRTCPhone extends Emitter {
9237
9252
 
9238
9253
  if (screenTrack) {
9239
9254
  screenTrack.onended = () => {
9240
- logger$7.info('WebRTC phone - on screenshare ended', {
9255
+ logger$5.info('WebRTC phone - on screenshare ended', {
9241
9256
  hadVideo,
9242
9257
  id: this.getSipSessionId(sipSession),
9243
9258
  screenTrack,
@@ -9268,7 +9283,7 @@ class WebRTCPhone extends Emitter {
9268
9283
  }
9269
9284
 
9270
9285
  _onCallAccepted(sipSession , cameraEnabled ) {
9271
- logger$7.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
9286
+ logger$5.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
9272
9287
 
9273
9288
  const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
9274
9289
  this.currentSipSession = sipSession;
@@ -9286,7 +9301,7 @@ class WebRTCPhone extends Emitter {
9286
9301
  }
9287
9302
 
9288
9303
  changeAudioDevice(id ) {
9289
- logger$7.info('WebRTC phone - change audio device', { deviceId: id });
9304
+ logger$5.info('WebRTC phone - change audio device', { deviceId: id });
9290
9305
  this.audioOutputDeviceId = id;
9291
9306
  this.client.changeAudioOutputDevice(id);
9292
9307
  }
@@ -9296,14 +9311,14 @@ class WebRTCPhone extends Emitter {
9296
9311
  }
9297
9312
 
9298
9313
  changeRingDevice(id ) {
9299
- logger$7.info('WebRTC phone - changing ring device', { id });
9314
+ logger$5.info('WebRTC phone - changing ring device', { id });
9300
9315
 
9301
9316
  this.audioRingDeviceId = id;
9302
9317
  }
9303
9318
 
9304
9319
  // volume is a value between 0 and 1
9305
9320
  changeAudioVolume(volume ) {
9306
- logger$7.info('WebRTC phone - changing audio volume', { volume });
9321
+ logger$5.info('WebRTC phone - changing audio volume', { volume });
9307
9322
 
9308
9323
  this.audioOutputVolume = volume;
9309
9324
  this.client.changeAudioOutputVolume(volume);
@@ -9311,31 +9326,31 @@ class WebRTCPhone extends Emitter {
9311
9326
 
9312
9327
  // volume is a value between 0 and 1
9313
9328
  changeRingVolume(volume ) {
9314
- logger$7.info('WebRTC phone - changing ring volume', { volume });
9329
+ logger$5.info('WebRTC phone - changing ring volume', { volume });
9315
9330
 
9316
9331
  this.audioRingVolume = volume;
9317
9332
  }
9318
9333
 
9319
9334
  changeAudioInputDevice(id ) {
9320
- logger$7.info('WebRTC phone - changeAudio input device', { deviceId: id });
9335
+ logger$5.info('WebRTC phone - changeAudio input device', { deviceId: id });
9321
9336
 
9322
9337
  return this.client.changeAudioInputDevice(id, this.currentSipSession);
9323
9338
  }
9324
9339
 
9325
9340
  changeVideoInputDevice(id ) {
9326
- logger$7.info('WebRTC phone - change video input device', { deviceId: id });
9341
+ logger$5.info('WebRTC phone - change video input device', { deviceId: id });
9327
9342
 
9328
9343
  return this.client.changeVideoInputDevice(id, this.currentSipSession);
9329
9344
  }
9330
9345
 
9331
9346
  changeSessionVideoInputDevice(id ) {
9332
- logger$7.info('WebRTC phone - change session video input device', { deviceId: id });
9347
+ logger$5.info('WebRTC phone - change session video input device', { deviceId: id });
9333
9348
 
9334
9349
  return this.client.changeSessionVideoInputDevice(id, this.currentSipSession);
9335
9350
  }
9336
9351
 
9337
9352
  _onCallTerminated(sipSession ) {
9338
- logger$7.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9353
+ logger$5.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9339
9354
 
9340
9355
  const callSession = this._createCallSession(sipSession);
9341
9356
  const isCurrentSession = this.isCurrentCallSipSession(callSession);
@@ -9369,7 +9384,7 @@ class WebRTCPhone extends Emitter {
9369
9384
  const hasIncomingCallSession = this.hasIncomingCallSession();
9370
9385
 
9371
9386
  // Re-trigger incoming call event for remaining incoming calls
9372
- logger$7.info('WebRTC phone - check to re-trigger incoming call', {
9387
+ logger$5.info('WebRTC phone - check to re-trigger incoming call', {
9373
9388
  sipId: sipSession.id,
9374
9389
  shouldRetrigger,
9375
9390
  hasIncomingCallSession,
@@ -9460,37 +9475,37 @@ class WebRTCPhone extends Emitter {
9460
9475
 
9461
9476
  // Deprecated
9462
9477
  getLocalStreamForCall(callSession ) {
9463
- logger$7.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
9478
+ logger$5.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
9464
9479
 
9465
9480
  return this.getLocalStream(callSession);
9466
9481
  }
9467
9482
 
9468
9483
  // Deprecated
9469
9484
  getRemoteStreamForCall(callSession ) {
9470
- logger$7.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
9485
+ logger$5.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
9471
9486
 
9472
9487
  return this.getRemoteVideoStream(callSession);
9473
9488
  }
9474
9489
 
9475
9490
  getRemoteStreamsForCall(callSession ) {
9476
- logger$7.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
9491
+ logger$5.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
9477
9492
 
9478
9493
  return this.getRemoteStream(callSession);
9479
9494
  }
9480
9495
 
9481
9496
  accept(callSession , cameraEnabled ) {
9482
- logger$7.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
9497
+ logger$5.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
9483
9498
  if (this.currentSipSession) {
9484
9499
  this.holdSipSession(this.currentSipSession, this.currentCallSession, true);
9485
9500
  }
9486
9501
 
9487
9502
  if (!callSession) {
9488
- logger$7.warn('no CallSession to accept.');
9503
+ logger$5.warn('no CallSession to accept.');
9489
9504
  return Promise.resolve(null);
9490
9505
  }
9491
9506
 
9492
9507
  if (callSession.getId() in this.acceptedSessions) {
9493
- logger$7.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
9508
+ logger$5.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
9494
9509
  return Promise.resolve(callSession.sipCallId);
9495
9510
  }
9496
9511
 
@@ -9502,24 +9517,24 @@ class WebRTCPhone extends Emitter {
9502
9517
  const sipSession = this.client.getSipSession(callSession.getId());
9503
9518
  if (sipSession) {
9504
9519
  if (sipSession.state === SessionState.Terminated || sipSession.state === SessionState.Terminating) {
9505
- logger$7.warn('Trying to answer a terminated sipSession.');
9520
+ logger$5.warn('Trying to answer a terminated sipSession.');
9506
9521
 
9507
9522
  return Promise.resolve(null);
9508
9523
  }
9509
9524
 
9510
- logger$7.info('accept call, session found', { sipId: sipSession.id });
9525
+ logger$5.info('accept call, session found', { sipId: sipSession.id });
9511
9526
 
9512
9527
  // $FlowFixMe
9513
9528
  return this.client.answer(sipSession, this.allowVideo ? cameraEnabled : false).then(() => {
9514
9529
  return callSession.sipCallId;
9515
9530
  }).catch(e => {
9516
- logger$7.error(e);
9531
+ logger$5.error(e);
9517
9532
  this.endCurrentCall(callSession);
9518
9533
  throw e;
9519
9534
  });
9520
9535
  }
9521
9536
 
9522
- logger$7.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
9537
+ logger$5.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
9523
9538
 
9524
9539
  return Promise.resolve(null);
9525
9540
  }
@@ -9529,7 +9544,7 @@ class WebRTCPhone extends Emitter {
9529
9544
  }
9530
9545
 
9531
9546
  async reject(callSession ) {
9532
- logger$7.info('reject WebRTC called', { id: callSession.getId() });
9547
+ logger$5.info('reject WebRTC called', { id: callSession.getId() });
9533
9548
 
9534
9549
  this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'call rejected locally');
9535
9550
  if (!callSession || callSession.getId() in this.rejectedSessions) {
@@ -9541,14 +9556,14 @@ class WebRTCPhone extends Emitter {
9541
9556
 
9542
9557
  const sipSession = this.findSipSession(callSession);
9543
9558
  if (sipSession) {
9544
- logger$7.info('WebRTC rejecting', { sipId: sipSession.id });
9559
+ logger$5.info('WebRTC rejecting', { sipId: sipSession.id });
9545
9560
 
9546
9561
  this.client.hangup(sipSession);
9547
9562
  }
9548
9563
  }
9549
9564
 
9550
9565
  async ignore(callSession ) {
9551
- logger$7.info('WebRTC ignore', { id: callSession.getId() });
9566
+ logger$5.info('WebRTC ignore', { id: callSession.getId() });
9552
9567
 
9553
9568
  // kill the ring
9554
9569
  this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'ignoring call');
@@ -9560,14 +9575,14 @@ class WebRTCPhone extends Emitter {
9560
9575
  const sipSession = this.findSipSession(callSession);
9561
9576
 
9562
9577
  if (sipSession) {
9563
- logger$7.info('WebRTC atxfer', { sipId: sipSession.id });
9578
+ logger$5.info('WebRTC atxfer', { sipId: sipSession.id });
9564
9579
 
9565
9580
  return this.client.atxfer(sipSession);
9566
9581
  }
9567
9582
  }
9568
9583
 
9569
9584
  hold(callSession , withEvent = true, isConference = false) {
9570
- logger$7.info('WebRTC hold', { id: callSession.getId() });
9585
+ logger$5.info('WebRTC hold', { id: callSession.getId() });
9571
9586
 
9572
9587
  const sipSession = this.findSipSession(callSession);
9573
9588
 
@@ -9582,18 +9597,18 @@ class WebRTCPhone extends Emitter {
9582
9597
  }
9583
9598
 
9584
9599
  resume(callSession , isConference = false, withEvent = true) {
9585
- logger$7.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
9600
+ logger$5.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
9586
9601
 
9587
9602
  const sipSession = this.findSipSession(callSession);
9588
9603
  if (!sipSession) {
9589
9604
  return new Promise((resolve, reject) => reject(new Error('No session to resume')));
9590
9605
  }
9591
9606
 
9592
- logger$7.info('WebRTC resuming', { sipId: sipSession.id });
9607
+ logger$5.info('WebRTC resuming', { sipId: sipSession.id });
9593
9608
 
9594
9609
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
9595
9610
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
9596
- logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9611
+ logger$5.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9597
9612
  this.holdSipSession(this.currentSipSession, callSession);
9598
9613
  }
9599
9614
 
@@ -9618,7 +9633,7 @@ class WebRTCPhone extends Emitter {
9618
9633
  const sessionId = this.getSipSessionId(sipSession);
9619
9634
  const hasVideo = this.client.hasLocalVideo(sessionId);
9620
9635
 
9621
- logger$7.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
9636
+ logger$5.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
9622
9637
 
9623
9638
  // Stop screenshre if needed
9624
9639
  if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
@@ -9649,7 +9664,7 @@ class WebRTCPhone extends Emitter {
9649
9664
  return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
9650
9665
  }
9651
9666
  const sessionId = this.getSipSessionId(sipSession);
9652
- logger$7.info('WebRTC unhold sip session', { sessionId, isConference });
9667
+ logger$5.info('WebRTC unhold sip session', { sessionId, isConference });
9653
9668
 
9654
9669
  const { hasVideo } = this.client.getHeldSession(sessionId) || {};
9655
9670
  const wasScreensharing = this.lastScreenShare && this.lastScreenShare.sipSessionId === sessionId;
@@ -9693,14 +9708,14 @@ class WebRTCPhone extends Emitter {
9693
9708
  }
9694
9709
 
9695
9710
  mute(callSession , withEvent = true) {
9696
- logger$7.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
9711
+ logger$5.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
9697
9712
 
9698
9713
  const sipSession = this.findSipSession(callSession);
9699
9714
  if (!sipSession) {
9700
9715
  return;
9701
9716
  }
9702
9717
 
9703
- logger$7.info('WebRTC muting', { sipId: sipSession.id });
9718
+ logger$5.info('WebRTC muting', { sipId: sipSession.id });
9704
9719
  this.client.mute(sipSession);
9705
9720
  const newCallSession = this._createCallSession(sipSession, callSession, { muted: true });
9706
9721
 
@@ -9714,14 +9729,14 @@ class WebRTCPhone extends Emitter {
9714
9729
  }
9715
9730
 
9716
9731
  unmute(callSession , withEvent = true) {
9717
- logger$7.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
9732
+ logger$5.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
9718
9733
 
9719
9734
  const sipSession = this.findSipSession(callSession);
9720
9735
  if (!sipSession) {
9721
9736
  return;
9722
9737
  }
9723
9738
 
9724
- logger$7.info('WebRTC unmuting', { sipId: sipSession.id });
9739
+ logger$5.info('WebRTC unmuting', { sipId: sipSession.id });
9725
9740
  this.client.unmute(sipSession);
9726
9741
  const newCallSession = this._createCallSession(sipSession, callSession, { muted: false });
9727
9742
 
@@ -9748,7 +9763,7 @@ class WebRTCPhone extends Emitter {
9748
9763
  if (!sipSession) {
9749
9764
  return;
9750
9765
  }
9751
- logger$7.info('WebRTC turn camera on', { sipId: sipSession.id });
9766
+ logger$5.info('WebRTC turn camera on', { sipId: sipSession.id });
9752
9767
 
9753
9768
  this.client.toggleCameraOn(sipSession);
9754
9769
 
@@ -9760,7 +9775,7 @@ class WebRTCPhone extends Emitter {
9760
9775
  if (!sipSession) {
9761
9776
  return;
9762
9777
  }
9763
- logger$7.info('WebRTC turn camera off', { sipId: sipSession.id });
9778
+ logger$5.info('WebRTC turn camera off', { sipId: sipSession.id });
9764
9779
 
9765
9780
  this.client.toggleCameraOff(sipSession);
9766
9781
  this.eventEmitter.emit(ON_CAMERA_DISABLED, this._createCameraDisabledCallSession(sipSession, callSession));
@@ -9772,7 +9787,7 @@ class WebRTCPhone extends Emitter {
9772
9787
  return;
9773
9788
  }
9774
9789
 
9775
- logger$7.info('WebRTC send key', { sipId: sipSession.id, tone });
9790
+ logger$5.info('WebRTC send key', { sipId: sipSession.id, tone });
9776
9791
  this.client.sendDTMF(sipSession, tone);
9777
9792
  }
9778
9793
 
@@ -9780,7 +9795,7 @@ class WebRTCPhone extends Emitter {
9780
9795
  // @TODO: line is not used here
9781
9796
  async makeCall(number , line , cameraEnabled ,
9782
9797
  audioOnly = false, conference = false) {
9783
- logger$7.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled });
9798
+ logger$5.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled });
9784
9799
  if (!number) {
9785
9800
  return Promise.resolve(null);
9786
9801
  }
@@ -9790,7 +9805,7 @@ class WebRTCPhone extends Emitter {
9790
9805
  }
9791
9806
  if (this.currentSipSession) {
9792
9807
  this.holdSipSession(this.currentSipSession, this.currentCallSession, true).catch(e => {
9793
- logger$7.warn('Unable to hold current session when making another call', e);
9808
+ logger$5.warn('Unable to hold current session when making another call', e);
9794
9809
  });
9795
9810
  }
9796
9811
 
@@ -9800,7 +9815,7 @@ class WebRTCPhone extends Emitter {
9800
9815
  this._bindEvents(sipSession);
9801
9816
  } catch (error) {
9802
9817
  console.warn(error);
9803
- logger$7.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
9818
+ logger$5.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
9804
9819
  return Promise.resolve(null);
9805
9820
  }
9806
9821
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
@@ -9828,7 +9843,7 @@ class WebRTCPhone extends Emitter {
9828
9843
  return;
9829
9844
  }
9830
9845
 
9831
- logger$7.info('WebRTC transfer', { sipId: sipSession.id, target });
9846
+ logger$5.info('WebRTC transfer', { sipId: sipSession.id, target });
9832
9847
 
9833
9848
  this.client.transfer(sipSession, target);
9834
9849
  }
@@ -9837,7 +9852,7 @@ class WebRTCPhone extends Emitter {
9837
9852
  const sipSession = this.client.getSipSession(source.sipCallId);
9838
9853
  const sipSessionTarget = this.client.getSipSession(destination.sipCallId);
9839
9854
 
9840
- logger$7.info('WebRTC indirect transfer', {
9855
+ logger$5.info('WebRTC indirect transfer', {
9841
9856
  sipId: sipSession ? sipSession.id : null,
9842
9857
  target: sipSessionTarget ? sipSessionTarget.id : null,
9843
9858
  });
@@ -9876,7 +9891,7 @@ class WebRTCPhone extends Emitter {
9876
9891
  return false;
9877
9892
  }
9878
9893
 
9879
- logger$7.info('WebRTC hangup', { sipId: sipSession.id });
9894
+ logger$5.info('WebRTC hangup', { sipId: sipSession.id });
9880
9895
 
9881
9896
  const sipSessionId = this.getSipSessionId(sipSession);
9882
9897
 
@@ -9922,7 +9937,7 @@ class WebRTCPhone extends Emitter {
9922
9937
  endCurrentCall(callSession ) {
9923
9938
  const isCurrent = this.isCurrentCallSipSession(callSession);
9924
9939
 
9925
- logger$7.info('Ending current call', {
9940
+ logger$5.info('Ending current call', {
9926
9941
  id: callSession ? callSession.getId() : null,
9927
9942
  isCurrent,
9928
9943
  });
@@ -9946,7 +9961,7 @@ class WebRTCPhone extends Emitter {
9946
9961
  }
9947
9962
 
9948
9963
  async close() {
9949
- logger$7.info('WebRTC close');
9964
+ logger$5.info('WebRTC close');
9950
9965
 
9951
9966
  try {
9952
9967
  await Promise.race([
@@ -9954,7 +9969,7 @@ class WebRTCPhone extends Emitter {
9954
9969
  new Promise((resolve, reject) => setTimeout(() => reject(new Error('Unregister, timed out')), 3000)),
9955
9970
  ]);
9956
9971
  } catch (e) {
9957
- logger$7.error('WebRTC close, unregister error', e);
9972
+ logger$5.error('WebRTC close, unregister error', e);
9958
9973
  }
9959
9974
 
9960
9975
  this.client.close();
@@ -9972,12 +9987,12 @@ class WebRTCPhone extends Emitter {
9972
9987
  }
9973
9988
 
9974
9989
  enableRinging() {
9975
- logger$7.info('WebRTC enable ringing');
9990
+ logger$5.info('WebRTC enable ringing');
9976
9991
  this.ringingEnabled = true;
9977
9992
  }
9978
9993
 
9979
9994
  disableRinging() {
9980
- logger$7.info('WebRTC disable ringing');
9995
+ logger$5.info('WebRTC disable ringing');
9981
9996
  this.ringingEnabled = false;
9982
9997
  }
9983
9998
 
@@ -10017,7 +10032,7 @@ class WebRTCPhone extends Emitter {
10017
10032
 
10018
10033
  // Deprecated
10019
10034
  getLocalMediaStream(callSession ) {
10020
- logger$7.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
10035
+ logger$5.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
10021
10036
  return this.getLocalStream(callSession);
10022
10037
  }
10023
10038
 
@@ -10059,7 +10074,7 @@ class WebRTCPhone extends Emitter {
10059
10074
  this.client.on(this.client.INVITE, (sipSession , wantsToDoVideo ) => {
10060
10075
  const autoAnswer = sipSession.request.getHeader('Answer-Mode') === 'Auto';
10061
10076
  const withVideo = this.allowVideo ? wantsToDoVideo : false;
10062
- logger$7.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
10077
+ logger$5.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
10063
10078
 
10064
10079
  const callSession = this._createIncomingCallSession(sipSession, withVideo, null, autoAnswer);
10065
10080
  this.incomingSessions.push(callSession.getId());
@@ -10082,7 +10097,7 @@ class WebRTCPhone extends Emitter {
10082
10097
  });
10083
10098
 
10084
10099
  this.client.on(this.client.ON_REINVITE, (...args) => {
10085
- logger$7.info('WebRTC on reinvite', {
10100
+ logger$5.info('WebRTC on reinvite', {
10086
10101
  sessionId: args[0].id,
10087
10102
  inviteId: args[1].id,
10088
10103
  updatedCalleeName: args[2],
@@ -10102,7 +10117,7 @@ class WebRTCPhone extends Emitter {
10102
10117
  });
10103
10118
 
10104
10119
  this.client.on(this.client.ACCEPTED, (sipSession ) => {
10105
- logger$7.info('WebRTC call accepted', { sipId: sipSession.id });
10120
+ logger$5.info('WebRTC call accepted', { sipId: sipSession.id });
10106
10121
 
10107
10122
  this._onCallAccepted(sipSession, this.client.hasVideo(this.getSipSessionId(sipSession)));
10108
10123
 
@@ -10113,22 +10128,22 @@ class WebRTCPhone extends Emitter {
10113
10128
  this.client.on('ended', () => {});
10114
10129
 
10115
10130
  this.client.on(this.client.ON_ERROR, e => {
10116
- logger$7.error('WebRTC error', e);
10131
+ logger$5.error('WebRTC error', e);
10117
10132
  this.eventEmitter.emit(ON_CALL_ERROR, e);
10118
10133
  });
10119
10134
 
10120
10135
  this.client.on(this.client.UNREGISTERED, () => {
10121
- logger$7.info('WebRTC unregistered');
10136
+ logger$5.info('WebRTC unregistered');
10122
10137
  this.eventEmitter.emit(ON_UNREGISTERED);
10123
10138
  });
10124
10139
 
10125
10140
  this.client.on(this.client.ON_DISCONNECTED, () => {
10126
- logger$7.info('WebRTC disconnected');
10127
- this.eventEmitter.emit(ON_DISCONNECTED);
10141
+ logger$5.info('WebRTC disconnected');
10142
+ this.eventEmitter.emit(ON_DISCONNECTED$1);
10128
10143
  });
10129
10144
 
10130
10145
  this.client.on(this.client.REGISTERED, () => {
10131
- logger$7.info('WebRTC registered', {
10146
+ logger$5.info('WebRTC registered', {
10132
10147
  shouldSendReinvite: this.shouldSendReinvite,
10133
10148
  state: this.currentSipSession ? this.currentSipSession.state : null,
10134
10149
  currentSipSession: !!this.currentSipSession,
@@ -10141,23 +10156,27 @@ class WebRTCPhone extends Emitter {
10141
10156
  if (this.shouldSendReinvite && this.currentSipSession
10142
10157
  && this.currentSipSession.state === SessionState.Established) {
10143
10158
  this.shouldSendReinvite = false;
10159
+ const pc = this.currentSipSession.sessionDescriptionHandler.peerConnection;
10160
+ const isConference = pc ? pc.sfu : false;
10161
+ const hasVideo = this.currentCallSession && this.currentCallSession.cameraEnabled;
10162
+
10144
10163
  try {
10145
10164
  // Send reinvite with iceRestart
10146
- this.sendReinvite(this.currentCallSession, null, false, false, true);
10165
+ this.sendReinvite(this.currentCallSession, null, isConference, !hasVideo, true);
10147
10166
  } catch (e) {
10148
- logger$7.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
10167
+ logger$5.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
10149
10168
  }
10150
10169
  }
10151
10170
  });
10152
10171
 
10153
10172
  this.client.on(this.client.CONNECTED, () => {
10154
- logger$7.info('WebRTC client connected');
10173
+ logger$5.info('WebRTC client connected');
10155
10174
 
10156
10175
  this.stopHeartbeat();
10157
10176
  });
10158
10177
 
10159
10178
  this.client.on(this.client.DISCONNECTED, () => {
10160
- logger$7.info('WebRTC client disconnected');
10179
+ logger$5.info('WebRTC client disconnected');
10161
10180
 
10162
10181
  this.eventEmitter.emit(ON_UNREGISTERED);
10163
10182
 
@@ -10171,7 +10190,7 @@ class WebRTCPhone extends Emitter {
10171
10190
  });
10172
10191
 
10173
10192
  this.client.on(this.client.ON_TRACK, (session, event) => {
10174
- this.eventEmitter.emit(ON_TRACK, session, event);
10193
+ this.eventEmitter.emit(ON_TRACK$1, session, event);
10175
10194
  });
10176
10195
 
10177
10196
  this.client.on('onVideoInputChange', stream => {
@@ -10186,7 +10205,7 @@ class WebRTCPhone extends Emitter {
10186
10205
  this.client.on(this.client.ON_NETWORK_STATS, (session, stats, previousStats) => {
10187
10206
  const callSession = this.getCallSession(this.getSipSessionId(session));
10188
10207
 
10189
- this.eventEmitter.emit(ON_NETWORK_STATS, callSession, stats, previousStats);
10208
+ this.eventEmitter.emit(ON_NETWORK_STATS$1, callSession, stats, previousStats);
10190
10209
  });
10191
10210
 
10192
10211
  // Used when upgrading directly in screenshare mode
@@ -10195,7 +10214,7 @@ class WebRTCPhone extends Emitter {
10195
10214
  const localStream = this.client.getLocalStream(sipSessionId);
10196
10215
  const callSession = this.callSessions[sipSessionId];
10197
10216
 
10198
- logger$7.info('Updrading directly in screensharing mode', {
10217
+ logger$5.info('Updrading directly in screensharing mode', {
10199
10218
  sipSessionId,
10200
10219
  tracks: localStream ? localStream.getTracks() : null,
10201
10220
  });
@@ -10227,6 +10246,15 @@ class WebRTCPhone extends Emitter {
10227
10246
  return this.client.getSipSessionId(sipSession);
10228
10247
  }
10229
10248
 
10249
+ _updateCallSession(callSession ) {
10250
+ const sipSession = this.findSipSession(callSession);
10251
+ const sipSessionId = sipSession ? this.getSipSessionId(sipSession) : null;
10252
+
10253
+ if (sipSessionId) {
10254
+ this.callSessions[sipSessionId] = callSession;
10255
+ }
10256
+ }
10257
+
10230
10258
  _onMessage(message ) {
10231
10259
  if (!message || message.method !== 'MESSAGE') {
10232
10260
  return;
@@ -10364,8 +10392,8 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
10364
10392
  ON_CALL_ENDED: ON_CALL_ENDED,
10365
10393
  ON_CALL_ENDING: ON_CALL_ENDING,
10366
10394
  ON_MESSAGE: ON_MESSAGE,
10367
- ON_REINVITE: ON_REINVITE,
10368
- ON_TRACK: ON_TRACK,
10395
+ ON_REINVITE: ON_REINVITE$1,
10396
+ ON_TRACK: ON_TRACK$1,
10369
10397
  ON_AUDIO_STREAM: ON_AUDIO_STREAM,
10370
10398
  ON_VIDEO_STREAM: ON_VIDEO_STREAM,
10371
10399
  ON_REMOVE_STREAM: ON_REMOVE_STREAM,
@@ -10380,13 +10408,13 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
10380
10408
  ON_VIDEO_INPUT_CHANGE: ON_VIDEO_INPUT_CHANGE,
10381
10409
  ON_CALL_ERROR: ON_CALL_ERROR,
10382
10410
  ON_MESSAGE_TRACK_UPDATED: ON_MESSAGE_TRACK_UPDATED,
10383
- ON_NETWORK_STATS: ON_NETWORK_STATS,
10411
+ ON_NETWORK_STATS: ON_NETWORK_STATS$1,
10384
10412
  ON_CHAT: ON_CHAT,
10385
10413
  ON_SIGNAL: ON_SIGNAL,
10386
- ON_DISCONNECTED: ON_DISCONNECTED,
10414
+ ON_DISCONNECTED: ON_DISCONNECTED$1,
10387
10415
  MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
10388
10416
  MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
10389
- events: events,
10417
+ events: events$1,
10390
10418
  'default': WebRTCPhone
10391
10419
  });
10392
10420
 
@@ -10780,7 +10808,7 @@ class Phone extends Emitter {
10780
10808
 
10781
10809
  _transferEvents() {
10782
10810
  this.unbind();
10783
- [...events$1, ...transportEvents].forEach(event => {
10811
+ [...events, ...transportEvents].forEach(event => {
10784
10812
  this.client.on(event, (...args) =>
10785
10813
  this.eventEmitter.emit.apply(this.eventEmitter.emit, [`client-${event}`, ...args]));
10786
10814
  });
@@ -10802,7 +10830,7 @@ var Phone$1 = global.wazoTelephonyInstance;
10802
10830
 
10803
10831
  //
10804
10832
 
10805
- const SOCKET_EVENTS$1 = {
10833
+ const SOCKET_EVENTS = {
10806
10834
  ON_OPEN: 'onopen',
10807
10835
  ON_MESSAGE: 'onmessage',
10808
10836
  ON_ERROR: 'onerror',
@@ -10898,7 +10926,7 @@ const BLACKLIST_EVENTS = [
10898
10926
  ];
10899
10927
 
10900
10928
  const HEARTBEAT_ENGINE_VERSION = '20.09';
10901
- const logger$5 = IssueReporter$1.loggerFor('wazo-ws');
10929
+ const logger$7 = IssueReporter$1.loggerFor('wazo-ws');
10902
10930
  const messageLogger = IssueReporter$1.loggerFor('wazo-ws-message');
10903
10931
 
10904
10932
  class WebSocketClient extends Emitter {
@@ -10947,24 +10975,24 @@ class WebSocketClient extends Emitter {
10947
10975
  }
10948
10976
 
10949
10977
  connect() {
10950
- logger$5.info('connect method started', { host: this.host, token: this.token });
10978
+ logger$7.info('connect method started', { host: this.host, token: this.token });
10951
10979
  this.socket = new ReconnectingWebSocket(this._getUrl.bind(this), [], this.options);
10952
10980
  if (this.options.binaryType) {
10953
10981
  this.socket.binaryType = this.options.binaryType;
10954
10982
  }
10955
10983
 
10956
10984
  this.socket.onopen = () => {
10957
- logger$5.info('on Wazo WS open', { method: 'connect', host: this.host });
10958
- this.eventEmitter.emit(SOCKET_EVENTS$1.ON_OPEN);
10985
+ logger$7.info('on Wazo WS open', { method: 'connect', host: this.host });
10986
+ this.eventEmitter.emit(SOCKET_EVENTS.ON_OPEN);
10959
10987
  };
10960
10988
 
10961
10989
  this.socket.onerror = event => {
10962
- logger$5.error('on Wazo WS error', event.target);
10963
- this.eventEmitter.emit(SOCKET_EVENTS$1.ON_ERROR, event);
10990
+ logger$7.error('on Wazo WS error', event.target);
10991
+ this.eventEmitter.emit(SOCKET_EVENTS.ON_ERROR, event);
10964
10992
  };
10965
10993
 
10966
10994
  this.socket.onmessage = (event ) => {
10967
- this.eventEmitter.emit(SOCKET_EVENTS$1.ON_MESSAGE, event.data);
10995
+ this.eventEmitter.emit(SOCKET_EVENTS.ON_MESSAGE, event.data);
10968
10996
 
10969
10997
  const message = JSON.parse(typeof event.data === 'string' ? event.data : '{}');
10970
10998
  let { name } = message;
@@ -10989,7 +11017,7 @@ class WebSocketClient extends Emitter {
10989
11017
 
10990
11018
  this.socket.onclose = event => {
10991
11019
  // Can't be converted to JSON (circular structure)
10992
- logger$5.info('on Wazo WS close', {
11020
+ logger$7.info('on Wazo WS close', {
10993
11021
  reason: event.reason,
10994
11022
  code: event.code,
10995
11023
  readyState: event.target.readyState,
@@ -10997,22 +11025,22 @@ class WebSocketClient extends Emitter {
10997
11025
  token: this.token,
10998
11026
  });
10999
11027
  this.initialized = false;
11000
- this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, event);
11028
+ this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, event);
11001
11029
 
11002
11030
  switch (event.code) {
11003
11031
  case 4002:
11004
- this.eventEmitter.emit(SOCKET_EVENTS$1.ON_AUTH_FAILED);
11032
+ this.eventEmitter.emit(SOCKET_EVENTS.ON_AUTH_FAILED);
11005
11033
  break;
11006
11034
  }
11007
11035
  };
11008
11036
 
11009
11037
  this.socket.onerror = event => {
11010
- logger$5.info('Wazo WS error', { message: event.message, code: event.code, readyState: event.target.readyState });
11038
+ logger$7.info('Wazo WS error', { message: event.message, code: event.code, readyState: event.target.readyState });
11011
11039
  };
11012
11040
  }
11013
11041
 
11014
11042
  close(force = false) {
11015
- logger$5.info('Wazo WS close', { socket: !!this.socket, host: this.host, token: this.token });
11043
+ logger$7.info('Wazo WS close', { socket: !!this.socket, host: this.host, token: this.token });
11016
11044
 
11017
11045
  if (!this.socket) {
11018
11046
  return;
@@ -11030,7 +11058,7 @@ class WebSocketClient extends Emitter {
11030
11058
 
11031
11059
  updateToken(token ) {
11032
11060
  this.token = token;
11033
- logger$5.info('Wazo WS updating token', { url: this._getUrl(), token, socket: !!this.socket });
11061
+ logger$7.info('Wazo WS updating token', { url: this._getUrl(), token, socket: !!this.socket });
11034
11062
 
11035
11063
  if (this.socket) {
11036
11064
  // If still connected, send the token to the WS
@@ -11048,7 +11076,7 @@ class WebSocketClient extends Emitter {
11048
11076
  }
11049
11077
 
11050
11078
  startHeartbeat() {
11051
- logger$5.info('Wazo WS start heartbeat', { host: this.host, token: this.token });
11079
+ logger$7.info('Wazo WS start heartbeat', { host: this.host, token: this.token });
11052
11080
 
11053
11081
  if (!this.socket) {
11054
11082
  this.heartbeat.stop();
@@ -11062,7 +11090,7 @@ class WebSocketClient extends Emitter {
11062
11090
  }
11063
11091
 
11064
11092
  stopHeartbeat() {
11065
- logger$5.info('Wazo WS stop heartbeat', { host: this.host, token: this.token });
11093
+ logger$7.info('Wazo WS stop heartbeat', { host: this.host, token: this.token });
11066
11094
 
11067
11095
  this.heartbeat.stop();
11068
11096
  }
@@ -11092,7 +11120,7 @@ class WebSocketClient extends Emitter {
11092
11120
  }
11093
11121
 
11094
11122
  reconnect(reason ) {
11095
- logger$5.info('Wazo WS reconnect', { reason, socket: !!this.socket, host: this.host, token: this.token });
11123
+ logger$7.info('Wazo WS reconnect', { reason, socket: !!this.socket, host: this.host, token: this.token });
11096
11124
  if (!this.socket) {
11097
11125
  return;
11098
11126
  }
@@ -11117,7 +11145,7 @@ class WebSocketClient extends Emitter {
11117
11145
  break;
11118
11146
  case 'start':
11119
11147
  this.initialized = true;
11120
- this.eventEmitter.emit(SOCKET_EVENTS$1.INITIALIZED);
11148
+ this.eventEmitter.emit(SOCKET_EVENTS.INITIALIZED);
11121
11149
  break;
11122
11150
  default:
11123
11151
  this.eventEmitter.emit('message', message);
@@ -11148,7 +11176,7 @@ class WebSocketClient extends Emitter {
11148
11176
  this.close();
11149
11177
  }
11150
11178
  const url = `wss://${this.host || ''}/api/websocketd/?token=${this.token || ''}&version=${this.version}`;
11151
- logger$5.log('Wazo WS url computed to reconnect', { url });
11179
+ logger$7.log('Wazo WS url computed to reconnect', { url });
11152
11180
 
11153
11181
  return url;
11154
11182
  }
@@ -11156,15 +11184,15 @@ class WebSocketClient extends Emitter {
11156
11184
  _onHeartbeat(message ) {
11157
11185
  if (message.payload === 'pong') {
11158
11186
  this.heartbeat.onHeartbeat();
11159
- logger$5.log('on heartbeat received from Wazo WS');
11187
+ logger$7.log('on heartbeat received from Wazo WS');
11160
11188
  }
11161
11189
  }
11162
11190
 
11163
11191
  async _onHeartbeatTimeout() {
11164
- logger$5.log('heartbeat timed out', { host: this.host, token: this.token });
11192
+ logger$7.log('heartbeat timed out', { host: this.host, token: this.token });
11165
11193
 
11166
11194
  this.close();
11167
- this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, new Error('Websocket ping failure.'));
11195
+ this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, new Error('Websocket ping failure.'));
11168
11196
 
11169
11197
  if (this.onHeartBeatTimeout) {
11170
11198
  this.onHeartBeatTimeout();
@@ -11244,7 +11272,7 @@ WebSocketClient.eventLists = [
11244
11272
 
11245
11273
  var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
11246
11274
  __proto__: null,
11247
- SOCKET_EVENTS: SOCKET_EVENTS$1,
11275
+ SOCKET_EVENTS: SOCKET_EVENTS,
11248
11276
  AUTH_SESSION_EXPIRE_SOON: AUTH_SESSION_EXPIRE_SOON,
11249
11277
  FAVORITE_ADDED: FAVORITE_ADDED,
11250
11278
  FAVORITE_DELETED: FAVORITE_DELETED,
@@ -11317,10 +11345,10 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
11317
11345
 
11318
11346
  //
11319
11347
 
11320
- const { SOCKET_EVENTS, ...OTHER_EVENTS } = WebSocketClient$1;
11321
- const ALL_EVENTS = [...Object.values(SOCKET_EVENTS), ...Object.values(OTHER_EVENTS)];
11348
+ const { SOCKET_EVENTS: SOCKET_EVENTS$1, ...OTHER_EVENTS } = WebSocketClient$1;
11349
+ const ALL_EVENTS = [...Object.values(SOCKET_EVENTS$1), ...Object.values(OTHER_EVENTS)];
11322
11350
 
11323
- const logger$4 = IssueReporter$1.loggerFor('simple-ws-client');
11351
+ const logger$8 = IssueReporter$1.loggerFor('simple-ws-client');
11324
11352
 
11325
11353
  class Websocket extends Emitter {
11326
11354
 
@@ -11334,9 +11362,9 @@ class Websocket extends Emitter {
11334
11362
  // $FlowFixMe
11335
11363
  this[key] = OTHER_EVENTS[key];
11336
11364
  });
11337
- Object.keys(SOCKET_EVENTS).forEach(key => {
11365
+ Object.keys(SOCKET_EVENTS$1).forEach(key => {
11338
11366
  // $FlowFixMe
11339
- this[key] = SOCKET_EVENTS[key];
11367
+ this[key] = SOCKET_EVENTS$1[key];
11340
11368
  });
11341
11369
  this.eventLists = WebSocketClient.eventLists;
11342
11370
 
@@ -11344,7 +11372,7 @@ class Websocket extends Emitter {
11344
11372
  }
11345
11373
 
11346
11374
  open(host , session ) {
11347
- logger$4.info('open simple WebSocket', { host, token: session.token });
11375
+ logger$8.info('open simple WebSocket', { host, token: session.token });
11348
11376
  this.ws = new WebSocketClient(
11349
11377
  {
11350
11378
  host,
@@ -11372,7 +11400,7 @@ class Websocket extends Emitter {
11372
11400
  }
11373
11401
 
11374
11402
  updateToken(token ) {
11375
- logger$4.info('update token via simple Websocket', { token, ws: !!this.ws });
11403
+ logger$8.info('update token via simple Websocket', { token, ws: !!this.ws });
11376
11404
 
11377
11405
  if (!this.ws) {
11378
11406
  return;
@@ -11400,7 +11428,7 @@ var Websocket$1 = global.wazoWebsocketInstance;
11400
11428
 
11401
11429
  //
11402
11430
 
11403
- const logger$3 = IssueReporter$1.loggerFor('room');
11431
+ const logger$9 = IssueReporter$1.loggerFor('room');
11404
11432
 
11405
11433
  class Participant extends Emitter {
11406
11434
 
@@ -11522,7 +11550,7 @@ class Participant extends Emitter {
11522
11550
  }
11523
11551
 
11524
11552
  onTalking(isTalking ) {
11525
- logger$3.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
11553
+ logger$9.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
11526
11554
  this.isTalking = isTalking;
11527
11555
  // you may notice we're not broadcasting: since all participants are getting this info
11528
11556
  // directly from asterisk, there's no need to do so
@@ -11625,7 +11653,7 @@ class Participant extends Emitter {
11625
11653
  }
11626
11654
 
11627
11655
  updateStatus(status , broadcast = true) {
11628
- logger$3.info('updating participant status', { name: this.name, status });
11656
+ logger$9.info('updating participant status', { name: this.name, status });
11629
11657
 
11630
11658
  if (typeof status.audioMuted !== 'undefined' && status.audioMuted !== this.audioMuted) {
11631
11659
  if (status.audioMuted) {
@@ -11673,7 +11701,7 @@ class Participant extends Emitter {
11673
11701
 
11674
11702
  broadcastStatus(inboundStatus = null) {
11675
11703
  const status = inboundStatus || this.getStatus();
11676
- logger$3.info('broadcasting participant status', { callId: this.callId, status });
11704
+ logger$9.info('broadcasting participant status', { callId: this.callId, status });
11677
11705
 
11678
11706
  this.room.sendSignal({
11679
11707
  type: SIGNAL_TYPE_PARTICIPANT_UPDATE,
@@ -11709,9 +11737,9 @@ class LocalParticipant extends Participant {
11709
11737
  const SIGNAL_TYPE_PARTICIPANT_UPDATE = 'signal/PARTICIPANT_UPDATE';
11710
11738
  const SIGNAL_TYPE_PARTICIPANT_REQUEST = 'signal/PARTICIPANT_REQUEST';
11711
11739
 
11712
- const logger$2 = IssueReporter$1.loggerFor('sdk-room');
11740
+ const logger$a = IssueReporter$1.loggerFor('sdk-room');
11713
11741
 
11714
- class Room$1 extends Emitter {
11742
+ class Room extends Emitter {
11715
11743
 
11716
11744
 
11717
11745
 
@@ -11769,7 +11797,7 @@ class Room$1 extends Emitter {
11769
11797
  extra = {},
11770
11798
  ) {
11771
11799
  super();
11772
- logger$2.info('room initialized', { callId, extension, sourceId, meetingUuid });
11800
+ logger$a.info('room initialized', { callId, extension, sourceId, meetingUuid });
11773
11801
 
11774
11802
  // Represents the room callSession
11775
11803
  this.callSession = callSession;
@@ -11835,7 +11863,7 @@ class Room$1 extends Emitter {
11835
11863
  * @returns {Promise<Room>}
11836
11864
  */
11837
11865
  static async connect({ extension, constraints, audioOnly = false, extra, room, meeting } ) {
11838
- logger$2.info('connecting to room', { extension, audioOnly, room: !!room });
11866
+ logger$a.info('connecting to room', { extension, audioOnly, room: !!room });
11839
11867
 
11840
11868
  if (!room) {
11841
11869
  await Wazo.Phone.connect();
@@ -11848,7 +11876,7 @@ class Room$1 extends Emitter {
11848
11876
 
11849
11877
  // Call_created is triggered before call_accepted, so we have to listen for it here.
11850
11878
  Wazo.Websocket.once(Wazo.Websocket.CALL_CREATED, ({ data }) => {
11851
- logger$2.info('room call received via WS', { callId: data.call_id });
11879
+ logger$a.info('room call received via WS', { callId: data.call_id });
11852
11880
  if (room) {
11853
11881
  room.setCallId(data.call_id);
11854
11882
  }
@@ -11856,7 +11884,7 @@ class Room$1 extends Emitter {
11856
11884
 
11857
11885
  const callSession = await Wazo.Phone.call(extension, withCamera, null, audioOnly, true);
11858
11886
  // eslint-disable-next-line no-param-reassign
11859
- room = new Room$1(callSession, extension, null, null, extra);
11887
+ room = new Room(callSession, extension, null, null, extra);
11860
11888
 
11861
11889
  // Wait for the call to be accepted
11862
11890
  await new Promise((resolve, reject) => {
@@ -11877,7 +11905,7 @@ class Room$1 extends Emitter {
11877
11905
  // Retrieve conference
11878
11906
  const conference = contacts.find(contact => contact.numbers.find(number => number.number === extension));
11879
11907
 
11880
- logger$2.info('connected to room', {
11908
+ logger$a.info('connected to room', {
11881
11909
  sourceId: conference ? conference.sourceId : null,
11882
11910
  name: conference ? conference.name : null,
11883
11911
  });
@@ -11887,7 +11915,7 @@ class Room$1 extends Emitter {
11887
11915
  room.setName(conference.name);
11888
11916
  }
11889
11917
  } else if (meeting) {
11890
- logger$2.info('Already connected to meeting', {
11918
+ logger$a.info('Already connected to meeting', {
11891
11919
  uuid: meeting.uuid,
11892
11920
  name: meeting.name,
11893
11921
  });
@@ -11900,13 +11928,13 @@ class Room$1 extends Emitter {
11900
11928
  }
11901
11929
 
11902
11930
  static disconnect() {
11903
- logger$2.info('static disconnection to room');
11931
+ logger$a.info('static disconnection to room');
11904
11932
 
11905
11933
  Wazo.Phone.disconnect();
11906
11934
  }
11907
11935
 
11908
11936
  async disconnect() {
11909
- logger$2.info('disconnection to room called');
11937
+ logger$a.info('disconnection to room called');
11910
11938
 
11911
11939
  await Wazo.Phone.hangup(this.callSession);
11912
11940
  this.callSession = null;
@@ -11926,19 +11954,19 @@ class Room$1 extends Emitter {
11926
11954
  }
11927
11955
 
11928
11956
  setSourceId(sourceId ) {
11929
- logger$2.info('set room source id', { sourceId });
11957
+ logger$a.info('set room source id', { sourceId });
11930
11958
 
11931
11959
  this.sourceId = sourceId;
11932
11960
  }
11933
11961
 
11934
11962
  setMeetingUuid(meetingUuid ) {
11935
- logger$2.info('set meeting uuid', { meetingUuid });
11963
+ logger$a.info('set meeting uuid', { meetingUuid });
11936
11964
 
11937
11965
  this.meetingUuid = meetingUuid;
11938
11966
  }
11939
11967
 
11940
11968
  setCallId(callId ) {
11941
- logger$2.info('set room call id', { callId });
11969
+ logger$a.info('set room call id', { callId });
11942
11970
 
11943
11971
  if (callId) {
11944
11972
  this.callId = callId;
@@ -11946,7 +11974,7 @@ class Room$1 extends Emitter {
11946
11974
  }
11947
11975
 
11948
11976
  setName(name ) {
11949
- logger$2.info('set room name', { name });
11977
+ logger$a.info('set room name', { name });
11950
11978
 
11951
11979
  this.name = name;
11952
11980
  }
@@ -11965,7 +11993,7 @@ class Room$1 extends Emitter {
11965
11993
  }
11966
11994
 
11967
11995
  async startScreenSharing(constraints ) {
11968
- logger$2.info('start room screen sharing', { constraints });
11996
+ logger$a.info('start room screen sharing', { constraints });
11969
11997
 
11970
11998
  const screensharingStream = await Wazo.Phone.startScreenSharing(constraints, this.callSession);
11971
11999
  if (!screensharingStream) {
@@ -11979,7 +12007,7 @@ class Room$1 extends Emitter {
11979
12007
  }
11980
12008
 
11981
12009
  async stopScreenSharing(restoreLocalStream = true) {
11982
- logger$2.info('stop room screen sharing');
12010
+ logger$a.info('stop room screen sharing');
11983
12011
 
11984
12012
  await Wazo.Phone.stopScreenSharing(this.callSession, restoreLocalStream);
11985
12013
 
@@ -11991,7 +12019,7 @@ class Room$1 extends Emitter {
11991
12019
  }
11992
12020
 
11993
12021
  turnCameraOff() {
11994
- logger$2.info('turn room camera off');
12022
+ logger$a.info('turn room camera off');
11995
12023
 
11996
12024
  Wazo.Phone.turnCameraOff(this.callSession);
11997
12025
 
@@ -12001,7 +12029,7 @@ class Room$1 extends Emitter {
12001
12029
  }
12002
12030
 
12003
12031
  turnCameraOn() {
12004
- logger$2.info('turn room camera on');
12032
+ logger$a.info('turn room camera on');
12005
12033
 
12006
12034
  Wazo.Phone.turnCameraOn(this.callSession);
12007
12035
 
@@ -12011,7 +12039,7 @@ class Room$1 extends Emitter {
12011
12039
  }
12012
12040
 
12013
12041
  mute() {
12014
- logger$2.info('mute room');
12042
+ logger$a.info('mute room');
12015
12043
 
12016
12044
  Wazo.Phone.mute(this.callSession);
12017
12045
 
@@ -12019,7 +12047,7 @@ class Room$1 extends Emitter {
12019
12047
  }
12020
12048
 
12021
12049
  unmute() {
12022
- logger$2.info('unmute room');
12050
+ logger$a.info('unmute room');
12023
12051
 
12024
12052
  Wazo.Phone.unmute(this.callSession);
12025
12053
 
@@ -12039,7 +12067,7 @@ class Room$1 extends Emitter {
12039
12067
  }
12040
12068
 
12041
12069
  hold() {
12042
- logger$2.info('hold room');
12070
+ logger$a.info('hold room');
12043
12071
 
12044
12072
  Wazo.Phone.hold(this.callSession, true);
12045
12073
 
@@ -12049,7 +12077,7 @@ class Room$1 extends Emitter {
12049
12077
  }
12050
12078
 
12051
12079
  async resume() {
12052
- logger$2.info('resume room');
12080
+ logger$a.info('resume room');
12053
12081
 
12054
12082
  const newStream = await Wazo.Phone.resume(this.callSession, true);
12055
12083
 
@@ -12077,13 +12105,13 @@ class Room$1 extends Emitter {
12077
12105
  }
12078
12106
 
12079
12107
  sendDTMF(tone ) {
12080
- logger$2.info('send room DTMF', { tone });
12108
+ logger$a.info('send room DTMF', { tone });
12081
12109
 
12082
12110
  Wazo.Phone.sendDTMF(tone, this.callSession);
12083
12111
  }
12084
12112
 
12085
12113
  async sendReinvite(newConstraints = null) {
12086
- logger$2.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
12114
+ logger$a.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
12087
12115
  const wasScreensharing = this.localParticipant && this.localParticipant.screensharing;
12088
12116
 
12089
12117
  Wazo.Phone.on(Wazo.Phone.ON_SHARE_SCREEN_STARTED, () => {
@@ -12142,7 +12170,7 @@ class Room$1 extends Emitter {
12142
12170
  Wazo.Phone.phone.on(Wazo.Phone.phone.client.ON_REINVITE, this._boundOnReinvite);
12143
12171
 
12144
12172
  this.on(this.ON_AUDIO_STREAM, stream => {
12145
- logger$2.info('on room audio stream');
12173
+ logger$a.info('on room audio stream');
12146
12174
 
12147
12175
  this.audioStream = stream;
12148
12176
  if (!this.roomAudioElement) {
@@ -12155,7 +12183,7 @@ class Room$1 extends Emitter {
12155
12183
  });
12156
12184
 
12157
12185
  this.on(this.ON_VIDEO_STREAM, (stream, streamId, event, sipSession) => {
12158
- logger$2.info('on room video stream', { streamId });
12186
+ logger$a.info('on room video stream', { streamId });
12159
12187
 
12160
12188
  this._mapMsid(sipSession.body.body);
12161
12189
 
@@ -12170,7 +12198,7 @@ class Room$1 extends Emitter {
12170
12198
  });
12171
12199
 
12172
12200
  this.on(this.ON_REMOVE_STREAM, stream => {
12173
- logger$2.info('on room remove stream');
12201
+ logger$a.info('on room remove stream');
12174
12202
 
12175
12203
  const participant = this.participants.find(someParticipant =>
12176
12204
  someParticipant.streams.find(someStream => someStream && someStream.id === stream.id));
@@ -12302,7 +12330,7 @@ class Room$1 extends Emitter {
12302
12330
  const requester = this._getParticipantFromCallId(origin.callId);
12303
12331
  if (requester) {
12304
12332
  // @FIXME?: when need to trigger an update on join-in; this is a bit of a hack
12305
- logger$2.info('trigger room requester status', { origin });
12333
+ logger$a.info('trigger room requester status', { origin });
12306
12334
  requester.triggerUpdate('REQUESTER_UPDATE');
12307
12335
  }
12308
12336
  break;
@@ -12333,24 +12361,24 @@ class Room$1 extends Emitter {
12333
12361
 
12334
12362
  // When we join the room, we can call `getConferenceParticipantsAsUser`, not before.
12335
12363
  if (participant.user_uuid === session.uuid) {
12336
- logger$2.info('room current user joined');
12364
+ logger$a.info('room current user joined');
12337
12365
 
12338
12366
  // Retrieve participants via an API calls
12339
12367
  const conferenceId = this.sourceId || payload.data.conference_id;
12340
12368
  let response;
12341
12369
  try {
12342
12370
  if (this.meetingUuid) {
12343
- logger$2.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
12371
+ logger$a.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
12344
12372
  response = await getApiClient().calld.getMeetingParticipantsAsUser(this.meetingUuid);
12345
12373
  } else {
12346
- logger$2.info('fetching conference participants', { conferenceId });
12374
+ logger$a.info('fetching conference participants', { conferenceId });
12347
12375
  response = await getApiClient().calld.getConferenceParticipantsAsUser(conferenceId);
12348
12376
  }
12349
12377
  } catch (e) {
12350
- logger$2.error('room participants fetching, error', e);
12378
+ logger$a.error('room participants fetching, error', e);
12351
12379
  }
12352
12380
  if (response) {
12353
- logger$2.info('conference participants fetched', { nb: response.items.length });
12381
+ logger$a.info('conference participants fetched', { nb: response.items.length });
12354
12382
  participants = response.items.map(item => {
12355
12383
  const isMe = item.call_id === this.callId;
12356
12384
 
@@ -12377,7 +12405,7 @@ class Room$1 extends Emitter {
12377
12405
  ? new Wazo.RemoteParticipant(this, participant)
12378
12406
  : null;
12379
12407
 
12380
- logger$2.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
12408
+ logger$a.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
12381
12409
 
12382
12410
  if (remoteParticipant) {
12383
12411
  this.participants.push(remoteParticipant);
@@ -12542,12 +12570,12 @@ class Room$1 extends Emitter {
12542
12570
 
12543
12571
  //
12544
12572
 
12545
- const logger$1 = IssueReporter$1.loggerFor('sdk-sip-room');
12573
+ const logger$b = IssueReporter$1.loggerFor('sdk-sip-room');
12546
12574
 
12547
- class SipRoom extends Room$1 {
12575
+ class SipRoom extends Room {
12548
12576
 
12549
12577
  static async connect({ extension, constraints, audioOnly = false, extra, room } ) {
12550
- logger$1.info('connecting to sip room', { extension, audioOnly, room: !!room });
12578
+ logger$b.info('connecting to sip room', { extension, audioOnly, room: !!room });
12551
12579
 
12552
12580
  if (!room) {
12553
12581
  await Wazo.Phone.connect();
@@ -12563,7 +12591,7 @@ class SipRoom extends Room$1 {
12563
12591
  room.setCallId(room.callSession.call.id);
12564
12592
  }
12565
12593
 
12566
- logger$1.info('connected to room', {
12594
+ logger$b.info('connected to room', {
12567
12595
  extension: room.extension,
12568
12596
  });
12569
12597
 
@@ -12571,7 +12599,7 @@ class SipRoom extends Room$1 {
12571
12599
  }
12572
12600
 
12573
12601
  mute() {
12574
- logger$1.info('mute sip room');
12602
+ logger$b.info('mute sip room');
12575
12603
 
12576
12604
  Wazo.Phone.mute(this.callSession, false);
12577
12605
 
@@ -12579,7 +12607,7 @@ class SipRoom extends Room$1 {
12579
12607
  }
12580
12608
 
12581
12609
  unmute() {
12582
- logger$1.info('unmute sip room');
12610
+ logger$b.info('unmute sip room');
12583
12611
 
12584
12612
  Wazo.Phone.unmute(this.callSession, false);
12585
12613
 
@@ -12863,7 +12891,7 @@ class NotificationOptions {
12863
12891
 
12864
12892
 
12865
12893
  // Represents a conference room, like `9000`.
12866
- class Room {
12894
+ class Room$1 {
12867
12895
 
12868
12896
 
12869
12897
 
@@ -12884,7 +12912,7 @@ class Room {
12884
12912
  }
12885
12913
 
12886
12914
  connect(callSession ) {
12887
- return new Room({ ...this, connectedCallSession: callSession });
12915
+ return new Room$1({ ...this, connectedCallSession: callSession });
12888
12916
  }
12889
12917
 
12890
12918
  has(callSession ) {
@@ -12893,7 +12921,7 @@ class Room {
12893
12921
 
12894
12922
  addParticipant(uuid , extension , talking = null) {
12895
12923
  if (!this.participants.some(participant => participant.uuid === uuid || participant.extension === extension)) {
12896
- return new Room({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
12924
+ return new Room$1({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
12897
12925
  }
12898
12926
 
12899
12927
  return this;
@@ -12912,7 +12940,7 @@ class Room {
12912
12940
  updatedParticipants.push(participant);
12913
12941
  }
12914
12942
 
12915
- return new Room({ ...this, participants: updatedParticipants });
12943
+ return new Room$1({ ...this, participants: updatedParticipants });
12916
12944
  }
12917
12945
 
12918
12946
  updateParticipantByExtension(extension , participant , shouldAdd = false) {
@@ -12928,7 +12956,7 @@ class Room {
12928
12956
  updatedParticipants.push(participant);
12929
12957
  }
12930
12958
 
12931
- return new Room({ ...this, participants: updatedParticipants });
12959
+ return new Room$1({ ...this, participants: updatedParticipants });
12932
12960
  }
12933
12961
 
12934
12962
  hasCallWithId(id ) {
@@ -12936,18 +12964,18 @@ class Room {
12936
12964
  }
12937
12965
 
12938
12966
  disconnect() {
12939
- return new Room({ ...this, connectedCallSession: null });
12967
+ return new Room$1({ ...this, connectedCallSession: null });
12940
12968
  }
12941
12969
 
12942
12970
  removeParticipantWithUUID(uuid ) {
12943
- return new Room({
12971
+ return new Room$1({
12944
12972
  ...this,
12945
12973
  participants: this.participants.filter(participant => participant.uuid !== uuid),
12946
12974
  });
12947
12975
  }
12948
12976
 
12949
12977
  removeParticipantWithExtension(extension ) {
12950
- return new Room({
12978
+ return new Room$1({
12951
12979
  ...this,
12952
12980
  participants: this.participants.filter(participant => participant.extension !== extension),
12953
12981
  });
@@ -12958,7 +12986,7 @@ class Room {
12958
12986
  }
12959
12987
 
12960
12988
  static newFrom(room ) {
12961
- return newFrom(room, Room);
12989
+ return newFrom(room, Room$1);
12962
12990
  }
12963
12991
  }
12964
12992
 
@@ -13265,11 +13293,11 @@ var wazoWebsocket = {
13265
13293
  resolve();
13266
13294
  };
13267
13295
 
13268
- client.on(SOCKET_EVENTS$1.ON_ERROR, error => {
13296
+ client.on(SOCKET_EVENTS.ON_ERROR, error => {
13269
13297
  handleError(`Connection error : ${error}`);
13270
13298
  });
13271
13299
 
13272
- client.on(SOCKET_EVENTS$1.ON_OPEN, () => {
13300
+ client.on(SOCKET_EVENTS.ON_OPEN, () => {
13273
13301
  if (session.hasEngineVersionGte(HEARTBEAT_ENGINE_VERSION)) {
13274
13302
  client.setOnHeartbeatTimeout(() => {
13275
13303
  handleError('No response to heartbeat');
@@ -13370,7 +13398,7 @@ var webrtc = {
13370
13398
  }),
13371
13399
  };
13372
13400
 
13373
- const parseCandidate = line => {
13401
+ const parseCandidate$1 = line => {
13374
13402
  let parts;
13375
13403
  // Parse both variants.
13376
13404
  if (line.indexOf('a=candidate:') === 0) {
@@ -13461,7 +13489,7 @@ var SymmetricNat = {
13461
13489
  }
13462
13490
 
13463
13491
  if (e.candidate && e.candidate.candidate.indexOf('srflx') !== -1) {
13464
- const cand = parseCandidate(e.candidate.candidate);
13492
+ const cand = parseCandidate$1(e.candidate.candidate);
13465
13493
  if (!candidates[cand.relatedPort]) candidates[cand.relatedPort] = [];
13466
13494
  candidates[cand.relatedPort].push(cand.port);
13467
13495
  } else if (!e.candidate) {
@@ -13529,7 +13557,7 @@ var iceIpv4 = {
13529
13557
  const rawCandidate = e.candidate.candidate;
13530
13558
  if (rawCandidate.indexOf('srflx') !== -1 || rawCandidate.indexOf('relay') !== -1) {
13531
13559
  hasSrflxOrRelay = true;
13532
- const candidate = parseCandidate(e.candidate.candidate);
13560
+ const candidate = parseCandidate$1(e.candidate.candidate);
13533
13561
  ips.push(candidate.ip);
13534
13562
  }
13535
13563
  } else if (!e.candidate) {
@@ -13566,7 +13594,7 @@ var checks = [
13566
13594
 
13567
13595
  //
13568
13596
 
13569
- const logger = IssueReporter$1.loggerFor('engine-check');
13597
+ const logger$c = IssueReporter$1.loggerFor('engine-check');
13570
13598
 
13571
13599
  class Checker {
13572
13600
 
@@ -13584,28 +13612,28 @@ class Checker {
13584
13612
  async check(onCheckBegin = () => {}, onCheckResult = () => {}) {
13585
13613
  await this._addEngineVersion();
13586
13614
 
13587
- logger.info('Engine check starting');
13615
+ logger$c.info('Engine check starting');
13588
13616
 
13589
13617
  for (let i = 0; i < this.checks.length; i++) {
13590
13618
  const { name, check } = this.checks[i];
13591
13619
 
13592
- logger.info(`Checking ${name} ...`);
13620
+ logger$c.info(`Checking ${name} ...`);
13593
13621
 
13594
13622
  onCheckBegin(name);
13595
13623
  try {
13596
13624
  // eslint-disable-next-line no-await-in-loop
13597
13625
  const result = await check(this.server, this.session, this.externalAppConfig);
13598
- logger.info(`Checking ${name} success.`, { result });
13626
+ logger$c.info(`Checking ${name} success.`, { result });
13599
13627
 
13600
13628
  onCheckResult(name, result);
13601
13629
  } catch (e) {
13602
- logger.info(`Checking ${name} failure`, { message: e.message });
13630
+ logger$c.info(`Checking ${name} failure`, { message: e.message });
13603
13631
 
13604
13632
  onCheckResult(name, e);
13605
13633
  }
13606
13634
  }
13607
13635
 
13608
- logger.info('Engine check done.');
13636
+ logger$c.info('Engine check done.');
13609
13637
  }
13610
13638
 
13611
13639
  addCheck(check ) {
@@ -13629,7 +13657,7 @@ const Wazo = {
13629
13657
  Auth: Auth$1,
13630
13658
  Phone: Phone$1,
13631
13659
  Websocket: Websocket$1,
13632
- Room: Room$1,
13660
+ Room,
13633
13661
  SipRoom,
13634
13662
  RemoteParticipant,
13635
13663
  LocalParticipant,
@@ -13662,7 +13690,7 @@ const Wazo = {
13662
13690
  Session,
13663
13691
  Voicemail,
13664
13692
  Relocation,
13665
- ConferenceRoom: Room,
13693
+ ConferenceRoom: Room$1,
13666
13694
  CallSession,
13667
13695
  IndirectTransfer,
13668
13696
  SwitchboardCall,