@wazo/sdk 0.37.33 → 0.37.36

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 (98) hide show
  1. package/README.md +1 -0
  2. package/dist/wazo-sdk.js +2 -2
  3. package/esm/__tests__/api-client.test.js +17 -0
  4. package/esm/__tests__/web-rtc-client.test.js +18 -1
  5. package/esm/api/auth.js +5 -0
  6. package/esm/api/call-logd.js +6 -0
  7. package/esm/api/chatd.js +6 -0
  8. package/esm/api/confd.js +6 -0
  9. package/esm/api-client.js +17 -0
  10. package/esm/checker/Checker.js +18 -1
  11. package/esm/checker/checks/aor.js +17 -0
  12. package/esm/checker/checks/api.js +17 -0
  13. package/esm/checker/checks/index.js +18 -1
  14. package/esm/checker/checks/webrtc-transport.js +18 -1
  15. package/esm/checker/checks/webrtc.js +18 -1
  16. package/esm/domain/AdHocAPIConference.js +21 -0
  17. package/esm/domain/CallLog.js +6 -0
  18. package/esm/domain/CallSession.js +14 -0
  19. package/esm/domain/Features.js +17 -0
  20. package/esm/domain/Phone/CTIPhone.js +31 -0
  21. package/esm/domain/Phone/WebRTCPhone.js +65 -15
  22. package/esm/domain/Profile.js +6 -0
  23. package/esm/domain/__tests__/CallLog.test.js +10 -0
  24. package/esm/domain/__tests__/CallSession.test.js +14 -0
  25. package/esm/domain/__tests__/IndirectTransfer.test.js +14 -0
  26. package/esm/domain/__tests__/Profile.test.js +6 -0
  27. package/esm/domain/__tests__/Room.test.js +14 -0
  28. package/esm/domain/__tests__/Session.test.js +6 -0
  29. package/esm/index.js +93 -22
  30. package/esm/service/CallApi.js +17 -0
  31. package/esm/service/getApiClient.js +17 -0
  32. package/esm/simple/Auth.js +93 -22
  33. package/esm/simple/Configuration.js +93 -22
  34. package/esm/simple/Directory.js +17 -0
  35. package/esm/simple/Phone.js +93 -22
  36. package/esm/simple/index.js +93 -22
  37. package/esm/simple/room/LocalParticipant.js +93 -22
  38. package/esm/simple/room/Participant.js +93 -22
  39. package/esm/simple/room/RemoteParticipant.js +93 -22
  40. package/esm/simple/room/Room.js +93 -22
  41. package/esm/simple/room/SipRoom.js +93 -22
  42. package/esm/simple/room/Stream.js +93 -22
  43. package/esm/simple/room/__tests__/RemoteParticipant.test.js +93 -22
  44. package/esm/simple/utils.js +93 -22
  45. package/esm/web-rtc-client.js +18 -1
  46. package/lib/__tests__/api-client.test.js +17 -0
  47. package/lib/__tests__/web-rtc-client.test.js +18 -1
  48. package/lib/api/auth.js +5 -0
  49. package/lib/api/call-logd.js +6 -0
  50. package/lib/api/chatd.js +6 -0
  51. package/lib/api/confd.js +6 -0
  52. package/lib/api-client.js +17 -0
  53. package/lib/checker/Checker.js +18 -1
  54. package/lib/checker/checks/aor.js +17 -0
  55. package/lib/checker/checks/api.js +17 -0
  56. package/lib/checker/checks/index.js +18 -1
  57. package/lib/checker/checks/webrtc-transport.js +18 -1
  58. package/lib/checker/checks/webrtc.js +18 -1
  59. package/lib/domain/AdHocAPIConference.js +21 -0
  60. package/lib/domain/CallLog.js +6 -0
  61. package/lib/domain/CallSession.js +14 -0
  62. package/lib/domain/Features.js +17 -0
  63. package/lib/domain/Phone/CTIPhone.js +31 -0
  64. package/lib/domain/Phone/WebRTCPhone.js +65 -15
  65. package/lib/domain/Profile.js +6 -0
  66. package/lib/domain/__tests__/CallLog.test.js +10 -0
  67. package/lib/domain/__tests__/CallSession.test.js +14 -0
  68. package/lib/domain/__tests__/IndirectTransfer.test.js +14 -0
  69. package/lib/domain/__tests__/Profile.test.js +6 -0
  70. package/lib/domain/__tests__/Room.test.js +14 -0
  71. package/lib/domain/__tests__/Session.test.js +6 -0
  72. package/lib/index.js +93 -22
  73. package/lib/service/CallApi.js +17 -0
  74. package/lib/service/getApiClient.js +17 -0
  75. package/lib/simple/Auth.js +93 -22
  76. package/lib/simple/Configuration.js +93 -22
  77. package/lib/simple/Directory.js +17 -0
  78. package/lib/simple/Phone.js +93 -22
  79. package/lib/simple/index.js +93 -22
  80. package/lib/simple/room/LocalParticipant.js +93 -22
  81. package/lib/simple/room/Participant.js +93 -22
  82. package/lib/simple/room/RemoteParticipant.js +93 -22
  83. package/lib/simple/room/Room.js +93 -22
  84. package/lib/simple/room/SipRoom.js +93 -22
  85. package/lib/simple/room/Stream.js +93 -22
  86. package/lib/simple/room/__tests__/RemoteParticipant.test.js +93 -22
  87. package/lib/simple/utils.js +93 -22
  88. package/lib/web-rtc-client.js +18 -1
  89. package/package.json +1 -1
  90. package/src/api/auth.js +5 -0
  91. package/src/domain/AdHocAPIConference.js +4 -0
  92. package/src/domain/CallLog.js +6 -0
  93. package/src/domain/CallSession.js +14 -0
  94. package/src/domain/Phone/WebRTCPhone.js +51 -15
  95. package/src/domain/Profile.js +6 -0
  96. package/src/domain/__tests__/CallLog.test.js +4 -0
  97. package/src/simple/Phone.js +6 -6
  98. package/src/web-rtc-client.js +1 -1
