@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
@@ -1024,7 +1024,7 @@ var IssueReporter$1 = new IssueReporter();
1024
1024
 
1025
1025
  const methods = ['head', 'get', 'post', 'put', 'delete'];
1026
1026
 
1027
- const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
1027
+ const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
1028
1028
 
1029
1029
  // Use a function here to be able to mock it in tests
1030
1030
  const realFetch = () => {
@@ -1163,7 +1163,7 @@ class ApiRequester {
1163
1163
  };
1164
1164
 
1165
1165
  if (this.refreshTokenPromise) {
1166
- logger$c.info('A token is already refreshing, waiting ...', { url });
1166
+ logger.info('A token is already refreshing, waiting ...', { url });
1167
1167
  await this.refreshTokenPromise;
1168
1168
  }
1169
1169
 
@@ -1183,7 +1183,7 @@ class ApiRequester {
1183
1183
  return promise.then(async (err ) => {
1184
1184
  // Check if the token is still valid
1185
1185
  if (firstCall && this._checkTokenExpired(response, err)) {
1186
- logger$c.warn('token expired', { error: err.reason });
1186
+ logger.warn('token expired', { error: err.reason });
1187
1187
  // Replay the call after refreshing the token
1188
1188
  return this._replayWithNewToken(err, path, method, body, headers, parse);
1189
1189
  }
@@ -1193,7 +1193,7 @@ class ApiRequester {
1193
1193
  : exceptionClass.fromResponse(err, response.status);
1194
1194
 
1195
1195
  if (this.shouldLogErrors) {
1196
- logger$c.error('API error', error);
1196
+ logger.error('API error', error);
1197
1197
  }
1198
1198
 
1199
1199
  throw error;
@@ -1203,7 +1203,7 @@ class ApiRequester {
1203
1203
  return newParse(response, isJson);
1204
1204
  }).catch(error => {
1205
1205
  if (this.shouldLogErrors) {
1206
- logger$c.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
1206
+ logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
1207
1207
  }
1208
1208
 
1209
1209
  throw error;
@@ -1231,13 +1231,13 @@ class ApiRequester {
1231
1231
  ) {
1232
1232
  const isTokenNotFound = this._isTokenNotFound(err);
1233
1233
  let newPath = path;
1234
- logger$c.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
1234
+ logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
1235
1235
 
1236
1236
  this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
1237
1237
 
1238
1238
  return this.refreshTokenPromise.then(() => {
1239
1239
  this.refreshTokenPromise = null;
1240
- logger$c.info('token refreshed', { isTokenNotFound });
1240
+ logger.info('token refreshed', { isTokenNotFound });
1241
1241
  if (isTokenNotFound) {
1242
1242
  const pathParts = path.split('/');
1243
1243
  pathParts.pop();
@@ -3184,8 +3184,9 @@ class ExternalApp {
3184
3184
 
3185
3185
 
3186
3186
 
3187
-
3187
+
3188
3188
 
3189
+
3189
3190
 
3190
3191
 
3191
3192
  class Meeting {
@@ -3196,9 +3197,10 @@ class Meeting {
3196
3197
 
3197
3198
 
3198
3199
 
3199
-
3200
+
3200
3201
 
3201
3202
 
3203
+
3202
3204
 
3203
3205
  static parse(plain ) {
3204
3206
  return new Meeting({
@@ -3208,8 +3210,9 @@ class Meeting {
3208
3210
  ownerUuids: plain.owner_uuids,
3209
3211
  port: plain.port,
3210
3212
  uuid: plain.uuid,
3211
- number: plain.number,
3213
+ extension: plain.exten,
3212
3214
  persistent: plain.persistent,
3215
+ creationTime: moment(plain.creation_time).toDate(),
3213
3216
  });
3214
3217
  }
3215
3218
 
@@ -3231,8 +3234,9 @@ class Meeting {
3231
3234
  ownerUuids,
3232
3235
  port,
3233
3236
  uri,
3234
- number,
3237
+ extension,
3235
3238
  persistent,
3239
+ creationTime,
3236
3240
  } = {}) {
3237
3241
  this.guestSipAuthorization = guestSipAuthorization;
3238
3242
  this.uri = uri;
@@ -3240,8 +3244,9 @@ class Meeting {
3240
3244
  this.ownerUuids = ownerUuids;
3241
3245
  this.port = port;
3242
3246
  this.uuid = uuid;
3243
- this.number = number;
3247
+ this.extension = extension;
3244
3248
  this.persistent = persistent;
3249
+ this.creationTime = creationTime;
3245
3250
 
3246
3251
  // Useful to compare instead of instanceof with minified code
3247
3252
  this.type = 'Meeting';
@@ -4048,7 +4053,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
4048
4053
 
4049
4054
  // const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
4050
4055
 
4051
- const logger$b = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
4056
+ const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
4052
4057
 
4053
4058
  class CTIPhone extends Emitter {
4054
4059
 
@@ -4061,7 +4066,7 @@ class CTIPhone extends Emitter {
4061
4066
 
4062
4067
  constructor(session , isMobile = false, callbackAllLines = false) {
4063
4068
  super();
4064
- logger$b.info('CTI Phone created');
4069
+ logger$1.info('CTI Phone created');
4065
4070
  this.session = session;
4066
4071
  this.isMobile = isMobile;
4067
4072
  this.callbackAllLines = callbackAllLines;
@@ -4122,7 +4127,7 @@ class CTIPhone extends Emitter {
4122
4127
  }
4123
4128
 
4124
4129
  async makeCall(number , line ) {
4125
- logger$b.info('make CTI call', { number });
4130
+ logger$1.info('make CTI call', { number });
4126
4131
 
4127
4132
  if (!number) {
4128
4133
  return null;
@@ -4145,7 +4150,7 @@ class CTIPhone extends Emitter {
4145
4150
  if (!callSession) {
4146
4151
  return Promise.resolve(null);
4147
4152
  }
4148
- logger$b.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
4153
+ logger$1.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
4149
4154
 
4150
4155
  if (!this.currentCall) {
4151
4156
  this.currentCall = callSession.call;
@@ -4158,7 +4163,7 @@ class CTIPhone extends Emitter {
4158
4163
  if (!callSession) {
4159
4164
  return;
4160
4165
  }
4161
- logger$b.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
4166
+ logger$1.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
4162
4167
 
4163
4168
  this.currentCall = undefined;
4164
4169
  this.eventEmitter.emit('onCallEnded', callSession);
@@ -4168,7 +4173,7 @@ class CTIPhone extends Emitter {
4168
4173
  if (!callSession) {
4169
4174
  return Promise.resolve(false);
4170
4175
  }
4171
- logger$b.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
4176
+ logger$1.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
4172
4177
 
4173
4178
  try {
4174
4179
  await CallApi.cancelCall(callSession);
@@ -4179,7 +4184,7 @@ class CTIPhone extends Emitter {
4179
4184
  this.eventEmitter.emit('onCallEnded', callSession);
4180
4185
  return true;
4181
4186
  } catch (e) {
4182
- logger$b.error('hangup CTI call, error', e);
4187
+ logger$1.error('hangup CTI call, error', e);
4183
4188
 
4184
4189
  this.eventEmitter.emit('onCallFailed', callSession);
4185
4190
  return false;
@@ -4192,7 +4197,7 @@ class CTIPhone extends Emitter {
4192
4197
  if (!callSession) {
4193
4198
  return;
4194
4199
  }
4195
- logger$b.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
4200
+ logger$1.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
4196
4201
 
4197
4202
  await CallApi.cancelCall(callSession);
4198
4203
  this.eventEmitter.emit('onCallEnded', callSession);
@@ -4202,7 +4207,7 @@ class CTIPhone extends Emitter {
4202
4207
  if (!callSession) {
4203
4208
  return;
4204
4209
  }
4205
- logger$b.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
4210
+ logger$1.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
4206
4211
 
4207
4212
  await CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_BLIND);
4208
4213
  }
@@ -4215,19 +4220,19 @@ class CTIPhone extends Emitter {
4215
4220
  if (!callSession) {
4216
4221
  return;
4217
4222
  }
4218
- logger$b.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
4223
+ logger$1.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
4219
4224
 
4220
4225
  return CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_ATTENDED);
4221
4226
  }
4222
4227
 
4223
4228
  async cancelCTIIndirectTransfer(transferId ) {
4224
- logger$b.info('cancel CTI transfer', { transferId });
4229
+ logger$1.info('cancel CTI transfer', { transferId });
4225
4230
 
4226
4231
  return CallApi.cancelCallTransfer(transferId);
4227
4232
  }
4228
4233
 
4229
4234
  async confirmCTIIndirectTransfer(transferId ) {
4230
- logger$b.info('confirm CTI transfer', { transferId });
4235
+ logger$1.info('confirm CTI transfer', { transferId });
4231
4236
 
4232
4237
  return CallApi.confirmCallTransfer(transferId);
4233
4238
  }
@@ -4236,19 +4241,19 @@ class CTIPhone extends Emitter {
4236
4241
  if (!callSession) {
4237
4242
  return;
4238
4243
  }
4239
- logger$b.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
4244
+ logger$1.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
4240
4245
 
4241
4246
  return CallApi.sendDTMF(callSession.callId, digits);
4242
4247
  }
4243
4248
 
4244
4249
  onConnectionMade() {
4245
- logger$b.info('on CTI connection made');
4250
+ logger$1.info('on CTI connection made');
4246
4251
 
4247
4252
  this.eventEmitter.emit('onCallAccepted');
4248
4253
  }
4249
4254
 
4250
4255
  async close() {
4251
- logger$b.info('CTI close');
4256
+ logger$1.info('CTI close');
4252
4257
 
4253
4258
  return Promise.resolve();
4254
4259
  }
@@ -4257,7 +4262,7 @@ class CTIPhone extends Emitter {
4257
4262
  if (!callSession) {
4258
4263
  return;
4259
4264
  }
4260
- logger$b.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
4265
+ logger$1.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
4261
4266
 
4262
4267
  return CallApi.hold(callSession.callId);
4263
4268
  }
@@ -4266,7 +4271,7 @@ class CTIPhone extends Emitter {
4266
4271
  if (!callSession) {
4267
4272
  return;
4268
4273
  }
4269
- logger$b.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
4274
+ logger$1.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
4270
4275
 
4271
4276
  return CallApi.resume(callSession.callId);
4272
4277
  }
@@ -4275,7 +4280,7 @@ class CTIPhone extends Emitter {
4275
4280
  if (!callSession) {
4276
4281
  return;
4277
4282
  }
4278
- logger$b.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
4283
+ logger$1.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
4279
4284
 
4280
4285
  return CallApi.mute(callSession.callId);
4281
4286
  }
@@ -4284,7 +4289,7 @@ class CTIPhone extends Emitter {
4284
4289
  if (!callSession) {
4285
4290
  return;
4286
4291
  }
4287
- logger$b.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
4292
+ logger$1.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
4288
4293
 
4289
4294
  return CallApi.unmute(callSession.callId);
4290
4295
  }
@@ -5293,7 +5298,7 @@ const AGENTD_VERSION = '1.0';
5293
5298
  const WEBHOOKD_VERSION = '1.0';
5294
5299
  const AMID_VERSION = '1.0';
5295
5300
 
5296
- const logger$a = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
5301
+ const logger$2 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
5297
5302
 
5298
5303
  class ApiClient {
5299
5304
 
@@ -5345,12 +5350,12 @@ class ApiClient {
5345
5350
  }
5346
5351
 
5347
5352
  async forceRefreshToken() {
5348
- logger$a.info('forcing refresh token, calling callback');
5353
+ logger$2.info('forcing refresh token, calling callback');
5349
5354
  return this.refreshTokenCallback();
5350
5355
  }
5351
5356
 
5352
5357
  async refreshTokenCallback() {
5353
- logger$a.info('refresh token callback called', {
5358
+ logger$2.info('refresh token callback called', {
5354
5359
  refreshToken: this.refreshToken,
5355
5360
  refreshBackend: this.refreshBackend,
5356
5361
  refreshExpiration: this.refreshExpiration,
@@ -5368,7 +5373,7 @@ class ApiClient {
5368
5373
  this.isMobile,
5369
5374
  );
5370
5375
 
5371
- logger$a.info('token refreshed', { token: session.token });
5376
+ logger$2.info('token refreshed', { token: session.token });
5372
5377
 
5373
5378
  if (this.onRefreshToken) {
5374
5379
  this.onRefreshToken(session.token, session);
@@ -5681,7 +5686,7 @@ class AdHocAPIConference {
5681
5686
 
5682
5687
  /* */
5683
5688
 
5684
- const parseCandidate$1 = (candidate ) => {
5689
+ const parseCandidate = (candidate ) => {
5685
5690
  if (!candidate) {
5686
5691
  return null;
5687
5692
  }
@@ -5835,7 +5840,7 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
5835
5840
  this.peerConnectionDelegate.onicecandidate = event => {
5836
5841
  wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
5837
5842
  if (event.candidate) {
5838
- this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
5843
+ this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
5839
5844
  }
5840
5845
  };
5841
5846
 
@@ -6299,7 +6304,7 @@ const DEFAULT_ICE_TIMEOUT = 3000;
6299
6304
  const SEND_STATS_DELAY = 5000;
6300
6305
 
6301
6306
  const states = ['STATUS_NULL', 'STATUS_NEW', 'STATUS_CONNECTING', 'STATUS_CONNECTED', 'STATUS_COMPLETED'];
6302
- const logger$9 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
6307
+ const logger$3 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
6303
6308
  const statsLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-stats') : console;
6304
6309
 
6305
6310
  // events
@@ -6313,14 +6318,14 @@ const TRANSPORT_ERROR = 'transportError';
6313
6318
  const MESSAGE = 'message';
6314
6319
  const ACCEPTED = 'accepted';
6315
6320
  const REJECTED = 'rejected';
6316
- const ON_TRACK$1 = 'onTrack';
6317
- const ON_REINVITE$1 = 'reinvite';
6321
+ const ON_TRACK = 'onTrack';
6322
+ const ON_REINVITE = 'reinvite';
6318
6323
  const ON_ERROR = 'onError';
6319
6324
  const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
6320
- const ON_NETWORK_STATS$1 = 'onNetworkStats';
6321
- const ON_DISCONNECTED$1 = 'onDisconnected';
6325
+ const ON_NETWORK_STATS = 'onNetworkStats';
6326
+ const ON_DISCONNECTED = 'onDisconnected';
6322
6327
 
6323
- const events$1 = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
6328
+ const events = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
6324
6329
  const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
6325
6330
  class CanceledCallError extends Error {}
6326
6331
 
@@ -6456,12 +6461,12 @@ class WebRTCClient extends Emitter {
6456
6461
  this.MESSAGE = MESSAGE;
6457
6462
  this.ACCEPTED = ACCEPTED;
6458
6463
  this.REJECTED = REJECTED;
6459
- this.ON_TRACK = ON_TRACK$1;
6460
- this.ON_REINVITE = ON_REINVITE$1;
6464
+ this.ON_TRACK = ON_TRACK;
6465
+ this.ON_REINVITE = ON_REINVITE;
6461
6466
  this.ON_ERROR = ON_ERROR;
6462
6467
  this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
6463
- this.ON_NETWORK_STATS = ON_NETWORK_STATS$1;
6464
- this.ON_DISCONNECTED = ON_DISCONNECTED$1;
6468
+ this.ON_NETWORK_STATS = ON_NETWORK_STATS;
6469
+ this.ON_DISCONNECTED = ON_DISCONNECTED;
6465
6470
  }
6466
6471
 
6467
6472
  configureMedia(media ) {
@@ -6478,13 +6483,13 @@ class WebRTCClient extends Emitter {
6478
6483
 
6479
6484
  createUserAgent(configOverrides ) {
6480
6485
  const webRTCConfiguration = this._createWebRTCConfiguration(configOverrides);
6481
- logger$9.info('sdk webrtc, creating UA', { webRTCConfiguration });
6486
+ logger$3.info('sdk webrtc, creating UA', { webRTCConfiguration });
6482
6487
 
6483
6488
  webRTCConfiguration.delegate = {
6484
6489
  onConnect: this.onConnect.bind(this),
6485
6490
  onDisconnect: this.onDisconnect.bind(this),
6486
6491
  onInvite: (invitation ) => {
6487
- logger$9.info('sdk webrtc on invite', {
6492
+ logger$3.info('sdk webrtc on invite', {
6488
6493
  method: 'delegate.onInvite',
6489
6494
  id: invitation.id,
6490
6495
  remoteURI: invitation.remoteURI,
@@ -6527,7 +6532,7 @@ class WebRTCClient extends Emitter {
6527
6532
  }
6528
6533
 
6529
6534
  onConnect() {
6530
- logger$9.info('sdk webrtc connected', { method: 'delegate.onConnect' });
6535
+ logger$3.info('sdk webrtc connected', { method: 'delegate.onConnect' });
6531
6536
  this.eventEmitter.emit(CONNECTED);
6532
6537
  if (!this.isRegistered() && this.registerer && this.registerer.waiting) {
6533
6538
  this.registerer.waitingToggle(false);
@@ -6536,7 +6541,7 @@ class WebRTCClient extends Emitter {
6536
6541
  }
6537
6542
 
6538
6543
  async onDisconnect(error ) {
6539
- logger$9.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
6544
+ logger$3.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
6540
6545
  this.connectionPromise = null;
6541
6546
  // The UA will attempt to reconnect automatically when an error occurred
6542
6547
  this.eventEmitter.emit(DISCONNECTED, error);
@@ -6561,37 +6566,37 @@ class WebRTCClient extends Emitter {
6561
6566
  };
6562
6567
 
6563
6568
  if (this.skipRegister) {
6564
- logger$9.info('sdk webrtc skip register...', logInfo);
6569
+ logger$3.info('sdk webrtc skip register...', logInfo);
6565
6570
  return Promise.resolve();
6566
6571
  }
6567
6572
 
6568
- logger$9.info('sdk webrtc registering...', logInfo);
6573
+ logger$3.info('sdk webrtc registering...', logInfo);
6569
6574
 
6570
6575
  if (!this.userAgent) {
6571
- logger$9.info('sdk webrtc recreating User Agent');
6576
+ logger$3.info('sdk webrtc recreating User Agent');
6572
6577
  this.userAgent = this.createUserAgent(this.uaConfigOverrides);
6573
6578
  }
6574
6579
  if (!this.userAgent || this.isRegistered()) {
6575
- logger$9.info('sdk webrtc registering aborted, already registered or no UA can be created');
6580
+ logger$3.info('sdk webrtc registering aborted, already registered or no UA can be created');
6576
6581
  return Promise.resolve();
6577
6582
  }
6578
6583
 
6579
6584
  if (this.connectionPromise || (this.registerer && this.registerer.waiting)) {
6580
- logger$9.info('sdk webrtc registering aborted due to a registration in progress.');
6585
+ logger$3.info('sdk webrtc registering aborted due to a registration in progress.');
6581
6586
  return Promise.resolve();
6582
6587
  }
6583
6588
 
6584
6589
  const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
6585
6590
 
6586
6591
  const onRegisterFailed = () => {
6587
- logger$9.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
6592
+ logger$3.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
6588
6593
  this.connectionPromise = null;
6589
6594
  if (this.registerer && this.registerer.waiting) {
6590
6595
  this.registerer.waitingToggle(false);
6591
6596
  }
6592
6597
 
6593
6598
  if (tries <= MAX_REGISTER_TRIES) {
6594
- logger$9.info('sdk webrtc registering, retrying...', { tries });
6599
+ logger$3.info('sdk webrtc registering, retrying...', { tries });
6595
6600
  setTimeout(() => this.register(tries + 1), 300);
6596
6601
  }
6597
6602
  };
@@ -6600,18 +6605,18 @@ class WebRTCClient extends Emitter {
6600
6605
  // Avoid race condition with the close method called just before register and setting userAgent to null
6601
6606
  // during the resolution of the primise.
6602
6607
  if (!this.userAgent) {
6603
- logger$9.info('sdk webrtc recreating User Agent after connection');
6608
+ logger$3.info('sdk webrtc recreating User Agent after connection');
6604
6609
  this.userAgent = this.createUserAgent(this.uaConfigOverrides);
6605
6610
  }
6606
6611
 
6607
- logger$9.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
6612
+ logger$3.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
6608
6613
  this.registerer = new Registerer(this.userAgent, registerOptions);
6609
6614
  this.connectionPromise = null;
6610
6615
  this._monkeyPatchRegisterer(this.registerer);
6611
6616
 
6612
6617
  // Bind registerer events
6613
6618
  this.registerer.stateChange.addListener(newState => {
6614
- logger$9.info('sdk webrtc registering, state changed', { newState });
6619
+ logger$3.info('sdk webrtc registering, state changed', { newState });
6615
6620
 
6616
6621
  if (newState === RegistererState.Registered && this.registerer
6617
6622
  && this.registerer.state === RegistererState.Registered) {
@@ -6624,7 +6629,7 @@ class WebRTCClient extends Emitter {
6624
6629
  const options = {
6625
6630
  requestDelegate: {
6626
6631
  onReject: response => {
6627
- logger$9.error('sdk webrtc registering, rejected', { response });
6632
+ logger$3.error('sdk webrtc registering, rejected', { response });
6628
6633
 
6629
6634
  onRegisterFailed();
6630
6635
  },
@@ -6632,13 +6637,13 @@ class WebRTCClient extends Emitter {
6632
6637
  };
6633
6638
 
6634
6639
  return this.registerer.register(options).catch((e) => {
6635
- logger$9.error('sdk webrtc registering, error', e);
6640
+ logger$3.error('sdk webrtc registering, error', e);
6636
6641
 
6637
6642
  this.eventEmitter.emit(REGISTRATION_FAILED);
6638
6643
  return e;
6639
6644
  });
6640
6645
  }).catch(error => {
6641
- logger$9.error('sdk webrtc registering, transport error', error);
6646
+ logger$3.error('sdk webrtc registering, transport error', error);
6642
6647
  onRegisterFailed();
6643
6648
  });
6644
6649
  }
@@ -6667,21 +6672,21 @@ class WebRTCClient extends Emitter {
6667
6672
  }
6668
6673
 
6669
6674
  unregister() {
6670
- logger$9.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
6675
+ logger$3.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
6671
6676
  if (!this.registerer) {
6672
6677
  return Promise.resolve();
6673
6678
  }
6674
6679
 
6675
6680
  try {
6676
6681
  return this.registerer.unregister().then(() => {
6677
- logger$9.info('sdk webrtc unregistered');
6682
+ logger$3.info('sdk webrtc unregistered');
6678
6683
  this._cleanupRegister();
6679
6684
  }).catch(e => {
6680
- logger$9.error('sdk webrtc unregistering, promise error', e);
6685
+ logger$3.error('sdk webrtc unregistering, promise error', e);
6681
6686
  this._cleanupRegister();
6682
6687
  });
6683
6688
  } catch (e) {
6684
- logger$9.error('sdk webrtc unregistering, error', e);
6689
+ logger$3.error('sdk webrtc unregistering, error', e);
6685
6690
  // Avoid issue with `undefined is not an object (evaluating 'new.target.prototype')` when triggering a new
6686
6691
  // error when the registerer is in a bad state
6687
6692
  this._cleanupRegister();
@@ -6689,7 +6694,7 @@ class WebRTCClient extends Emitter {
6689
6694
  }
6690
6695
 
6691
6696
  stop() {
6692
- logger$9.info('sdk webrtc stop', { userAgent: !!this.userAgent });
6697
+ logger$3.info('sdk webrtc stop', { userAgent: !!this.userAgent });
6693
6698
  if (!this.userAgent) {
6694
6699
  return Promise.resolve();
6695
6700
  }
@@ -6697,12 +6702,12 @@ class WebRTCClient extends Emitter {
6697
6702
  return this.userAgent.stop().then(() => {
6698
6703
  return this._cleanupRegister();
6699
6704
  }).catch(e => {
6700
- logger$9.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
6705
+ logger$3.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
6701
6706
  });
6702
6707
  }
6703
6708
 
6704
6709
  call(number , enableVideo , audioOnly = false, conference = false) {
6705
- logger$9.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
6710
+ logger$3.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
6706
6711
  const inviterOptions = {
6707
6712
  sessionDescriptionHandlerOptionsReInvite: {
6708
6713
  conference,
@@ -6733,7 +6738,7 @@ class WebRTCClient extends Emitter {
6733
6738
  this._onAccepted(session, response.session, true);
6734
6739
  },
6735
6740
  onReject: (response ) => {
6736
- logger$9.info('on call rejected', { id: session.id, fromTag: session.fromTag });
6741
+ logger$3.info('on call rejected', { id: session.id, fromTag: session.fromTag });
6737
6742
  this._stopSendingStats(session);
6738
6743
  this.stopNetworkMonitoring(session);
6739
6744
 
@@ -6756,11 +6761,11 @@ class WebRTCClient extends Emitter {
6756
6761
  }
6757
6762
 
6758
6763
  answer(session , enableVideo ) {
6759
- logger$9.info('sdk webrtc answer call', { id: session.id, enableVideo });
6764
+ logger$3.info('sdk webrtc answer call', { id: session.id, enableVideo });
6760
6765
 
6761
6766
  if (!session || !session.accept) {
6762
6767
  const error = 'No session to answer, or not an invitation';
6763
- logger$9.warn(error);
6768
+ logger$3.warn(error);
6764
6769
  return Promise.reject(new Error(error));
6765
6770
  }
6766
6771
  const options = {
@@ -6770,15 +6775,15 @@ class WebRTCClient extends Emitter {
6770
6775
  return session.accept(options).then(() => {
6771
6776
  if (session.isCanceled) {
6772
6777
  const message = 'accepted a canceled session (or was canceled during the accept phase).';
6773
- logger$9.error(message, { id: session.id });
6778
+ logger$3.error(message, { id: session.id });
6774
6779
  this.onCallEnded(session);
6775
6780
 
6776
6781
  throw new CanceledCallError(message);
6777
6782
  }
6778
- logger$9.info('sdk webrtc answer, accepted.');
6783
+ logger$3.info('sdk webrtc answer, accepted.');
6779
6784
  this._onAccepted(session);
6780
6785
  }).catch(e => {
6781
- logger$9.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
6786
+ logger$3.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
6782
6787
 
6783
6788
  throw e;
6784
6789
  });
@@ -6786,7 +6791,7 @@ class WebRTCClient extends Emitter {
6786
6791
 
6787
6792
  hangup(session ) {
6788
6793
  const { state, id } = session;
6789
- logger$9.info('sdk webrtc hangup call', { id, state });
6794
+ logger$3.info('sdk webrtc hangup call', { id, state });
6790
6795
 
6791
6796
  try {
6792
6797
  this._stopSendingStats(session);
@@ -6815,7 +6820,7 @@ class WebRTCClient extends Emitter {
6815
6820
 
6816
6821
  return bye();
6817
6822
  } catch (error) {
6818
- logger$9.warn('sdk webrtc hangup, error', error);
6823
+ logger$3.warn('sdk webrtc hangup, error', error);
6819
6824
  }
6820
6825
 
6821
6826
  return null;
@@ -6833,7 +6838,7 @@ class WebRTCClient extends Emitter {
6833
6838
  // Fetch and emit an event at `interval` with session network stats
6834
6839
  startNetworkMonitoring(session , interval = 1000) {
6835
6840
  const sessionId = this.getSipSessionId(session);
6836
- logger$9.info('starting network inspection', { id: sessionId });
6841
+ logger$3.info('starting network inspection', { id: sessionId });
6837
6842
 
6838
6843
  this.sessionNetworkStats[sessionId] = [];
6839
6844
 
@@ -6843,7 +6848,7 @@ class WebRTCClient extends Emitter {
6843
6848
  stopNetworkMonitoring(session ) {
6844
6849
  const sessionId = this.getSipSessionId(session);
6845
6850
  const exists = sessionId in this.networkMonitoringInterval;
6846
- logger$9.info('stopping network inspection', { id: sessionId, exists });
6851
+ logger$3.info('stopping network inspection', { id: sessionId, exists });
6847
6852
 
6848
6853
  if (exists) {
6849
6854
  clearInterval(this.networkMonitoringInterval[sessionId]);
@@ -6853,17 +6858,17 @@ class WebRTCClient extends Emitter {
6853
6858
  }
6854
6859
 
6855
6860
  reject(session ) {
6856
- logger$9.info('sdk webrtc reject call', { id: session.id });
6861
+ logger$3.info('sdk webrtc reject call', { id: session.id });
6857
6862
 
6858
6863
  try {
6859
6864
  return session.reject ? session.reject() : session.cancel();
6860
6865
  } catch (e) {
6861
- logger$9.warn('Error when rejecting call', e.message, e.stack);
6866
+ logger$3.warn('Error when rejecting call', e.message, e.stack);
6862
6867
  }
6863
6868
  }
6864
6869
 
6865
6870
  async close() {
6866
- logger$9.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
6871
+ logger$3.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
6867
6872
  this._cleanupMedia();
6868
6873
  this.connectionPromise = null;
6869
6874
 
@@ -6894,7 +6899,7 @@ class WebRTCClient extends Emitter {
6894
6899
  // eg: "INVITE not rejectable in state Completed"
6895
6900
  }
6896
6901
  this.userAgent = null;
6897
- logger$9.info('sdk webrtc client closed');
6902
+ logger$3.info('sdk webrtc client closed');
6898
6903
  }
6899
6904
 
6900
6905
  getNumber(session ) {
@@ -6907,13 +6912,13 @@ class WebRTCClient extends Emitter {
6907
6912
  }
6908
6913
 
6909
6914
  mute(session ) {
6910
- logger$9.info('sdk webrtc mute', { id: session.id });
6915
+ logger$3.info('sdk webrtc mute', { id: session.id });
6911
6916
 
6912
6917
  this._toggleAudio(session, true);
6913
6918
  }
6914
6919
 
6915
6920
  unmute(session ) {
6916
- logger$9.info('sdk webrtc unmute', { id: session.id });
6921
+ logger$3.info('sdk webrtc unmute', { id: session.id });
6917
6922
 
6918
6923
  this._toggleAudio(session, false);
6919
6924
  }
@@ -6953,13 +6958,13 @@ class WebRTCClient extends Emitter {
6953
6958
  }
6954
6959
 
6955
6960
  toggleCameraOn(session ) {
6956
- logger$9.info('sdk webrtc toggle camera on', { id: session.id });
6961
+ logger$3.info('sdk webrtc toggle camera on', { id: session.id });
6957
6962
 
6958
6963
  this._toggleVideo(session, false);
6959
6964
  }
6960
6965
 
6961
6966
  toggleCameraOff(session ) {
6962
- logger$9.info('sdk webrtc toggle camera off', { id: session.id });
6967
+ logger$3.info('sdk webrtc toggle camera off', { id: session.id });
6963
6968
 
6964
6969
  this._toggleVideo(session, true);
6965
6970
  }
@@ -6968,7 +6973,7 @@ class WebRTCClient extends Emitter {
6968
6973
  const sessionId = this.getSipSessionId(session);
6969
6974
  const hasVideo = hadVideo || this.hasLocalVideo(sessionId);
6970
6975
 
6971
- logger$9.info('sdk webrtc hold', {
6976
+ logger$3.info('sdk webrtc hold', {
6972
6977
  sessionId,
6973
6978
  keys: Object.keys(this.heldSessions),
6974
6979
  pendingReinvite: !!session.pendingReinvite,
@@ -7017,7 +7022,7 @@ class WebRTCClient extends Emitter {
7017
7022
  const sessionId = this.getSipSessionId(session);
7018
7023
  const hasVideo = sessionId in this.heldSessions && this.heldSessions[sessionId].hasVideo;
7019
7024
 
7020
- logger$9.info('sdk webrtc unhold', {
7025
+ logger$3.info('sdk webrtc unhold', {
7021
7026
  sessionId,
7022
7027
  keys: Object.keys(this.heldSessions),
7023
7028
  pendingReinvite: !!session.pendingReinvite,
@@ -7165,7 +7170,7 @@ class WebRTCClient extends Emitter {
7165
7170
  if (!session.sessionDescriptionHandler) {
7166
7171
  return;
7167
7172
  }
7168
- logger$9.info('Sending DTMF', {
7173
+ logger$3.info('Sending DTMF', {
7169
7174
  id: this.getSipSessionId(session),
7170
7175
  tone,
7171
7176
  });
@@ -7181,7 +7186,7 @@ class WebRTCClient extends Emitter {
7181
7186
  transfer(session , target ) {
7182
7187
  this.hold(session);
7183
7188
 
7184
- logger$9.info('Transfering a session', {
7189
+ logger$3.info('Transfering a session', {
7185
7190
  id: this.getSipSessionId(session),
7186
7191
  target,
7187
7192
  });
@@ -7203,17 +7208,17 @@ class WebRTCClient extends Emitter {
7203
7208
  atxfer(session ) {
7204
7209
  this.hold(session);
7205
7210
 
7206
- logger$9.info('webrtc transfer started', { id: this.getSipSessionId(session) });
7211
+ logger$3.info('webrtc transfer started', { id: this.getSipSessionId(session) });
7207
7212
 
7208
7213
  const result = {
7209
7214
  newSession: null,
7210
7215
  init: async (target ) => {
7211
- logger$9.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
7216
+ logger$3.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
7212
7217
 
7213
7218
  result.newSession = await this.call(target);
7214
7219
  },
7215
7220
  complete: () => {
7216
- logger$9.info('webrtc transfer completed', {
7221
+ logger$3.info('webrtc transfer completed', {
7217
7222
  id: this.getSipSessionId(session),
7218
7223
  referId: this.getSipSessionId(result.newSession),
7219
7224
  });
@@ -7234,7 +7239,7 @@ class WebRTCClient extends Emitter {
7234
7239
  return;
7235
7240
  }
7236
7241
 
7237
- logger$9.info('send WebRTC message', { sipId: sipSession.id, contentType });
7242
+ logger$3.info('send WebRTC message', { sipId: sipSession.id, contentType });
7238
7243
 
7239
7244
  try {
7240
7245
  sipSession.message({
@@ -7276,7 +7281,7 @@ class WebRTCClient extends Emitter {
7276
7281
  }
7277
7282
 
7278
7283
  changeAudioOutputVolume(volume ) {
7279
- logger$9.info('Changing audio output volume', { volume });
7284
+ logger$3.info('Changing audio output volume', { volume });
7280
7285
 
7281
7286
  Object.values(this.audioElements).forEach(audioElement => {
7282
7287
  if (audioElement instanceof HTMLAudioElement) {
@@ -7288,7 +7293,7 @@ class WebRTCClient extends Emitter {
7288
7293
  }
7289
7294
 
7290
7295
  changeAudioOutputDevice(id ) {
7291
- logger$9.info('Changing audio output device', { id });
7296
+ logger$3.info('Changing audio output device', { id });
7292
7297
 
7293
7298
  Object.values(this.audioElements).forEach(audioElement => {
7294
7299
  // `setSinkId` method is not included in any flow type definitions for HTMLAudioElements but is a valid method
@@ -7305,7 +7310,7 @@ class WebRTCClient extends Emitter {
7305
7310
 
7306
7311
  changeAudioInputDevice(id , session ) {
7307
7312
  const currentId = this.getAudioDeviceId();
7308
- logger$9.info('setting audio input device', { id, currentId, session: !!session });
7313
+ logger$3.info('setting audio input device', { id, currentId, session: !!session });
7309
7314
 
7310
7315
  if (id === currentId) {
7311
7316
  return null;
@@ -7351,7 +7356,7 @@ class WebRTCClient extends Emitter {
7351
7356
 
7352
7357
  setVideoInputDevice(id ) {
7353
7358
  const currentId = this.getVideoDeviceId();
7354
- logger$9.info('setting video input device', { id, currentId });
7359
+ logger$3.info('setting video input device', { id, currentId });
7355
7360
 
7356
7361
  if (id === currentId) {
7357
7362
  return null;
@@ -7376,7 +7381,7 @@ class WebRTCClient extends Emitter {
7376
7381
  const sessionId = this.getSipSessionId(session);
7377
7382
  const localStream = this.getLocalStream(sessionId);
7378
7383
 
7379
- logger$9.info('changing video input device', { id, sessionId });
7384
+ logger$3.info('changing video input device', { id, sessionId });
7380
7385
 
7381
7386
  // Release old video stream
7382
7387
  if (localStream) {
@@ -7444,7 +7449,7 @@ class WebRTCClient extends Emitter {
7444
7449
  const shouldDoScreenSharing = newConstraints && newConstraints.screen;
7445
7450
  const desktop = newConstraints && newConstraints.desktop;
7446
7451
 
7447
- logger$9.info('Sending reinvite', {
7452
+ logger$3.info('Sending reinvite', {
7448
7453
  id: this.getSipSessionId(sipSession),
7449
7454
  newConstraints,
7450
7455
  conference,
@@ -7482,7 +7487,7 @@ class WebRTCClient extends Emitter {
7482
7487
  sipSession.incomingInviteRequest.message.body = response.message.body;
7483
7488
  }
7484
7489
 
7485
- logger$9.info('on re-INVITE accepted', {
7490
+ logger$3.info('on re-INVITE accepted', {
7486
7491
  id: this.getSipSessionId(sipSession),
7487
7492
  wasMuted,
7488
7493
  shouldDoScreenSharing,
@@ -7500,7 +7505,7 @@ class WebRTCClient extends Emitter {
7500
7505
  this.eventEmitter.emit(ON_SCREEN_SHARING_REINVITE, sipSession, response, desktop);
7501
7506
  }
7502
7507
 
7503
- return this.eventEmitter.emit(ON_REINVITE$1, sipSession, response);
7508
+ return this.eventEmitter.emit(ON_REINVITE, sipSession, response);
7504
7509
  },
7505
7510
  },
7506
7511
  sessionDescriptionHandlerModifiers: [replaceLocalIpModifier],
@@ -7657,7 +7662,7 @@ class WebRTCClient extends Emitter {
7657
7662
  }
7658
7663
 
7659
7664
  startHeartbeat() {
7660
- logger$9.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
7665
+ logger$3.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
7661
7666
  if (!this.userAgent) {
7662
7667
  this.heartbeat.stop();
7663
7668
  return;
@@ -7670,7 +7675,7 @@ class WebRTCClient extends Emitter {
7670
7675
  }
7671
7676
 
7672
7677
  stopHeartbeat() {
7673
- logger$9.info('sdk webrtc stop heartbeat');
7678
+ logger$3.info('sdk webrtc stop heartbeat');
7674
7679
  this.heartbeat.stop();
7675
7680
  }
7676
7681
 
@@ -7691,7 +7696,7 @@ class WebRTCClient extends Emitter {
7691
7696
  }
7692
7697
 
7693
7698
  attemptReconnection() {
7694
- logger$9.info('attempt reconnection', { userAgent: !!this.userAgent });
7699
+ logger$3.info('attempt reconnection', { userAgent: !!this.userAgent });
7695
7700
  if (!this.userAgent) {
7696
7701
  return;
7697
7702
  }
@@ -7716,7 +7721,7 @@ class WebRTCClient extends Emitter {
7716
7721
  return;
7717
7722
  }
7718
7723
 
7719
- logger$9.info('setting local media stream', {
7724
+ logger$3.info('setting local media stream', {
7720
7725
  sipSessionId,
7721
7726
  tracks: newStream ? newStream.getTracks() : null,
7722
7727
  });
@@ -7733,7 +7738,7 @@ class WebRTCClient extends Emitter {
7733
7738
 
7734
7739
  const oldStream = this.getLocalStream(sipSessionId);
7735
7740
 
7736
- logger$9.info('updating local stream', {
7741
+ logger$3.info('updating local stream', {
7737
7742
  sipSessionId,
7738
7743
  oldStream: !!oldStream,
7739
7744
  tracks: newStream.getTracks(),
@@ -7753,7 +7758,7 @@ class WebRTCClient extends Emitter {
7753
7758
  const remoteStream = this.getRemoteStream(sessionId);
7754
7759
  const pc = this.getPeerConnection(sessionId);
7755
7760
 
7756
- logger$9.info('Updating remote stream', {
7761
+ logger$3.info('Updating remote stream', {
7757
7762
  sessionId,
7758
7763
  tracks: remoteStream ? remoteStream.getTracks() : null,
7759
7764
  receiverTracks: pc && pc.getReceivers ? pc.getReceivers().map(receiver => receiver.track) : null,
@@ -7779,7 +7784,7 @@ class WebRTCClient extends Emitter {
7779
7784
  const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
7780
7785
  const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
7781
7786
 
7782
- logger$9.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
7787
+ logger$3.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
7783
7788
 
7784
7789
  return {
7785
7790
  constraints: {
@@ -7828,7 +7833,7 @@ class WebRTCClient extends Emitter {
7828
7833
  }
7829
7834
 
7830
7835
  _onTransportError() {
7831
- logger$9.error('on transport error');
7836
+ logger$3.error('on transport error');
7832
7837
  this.eventEmitter.emit(TRANSPORT_ERROR);
7833
7838
  this.attemptReconnection();
7834
7839
  }
@@ -7837,7 +7842,7 @@ class WebRTCClient extends Emitter {
7837
7842
  const body = message && typeof message === 'object' ? message.data : message;
7838
7843
  if (body && body.indexOf('200 OK') !== -1) {
7839
7844
  if (this.hasHeartbeat()) {
7840
- logger$9.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
7845
+ logger$3.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
7841
7846
 
7842
7847
  this.heartbeat.onHeartbeat();
7843
7848
  if (this.heartbeatCb) {
@@ -7848,7 +7853,7 @@ class WebRTCClient extends Emitter {
7848
7853
  }
7849
7854
 
7850
7855
  async _onHeartbeatTimeout() {
7851
- logger$9.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
7856
+ logger$3.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
7852
7857
 
7853
7858
  if (this.heartbeatTimeoutCb) {
7854
7859
  this.heartbeatTimeoutCb();
@@ -7860,7 +7865,7 @@ class WebRTCClient extends Emitter {
7860
7865
  try {
7861
7866
  await this.userAgent.transport.disconnect();
7862
7867
  } catch (e) {
7863
- logger$9.error('Transport disconnection after heartbeat timeout, error', e);
7868
+ logger$3.error('Transport disconnection after heartbeat timeout, error', e);
7864
7869
  }
7865
7870
  }
7866
7871
 
@@ -7893,31 +7898,31 @@ class WebRTCClient extends Emitter {
7893
7898
  }
7894
7899
 
7895
7900
  _connectIfNeeded() {
7896
- logger$9.info('connect if needed, checking', { connected: this.isConnected() });
7901
+ logger$3.info('connect if needed, checking', { connected: this.isConnected() });
7897
7902
  if (!this.userAgent) {
7898
- logger$9.info('need to recreate User Agent');
7903
+ logger$3.info('need to recreate User Agent');
7899
7904
  this.userAgent = this.createUserAgent(this.uaConfigOverrides);
7900
7905
  }
7901
7906
 
7902
7907
  if (this.isConnected()) {
7903
- logger$9.info('webrtc sdk, already connected');
7908
+ logger$3.info('webrtc sdk, already connected');
7904
7909
  return Promise.resolve();
7905
7910
  }
7906
7911
 
7907
7912
  if (this.isConnecting()) {
7908
- logger$9.info('webrtc sdk, already connecting...');
7913
+ logger$3.info('webrtc sdk, already connecting...');
7909
7914
 
7910
7915
  this.connectionPromise = this.userAgent.transport.connectPromise;
7911
7916
  return this.connectionPromise;
7912
7917
  }
7913
7918
 
7914
7919
  if (this.connectionPromise) {
7915
- logger$9.info('webrtc sdk, connection promise connecting...');
7920
+ logger$3.info('webrtc sdk, connection promise connecting...');
7916
7921
  // $FlowFixMe
7917
7922
  return this.connectionPromise;
7918
7923
  }
7919
7924
 
7920
- logger$9.info('WebRTC UA needs to connect');
7925
+ logger$3.info('WebRTC UA needs to connect');
7921
7926
 
7922
7927
  // Force UA to reconnect
7923
7928
  if (this.userAgent && this.userAgent.state !== UserAgentState.Stopped) {
@@ -8042,7 +8047,7 @@ class WebRTCClient extends Emitter {
8042
8047
 
8043
8048
  sdh.peerConnectionDelegate = {
8044
8049
  onicecandidateerror: (error ) => {
8045
- logger$9.error('on icecandidate error', {
8050
+ logger$3.error('on icecandidate error', {
8046
8051
  address: error.address,
8047
8052
  port: error.port,
8048
8053
  errorCode: error.errorCode,
@@ -8071,7 +8076,7 @@ class WebRTCClient extends Emitter {
8071
8076
  updatedNumber = session.assertedIdentity.uri.normal.user;
8072
8077
  updatedCalleeName = session.assertedIdentity.displayName || updatedNumber;
8073
8078
  }
8074
- logger$9.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
8079
+ logger$3.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
8075
8080
 
8076
8081
  // Useful to know if it's a video upgrade or an unhold from a remote peer with a video stream
8077
8082
 
@@ -8087,12 +8092,12 @@ class WebRTCClient extends Emitter {
8087
8092
 
8088
8093
  this._setupMedias(session);
8089
8094
 
8090
- return this.eventEmitter.emit(ON_REINVITE$1, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
8095
+ return this.eventEmitter.emit(ON_REINVITE, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
8091
8096
  };
8092
8097
  }
8093
8098
 
8094
8099
  _onAccepted(session , sessionDialog , withEvent = true) {
8095
- logger$9.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
8100
+ logger$3.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
8096
8101
 
8097
8102
  this.storeSipSession(session);
8098
8103
 
@@ -8104,14 +8109,14 @@ class WebRTCClient extends Emitter {
8104
8109
  const onTrack = (event ) => {
8105
8110
  const isAudioOnly = this._isAudioOnly(session);
8106
8111
  const { kind, label, readyState, id, muted } = event.track;
8107
- logger$9.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
8112
+ logger$3.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
8108
8113
 
8109
8114
  // Stop video track in audio only mode
8110
8115
  if (isAudioOnly && kind === 'video') {
8111
8116
  event.track.stop();
8112
8117
  }
8113
8118
 
8114
- this.eventEmitter.emit(ON_TRACK$1, session, event);
8119
+ this.eventEmitter.emit(ON_TRACK, session, event);
8115
8120
  };
8116
8121
 
8117
8122
  if (session.sessionDescriptionHandler.peerConnection) {
@@ -8121,9 +8126,9 @@ class WebRTCClient extends Emitter {
8121
8126
  session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
8122
8127
 
8123
8128
  pc.oniceconnectionstatechange = () => {
8124
- logger$9.info('on ice connection state changed', { state: pc.iceConnectionState });
8129
+ logger$3.info('on ice connection state changed', { state: pc.iceConnectionState });
8125
8130
  if (pc.iceConnectionState === 'disconnected') {
8126
- this.eventEmitter.emit(ON_DISCONNECTED$1);
8131
+ this.eventEmitter.emit(ON_DISCONNECTED);
8127
8132
  }
8128
8133
  };
8129
8134
 
@@ -8294,10 +8299,10 @@ class WebRTCClient extends Emitter {
8294
8299
 
8295
8300
  _stopSendingStats(session ) {
8296
8301
  const sessionId = this.getSipSessionId(session);
8297
- logger$9.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
8302
+ logger$3.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
8298
8303
 
8299
8304
  if (sessionId in this.statsIntervals) {
8300
- logger$9.trace('Stop sending stats for call', { sessionId });
8305
+ logger$3.trace('Stop sending stats for call', { sessionId });
8301
8306
  this.statsIntervals[sessionId]();
8302
8307
  delete this.statsIntervals[sessionId];
8303
8308
  }
@@ -8313,7 +8318,7 @@ class WebRTCClient extends Emitter {
8313
8318
  try {
8314
8319
  await this.userAgent.transport.disconnect();
8315
8320
  } catch (e) {
8316
- logger$9.error('WebRTC transport disconnect, error', e);
8321
+ logger$3.error('WebRTC transport disconnect, error', e);
8317
8322
  }
8318
8323
  }
8319
8324
  }
@@ -8407,7 +8412,7 @@ class WebRTCClient extends Emitter {
8407
8412
  + networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
8408
8413
  + networkStats.transportSent;
8409
8414
 
8410
- this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
8415
+ this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
8411
8416
  this.sessionNetworkStats[sessionId].push(networkStats);
8412
8417
  }
8413
8418
 
@@ -8435,8 +8440,8 @@ const ON_CALL_FAILED = 'onCallFailed';
8435
8440
  const ON_CALL_ENDED = 'onCallEnded';
8436
8441
  const ON_CALL_ENDING = 'onCallEnding';
8437
8442
  const ON_MESSAGE = 'onMessage';
8438
- const ON_REINVITE = 'reinvite';
8439
- const ON_TRACK = 'onTrack';
8443
+ const ON_REINVITE$1 = 'reinvite';
8444
+ const ON_TRACK$1 = 'onTrack';
8440
8445
  const ON_AUDIO_STREAM = 'onAudioStream';
8441
8446
  const ON_VIDEO_STREAM = 'onVideoStream';
8442
8447
  const ON_REMOVE_STREAM = 'onRemoveStream';
@@ -8451,15 +8456,15 @@ const ON_PLAY_PROGRESS_SOUND = 'playProgressSound';
8451
8456
  const ON_VIDEO_INPUT_CHANGE = 'videoInputChange';
8452
8457
  const ON_CALL_ERROR = 'onCallError';
8453
8458
  const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
8454
- const ON_NETWORK_STATS = 'onNetworkStats';
8459
+ const ON_NETWORK_STATS$1 = 'onNetworkStats';
8455
8460
  const ON_CHAT = 'phone/ON_CHAT';
8456
8461
  const ON_SIGNAL = 'phone/ON_SIGNAL';
8457
- const ON_DISCONNECTED = 'onDisconnected';
8462
+ const ON_DISCONNECTED$1 = 'onDisconnected';
8458
8463
 
8459
8464
  const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
8460
8465
  const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
8461
8466
 
8462
- const events = [
8467
+ const events$1 = [
8463
8468
  ON_USER_AGENT,
8464
8469
  ON_REGISTERED,
8465
8470
  ON_UNREGISTERED,
@@ -8477,8 +8482,8 @@ const events = [
8477
8482
  ON_CALL_FAILED,
8478
8483
  ON_CALL_ENDED,
8479
8484
  ON_MESSAGE,
8480
- ON_REINVITE,
8481
- ON_TRACK,
8485
+ ON_REINVITE$1,
8486
+ ON_TRACK$1,
8482
8487
  ON_AUDIO_STREAM,
8483
8488
  ON_VIDEO_STREAM,
8484
8489
  ON_REMOVE_STREAM,
@@ -8493,11 +8498,11 @@ const events = [
8493
8498
  ON_CALL_ERROR,
8494
8499
  ON_CHAT,
8495
8500
  ON_SIGNAL,
8496
- ON_NETWORK_STATS,
8497
- ON_DISCONNECTED,
8501
+ ON_NETWORK_STATS$1,
8502
+ ON_DISCONNECTED$1,
8498
8503
  ];
8499
8504
 
8500
- const logger$8 = IssueReporter$1.loggerFor('webrtc-phone');
8505
+ const logger$4 = IssueReporter$1.loggerFor('webrtc-phone');
8501
8506
 
8502
8507
  class WebRTCPhone extends Emitter {
8503
8508
 
@@ -8570,7 +8575,7 @@ class WebRTCPhone extends Emitter {
8570
8575
  }).catch(error => {
8571
8576
  // Avoid exception on `t.server.scheme` in sip transport when losing the webrtc socket connection
8572
8577
  console.error('register error', error, error.message, error.stack);
8573
- logger$8.error('WebRTC register error', { message: error.message, stack: error.stack });
8578
+ logger$4.error('WebRTC register error', { message: error.message, stack: error.stack });
8574
8579
  });
8575
8580
  }
8576
8581
 
@@ -8585,7 +8590,7 @@ class WebRTCPhone extends Emitter {
8585
8590
  if (!this.client) {
8586
8591
  return;
8587
8592
  }
8588
- logger$8.info('WebRTC phone stop');
8593
+ logger$4.info('WebRTC phone stop');
8589
8594
  this.client.stop();
8590
8595
  }
8591
8596
 
@@ -8600,7 +8605,7 @@ class WebRTCPhone extends Emitter {
8600
8605
  async sendReinvite(callSession , constraints = null, conference = false,
8601
8606
  audioOnly = false, iceRestart = false) {
8602
8607
  const sipSession = this.findSipSession(callSession);
8603
- logger$8.info('WebRTC phone - send reinvite', {
8608
+ logger$4.info('WebRTC phone - send reinvite', {
8604
8609
  sessionId: sipSession ? sipSession.id : null,
8605
8610
  constraints,
8606
8611
  audioOnly,
@@ -8637,7 +8642,7 @@ class WebRTCPhone extends Emitter {
8637
8642
  }
8638
8643
 
8639
8644
  startHeartbeat() {
8640
- logger$8.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
8645
+ logger$4.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
8641
8646
  if (!this.client || this.client.hasHeartbeat()) {
8642
8647
  return;
8643
8648
  }
@@ -8646,7 +8651,7 @@ class WebRTCPhone extends Emitter {
8646
8651
  }
8647
8652
 
8648
8653
  stopHeartbeat() {
8649
- logger$8.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
8654
+ logger$4.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
8650
8655
  if (!this.client) {
8651
8656
  return;
8652
8657
  }
@@ -8663,7 +8668,7 @@ class WebRTCPhone extends Emitter {
8663
8668
  }
8664
8669
 
8665
8670
  reconnect() {
8666
- logger$8.info('WebRTC phone - reconnect', { client: !!this.client });
8671
+ logger$4.info('WebRTC phone - reconnect', { client: !!this.client });
8667
8672
  if (!this.client) {
8668
8673
  return;
8669
8674
  }
@@ -8704,10 +8709,15 @@ class WebRTCPhone extends Emitter {
8704
8709
  return false;
8705
8710
  }
8706
8711
 
8707
- logger$8.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
8712
+ logger$4.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
8708
8713
 
8709
8714
  this.client.downgradeToAudio(sipSession);
8710
8715
 
8716
+ if (callSession) {
8717
+ callSession.cameraEnabled = false;
8718
+ this._updateCallSession(callSession);
8719
+ }
8720
+
8711
8721
  if (withMessage) {
8712
8722
  this._sendReinviteMessage(callSession, false);
8713
8723
  }
@@ -8722,7 +8732,7 @@ class WebRTCPhone extends Emitter {
8722
8732
  return Promise.resolve(false);
8723
8733
  }
8724
8734
 
8725
- logger$8.info('Upgrade to video', {
8735
+ logger$4.info('Upgrade to video', {
8726
8736
  id: callSession ? callSession.getId() : null,
8727
8737
  constraints,
8728
8738
  isConference,
@@ -8735,6 +8745,11 @@ class WebRTCPhone extends Emitter {
8735
8745
 
8736
8746
  const newStream = await this.client.upgradeToVideo(sipSession, constraints, isConference);
8737
8747
 
8748
+ if (callSession) {
8749
+ callSession.cameraEnabled = true;
8750
+ this._updateCallSession(callSession);
8751
+ }
8752
+
8738
8753
  // If no stream is returned, it means we have to reinvite
8739
8754
  if (!newStream) {
8740
8755
  return true;
@@ -8757,7 +8772,7 @@ class WebRTCPhone extends Emitter {
8757
8772
 
8758
8773
  _sendReinviteMessage(callSession , isUpgrade ) {
8759
8774
  const sipSession = this.findSipSession(callSession);
8760
- logger$8.info('Sending reinvite message', {
8775
+ logger$4.info('Sending reinvite message', {
8761
8776
  id: callSession ? callSession.getId() : null,
8762
8777
  isUpgrade,
8763
8778
  });
@@ -8783,7 +8798,7 @@ class WebRTCPhone extends Emitter {
8783
8798
  // Monkey patch to know when canceled with the CANCEL message
8784
8799
  const onCancel = sipSession._onCancel.bind(sipSession);
8785
8800
  sipSession._onCancel = (message ) => {
8786
- logger$8.trace('on sip session canceled', { callId: message.callId });
8801
+ logger$4.trace('on sip session canceled', { callId: message.callId });
8787
8802
 
8788
8803
  onCancel(message);
8789
8804
  const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
@@ -8811,13 +8826,13 @@ class WebRTCPhone extends Emitter {
8811
8826
  this.audioOutputVolume,
8812
8827
  );
8813
8828
  case SessionState.Terminating:
8814
- logger$8.info('WebRTC phone - call terminating', { sipId: sipSession.id });
8829
+ logger$4.info('WebRTC phone - call terminating', { sipId: sipSession.id });
8815
8830
 
8816
8831
  this.eventEmitter.emit(ON_CALL_ENDING, this._createCallSession(sipSession));
8817
8832
 
8818
8833
  break;
8819
8834
  case SessionState.Terminated: {
8820
- logger$8.info('WebRTC phone - call terminated', { sipId: sipSession.id });
8835
+ logger$4.info('WebRTC phone - call terminated', { sipId: sipSession.id });
8821
8836
 
8822
8837
  // Should be called before `_onCallTerminated` or the callCount will not decrement...
8823
8838
  const callSession = this._createCallSession(sipSession);
@@ -8839,7 +8854,7 @@ class WebRTCPhone extends Emitter {
8839
8854
  const [stream] = event.streams;
8840
8855
  const kind = event && event.track && event.track.kind;
8841
8856
 
8842
- logger$8.info('on track stream called on the peer connection', {
8857
+ logger$4.info('on track stream called on the peer connection', {
8843
8858
  callId: this.getSipSessionId(sipSession),
8844
8859
  streamId: stream ? stream.id : null,
8845
8860
  tracks: stream ? stream.getTracks() : null,
@@ -8859,7 +8874,7 @@ class WebRTCPhone extends Emitter {
8859
8874
  };
8860
8875
 
8861
8876
  peerConnection.onremovestream = event => {
8862
- logger$8.info('on remove stream called on the peer connection', {
8877
+ logger$4.info('on remove stream called on the peer connection', {
8863
8878
  id: event.stream.id,
8864
8879
  tracks: event.stream.getTracks(),
8865
8880
  });
@@ -8869,7 +8884,7 @@ class WebRTCPhone extends Emitter {
8869
8884
  }
8870
8885
 
8871
8886
  async startScreenSharing(constraints , callSession ) {
8872
- logger$8.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
8887
+ logger$4.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
8873
8888
 
8874
8889
  const screenShareStream = await this.client.getStreamFromConstraints(constraints);
8875
8890
  if (!screenShareStream) {
@@ -8909,7 +8924,7 @@ class WebRTCPhone extends Emitter {
8909
8924
  return;
8910
8925
  }
8911
8926
 
8912
- logger$8.info('WebRTC phone - stop screen sharing', {
8927
+ logger$4.info('WebRTC phone - stop screen sharing', {
8913
8928
  restoreLocalStream,
8914
8929
  });
8915
8930
 
@@ -8965,7 +8980,7 @@ class WebRTCPhone extends Emitter {
8965
8980
  const pc = this.client.getPeerConnection(sipSessionId);
8966
8981
  const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
8967
8982
 
8968
- logger$8.info('WebRTC phone - on screensharing', {
8983
+ logger$4.info('WebRTC phone - on screensharing', {
8969
8984
  hadVideo,
8970
8985
  id: this.getSipSessionId(sipSession),
8971
8986
  screenTrack,
@@ -8973,7 +8988,7 @@ class WebRTCPhone extends Emitter {
8973
8988
 
8974
8989
  if (screenTrack) {
8975
8990
  screenTrack.onended = () => {
8976
- logger$8.info('WebRTC phone - on screenshare ended', {
8991
+ logger$4.info('WebRTC phone - on screenshare ended', {
8977
8992
  hadVideo,
8978
8993
  id: this.getSipSessionId(sipSession),
8979
8994
  screenTrack,
@@ -9004,7 +9019,7 @@ class WebRTCPhone extends Emitter {
9004
9019
  }
9005
9020
 
9006
9021
  _onCallAccepted(sipSession , cameraEnabled ) {
9007
- logger$8.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
9022
+ logger$4.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
9008
9023
 
9009
9024
  const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
9010
9025
  this.currentSipSession = sipSession;
@@ -9022,7 +9037,7 @@ class WebRTCPhone extends Emitter {
9022
9037
  }
9023
9038
 
9024
9039
  changeAudioDevice(id ) {
9025
- logger$8.info('WebRTC phone - change audio device', { deviceId: id });
9040
+ logger$4.info('WebRTC phone - change audio device', { deviceId: id });
9026
9041
  this.audioOutputDeviceId = id;
9027
9042
  this.client.changeAudioOutputDevice(id);
9028
9043
  }
@@ -9032,14 +9047,14 @@ class WebRTCPhone extends Emitter {
9032
9047
  }
9033
9048
 
9034
9049
  changeRingDevice(id ) {
9035
- logger$8.info('WebRTC phone - changing ring device', { id });
9050
+ logger$4.info('WebRTC phone - changing ring device', { id });
9036
9051
 
9037
9052
  this.audioRingDeviceId = id;
9038
9053
  }
9039
9054
 
9040
9055
  // volume is a value between 0 and 1
9041
9056
  changeAudioVolume(volume ) {
9042
- logger$8.info('WebRTC phone - changing audio volume', { volume });
9057
+ logger$4.info('WebRTC phone - changing audio volume', { volume });
9043
9058
 
9044
9059
  this.audioOutputVolume = volume;
9045
9060
  this.client.changeAudioOutputVolume(volume);
@@ -9047,31 +9062,31 @@ class WebRTCPhone extends Emitter {
9047
9062
 
9048
9063
  // volume is a value between 0 and 1
9049
9064
  changeRingVolume(volume ) {
9050
- logger$8.info('WebRTC phone - changing ring volume', { volume });
9065
+ logger$4.info('WebRTC phone - changing ring volume', { volume });
9051
9066
 
9052
9067
  this.audioRingVolume = volume;
9053
9068
  }
9054
9069
 
9055
9070
  changeAudioInputDevice(id ) {
9056
- logger$8.info('WebRTC phone - changeAudio input device', { deviceId: id });
9071
+ logger$4.info('WebRTC phone - changeAudio input device', { deviceId: id });
9057
9072
 
9058
9073
  return this.client.changeAudioInputDevice(id, this.currentSipSession);
9059
9074
  }
9060
9075
 
9061
9076
  changeVideoInputDevice(id ) {
9062
- logger$8.info('WebRTC phone - change video input device', { deviceId: id });
9077
+ logger$4.info('WebRTC phone - change video input device', { deviceId: id });
9063
9078
 
9064
9079
  return this.client.changeVideoInputDevice(id, this.currentSipSession);
9065
9080
  }
9066
9081
 
9067
9082
  changeSessionVideoInputDevice(id ) {
9068
- logger$8.info('WebRTC phone - change session video input device', { deviceId: id });
9083
+ logger$4.info('WebRTC phone - change session video input device', { deviceId: id });
9069
9084
 
9070
9085
  return this.client.changeSessionVideoInputDevice(id, this.currentSipSession);
9071
9086
  }
9072
9087
 
9073
9088
  _onCallTerminated(sipSession ) {
9074
- logger$8.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9089
+ logger$4.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9075
9090
 
9076
9091
  const callSession = this._createCallSession(sipSession);
9077
9092
  const isCurrentSession = this.isCurrentCallSipSession(callSession);
@@ -9105,7 +9120,7 @@ class WebRTCPhone extends Emitter {
9105
9120
  const hasIncomingCallSession = this.hasIncomingCallSession();
9106
9121
 
9107
9122
  // Re-trigger incoming call event for remaining incoming calls
9108
- logger$8.info('WebRTC phone - check to re-trigger incoming call', {
9123
+ logger$4.info('WebRTC phone - check to re-trigger incoming call', {
9109
9124
  sipId: sipSession.id,
9110
9125
  shouldRetrigger,
9111
9126
  hasIncomingCallSession,
@@ -9196,37 +9211,37 @@ class WebRTCPhone extends Emitter {
9196
9211
 
9197
9212
  // Deprecated
9198
9213
  getLocalStreamForCall(callSession ) {
9199
- logger$8.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
9214
+ logger$4.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
9200
9215
 
9201
9216
  return this.getLocalStream(callSession);
9202
9217
  }
9203
9218
 
9204
9219
  // Deprecated
9205
9220
  getRemoteStreamForCall(callSession ) {
9206
- logger$8.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
9221
+ logger$4.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
9207
9222
 
9208
9223
  return this.getRemoteVideoStream(callSession);
9209
9224
  }
9210
9225
 
9211
9226
  getRemoteStreamsForCall(callSession ) {
9212
- logger$8.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
9227
+ logger$4.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
9213
9228
 
9214
9229
  return this.getRemoteStream(callSession);
9215
9230
  }
9216
9231
 
9217
9232
  accept(callSession , cameraEnabled ) {
9218
- logger$8.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
9233
+ logger$4.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
9219
9234
  if (this.currentSipSession) {
9220
9235
  this.holdSipSession(this.currentSipSession, this.currentCallSession, true);
9221
9236
  }
9222
9237
 
9223
9238
  if (!callSession) {
9224
- logger$8.warn('no CallSession to accept.');
9239
+ logger$4.warn('no CallSession to accept.');
9225
9240
  return Promise.resolve(null);
9226
9241
  }
9227
9242
 
9228
9243
  if (callSession.getId() in this.acceptedSessions) {
9229
- logger$8.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
9244
+ logger$4.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
9230
9245
  return Promise.resolve(callSession.sipCallId);
9231
9246
  }
9232
9247
 
@@ -9238,24 +9253,24 @@ class WebRTCPhone extends Emitter {
9238
9253
  const sipSession = this.client.getSipSession(callSession.getId());
9239
9254
  if (sipSession) {
9240
9255
  if (sipSession.state === SessionState.Terminated || sipSession.state === SessionState.Terminating) {
9241
- logger$8.warn('Trying to answer a terminated sipSession.');
9256
+ logger$4.warn('Trying to answer a terminated sipSession.');
9242
9257
 
9243
9258
  return Promise.resolve(null);
9244
9259
  }
9245
9260
 
9246
- logger$8.info('accept call, session found', { sipId: sipSession.id });
9261
+ logger$4.info('accept call, session found', { sipId: sipSession.id });
9247
9262
 
9248
9263
  // $FlowFixMe
9249
9264
  return this.client.answer(sipSession, this.allowVideo ? cameraEnabled : false).then(() => {
9250
9265
  return callSession.sipCallId;
9251
9266
  }).catch(e => {
9252
- logger$8.error(e);
9267
+ logger$4.error(e);
9253
9268
  this.endCurrentCall(callSession);
9254
9269
  throw e;
9255
9270
  });
9256
9271
  }
9257
9272
 
9258
- logger$8.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
9273
+ logger$4.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
9259
9274
 
9260
9275
  return Promise.resolve(null);
9261
9276
  }
@@ -9265,7 +9280,7 @@ class WebRTCPhone extends Emitter {
9265
9280
  }
9266
9281
 
9267
9282
  async reject(callSession ) {
9268
- logger$8.info('reject WebRTC called', { id: callSession.getId() });
9283
+ logger$4.info('reject WebRTC called', { id: callSession.getId() });
9269
9284
 
9270
9285
  this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'call rejected locally');
9271
9286
  if (!callSession || callSession.getId() in this.rejectedSessions) {
@@ -9277,14 +9292,14 @@ class WebRTCPhone extends Emitter {
9277
9292
 
9278
9293
  const sipSession = this.findSipSession(callSession);
9279
9294
  if (sipSession) {
9280
- logger$8.info('WebRTC rejecting', { sipId: sipSession.id });
9295
+ logger$4.info('WebRTC rejecting', { sipId: sipSession.id });
9281
9296
 
9282
9297
  this.client.hangup(sipSession);
9283
9298
  }
9284
9299
  }
9285
9300
 
9286
9301
  async ignore(callSession ) {
9287
- logger$8.info('WebRTC ignore', { id: callSession.getId() });
9302
+ logger$4.info('WebRTC ignore', { id: callSession.getId() });
9288
9303
 
9289
9304
  // kill the ring
9290
9305
  this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'ignoring call');
@@ -9296,14 +9311,14 @@ class WebRTCPhone extends Emitter {
9296
9311
  const sipSession = this.findSipSession(callSession);
9297
9312
 
9298
9313
  if (sipSession) {
9299
- logger$8.info('WebRTC atxfer', { sipId: sipSession.id });
9314
+ logger$4.info('WebRTC atxfer', { sipId: sipSession.id });
9300
9315
 
9301
9316
  return this.client.atxfer(sipSession);
9302
9317
  }
9303
9318
  }
9304
9319
 
9305
9320
  hold(callSession , withEvent = true, isConference = false) {
9306
- logger$8.info('WebRTC hold', { id: callSession.getId() });
9321
+ logger$4.info('WebRTC hold', { id: callSession.getId() });
9307
9322
 
9308
9323
  const sipSession = this.findSipSession(callSession);
9309
9324
 
@@ -9318,18 +9333,18 @@ class WebRTCPhone extends Emitter {
9318
9333
  }
9319
9334
 
9320
9335
  resume(callSession , isConference = false, withEvent = true) {
9321
- logger$8.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
9336
+ logger$4.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
9322
9337
 
9323
9338
  const sipSession = this.findSipSession(callSession);
9324
9339
  if (!sipSession) {
9325
9340
  return new Promise((resolve, reject) => reject(new Error('No session to resume')));
9326
9341
  }
9327
9342
 
9328
- logger$8.info('WebRTC resuming', { sipId: sipSession.id });
9343
+ logger$4.info('WebRTC resuming', { sipId: sipSession.id });
9329
9344
 
9330
9345
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
9331
9346
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
9332
- logger$8.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9347
+ logger$4.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9333
9348
  this.holdSipSession(this.currentSipSession, callSession);
9334
9349
  }
9335
9350
 
@@ -9354,7 +9369,7 @@ class WebRTCPhone extends Emitter {
9354
9369
  const sessionId = this.getSipSessionId(sipSession);
9355
9370
  const hasVideo = this.client.hasLocalVideo(sessionId);
9356
9371
 
9357
- logger$8.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
9372
+ logger$4.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
9358
9373
 
9359
9374
  // Stop screenshre if needed
9360
9375
  if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
@@ -9385,7 +9400,7 @@ class WebRTCPhone extends Emitter {
9385
9400
  return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
9386
9401
  }
9387
9402
  const sessionId = this.getSipSessionId(sipSession);
9388
- logger$8.info('WebRTC unhold sip session', { sessionId, isConference });
9403
+ logger$4.info('WebRTC unhold sip session', { sessionId, isConference });
9389
9404
 
9390
9405
  const { hasVideo } = this.client.getHeldSession(sessionId) || {};
9391
9406
  const wasScreensharing = this.lastScreenShare && this.lastScreenShare.sipSessionId === sessionId;
@@ -9429,14 +9444,14 @@ class WebRTCPhone extends Emitter {
9429
9444
  }
9430
9445
 
9431
9446
  mute(callSession , withEvent = true) {
9432
- logger$8.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
9447
+ logger$4.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
9433
9448
 
9434
9449
  const sipSession = this.findSipSession(callSession);
9435
9450
  if (!sipSession) {
9436
9451
  return;
9437
9452
  }
9438
9453
 
9439
- logger$8.info('WebRTC muting', { sipId: sipSession.id });
9454
+ logger$4.info('WebRTC muting', { sipId: sipSession.id });
9440
9455
  this.client.mute(sipSession);
9441
9456
  const newCallSession = this._createCallSession(sipSession, callSession, { muted: true });
9442
9457
 
@@ -9450,14 +9465,14 @@ class WebRTCPhone extends Emitter {
9450
9465
  }
9451
9466
 
9452
9467
  unmute(callSession , withEvent = true) {
9453
- logger$8.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
9468
+ logger$4.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
9454
9469
 
9455
9470
  const sipSession = this.findSipSession(callSession);
9456
9471
  if (!sipSession) {
9457
9472
  return;
9458
9473
  }
9459
9474
 
9460
- logger$8.info('WebRTC unmuting', { sipId: sipSession.id });
9475
+ logger$4.info('WebRTC unmuting', { sipId: sipSession.id });
9461
9476
  this.client.unmute(sipSession);
9462
9477
  const newCallSession = this._createCallSession(sipSession, callSession, { muted: false });
9463
9478
 
@@ -9484,7 +9499,7 @@ class WebRTCPhone extends Emitter {
9484
9499
  if (!sipSession) {
9485
9500
  return;
9486
9501
  }
9487
- logger$8.info('WebRTC turn camera on', { sipId: sipSession.id });
9502
+ logger$4.info('WebRTC turn camera on', { sipId: sipSession.id });
9488
9503
 
9489
9504
  this.client.toggleCameraOn(sipSession);
9490
9505
 
@@ -9496,7 +9511,7 @@ class WebRTCPhone extends Emitter {
9496
9511
  if (!sipSession) {
9497
9512
  return;
9498
9513
  }
9499
- logger$8.info('WebRTC turn camera off', { sipId: sipSession.id });
9514
+ logger$4.info('WebRTC turn camera off', { sipId: sipSession.id });
9500
9515
 
9501
9516
  this.client.toggleCameraOff(sipSession);
9502
9517
  this.eventEmitter.emit(ON_CAMERA_DISABLED, this._createCameraDisabledCallSession(sipSession, callSession));
@@ -9508,7 +9523,7 @@ class WebRTCPhone extends Emitter {
9508
9523
  return;
9509
9524
  }
9510
9525
 
9511
- logger$8.info('WebRTC send key', { sipId: sipSession.id, tone });
9526
+ logger$4.info('WebRTC send key', { sipId: sipSession.id, tone });
9512
9527
  this.client.sendDTMF(sipSession, tone);
9513
9528
  }
9514
9529
 
@@ -9516,7 +9531,7 @@ class WebRTCPhone extends Emitter {
9516
9531
  // @TODO: line is not used here
9517
9532
  async makeCall(number , line , cameraEnabled ,
9518
9533
  audioOnly = false, conference = false) {
9519
- logger$8.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled });
9534
+ logger$4.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled });
9520
9535
  if (!number) {
9521
9536
  return Promise.resolve(null);
9522
9537
  }
@@ -9526,7 +9541,7 @@ class WebRTCPhone extends Emitter {
9526
9541
  }
9527
9542
  if (this.currentSipSession) {
9528
9543
  this.holdSipSession(this.currentSipSession, this.currentCallSession, true).catch(e => {
9529
- logger$8.warn('Unable to hold current session when making another call', e);
9544
+ logger$4.warn('Unable to hold current session when making another call', e);
9530
9545
  });
9531
9546
  }
9532
9547
 
@@ -9536,7 +9551,7 @@ class WebRTCPhone extends Emitter {
9536
9551
  this._bindEvents(sipSession);
9537
9552
  } catch (error) {
9538
9553
  console.warn(error);
9539
- logger$8.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
9554
+ logger$4.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
9540
9555
  return Promise.resolve(null);
9541
9556
  }
9542
9557
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
@@ -9564,7 +9579,7 @@ class WebRTCPhone extends Emitter {
9564
9579
  return;
9565
9580
  }
9566
9581
 
9567
- logger$8.info('WebRTC transfer', { sipId: sipSession.id, target });
9582
+ logger$4.info('WebRTC transfer', { sipId: sipSession.id, target });
9568
9583
 
9569
9584
  this.client.transfer(sipSession, target);
9570
9585
  }
@@ -9573,7 +9588,7 @@ class WebRTCPhone extends Emitter {
9573
9588
  const sipSession = this.client.getSipSession(source.sipCallId);
9574
9589
  const sipSessionTarget = this.client.getSipSession(destination.sipCallId);
9575
9590
 
9576
- logger$8.info('WebRTC indirect transfer', {
9591
+ logger$4.info('WebRTC indirect transfer', {
9577
9592
  sipId: sipSession ? sipSession.id : null,
9578
9593
  target: sipSessionTarget ? sipSessionTarget.id : null,
9579
9594
  });
@@ -9612,7 +9627,7 @@ class WebRTCPhone extends Emitter {
9612
9627
  return false;
9613
9628
  }
9614
9629
 
9615
- logger$8.info('WebRTC hangup', { sipId: sipSession.id });
9630
+ logger$4.info('WebRTC hangup', { sipId: sipSession.id });
9616
9631
 
9617
9632
  const sipSessionId = this.getSipSessionId(sipSession);
9618
9633
 
@@ -9658,7 +9673,7 @@ class WebRTCPhone extends Emitter {
9658
9673
  endCurrentCall(callSession ) {
9659
9674
  const isCurrent = this.isCurrentCallSipSession(callSession);
9660
9675
 
9661
- logger$8.info('Ending current call', {
9676
+ logger$4.info('Ending current call', {
9662
9677
  id: callSession ? callSession.getId() : null,
9663
9678
  isCurrent,
9664
9679
  });
@@ -9682,7 +9697,7 @@ class WebRTCPhone extends Emitter {
9682
9697
  }
9683
9698
 
9684
9699
  async close() {
9685
- logger$8.info('WebRTC close');
9700
+ logger$4.info('WebRTC close');
9686
9701
 
9687
9702
  try {
9688
9703
  await Promise.race([
@@ -9690,7 +9705,7 @@ class WebRTCPhone extends Emitter {
9690
9705
  new Promise((resolve, reject) => setTimeout(() => reject(new Error('Unregister, timed out')), 3000)),
9691
9706
  ]);
9692
9707
  } catch (e) {
9693
- logger$8.error('WebRTC close, unregister error', e);
9708
+ logger$4.error('WebRTC close, unregister error', e);
9694
9709
  }
9695
9710
 
9696
9711
  this.client.close();
@@ -9708,12 +9723,12 @@ class WebRTCPhone extends Emitter {
9708
9723
  }
9709
9724
 
9710
9725
  enableRinging() {
9711
- logger$8.info('WebRTC enable ringing');
9726
+ logger$4.info('WebRTC enable ringing');
9712
9727
  this.ringingEnabled = true;
9713
9728
  }
9714
9729
 
9715
9730
  disableRinging() {
9716
- logger$8.info('WebRTC disable ringing');
9731
+ logger$4.info('WebRTC disable ringing');
9717
9732
  this.ringingEnabled = false;
9718
9733
  }
9719
9734
 
@@ -9753,7 +9768,7 @@ class WebRTCPhone extends Emitter {
9753
9768
 
9754
9769
  // Deprecated
9755
9770
  getLocalMediaStream(callSession ) {
9756
- logger$8.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
9771
+ logger$4.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
9757
9772
  return this.getLocalStream(callSession);
9758
9773
  }
9759
9774
 
@@ -9795,7 +9810,7 @@ class WebRTCPhone extends Emitter {
9795
9810
  this.client.on(this.client.INVITE, (sipSession , wantsToDoVideo ) => {
9796
9811
  const autoAnswer = sipSession.request.getHeader('Answer-Mode') === 'Auto';
9797
9812
  const withVideo = this.allowVideo ? wantsToDoVideo : false;
9798
- logger$8.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
9813
+ logger$4.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
9799
9814
 
9800
9815
  const callSession = this._createIncomingCallSession(sipSession, withVideo, null, autoAnswer);
9801
9816
  this.incomingSessions.push(callSession.getId());
@@ -9818,7 +9833,7 @@ class WebRTCPhone extends Emitter {
9818
9833
  });
9819
9834
 
9820
9835
  this.client.on(this.client.ON_REINVITE, (...args) => {
9821
- logger$8.info('WebRTC on reinvite', {
9836
+ logger$4.info('WebRTC on reinvite', {
9822
9837
  sessionId: args[0].id,
9823
9838
  inviteId: args[1].id,
9824
9839
  updatedCalleeName: args[2],
@@ -9838,7 +9853,7 @@ class WebRTCPhone extends Emitter {
9838
9853
  });
9839
9854
 
9840
9855
  this.client.on(this.client.ACCEPTED, (sipSession ) => {
9841
- logger$8.info('WebRTC call accepted', { sipId: sipSession.id });
9856
+ logger$4.info('WebRTC call accepted', { sipId: sipSession.id });
9842
9857
 
9843
9858
  this._onCallAccepted(sipSession, this.client.hasVideo(this.getSipSessionId(sipSession)));
9844
9859
 
@@ -9849,22 +9864,22 @@ class WebRTCPhone extends Emitter {
9849
9864
  this.client.on('ended', () => {});
9850
9865
 
9851
9866
  this.client.on(this.client.ON_ERROR, e => {
9852
- logger$8.error('WebRTC error', e);
9867
+ logger$4.error('WebRTC error', e);
9853
9868
  this.eventEmitter.emit(ON_CALL_ERROR, e);
9854
9869
  });
9855
9870
 
9856
9871
  this.client.on(this.client.UNREGISTERED, () => {
9857
- logger$8.info('WebRTC unregistered');
9872
+ logger$4.info('WebRTC unregistered');
9858
9873
  this.eventEmitter.emit(ON_UNREGISTERED);
9859
9874
  });
9860
9875
 
9861
9876
  this.client.on(this.client.ON_DISCONNECTED, () => {
9862
- logger$8.info('WebRTC disconnected');
9863
- this.eventEmitter.emit(ON_DISCONNECTED);
9877
+ logger$4.info('WebRTC disconnected');
9878
+ this.eventEmitter.emit(ON_DISCONNECTED$1);
9864
9879
  });
9865
9880
 
9866
9881
  this.client.on(this.client.REGISTERED, () => {
9867
- logger$8.info('WebRTC registered', {
9882
+ logger$4.info('WebRTC registered', {
9868
9883
  shouldSendReinvite: this.shouldSendReinvite,
9869
9884
  state: this.currentSipSession ? this.currentSipSession.state : null,
9870
9885
  currentSipSession: !!this.currentSipSession,
@@ -9877,23 +9892,27 @@ class WebRTCPhone extends Emitter {
9877
9892
  if (this.shouldSendReinvite && this.currentSipSession
9878
9893
  && this.currentSipSession.state === SessionState.Established) {
9879
9894
  this.shouldSendReinvite = false;
9895
+ const pc = this.currentSipSession.sessionDescriptionHandler.peerConnection;
9896
+ const isConference = pc ? pc.sfu : false;
9897
+ const hasVideo = this.currentCallSession && this.currentCallSession.cameraEnabled;
9898
+
9880
9899
  try {
9881
9900
  // Send reinvite with iceRestart
9882
- this.sendReinvite(this.currentCallSession, null, false, false, true);
9901
+ this.sendReinvite(this.currentCallSession, null, isConference, !hasVideo, true);
9883
9902
  } catch (e) {
9884
- logger$8.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
9903
+ logger$4.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
9885
9904
  }
9886
9905
  }
9887
9906
  });
9888
9907
 
9889
9908
  this.client.on(this.client.CONNECTED, () => {
9890
- logger$8.info('WebRTC client connected');
9909
+ logger$4.info('WebRTC client connected');
9891
9910
 
9892
9911
  this.stopHeartbeat();
9893
9912
  });
9894
9913
 
9895
9914
  this.client.on(this.client.DISCONNECTED, () => {
9896
- logger$8.info('WebRTC client disconnected');
9915
+ logger$4.info('WebRTC client disconnected');
9897
9916
 
9898
9917
  this.eventEmitter.emit(ON_UNREGISTERED);
9899
9918
 
@@ -9907,7 +9926,7 @@ class WebRTCPhone extends Emitter {
9907
9926
  });
9908
9927
 
9909
9928
  this.client.on(this.client.ON_TRACK, (session, event) => {
9910
- this.eventEmitter.emit(ON_TRACK, session, event);
9929
+ this.eventEmitter.emit(ON_TRACK$1, session, event);
9911
9930
  });
9912
9931
 
9913
9932
  this.client.on('onVideoInputChange', stream => {
@@ -9922,7 +9941,7 @@ class WebRTCPhone extends Emitter {
9922
9941
  this.client.on(this.client.ON_NETWORK_STATS, (session, stats, previousStats) => {
9923
9942
  const callSession = this.getCallSession(this.getSipSessionId(session));
9924
9943
 
9925
- this.eventEmitter.emit(ON_NETWORK_STATS, callSession, stats, previousStats);
9944
+ this.eventEmitter.emit(ON_NETWORK_STATS$1, callSession, stats, previousStats);
9926
9945
  });
9927
9946
 
9928
9947
  // Used when upgrading directly in screenshare mode
@@ -9931,7 +9950,7 @@ class WebRTCPhone extends Emitter {
9931
9950
  const localStream = this.client.getLocalStream(sipSessionId);
9932
9951
  const callSession = this.callSessions[sipSessionId];
9933
9952
 
9934
- logger$8.info('Updrading directly in screensharing mode', {
9953
+ logger$4.info('Updrading directly in screensharing mode', {
9935
9954
  sipSessionId,
9936
9955
  tracks: localStream ? localStream.getTracks() : null,
9937
9956
  });
@@ -9963,6 +9982,15 @@ class WebRTCPhone extends Emitter {
9963
9982
  return this.client.getSipSessionId(sipSession);
9964
9983
  }
9965
9984
 
9985
+ _updateCallSession(callSession ) {
9986
+ const sipSession = this.findSipSession(callSession);
9987
+ const sipSessionId = sipSession ? this.getSipSessionId(sipSession) : null;
9988
+
9989
+ if (sipSessionId) {
9990
+ this.callSessions[sipSessionId] = callSession;
9991
+ }
9992
+ }
9993
+
9966
9994
  _onMessage(message ) {
9967
9995
  if (!message || message.method !== 'MESSAGE') {
9968
9996
  return;
@@ -10100,8 +10128,8 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
10100
10128
  ON_CALL_ENDED: ON_CALL_ENDED,
10101
10129
  ON_CALL_ENDING: ON_CALL_ENDING,
10102
10130
  ON_MESSAGE: ON_MESSAGE,
10103
- ON_REINVITE: ON_REINVITE,
10104
- ON_TRACK: ON_TRACK,
10131
+ ON_REINVITE: ON_REINVITE$1,
10132
+ ON_TRACK: ON_TRACK$1,
10105
10133
  ON_AUDIO_STREAM: ON_AUDIO_STREAM,
10106
10134
  ON_VIDEO_STREAM: ON_VIDEO_STREAM,
10107
10135
  ON_REMOVE_STREAM: ON_REMOVE_STREAM,
@@ -10116,13 +10144,13 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
10116
10144
  ON_VIDEO_INPUT_CHANGE: ON_VIDEO_INPUT_CHANGE,
10117
10145
  ON_CALL_ERROR: ON_CALL_ERROR,
10118
10146
  ON_MESSAGE_TRACK_UPDATED: ON_MESSAGE_TRACK_UPDATED,
10119
- ON_NETWORK_STATS: ON_NETWORK_STATS,
10147
+ ON_NETWORK_STATS: ON_NETWORK_STATS$1,
10120
10148
  ON_CHAT: ON_CHAT,
10121
10149
  ON_SIGNAL: ON_SIGNAL,
10122
- ON_DISCONNECTED: ON_DISCONNECTED,
10150
+ ON_DISCONNECTED: ON_DISCONNECTED$1,
10123
10151
  MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
10124
10152
  MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
10125
- events: events,
10153
+ events: events$1,
10126
10154
  'default': WebRTCPhone
10127
10155
  });
10128
10156
 
@@ -10131,7 +10159,7 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
10131
10159
  class InvalidSubscription extends Error {}
10132
10160
  class InvalidAuthorization extends Error {}
10133
10161
 
10134
- const logger$7 = IssueReporter$1.loggerFor('simple-auth');
10162
+ const logger$5 = IssueReporter$1.loggerFor('simple-auth');
10135
10163
 
10136
10164
  class Auth {
10137
10165
 
@@ -10166,7 +10194,7 @@ class Auth {
10166
10194
  setApiClientId(this.clientId);
10167
10195
  setRefreshExpiration(this.expiration);
10168
10196
  setOnRefreshToken((token , session ) => {
10169
- logger$7.info('on refresh token done', { token });
10197
+ logger$5.info('on refresh token done', { token });
10170
10198
  setApiToken(token);
10171
10199
  Wazo.Websocket.updateToken(token);
10172
10200
 
@@ -10211,7 +10239,7 @@ class Auth {
10211
10239
  const rawSession = await getApiClient().auth.authenticate(token);
10212
10240
  return this._onAuthenticated(rawSession);
10213
10241
  } catch (e) {
10214
- logger$7.error('on validate token error', e);
10242
+ logger$5.error('on validate token error', e);
10215
10243
  console.warn(e);
10216
10244
  return false;
10217
10245
  }
@@ -10392,7 +10420,7 @@ var Auth$1 = global.wazoAuthInstance;
10392
10420
 
10393
10421
  //
10394
10422
 
10395
- const SOCKET_EVENTS$1 = {
10423
+ const SOCKET_EVENTS = {
10396
10424
  ON_OPEN: 'onopen',
10397
10425
  ON_MESSAGE: 'onmessage',
10398
10426
  ON_ERROR: 'onerror',
@@ -10545,16 +10573,16 @@ class WebSocketClient extends Emitter {
10545
10573
 
10546
10574
  this.socket.onopen = () => {
10547
10575
  logger$6.info('on Wazo WS open', { method: 'connect', host: this.host });
10548
- this.eventEmitter.emit(SOCKET_EVENTS$1.ON_OPEN);
10576
+ this.eventEmitter.emit(SOCKET_EVENTS.ON_OPEN);
10549
10577
  };
10550
10578
 
10551
10579
  this.socket.onerror = event => {
10552
10580
  logger$6.error('on Wazo WS error', event.target);
10553
- this.eventEmitter.emit(SOCKET_EVENTS$1.ON_ERROR, event);
10581
+ this.eventEmitter.emit(SOCKET_EVENTS.ON_ERROR, event);
10554
10582
  };
10555
10583
 
10556
10584
  this.socket.onmessage = (event ) => {
10557
- this.eventEmitter.emit(SOCKET_EVENTS$1.ON_MESSAGE, event.data);
10585
+ this.eventEmitter.emit(SOCKET_EVENTS.ON_MESSAGE, event.data);
10558
10586
 
10559
10587
  const message = JSON.parse(typeof event.data === 'string' ? event.data : '{}');
10560
10588
  let { name } = message;
@@ -10587,11 +10615,11 @@ class WebSocketClient extends Emitter {
10587
10615
  token: this.token,
10588
10616
  });
10589
10617
  this.initialized = false;
10590
- this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, event);
10618
+ this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, event);
10591
10619
 
10592
10620
  switch (event.code) {
10593
10621
  case 4002:
10594
- this.eventEmitter.emit(SOCKET_EVENTS$1.ON_AUTH_FAILED);
10622
+ this.eventEmitter.emit(SOCKET_EVENTS.ON_AUTH_FAILED);
10595
10623
  break;
10596
10624
  }
10597
10625
  };
@@ -10707,7 +10735,7 @@ class WebSocketClient extends Emitter {
10707
10735
  break;
10708
10736
  case 'start':
10709
10737
  this.initialized = true;
10710
- this.eventEmitter.emit(SOCKET_EVENTS$1.INITIALIZED);
10738
+ this.eventEmitter.emit(SOCKET_EVENTS.INITIALIZED);
10711
10739
  break;
10712
10740
  default:
10713
10741
  this.eventEmitter.emit('message', message);
@@ -10754,7 +10782,7 @@ class WebSocketClient extends Emitter {
10754
10782
  logger$6.log('heartbeat timed out', { host: this.host, token: this.token });
10755
10783
 
10756
10784
  this.close();
10757
- this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, new Error('Websocket ping failure.'));
10785
+ this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, new Error('Websocket ping failure.'));
10758
10786
 
10759
10787
  if (this.onHeartBeatTimeout) {
10760
10788
  this.onHeartBeatTimeout();
@@ -10834,7 +10862,7 @@ WebSocketClient.eventLists = [
10834
10862
 
10835
10863
  var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
10836
10864
  __proto__: null,
10837
- SOCKET_EVENTS: SOCKET_EVENTS$1,
10865
+ SOCKET_EVENTS: SOCKET_EVENTS,
10838
10866
  AUTH_SESSION_EXPIRE_SOON: AUTH_SESSION_EXPIRE_SOON,
10839
10867
  FAVORITE_ADDED: FAVORITE_ADDED,
10840
10868
  FAVORITE_DELETED: FAVORITE_DELETED,
@@ -10907,10 +10935,10 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
10907
10935
 
10908
10936
  //
10909
10937
 
10910
- const { SOCKET_EVENTS, ...OTHER_EVENTS } = WebSocketClient$1;
10911
- const ALL_EVENTS = [...Object.values(SOCKET_EVENTS), ...Object.values(OTHER_EVENTS)];
10938
+ const { SOCKET_EVENTS: SOCKET_EVENTS$1, ...OTHER_EVENTS } = WebSocketClient$1;
10939
+ const ALL_EVENTS = [...Object.values(SOCKET_EVENTS$1), ...Object.values(OTHER_EVENTS)];
10912
10940
 
10913
- const logger$5 = IssueReporter$1.loggerFor('simple-ws-client');
10941
+ const logger$7 = IssueReporter$1.loggerFor('simple-ws-client');
10914
10942
 
10915
10943
  class Websocket extends Emitter {
10916
10944
 
@@ -10924,9 +10952,9 @@ class Websocket extends Emitter {
10924
10952
  // $FlowFixMe
10925
10953
  this[key] = OTHER_EVENTS[key];
10926
10954
  });
10927
- Object.keys(SOCKET_EVENTS).forEach(key => {
10955
+ Object.keys(SOCKET_EVENTS$1).forEach(key => {
10928
10956
  // $FlowFixMe
10929
- this[key] = SOCKET_EVENTS[key];
10957
+ this[key] = SOCKET_EVENTS$1[key];
10930
10958
  });
10931
10959
  this.eventLists = WebSocketClient.eventLists;
10932
10960
 
@@ -10934,7 +10962,7 @@ class Websocket extends Emitter {
10934
10962
  }
10935
10963
 
10936
10964
  open(host , session ) {
10937
- logger$5.info('open simple WebSocket', { host, token: session.token });
10965
+ logger$7.info('open simple WebSocket', { host, token: session.token });
10938
10966
  this.ws = new WebSocketClient(
10939
10967
  {
10940
10968
  host,
@@ -10962,7 +10990,7 @@ class Websocket extends Emitter {
10962
10990
  }
10963
10991
 
10964
10992
  updateToken(token ) {
10965
- logger$5.info('update token via simple Websocket', { token, ws: !!this.ws });
10993
+ logger$7.info('update token via simple Websocket', { token, ws: !!this.ws });
10966
10994
 
10967
10995
  if (!this.ws) {
10968
10996
  return;
@@ -10990,7 +11018,7 @@ var Websocket$1 = global.wazoWebsocketInstance;
10990
11018
 
10991
11019
  //
10992
11020
 
10993
- const logger$4 = IssueReporter$1.loggerFor('room');
11021
+ const logger$8 = IssueReporter$1.loggerFor('room');
10994
11022
 
10995
11023
  class Participant extends Emitter {
10996
11024
 
@@ -11112,7 +11140,7 @@ class Participant extends Emitter {
11112
11140
  }
11113
11141
 
11114
11142
  onTalking(isTalking ) {
11115
- logger$4.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
11143
+ logger$8.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
11116
11144
  this.isTalking = isTalking;
11117
11145
  // you may notice we're not broadcasting: since all participants are getting this info
11118
11146
  // directly from asterisk, there's no need to do so
@@ -11215,7 +11243,7 @@ class Participant extends Emitter {
11215
11243
  }
11216
11244
 
11217
11245
  updateStatus(status , broadcast = true) {
11218
- logger$4.info('updating participant status', { name: this.name, status });
11246
+ logger$8.info('updating participant status', { name: this.name, status });
11219
11247
 
11220
11248
  if (typeof status.audioMuted !== 'undefined' && status.audioMuted !== this.audioMuted) {
11221
11249
  if (status.audioMuted) {
@@ -11263,7 +11291,7 @@ class Participant extends Emitter {
11263
11291
 
11264
11292
  broadcastStatus(inboundStatus = null) {
11265
11293
  const status = inboundStatus || this.getStatus();
11266
- logger$4.info('broadcasting participant status', { callId: this.callId, status });
11294
+ logger$8.info('broadcasting participant status', { callId: this.callId, status });
11267
11295
 
11268
11296
  this.room.sendSignal({
11269
11297
  type: SIGNAL_TYPE_PARTICIPANT_UPDATE,
@@ -11299,9 +11327,9 @@ class LocalParticipant extends Participant {
11299
11327
  const SIGNAL_TYPE_PARTICIPANT_UPDATE = 'signal/PARTICIPANT_UPDATE';
11300
11328
  const SIGNAL_TYPE_PARTICIPANT_REQUEST = 'signal/PARTICIPANT_REQUEST';
11301
11329
 
11302
- const logger$3 = IssueReporter$1.loggerFor('sdk-room');
11330
+ const logger$9 = IssueReporter$1.loggerFor('sdk-room');
11303
11331
 
11304
- class Room$1 extends Emitter {
11332
+ class Room extends Emitter {
11305
11333
 
11306
11334
 
11307
11335
 
@@ -11359,7 +11387,7 @@ class Room$1 extends Emitter {
11359
11387
  extra = {},
11360
11388
  ) {
11361
11389
  super();
11362
- logger$3.info('room initialized', { callId, extension, sourceId, meetingUuid });
11390
+ logger$9.info('room initialized', { callId, extension, sourceId, meetingUuid });
11363
11391
 
11364
11392
  // Represents the room callSession
11365
11393
  this.callSession = callSession;
@@ -11425,7 +11453,7 @@ class Room$1 extends Emitter {
11425
11453
  * @returns {Promise<Room>}
11426
11454
  */
11427
11455
  static async connect({ extension, constraints, audioOnly = false, extra, room, meeting } ) {
11428
- logger$3.info('connecting to room', { extension, audioOnly, room: !!room });
11456
+ logger$9.info('connecting to room', { extension, audioOnly, room: !!room });
11429
11457
 
11430
11458
  if (!room) {
11431
11459
  await Wazo.Phone.connect();
@@ -11438,7 +11466,7 @@ class Room$1 extends Emitter {
11438
11466
 
11439
11467
  // Call_created is triggered before call_accepted, so we have to listen for it here.
11440
11468
  Wazo.Websocket.once(Wazo.Websocket.CALL_CREATED, ({ data }) => {
11441
- logger$3.info('room call received via WS', { callId: data.call_id });
11469
+ logger$9.info('room call received via WS', { callId: data.call_id });
11442
11470
  if (room) {
11443
11471
  room.setCallId(data.call_id);
11444
11472
  }
@@ -11446,7 +11474,7 @@ class Room$1 extends Emitter {
11446
11474
 
11447
11475
  const callSession = await Wazo.Phone.call(extension, withCamera, null, audioOnly, true);
11448
11476
  // eslint-disable-next-line no-param-reassign
11449
- room = new Room$1(callSession, extension, null, null, extra);
11477
+ room = new Room(callSession, extension, null, null, extra);
11450
11478
 
11451
11479
  // Wait for the call to be accepted
11452
11480
  await new Promise((resolve, reject) => {
@@ -11467,7 +11495,7 @@ class Room$1 extends Emitter {
11467
11495
  // Retrieve conference
11468
11496
  const conference = contacts.find(contact => contact.numbers.find(number => number.number === extension));
11469
11497
 
11470
- logger$3.info('connected to room', {
11498
+ logger$9.info('connected to room', {
11471
11499
  sourceId: conference ? conference.sourceId : null,
11472
11500
  name: conference ? conference.name : null,
11473
11501
  });
@@ -11477,7 +11505,7 @@ class Room$1 extends Emitter {
11477
11505
  room.setName(conference.name);
11478
11506
  }
11479
11507
  } else if (meeting) {
11480
- logger$3.info('Already connected to meeting', {
11508
+ logger$9.info('Already connected to meeting', {
11481
11509
  uuid: meeting.uuid,
11482
11510
  name: meeting.name,
11483
11511
  });
@@ -11490,13 +11518,13 @@ class Room$1 extends Emitter {
11490
11518
  }
11491
11519
 
11492
11520
  static disconnect() {
11493
- logger$3.info('static disconnection to room');
11521
+ logger$9.info('static disconnection to room');
11494
11522
 
11495
11523
  Wazo.Phone.disconnect();
11496
11524
  }
11497
11525
 
11498
11526
  async disconnect() {
11499
- logger$3.info('disconnection to room called');
11527
+ logger$9.info('disconnection to room called');
11500
11528
 
11501
11529
  await Wazo.Phone.hangup(this.callSession);
11502
11530
  this.callSession = null;
@@ -11516,19 +11544,19 @@ class Room$1 extends Emitter {
11516
11544
  }
11517
11545
 
11518
11546
  setSourceId(sourceId ) {
11519
- logger$3.info('set room source id', { sourceId });
11547
+ logger$9.info('set room source id', { sourceId });
11520
11548
 
11521
11549
  this.sourceId = sourceId;
11522
11550
  }
11523
11551
 
11524
11552
  setMeetingUuid(meetingUuid ) {
11525
- logger$3.info('set meeting uuid', { meetingUuid });
11553
+ logger$9.info('set meeting uuid', { meetingUuid });
11526
11554
 
11527
11555
  this.meetingUuid = meetingUuid;
11528
11556
  }
11529
11557
 
11530
11558
  setCallId(callId ) {
11531
- logger$3.info('set room call id', { callId });
11559
+ logger$9.info('set room call id', { callId });
11532
11560
 
11533
11561
  if (callId) {
11534
11562
  this.callId = callId;
@@ -11536,7 +11564,7 @@ class Room$1 extends Emitter {
11536
11564
  }
11537
11565
 
11538
11566
  setName(name ) {
11539
- logger$3.info('set room name', { name });
11567
+ logger$9.info('set room name', { name });
11540
11568
 
11541
11569
  this.name = name;
11542
11570
  }
@@ -11555,7 +11583,7 @@ class Room$1 extends Emitter {
11555
11583
  }
11556
11584
 
11557
11585
  async startScreenSharing(constraints ) {
11558
- logger$3.info('start room screen sharing', { constraints });
11586
+ logger$9.info('start room screen sharing', { constraints });
11559
11587
 
11560
11588
  const screensharingStream = await Wazo.Phone.startScreenSharing(constraints, this.callSession);
11561
11589
  if (!screensharingStream) {
@@ -11569,7 +11597,7 @@ class Room$1 extends Emitter {
11569
11597
  }
11570
11598
 
11571
11599
  async stopScreenSharing(restoreLocalStream = true) {
11572
- logger$3.info('stop room screen sharing');
11600
+ logger$9.info('stop room screen sharing');
11573
11601
 
11574
11602
  await Wazo.Phone.stopScreenSharing(this.callSession, restoreLocalStream);
11575
11603
 
@@ -11581,7 +11609,7 @@ class Room$1 extends Emitter {
11581
11609
  }
11582
11610
 
11583
11611
  turnCameraOff() {
11584
- logger$3.info('turn room camera off');
11612
+ logger$9.info('turn room camera off');
11585
11613
 
11586
11614
  Wazo.Phone.turnCameraOff(this.callSession);
11587
11615
 
@@ -11591,7 +11619,7 @@ class Room$1 extends Emitter {
11591
11619
  }
11592
11620
 
11593
11621
  turnCameraOn() {
11594
- logger$3.info('turn room camera on');
11622
+ logger$9.info('turn room camera on');
11595
11623
 
11596
11624
  Wazo.Phone.turnCameraOn(this.callSession);
11597
11625
 
@@ -11601,7 +11629,7 @@ class Room$1 extends Emitter {
11601
11629
  }
11602
11630
 
11603
11631
  mute() {
11604
- logger$3.info('mute room');
11632
+ logger$9.info('mute room');
11605
11633
 
11606
11634
  Wazo.Phone.mute(this.callSession);
11607
11635
 
@@ -11609,7 +11637,7 @@ class Room$1 extends Emitter {
11609
11637
  }
11610
11638
 
11611
11639
  unmute() {
11612
- logger$3.info('unmute room');
11640
+ logger$9.info('unmute room');
11613
11641
 
11614
11642
  Wazo.Phone.unmute(this.callSession);
11615
11643
 
@@ -11629,7 +11657,7 @@ class Room$1 extends Emitter {
11629
11657
  }
11630
11658
 
11631
11659
  hold() {
11632
- logger$3.info('hold room');
11660
+ logger$9.info('hold room');
11633
11661
 
11634
11662
  Wazo.Phone.hold(this.callSession, true);
11635
11663
 
@@ -11639,7 +11667,7 @@ class Room$1 extends Emitter {
11639
11667
  }
11640
11668
 
11641
11669
  async resume() {
11642
- logger$3.info('resume room');
11670
+ logger$9.info('resume room');
11643
11671
 
11644
11672
  const newStream = await Wazo.Phone.resume(this.callSession, true);
11645
11673
 
@@ -11667,13 +11695,13 @@ class Room$1 extends Emitter {
11667
11695
  }
11668
11696
 
11669
11697
  sendDTMF(tone ) {
11670
- logger$3.info('send room DTMF', { tone });
11698
+ logger$9.info('send room DTMF', { tone });
11671
11699
 
11672
11700
  Wazo.Phone.sendDTMF(tone, this.callSession);
11673
11701
  }
11674
11702
 
11675
11703
  async sendReinvite(newConstraints = null) {
11676
- logger$3.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
11704
+ logger$9.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
11677
11705
  const wasScreensharing = this.localParticipant && this.localParticipant.screensharing;
11678
11706
 
11679
11707
  Wazo.Phone.on(Wazo.Phone.ON_SHARE_SCREEN_STARTED, () => {
@@ -11732,7 +11760,7 @@ class Room$1 extends Emitter {
11732
11760
  Wazo.Phone.phone.on(Wazo.Phone.phone.client.ON_REINVITE, this._boundOnReinvite);
11733
11761
 
11734
11762
  this.on(this.ON_AUDIO_STREAM, stream => {
11735
- logger$3.info('on room audio stream');
11763
+ logger$9.info('on room audio stream');
11736
11764
 
11737
11765
  this.audioStream = stream;
11738
11766
  if (!this.roomAudioElement) {
@@ -11745,7 +11773,7 @@ class Room$1 extends Emitter {
11745
11773
  });
11746
11774
 
11747
11775
  this.on(this.ON_VIDEO_STREAM, (stream, streamId, event, sipSession) => {
11748
- logger$3.info('on room video stream', { streamId });
11776
+ logger$9.info('on room video stream', { streamId });
11749
11777
 
11750
11778
  this._mapMsid(sipSession.body.body);
11751
11779
 
@@ -11760,7 +11788,7 @@ class Room$1 extends Emitter {
11760
11788
  });
11761
11789
 
11762
11790
  this.on(this.ON_REMOVE_STREAM, stream => {
11763
- logger$3.info('on room remove stream');
11791
+ logger$9.info('on room remove stream');
11764
11792
 
11765
11793
  const participant = this.participants.find(someParticipant =>
11766
11794
  someParticipant.streams.find(someStream => someStream && someStream.id === stream.id));
@@ -11892,7 +11920,7 @@ class Room$1 extends Emitter {
11892
11920
  const requester = this._getParticipantFromCallId(origin.callId);
11893
11921
  if (requester) {
11894
11922
  // @FIXME?: when need to trigger an update on join-in; this is a bit of a hack
11895
- logger$3.info('trigger room requester status', { origin });
11923
+ logger$9.info('trigger room requester status', { origin });
11896
11924
  requester.triggerUpdate('REQUESTER_UPDATE');
11897
11925
  }
11898
11926
  break;
@@ -11923,24 +11951,24 @@ class Room$1 extends Emitter {
11923
11951
 
11924
11952
  // When we join the room, we can call `getConferenceParticipantsAsUser`, not before.
11925
11953
  if (participant.user_uuid === session.uuid) {
11926
- logger$3.info('room current user joined');
11954
+ logger$9.info('room current user joined');
11927
11955
 
11928
11956
  // Retrieve participants via an API calls
11929
11957
  const conferenceId = this.sourceId || payload.data.conference_id;
11930
11958
  let response;
11931
11959
  try {
11932
11960
  if (this.meetingUuid) {
11933
- logger$3.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
11961
+ logger$9.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
11934
11962
  response = await getApiClient().calld.getMeetingParticipantsAsUser(this.meetingUuid);
11935
11963
  } else {
11936
- logger$3.info('fetching conference participants', { conferenceId });
11964
+ logger$9.info('fetching conference participants', { conferenceId });
11937
11965
  response = await getApiClient().calld.getConferenceParticipantsAsUser(conferenceId);
11938
11966
  }
11939
11967
  } catch (e) {
11940
- logger$3.error('room participants fetching, error', e);
11968
+ logger$9.error('room participants fetching, error', e);
11941
11969
  }
11942
11970
  if (response) {
11943
- logger$3.info('conference participants fetched', { nb: response.items.length });
11971
+ logger$9.info('conference participants fetched', { nb: response.items.length });
11944
11972
  participants = response.items.map(item => {
11945
11973
  const isMe = item.call_id === this.callId;
11946
11974
 
@@ -11967,7 +11995,7 @@ class Room$1 extends Emitter {
11967
11995
  ? new Wazo.RemoteParticipant(this, participant)
11968
11996
  : null;
11969
11997
 
11970
- logger$3.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
11998
+ logger$9.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
11971
11999
 
11972
12000
  if (remoteParticipant) {
11973
12001
  this.participants.push(remoteParticipant);
@@ -12132,12 +12160,12 @@ class Room$1 extends Emitter {
12132
12160
 
12133
12161
  //
12134
12162
 
12135
- const logger$2 = IssueReporter$1.loggerFor('sdk-sip-room');
12163
+ const logger$a = IssueReporter$1.loggerFor('sdk-sip-room');
12136
12164
 
12137
- class SipRoom extends Room$1 {
12165
+ class SipRoom extends Room {
12138
12166
 
12139
12167
  static async connect({ extension, constraints, audioOnly = false, extra, room } ) {
12140
- logger$2.info('connecting to sip room', { extension, audioOnly, room: !!room });
12168
+ logger$a.info('connecting to sip room', { extension, audioOnly, room: !!room });
12141
12169
 
12142
12170
  if (!room) {
12143
12171
  await Wazo.Phone.connect();
@@ -12153,7 +12181,7 @@ class SipRoom extends Room$1 {
12153
12181
  room.setCallId(room.callSession.call.id);
12154
12182
  }
12155
12183
 
12156
- logger$2.info('connected to room', {
12184
+ logger$a.info('connected to room', {
12157
12185
  extension: room.extension,
12158
12186
  });
12159
12187
 
@@ -12161,7 +12189,7 @@ class SipRoom extends Room$1 {
12161
12189
  }
12162
12190
 
12163
12191
  mute() {
12164
- logger$2.info('mute sip room');
12192
+ logger$a.info('mute sip room');
12165
12193
 
12166
12194
  Wazo.Phone.mute(this.callSession, false);
12167
12195
 
@@ -12169,7 +12197,7 @@ class SipRoom extends Room$1 {
12169
12197
  }
12170
12198
 
12171
12199
  unmute() {
12172
- logger$2.info('unmute sip room');
12200
+ logger$a.info('unmute sip room');
12173
12201
 
12174
12202
  Wazo.Phone.unmute(this.callSession, false);
12175
12203
 
@@ -12453,7 +12481,7 @@ class NotificationOptions {
12453
12481
 
12454
12482
 
12455
12483
  // Represents a conference room, like `9000`.
12456
- class Room {
12484
+ class Room$1 {
12457
12485
 
12458
12486
 
12459
12487
 
@@ -12474,7 +12502,7 @@ class Room {
12474
12502
  }
12475
12503
 
12476
12504
  connect(callSession ) {
12477
- return new Room({ ...this, connectedCallSession: callSession });
12505
+ return new Room$1({ ...this, connectedCallSession: callSession });
12478
12506
  }
12479
12507
 
12480
12508
  has(callSession ) {
@@ -12483,7 +12511,7 @@ class Room {
12483
12511
 
12484
12512
  addParticipant(uuid , extension , talking = null) {
12485
12513
  if (!this.participants.some(participant => participant.uuid === uuid || participant.extension === extension)) {
12486
- return new Room({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
12514
+ return new Room$1({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
12487
12515
  }
12488
12516
 
12489
12517
  return this;
@@ -12502,7 +12530,7 @@ class Room {
12502
12530
  updatedParticipants.push(participant);
12503
12531
  }
12504
12532
 
12505
- return new Room({ ...this, participants: updatedParticipants });
12533
+ return new Room$1({ ...this, participants: updatedParticipants });
12506
12534
  }
12507
12535
 
12508
12536
  updateParticipantByExtension(extension , participant , shouldAdd = false) {
@@ -12518,7 +12546,7 @@ class Room {
12518
12546
  updatedParticipants.push(participant);
12519
12547
  }
12520
12548
 
12521
- return new Room({ ...this, participants: updatedParticipants });
12549
+ return new Room$1({ ...this, participants: updatedParticipants });
12522
12550
  }
12523
12551
 
12524
12552
  hasCallWithId(id ) {
@@ -12526,18 +12554,18 @@ class Room {
12526
12554
  }
12527
12555
 
12528
12556
  disconnect() {
12529
- return new Room({ ...this, connectedCallSession: null });
12557
+ return new Room$1({ ...this, connectedCallSession: null });
12530
12558
  }
12531
12559
 
12532
12560
  removeParticipantWithUUID(uuid ) {
12533
- return new Room({
12561
+ return new Room$1({
12534
12562
  ...this,
12535
12563
  participants: this.participants.filter(participant => participant.uuid !== uuid),
12536
12564
  });
12537
12565
  }
12538
12566
 
12539
12567
  removeParticipantWithExtension(extension ) {
12540
- return new Room({
12568
+ return new Room$1({
12541
12569
  ...this,
12542
12570
  participants: this.participants.filter(participant => participant.extension !== extension),
12543
12571
  });
@@ -12548,7 +12576,7 @@ class Room {
12548
12576
  }
12549
12577
 
12550
12578
  static newFrom(room ) {
12551
- return newFrom(room, Room);
12579
+ return newFrom(room, Room$1);
12552
12580
  }
12553
12581
  }
12554
12582
 
@@ -12855,11 +12883,11 @@ var wazoWebsocket = {
12855
12883
  resolve();
12856
12884
  };
12857
12885
 
12858
- client.on(SOCKET_EVENTS$1.ON_ERROR, error => {
12886
+ client.on(SOCKET_EVENTS.ON_ERROR, error => {
12859
12887
  handleError(`Connection error : ${error}`);
12860
12888
  });
12861
12889
 
12862
- client.on(SOCKET_EVENTS$1.ON_OPEN, () => {
12890
+ client.on(SOCKET_EVENTS.ON_OPEN, () => {
12863
12891
  if (session.hasEngineVersionGte(HEARTBEAT_ENGINE_VERSION)) {
12864
12892
  client.setOnHeartbeatTimeout(() => {
12865
12893
  handleError('No response to heartbeat');
@@ -12960,7 +12988,7 @@ var webrtc = {
12960
12988
  }),
12961
12989
  };
12962
12990
 
12963
- const parseCandidate = line => {
12991
+ const parseCandidate$1 = line => {
12964
12992
  let parts;
12965
12993
  // Parse both variants.
12966
12994
  if (line.indexOf('a=candidate:') === 0) {
@@ -13051,7 +13079,7 @@ var SymmetricNat = {
13051
13079
  }
13052
13080
 
13053
13081
  if (e.candidate && e.candidate.candidate.indexOf('srflx') !== -1) {
13054
- const cand = parseCandidate(e.candidate.candidate);
13082
+ const cand = parseCandidate$1(e.candidate.candidate);
13055
13083
  if (!candidates[cand.relatedPort]) candidates[cand.relatedPort] = [];
13056
13084
  candidates[cand.relatedPort].push(cand.port);
13057
13085
  } else if (!e.candidate) {
@@ -13119,7 +13147,7 @@ var iceIpv4 = {
13119
13147
  const rawCandidate = e.candidate.candidate;
13120
13148
  if (rawCandidate.indexOf('srflx') !== -1 || rawCandidate.indexOf('relay') !== -1) {
13121
13149
  hasSrflxOrRelay = true;
13122
- const candidate = parseCandidate(e.candidate.candidate);
13150
+ const candidate = parseCandidate$1(e.candidate.candidate);
13123
13151
  ips.push(candidate.ip);
13124
13152
  }
13125
13153
  } else if (!e.candidate) {
@@ -13156,7 +13184,7 @@ var checks = [
13156
13184
 
13157
13185
  //
13158
13186
 
13159
- const logger$1 = IssueReporter$1.loggerFor('engine-check');
13187
+ const logger$b = IssueReporter$1.loggerFor('engine-check');
13160
13188
 
13161
13189
  class Checker {
13162
13190
 
@@ -13174,28 +13202,28 @@ class Checker {
13174
13202
  async check(onCheckBegin = () => {}, onCheckResult = () => {}) {
13175
13203
  await this._addEngineVersion();
13176
13204
 
13177
- logger$1.info('Engine check starting');
13205
+ logger$b.info('Engine check starting');
13178
13206
 
13179
13207
  for (let i = 0; i < this.checks.length; i++) {
13180
13208
  const { name, check } = this.checks[i];
13181
13209
 
13182
- logger$1.info(`Checking ${name} ...`);
13210
+ logger$b.info(`Checking ${name} ...`);
13183
13211
 
13184
13212
  onCheckBegin(name);
13185
13213
  try {
13186
13214
  // eslint-disable-next-line no-await-in-loop
13187
13215
  const result = await check(this.server, this.session, this.externalAppConfig);
13188
- logger$1.info(`Checking ${name} success.`, { result });
13216
+ logger$b.info(`Checking ${name} success.`, { result });
13189
13217
 
13190
13218
  onCheckResult(name, result);
13191
13219
  } catch (e) {
13192
- logger$1.info(`Checking ${name} failure`, { message: e.message });
13220
+ logger$b.info(`Checking ${name} failure`, { message: e.message });
13193
13221
 
13194
13222
  onCheckResult(name, e);
13195
13223
  }
13196
13224
  }
13197
13225
 
13198
- logger$1.info('Engine check done.');
13226
+ logger$b.info('Engine check done.');
13199
13227
  }
13200
13228
 
13201
13229
  addCheck(check ) {
@@ -13219,7 +13247,7 @@ const Wazo = {
13219
13247
  Auth: Auth$1,
13220
13248
  Phone: Phone$1,
13221
13249
  Websocket: Websocket$1,
13222
- Room: Room$1,
13250
+ Room,
13223
13251
  SipRoom,
13224
13252
  RemoteParticipant,
13225
13253
  LocalParticipant,
@@ -13252,7 +13280,7 @@ const Wazo = {
13252
13280
  Session,
13253
13281
  Voicemail,
13254
13282
  Relocation,
13255
- ConferenceRoom: Room,
13283
+ ConferenceRoom: Room$1,
13256
13284
  CallSession,
13257
13285
  IndirectTransfer,
13258
13286
  SwitchboardCall,
@@ -13288,7 +13316,7 @@ if (global) {
13288
13316
 
13289
13317
  //
13290
13318
 
13291
- const logger = IssueReporter$1.loggerFor('simple-phone');
13319
+ const logger$c = IssueReporter$1.loggerFor('simple-phone');
13292
13320
  const sipLogger = IssueReporter$1.loggerFor('sip.js');
13293
13321
  const protocolLogger = IssueReporter$1.loggerFor('sip');
13294
13322
 
@@ -13395,7 +13423,7 @@ class Phone extends Emitter {
13395
13423
  async disconnect() {
13396
13424
  if (this.phone) {
13397
13425
  if (this.phone.hasAnActiveCall()) {
13398
- logger.info('hangup call on disconnect');
13426
+ logger$c.info('hangup call on disconnect');
13399
13427
  // $FlowFixMe
13400
13428
  await this.phone.hangup();
13401
13429
  }
@@ -13418,13 +13446,13 @@ class Phone extends Emitter {
13418
13446
  }
13419
13447
 
13420
13448
  async hangup(callSession ) {
13421
- logger.info('hangup via simple phone', { callId: callSession.getId() });
13449
+ logger$c.info('hangup via simple phone', { callId: callSession.getId() });
13422
13450
 
13423
13451
  return this.phone && this.phone.hangup(callSession);
13424
13452
  }
13425
13453
 
13426
13454
  async accept(callSession , cameraEnabled ) {
13427
- logger.info('accept via simple phone', { callId: callSession.getId(), cameraEnabled });
13455
+ logger$c.info('accept via simple phone', { callId: callSession.getId(), cameraEnabled });
13428
13456
 
13429
13457
  return this.phone && this.phone.accept(callSession, cameraEnabled);
13430
13458
  }
@@ -13463,7 +13491,7 @@ class Phone extends Emitter {
13463
13491
  muteViaAPI(callSession ) {
13464
13492
  if (callSession && callSession.callId) {
13465
13493
  Wazo.getApiClient().calld.mute(callSession.callId).catch(e => {
13466
- logger.error('Mute via API, error', e);
13494
+ logger$c.error('Mute via API, error', e);
13467
13495
  });
13468
13496
  }
13469
13497
  }
@@ -13471,7 +13499,7 @@ class Phone extends Emitter {
13471
13499
  unmuteViaAPI(callSession ) {
13472
13500
  if (callSession && callSession.callId) {
13473
13501
  Wazo.getApiClient().calld.unmute(callSession.callId).catch(e => {
13474
- logger.error('Unmute via API, error', e);
13502
+ logger$c.error('Unmute via API, error', e);
13475
13503
  });
13476
13504
  }
13477
13505
  }
@@ -13579,7 +13607,7 @@ class Phone extends Emitter {
13579
13607
 
13580
13608
  // @Deprecated
13581
13609
  getLocalMediaStream(callSession ) {
13582
- logger.warn('Phone.getLocalMediaStream is deprecated, use Phone.getLocalStream instead');
13610
+ logger$c.warn('Phone.getLocalMediaStream is deprecated, use Phone.getLocalStream instead');
13583
13611
 
13584
13612
  return this.phone && this.phone.getLocalStream(callSession);
13585
13613
  }
@@ -13602,20 +13630,20 @@ class Phone extends Emitter {
13602
13630
 
13603
13631
  // @Deprecated
13604
13632
  getRemoteStreamForCall(callSession ) {
13605
- logger.warn('Phone.getRemoteStreamForCall is deprecated, use Phone.getRemoteStream instead');
13633
+ logger$c.warn('Phone.getRemoteStreamForCall is deprecated, use Phone.getRemoteStream instead');
13606
13634
  return this.getRemoteStream(callSession);
13607
13635
  }
13608
13636
 
13609
13637
  // Returns remote streams directly from the peerConnection
13610
13638
  // @Deprecated
13611
13639
  getRemoteStreamsForCall(callSession ) {
13612
- logger.warn('Phone.getRemoteStreamsForCall is deprecated, use Phone.getLocalStream instead');
13640
+ logger$c.warn('Phone.getRemoteStreamsForCall is deprecated, use Phone.getLocalStream instead');
13613
13641
  return this.getLocalStream(callSession);
13614
13642
  }
13615
13643
 
13616
13644
  // @Deprecated
13617
13645
  getRemoteVideoStreamForCall(callSession ) {
13618
- logger.warn('Phone.getRemoteVideoStreamForCall is deprecated, use Phone.getRemoteVideoStream instead');
13646
+ logger$c.warn('Phone.getRemoteVideoStreamForCall is deprecated, use Phone.getRemoteVideoStream instead');
13619
13647
 
13620
13648
  return this.getRemoteVideoStream(callSession);
13621
13649
  }
@@ -13676,7 +13704,7 @@ class Phone extends Emitter {
13676
13704
 
13677
13705
  _transferEvents() {
13678
13706
  this.unbind();
13679
- [...events$1, ...transportEvents].forEach(event => {
13707
+ [...events, ...transportEvents].forEach(event => {
13680
13708
  this.client.on(event, (...args) =>
13681
13709
  this.eventEmitter.emit.apply(this.eventEmitter.emit, [`client-${event}`, ...args]));
13682
13710
  });