@@ -59,6 +59,7 @@ var updateFrom = (instance , from ) => {
59
59
 
60
60
 
61
61
 
62
+
62
63
 
63
64
 
64
65
  class CallSession {
@@ -121,6 +122,8 @@ class CallSession {
121
122
 
122
123
 
123
124
 
125
+
126
+
124
127
 
125
128
 
126
129
 
@@ -152,6 +155,7 @@ class CallSession {
152
155
  videoRemotelyDowngraded,
153
156
  sipSession,
154
157
  answerTime,
158
+ conference,
155
159
  } ) {
156
160
  this.callId = callId;
157
161
  this.sipCallId = sipCallId;
@@ -180,6 +184,7 @@ class CallSession {
180
184
  this.videoRemotelyDowngraded = videoRemotelyDowngraded;
181
185
  this.sipSession = sipSession;
182
186
  this.answerTime = answerTime || this.answerTime;
187
+ this.conference = conference;
183
188
 
184
189
  // Useful to compare instead of instanceof with minified code
185
190
  this.type = 'CallSession';
@@ -237,6 +242,10 @@ class CallSession {
237
242
  this.screensharing = false;
238
243
  }
239
244
 
245
+ setIsConference(conference ) {
246
+ this.conference = conference;
247
+ }
248
+
240
249
  isIncoming() {
241
250
  return !this.isCaller && !this.answered;
242
251
  }
@@ -313,6 +322,10 @@ class CallSession {
313
322
  return this.sipStatus === SessionState.Terminated;
314
323
  }
315
324
 
325
+ isConference() {
326
+ return this.conference;
327
+ }
328
+
316
329
  getElapsedTimeInSeconds() {
317
330
  if (!this.startTime) {
318
331
  return 0;
@@ -404,6 +417,7 @@ class CallSession {
404
417
  cameraEnabled: false,
405
418
  dialedExtension: call.dialedExtension,
406
419
  call,
420
+ conference: false, // @FIXME?
407
421
  });
408
422
  }
409
423
  }
@@ -191,6 +191,7 @@ const LINE_STATE = {
191
191
 
192
192
 
193
193
 
194
+
194
195
 
195
196
 
196
197
 
@@ -227,6 +228,7 @@ const LINE_STATE = {
227
228
 
228
229
 
229
230
 
231
+
230
232
 
231
233
 
232
234
 
@@ -258,6 +260,7 @@ class Profile {
258
260
 
259
261
 
260
262
 
263
+
261
264
 
262
265
 
263
266
 
@@ -274,6 +277,7 @@ class Profile {
274
277
  lines: plain.lines.map(line => Line.parse(line)),
275
278
  username: plain.username,
276
279
  mobileNumber: plain.mobile_phone_number || '',
280
+ ringSeconds: plain.ring_seconds,
277
281
  forwards: [
278
282
  ForwardOption.parse(plain.forwards.unconditional, FORWARD_KEYS.UNCONDITIONAL),
279
283
  ForwardOption.parse(plain.forwards.noanswer, FORWARD_KEYS.NO_ANSWER),
@@ -310,6 +314,7 @@ class Profile {
310
314
  switchboards,
311
315
  agent,
312
316
  status,
317
+ ringSeconds,
313
318
  sipLines,
314
319
  callPickupTargetUsers,
315
320
  onlineCallRecordEnabled,
@@ -331,6 +336,7 @@ class Profile {
331
336
  this.status = status;
332
337
  this.callPickupTargetUsers = callPickupTargetUsers;
333
338
  this.onlineCallRecordEnabled = onlineCallRecordEnabled;
339
+ this.ringSeconds = ringSeconds;
334
340
 
335
341
  this.sipLines = sipLines || [];
336
342
  }
@@ -59,6 +59,7 @@ var updateFrom = (instance , from ) => {
59
59
 
60
60
 
61
61
 
62
+
62
63
 
63
64
 
64
65
  class CallSession {
@@ -121,6 +122,8 @@ class CallSession {
121
122
 
122
123
 
123
124
 
125
+
126
+
124
127
 
125
128
 
126
129
 
@@ -152,6 +155,7 @@ class CallSession {
152
155
  videoRemotelyDowngraded,
153
156
  sipSession,
154
157
  answerTime,
158
+ conference,
155
159
  } ) {
156
160
  this.callId = callId;
157
161
  this.sipCallId = sipCallId;
@@ -180,6 +184,7 @@ class CallSession {
180
184
  this.videoRemotelyDowngraded = videoRemotelyDowngraded;
181
185
  this.sipSession = sipSession;
182
186
  this.answerTime = answerTime || this.answerTime;
187
+ this.conference = conference;
183
188
 
184
189
  // Useful to compare instead of instanceof with minified code
185
190
  this.type = 'CallSession';
@@ -237,6 +242,10 @@ class CallSession {
237
242
  this.screensharing = false;
238
243
  }
239
244
 
245
+ setIsConference(conference ) {
246
+ this.conference = conference;
247
+ }
248
+
240
249
  isIncoming() {
241
250
  return !this.isCaller && !this.answered;
242
251
  }
@@ -313,6 +322,10 @@ class CallSession {
313
322
  return this.sipStatus === SessionState.Terminated;
314
323
  }
315
324
 
325
+ isConference() {
326
+ return this.conference;
327
+ }
328
+
316
329
  getElapsedTimeInSeconds() {
317
330
  if (!this.startTime) {
318
331
  return 0;
@@ -404,6 +417,7 @@ class CallSession {
404
417
  cameraEnabled: false,
405
418
  dialedExtension: call.dialedExtension,
406
419
  call,
420
+ conference: false, // @FIXME?
407
421
  });
408
422
  }
409
423
  }
@@ -205,6 +205,7 @@ const LINE_STATE = {
205
205
 
206
206
 
207
207
 
208
+
208
209
 
209
210
 
210
211
 
@@ -241,6 +242,7 @@ const LINE_STATE = {
241
242
 
242
243
 
243
244
 
245
+
244
246
 
245
247
 
246
248
 
@@ -272,6 +274,7 @@ class Profile {
272
274
 
273
275
 
274
276
 
277
+
275
278
 
276
279
 
277
280
 
@@ -288,6 +291,7 @@ class Profile {
288
291
  lines: plain.lines.map(line => Line.parse(line)),
289
292
  username: plain.username,
290
293
  mobileNumber: plain.mobile_phone_number || '',
294
+ ringSeconds: plain.ring_seconds,
291
295
  forwards: [
292
296
  ForwardOption.parse(plain.forwards.unconditional, FORWARD_KEYS.UNCONDITIONAL),
293
297
  ForwardOption.parse(plain.forwards.noanswer, FORWARD_KEYS.NO_ANSWER),
@@ -324,6 +328,7 @@ class Profile {
324
328
  switchboards,
325
329
  agent,
326
330
  status,
331
+ ringSeconds,
327
332
  sipLines,
328
333
  callPickupTargetUsers,
329
334
  onlineCallRecordEnabled,
@@ -345,6 +350,7 @@ class Profile {
345
350
  this.status = status;
346
351
  this.callPickupTargetUsers = callPickupTargetUsers;
347
352
  this.onlineCallRecordEnabled = onlineCallRecordEnabled;
353
+ this.ringSeconds = ringSeconds;
348
354
 
349
355
  this.sipLines = sipLines || [];
350
356
  }
package/esm/index.js CHANGED
@@ -1072,6 +1072,7 @@ const LINE_STATE = {
1072
1072
 
1073
1073
 
1074
1074
 
1075
+
1075
1076
 
1076
1077
 
1077
1078
 
@@ -1108,6 +1109,7 @@ const LINE_STATE = {
1108
1109
 
1109
1110
 
1110
1111
 
1112
+
1111
1113
 
1112
1114
 
1113
1115
 
@@ -1139,6 +1141,7 @@ class Profile {
1139
1141
 
1140
1142
 
1141
1143
 
1144
+
1142
1145
 
1143
1146
 
1144
1147
 
@@ -1155,6 +1158,7 @@ class Profile {
1155
1158
  lines: plain.lines.map(line => Line.parse(line)),
1156
1159
  username: plain.username,
1157
1160
  mobileNumber: plain.mobile_phone_number || '',
1161
+ ringSeconds: plain.ring_seconds,
1158
1162
  forwards: [
1159
1163
  ForwardOption.parse(plain.forwards.unconditional, FORWARD_KEYS.UNCONDITIONAL),
1160
1164
  ForwardOption.parse(plain.forwards.noanswer, FORWARD_KEYS.NO_ANSWER),
@@ -1191,6 +1195,7 @@ class Profile {
1191
1195
  switchboards,
1192
1196
  agent,
1193
1197
  status,
1198
+ ringSeconds,
1194
1199
  sipLines,
1195
1200
  callPickupTargetUsers,
1196
1201
  onlineCallRecordEnabled,
@@ -1212,6 +1217,7 @@ class Profile {
1212
1217
  this.status = status;
1213
1218
  this.callPickupTargetUsers = callPickupTargetUsers;
1214
1219
  this.onlineCallRecordEnabled = onlineCallRecordEnabled;
1220
+ this.ringSeconds = ringSeconds;
1215
1221
 
1216
1222
  this.sipLines = sipLines || [];
1217
1223
  }
@@ -2217,6 +2223,7 @@ var authMethods = (client , baseUrl ) => ({
2217
2223
 
2218
2224
 
2219
2225
 
2226
+
2220
2227
  ) {
2221
2228
  const body = {
2222
2229
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -2236,6 +2243,10 @@ var authMethods = (client , baseUrl ) => ({
2236
2243
  headers['Wazo-Session-Type'] = 'mobile';
2237
2244
  }
2238
2245
 
2246
+ if (params.tenantId) {
2247
+ body.tenant_id = params.tenantId;
2248
+ }
2249
+
2239
2250
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
2240
2251
  },
2241
2252
 
@@ -3276,6 +3287,7 @@ var updateFrom = (instance , from ) => {
3276
3287
 
3277
3288
 
3278
3289
 
3290
+
3279
3291
 
3280
3292
 
3281
3293
  class CallSession {
@@ -3338,6 +3350,8 @@ class CallSession {
3338
3350
 
3339
3351
 
3340
3352
 
3353
+
3354
+
3341
3355
 
3342
3356
 
3343
3357
 
@@ -3369,6 +3383,7 @@ class CallSession {
3369
3383
  videoRemotelyDowngraded,
3370
3384
  sipSession,
3371
3385
  answerTime,
3386
+ conference,
3372
3387
  } ) {
3373
3388
  this.callId = callId;
3374
3389
  this.sipCallId = sipCallId;
@@ -3397,6 +3412,7 @@ class CallSession {
3397
3412
  this.videoRemotelyDowngraded = videoRemotelyDowngraded;
3398
3413
  this.sipSession = sipSession;
3399
3414
  this.answerTime = answerTime || this.answerTime;
3415
+ this.conference = conference;
3400
3416
 
3401
3417
  // Useful to compare instead of instanceof with minified code
3402
3418
  this.type = 'CallSession';
@@ -3454,6 +3470,10 @@ class CallSession {
3454
3470
  this.screensharing = false;
3455
3471
  }
3456
3472
 
3473
+ setIsConference(conference ) {
3474
+ this.conference = conference;
3475
+ }
3476
+
3457
3477
  isIncoming() {
3458
3478
  return !this.isCaller && !this.answered;
3459
3479
  }
@@ -3530,6 +3550,10 @@ class CallSession {
3530
3550
  return this.sipStatus === SessionState.Terminated;
3531
3551
  }
3532
3552
 
3553
+ isConference() {
3554
+ return this.conference;
3555
+ }
3556
+
3533
3557
  getElapsedTimeInSeconds() {
3534
3558
  if (!this.startTime) {
3535
3559
  return 0;
@@ -3621,6 +3645,7 @@ class CallSession {
3621
3645
  cameraEnabled: false,
3622
3646
  dialedExtension: call.dialedExtension,
3623
3647
  call,
3648
+ conference: false, // @FIXME?
3624
3649
  });
3625
3650
  }
3626
3651
  }
@@ -3710,11 +3735,13 @@ class Recording {
3710
3735
 
3711
3736
 
3712
3737
 
3738
+
3713
3739
 
3714
3740
 
3715
3741
 
3716
3742
 
3717
3743
 
3744
+
3718
3745
 
3719
3746
 
3720
3747
 
@@ -3735,10 +3762,12 @@ class Recording {
3735
3762
 
3736
3763
 
3737
3764
 
3765
+
3738
3766
 
3739
3767
 
3740
3768
 
3741
3769
 
3770
+
3742
3771
 
3743
3772
 
3744
3773
 
@@ -3800,10 +3829,12 @@ class CallLog {
3800
3829
  || plain.destination_extension
3801
3830
  || `meeting-${plain.requested_name || plain.destination_name || ''}`,
3802
3831
  name: plain.requested_name || plain.destination_name || '',
3832
+ uuid: plain.destination_user_uuid,
3803
3833
  },
3804
3834
  source: {
3805
3835
  extension: plain.source_extension,
3806
3836
  name: plain.source_name,
3837
+ uuid: plain.source_user_uuid,
3807
3838
  },
3808
3839
  id: plain.id,
3809
3840
  duration: (plain.duration || 0) * 1000, // duration is in seconds
@@ -6225,7 +6256,7 @@ const events$1 = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
6225
6256
  const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
6226
6257
  class CanceledCallError extends Error {}
6227
6258
 
6228
- const MAX_REGISTER_TRIES = 10;
6259
+ const MAX_REGISTER_TRIES = 5;
6229
6260
 
6230
6261
 
6231
6262
 
@@ -10081,7 +10112,11 @@ class WebRTCPhone extends Emitter {
10081
10112
  accept(callSession , cameraEnabled ) {
10082
10113
  logger$7.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
10083
10114
  if (this.currentSipSession) {
10084
- this.holdSipSession(this.currentSipSession, this.currentCallSession, true);
10115
+ this.holdSipSession(
10116
+ this.currentSipSession,
10117
+ this.currentCallSession,
10118
+ true,
10119
+ );
10085
10120
  }
10086
10121
 
10087
10122
  if (!callSession) {
@@ -10089,6 +10124,12 @@ class WebRTCPhone extends Emitter {
10089
10124
  return Promise.resolve(null);
10090
10125
  }
10091
10126
 
10127
+ const sipSessionId = this.getSipSessionIdFromCallSession(callSession);
10128
+ if (sipSessionId && !(sipSessionId in this.callSessions)) {
10129
+ logger$7.warn('Call session already ended or not found, can\'t accept it.', { sipSessionId });
10130
+ return Promise.resolve(null);
10131
+ }
10132
+
10092
10133
  if (callSession.getId() in this.acceptedSessions) {
10093
10134
  logger$7.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
10094
10135
  return Promise.resolve(callSession.sipCallId);
@@ -10168,22 +10209,22 @@ class WebRTCPhone extends Emitter {
10168
10209
  }
10169
10210
  }
10170
10211
 
10171
- hold(callSession , withEvent = true, isConference = false) {
10212
+ hold(callSession , withEvent = true) {
10172
10213
  logger$7.info('WebRTC hold', { id: callSession.getId() });
10173
10214
 
10174
10215
  const sipSession = this.findSipSession(callSession);
10175
10216
 
10176
- return sipSession ? this.holdSipSession(sipSession, callSession, withEvent, isConference) : null;
10217
+ return sipSession ? this.holdSipSession(sipSession, callSession, withEvent) : null;
10177
10218
  }
10178
10219
 
10179
10220
  // @Deprecated
10180
- unhold(callSession , withEvent = true, isConference = false) {
10221
+ unhold(callSession , withEvent = true) {
10181
10222
  console.warn('Please note that `phone.unhold()` is being deprecated; `phone.resume()` is the preferred method');
10182
10223
 
10183
- return this.resume(callSession, isConference, withEvent);
10224
+ return this.resume(callSession, withEvent);
10184
10225
  }
10185
10226
 
10186
- resume(callSession , isConference = false, withEvent = true) {
10227
+ resume(callSession , withEvent = true) {
10187
10228
  logger$7.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
10188
10229
 
10189
10230
  const sipSession = this.findSipSession(callSession);
@@ -10196,10 +10237,14 @@ class WebRTCPhone extends Emitter {
10196
10237
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
10197
10238
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
10198
10239
  logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
10199
- this.holdSipSession(this.currentSipSession, this.currentCallSession);
10240
+ this.holdSipSession(
10241
+ this.currentSipSession,
10242
+ this.currentCallSession,
10243
+ withEvent,
10244
+ );
10200
10245
  }
10201
10246
 
10202
- const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
10247
+ const promise = this.unholdSipSession(sipSession, callSession, withEvent);
10203
10248
  this.currentSipSession = sipSession;
10204
10249
  if (callSession) {
10205
10250
  this.currentCallSession = callSession;
@@ -10212,7 +10257,6 @@ class WebRTCPhone extends Emitter {
10212
10257
  sipSession ,
10213
10258
  callSession ,
10214
10259
  withEvent = true,
10215
- isConference = false,
10216
10260
  ) {
10217
10261
  if (!sipSession) {
10218
10262
  return new Promise((resolve, reject) => reject(new Error('No session to hold')));
@@ -10233,6 +10277,8 @@ class WebRTCPhone extends Emitter {
10233
10277
  await this.client.downgradeToAudio(sipSession);
10234
10278
  }
10235
10279
 
10280
+ const isConference = !!callSession && callSession.isConference();
10281
+
10236
10282
  const promise = this.client.hold(sipSession, isConference, hasVideo);
10237
10283
  if (withEvent) {
10238
10284
  this.eventEmitter.emit(ON_CALL_HELD, this._createCallSession(sipSession, callSession));
@@ -10245,11 +10291,13 @@ class WebRTCPhone extends Emitter {
10245
10291
  sipSession ,
10246
10292
  callSession ,
10247
10293
  withEvent = true,
10248
- isConference = false,
10249
10294
  ) {
10250
10295
  if (!sipSession) {
10251
10296
  return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
10252
10297
  }
10298
+
10299
+ const isConference = !!callSession && callSession.isConference();
10300
+
10253
10301
  const sessionId = this.getSipSessionId(sipSession);
10254
10302
  logger$7.info('WebRTC unhold sip session', { sessionId, isConference });
10255
10303
 
@@ -10391,7 +10439,11 @@ class WebRTCPhone extends Emitter {
10391
10439
  await this.client.register();
10392
10440
  }
10393
10441
  if (this.currentSipSession) {
10394
- this.holdSipSession(this.currentSipSession, this.currentCallSession, true).catch(e => {
10442
+ this.holdSipSession(
10443
+ this.currentSipSession,
10444
+ this.currentCallSession,
10445
+ true,
10446
+ ).catch(e => {
10395
10447
  logger$7.warn('Unable to hold current session when making another call', e);
10396
10448
  });
10397
10449
  }
@@ -10406,6 +10458,7 @@ class WebRTCPhone extends Emitter {
10406
10458
  return Promise.resolve(null);
10407
10459
  }
10408
10460
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
10461
+ callSession.setIsConference(conference);
10409
10462
  callSession.creationTime = new Date();
10410
10463
  this._updateCallSession(callSession);
10411
10464
 
@@ -10713,9 +10766,17 @@ class WebRTCPhone extends Emitter {
10713
10766
  });
10714
10767
 
10715
10768
  this.client.on(this.client.ACCEPTED, (sipSession ) => {
10716
- logger$7.info('WebRTC call accepted', { sipId: sipSession.id });
10769
+ const sessionId = this.getSipSessionId(sipSession);
10770
+ const hasSession = sessionId in this.callSessions;
10771
+
10772
+ logger$7.info('WebRTC call accepted', { sipId: sessionId, hasSession });
10773
+
10774
+ if (!hasSession) {
10775
+ logger$7.warn('Call accepted ignored, session is no longer present in the WebRtcPhone', { sessionId });
10776
+ return;
10777
+ }
10717
10778
 
10718
- this._onCallAccepted(sipSession, this.client.hasVideo(this.getSipSessionId(sipSession)));
10779
+ this._onCallAccepted(sipSession, this.client.hasVideo(sessionId));
10719
10780
 
10720
10781
  if (this.audioOutputDeviceId) {
10721
10782
  this.client.changeAudioOutputDevice(this.audioOutputDeviceId);
@@ -10851,9 +10912,14 @@ class WebRTCPhone extends Emitter {
10851
10912
  return this.client.getSipSessionId(sipSession);
10852
10913
  }
10853
10914
 
10854
- _updateCallSession(callSession ) {
10915
+ getSipSessionIdFromCallSession(callSession ) {
10855
10916
  const sipSession = this.findSipSession(callSession);
10856
- const sipSessionId = sipSession ? this.getSipSessionId(sipSession) : null;
10917
+
10918
+ return sipSession ? this.getSipSessionId(sipSession) : null;
10919
+ }
10920
+
10921
+ _updateCallSession(callSession ) {
10922
+ const sipSessionId = this.getSipSessionIdFromCallSession(callSession);
10857
10923
 
10858
10924
  if (sipSessionId) {
10859
10925
  this.callSessions[sipSessionId] = callSession;
@@ -10971,6 +11037,7 @@ class WebRTCPhone extends Emitter {
10971
11037
  recording: fromSession ? fromSession.isRecording() : false,
10972
11038
  recordingPaused: false, // @TODO
10973
11039
  sipSession,
11040
+ conference: !!fromSession && fromSession.isConference(),
10974
11041
  ...extra,
10975
11042
  });
10976
11043
 
@@ -11960,6 +12027,10 @@ class AdHocAPIConference {
11960
12027
  this.conferenceId = conferenceId || '';
11961
12028
  this.muted = muted || false;
11962
12029
  this.paused = paused || false;
12030
+
12031
+ if (this.host) {
12032
+ this.host.setIsConference(true);
12033
+ }
11963
12034
  }
11964
12035
 
11965
12036
  async start() {
@@ -12254,16 +12325,16 @@ class Phone extends Emitter {
12254
12325
  }
12255
12326
  }
12256
12327
 
12257
- hold(callSession , isConference = false) {
12258
- return this.phone && this.phone.hold(callSession, true, isConference);
12328
+ hold(callSession ) {
12329
+ return this.phone && this.phone.hold(callSession, true);
12259
12330
  }
12260
12331
 
12261
- unhold(callSession , isConference = false) {
12262
- return this.phone && this.phone.unhold(callSession, true, isConference);
12332
+ unhold(callSession ) {
12333
+ return this.phone && this.phone.unhold(callSession, true);
12263
12334
  }
12264
12335
 
12265
- resume(callSession , isConference = false) {
12266
- return this.phone && this.phone.resume(callSession, isConference);
12336
+ resume(callSession ) {
12337
+ return this.phone && this.phone.resume(callSession);
12267
12338
  }
12268
12339
 
12269
12340
  reject(callSession ) {
@@ -558,6 +558,7 @@ const LINE_STATE = {
558
558
 
559
559
 
560
560
 
561
+
561
562
 
562
563
 
563
564
 
@@ -594,6 +595,7 @@ const LINE_STATE = {
594
595
 
595
596
 
596
597
 
598
+
597
599
 
598
600
 
599
601
 
@@ -625,6 +627,7 @@ class Profile {
625
627
 
626
628
 
627
629
 
630
+
628
631
 
629
632
 
630
633
 
@@ -641,6 +644,7 @@ class Profile {
641
644
  lines: plain.lines.map(line => Line.parse(line)),
642
645
  username: plain.username,
643
646
  mobileNumber: plain.mobile_phone_number || '',
647
+ ringSeconds: plain.ring_seconds,
644
648
  forwards: [
645
649
  ForwardOption.parse(plain.forwards.unconditional, FORWARD_KEYS.UNCONDITIONAL),
646
650
  ForwardOption.parse(plain.forwards.noanswer, FORWARD_KEYS.NO_ANSWER),
@@ -677,6 +681,7 @@ class Profile {
677
681
  switchboards,
678
682
  agent,
679
683
  status,
684
+ ringSeconds,
680
685
  sipLines,
681
686
  callPickupTargetUsers,
682
687
  onlineCallRecordEnabled,
@@ -698,6 +703,7 @@ class Profile {
698
703
  this.status = status;
699
704
  this.callPickupTargetUsers = callPickupTargetUsers;
700
705
  this.onlineCallRecordEnabled = onlineCallRecordEnabled;
706
+ this.ringSeconds = ringSeconds;
701
707
 
702
708
  this.sipLines = sipLines || [];
703
709
  }
@@ -1745,11 +1751,13 @@ class Recording {
1745
1751
 
1746
1752
 
1747
1753
 
1754
+
1748
1755
 
1749
1756
 
1750
1757
 
1751
1758
 
1752
1759
 
1760
+
1753
1761
 
1754
1762
 
1755
1763
 
@@ -1770,10 +1778,12 @@ class Recording {
1770
1778
 
1771
1779
 
1772
1780
 
1781
+
1773
1782
 
1774
1783
 
1775
1784
 
1776
1785
 
1786
+
1777
1787
 
1778
1788
 
1779
1789
 
@@ -1835,10 +1845,12 @@ class CallLog {
1835
1845
  || plain.destination_extension
1836
1846
  || `meeting-${plain.requested_name || plain.destination_name || ''}`,
1837
1847
  name: plain.requested_name || plain.destination_name || '',
1848
+ uuid: plain.destination_user_uuid,
1838
1849
  },
1839
1850
  source: {
1840
1851
  extension: plain.source_extension,
1841
1852
  name: plain.source_name,
1853
+ uuid: plain.source_user_uuid,
1842
1854
  },
1843
1855
  id: plain.id,
1844
1856
  duration: (plain.duration || 0) * 1000, // duration is in seconds
@@ -2731,6 +2743,7 @@ var authMethods = (client , baseUrl ) => ({
2731
2743
 
2732
2744
 
2733
2745
 
2746
+
2734
2747
  ) {
2735
2748
  const body = {
2736
2749
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -2750,6 +2763,10 @@ var authMethods = (client , baseUrl ) => ({
2750
2763
  headers['Wazo-Session-Type'] = 'mobile';
2751
2764
  }
2752
2765
 
2766
+ if (params.tenantId) {
2767
+ body.tenant_id = params.tenantId;
2768
+ }
2769
+
2753
2770
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
2754
2771
  },
2755
2772