@wazo/sdk 0.37.34 → 0.37.37
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.
- package/README.md +8 -2
- package/dist/wazo-sdk.js +2 -2
- package/esm/__tests__/api-client.test.js +17 -0
- package/esm/__tests__/web-rtc-client.test.js +17 -0
- package/esm/api/auth.js +7 -1
- package/esm/api/call-logd.js +6 -0
- package/esm/api/chatd.js +6 -0
- package/esm/api/confd.js +6 -0
- package/esm/api-client.js +17 -0
- package/esm/checker/Checker.js +17 -0
- package/esm/checker/checks/aor.js +17 -0
- package/esm/checker/checks/api.js +17 -0
- package/esm/checker/checks/index.js +17 -0
- package/esm/checker/checks/webrtc-transport.js +17 -0
- package/esm/checker/checks/webrtc.js +17 -0
- package/esm/domain/AdHocAPIConference.js +21 -0
- package/esm/domain/CallLog.js +6 -0
- package/esm/domain/CallSession.js +14 -0
- package/esm/domain/Features.js +17 -0
- package/esm/domain/Phone/CTIPhone.js +31 -0
- package/esm/domain/Phone/WebRTCPhone.js +42 -11
- package/esm/domain/Profile.js +6 -0
- package/esm/domain/__tests__/CallLog.test.js +10 -0
- package/esm/domain/__tests__/CallSession.test.js +14 -0
- package/esm/domain/__tests__/IndirectTransfer.test.js +14 -0
- package/esm/domain/__tests__/Profile.test.js +6 -0
- package/esm/domain/__tests__/Room.test.js +14 -0
- package/esm/domain/__tests__/Session.test.js +6 -0
- package/esm/index.js +83 -18
- package/esm/service/CallApi.js +17 -0
- package/esm/service/getApiClient.js +17 -0
- package/esm/simple/Auth.js +84 -19
- package/esm/simple/Configuration.js +83 -18
- package/esm/simple/Directory.js +17 -0
- package/esm/simple/Phone.js +83 -18
- package/esm/simple/index.js +83 -18
- package/esm/simple/room/LocalParticipant.js +83 -18
- package/esm/simple/room/Participant.js +83 -18
- package/esm/simple/room/RemoteParticipant.js +83 -18
- package/esm/simple/room/Room.js +83 -18
- package/esm/simple/room/SipRoom.js +83 -18
- package/esm/simple/room/Stream.js +83 -18
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +83 -18
- package/esm/simple/utils.js +83 -18
- package/esm/web-rtc-client.js +17 -0
- package/lib/__tests__/api-client.test.js +17 -0
- package/lib/__tests__/web-rtc-client.test.js +17 -0
- package/lib/api/auth.js +8 -0
- package/lib/api/call-logd.js +6 -0
- package/lib/api/chatd.js +6 -0
- package/lib/api/confd.js +6 -0
- package/lib/api-client.js +17 -0
- package/lib/checker/Checker.js +17 -0
- package/lib/checker/checks/aor.js +17 -0
- package/lib/checker/checks/api.js +17 -0
- package/lib/checker/checks/index.js +17 -0
- package/lib/checker/checks/webrtc-transport.js +17 -0
- package/lib/checker/checks/webrtc.js +17 -0
- package/lib/domain/AdHocAPIConference.js +21 -0
- package/lib/domain/CallLog.js +6 -0
- package/lib/domain/CallSession.js +14 -0
- package/lib/domain/Features.js +17 -0
- package/lib/domain/Phone/CTIPhone.js +31 -0
- package/lib/domain/Phone/WebRTCPhone.js +42 -11
- package/lib/domain/Profile.js +6 -0
- package/lib/domain/__tests__/CallLog.test.js +10 -0
- package/lib/domain/__tests__/CallSession.test.js +14 -0
- package/lib/domain/__tests__/IndirectTransfer.test.js +14 -0
- package/lib/domain/__tests__/Profile.test.js +6 -0
- package/lib/domain/__tests__/Room.test.js +14 -0
- package/lib/domain/__tests__/Session.test.js +6 -0
- package/lib/index.js +83 -18
- package/lib/service/CallApi.js +17 -0
- package/lib/service/getApiClient.js +17 -0
- package/lib/simple/Auth.js +84 -18
- package/lib/simple/Configuration.js +83 -18
- package/lib/simple/Directory.js +17 -0
- package/lib/simple/Phone.js +83 -18
- package/lib/simple/index.js +83 -18
- package/lib/simple/room/LocalParticipant.js +83 -18
- package/lib/simple/room/Participant.js +83 -18
- package/lib/simple/room/RemoteParticipant.js +83 -18
- package/lib/simple/room/Room.js +83 -18
- package/lib/simple/room/SipRoom.js +83 -18
- package/lib/simple/room/Stream.js +83 -18
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +83 -18
- package/lib/simple/utils.js +83 -18
- package/lib/web-rtc-client.js +17 -0
- package/package.json +1 -1
- package/src/api/auth.js +7 -1
- package/src/domain/AdHocAPIConference.js +4 -0
- package/src/domain/CallLog.js +6 -0
- package/src/domain/CallSession.js +14 -0
- package/src/domain/Phone/WebRTCPhone.js +28 -11
- package/src/domain/Profile.js +6 -0
- package/src/domain/__tests__/CallLog.test.js +4 -0
- package/src/simple/Auth.js +13 -2
- package/src/simple/Phone.js +6 -6
- package/src/simple/index.js +2 -1
|
@@ -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
|
}
|
|
@@ -2203,6 +2209,7 @@ class Session {
|
|
|
2203
2209
|
/* */
|
|
2204
2210
|
|
|
2205
2211
|
const DEFAULT_BACKEND_USER = 'wazo_user';
|
|
2212
|
+
const BACKEND_LDAP_USER = 'ldap_user';
|
|
2206
2213
|
const DETAULT_EXPIRATION = 3600;
|
|
2207
2214
|
|
|
2208
2215
|
var authMethods = (client , baseUrl ) => ({
|
|
@@ -2217,6 +2224,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2217
2224
|
|
|
2218
2225
|
|
|
2219
2226
|
|
|
2227
|
+
|
|
2220
2228
|
) {
|
|
2221
2229
|
const body = {
|
|
2222
2230
|
backend: params.backend || DEFAULT_BACKEND_USER,
|
|
@@ -2236,6 +2244,10 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2236
2244
|
headers['Wazo-Session-Type'] = 'mobile';
|
|
2237
2245
|
}
|
|
2238
2246
|
|
|
2247
|
+
if (params.tenantId) {
|
|
2248
|
+
body.tenant_id = params.tenantId;
|
|
2249
|
+
}
|
|
2250
|
+
|
|
2239
2251
|
return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
|
|
2240
2252
|
},
|
|
2241
2253
|
|
|
@@ -3276,6 +3288,7 @@ var updateFrom = (instance , from ) => {
|
|
|
3276
3288
|
|
|
3277
3289
|
|
|
3278
3290
|
|
|
3291
|
+
|
|
3279
3292
|
|
|
3280
3293
|
|
|
3281
3294
|
class CallSession {
|
|
@@ -3338,6 +3351,8 @@ class CallSession {
|
|
|
3338
3351
|
|
|
3339
3352
|
|
|
3340
3353
|
|
|
3354
|
+
|
|
3355
|
+
|
|
3341
3356
|
|
|
3342
3357
|
|
|
3343
3358
|
|
|
@@ -3369,6 +3384,7 @@ class CallSession {
|
|
|
3369
3384
|
videoRemotelyDowngraded,
|
|
3370
3385
|
sipSession,
|
|
3371
3386
|
answerTime,
|
|
3387
|
+
conference,
|
|
3372
3388
|
} ) {
|
|
3373
3389
|
this.callId = callId;
|
|
3374
3390
|
this.sipCallId = sipCallId;
|
|
@@ -3397,6 +3413,7 @@ class CallSession {
|
|
|
3397
3413
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
3398
3414
|
this.sipSession = sipSession;
|
|
3399
3415
|
this.answerTime = answerTime || this.answerTime;
|
|
3416
|
+
this.conference = conference;
|
|
3400
3417
|
|
|
3401
3418
|
// Useful to compare instead of instanceof with minified code
|
|
3402
3419
|
this.type = 'CallSession';
|
|
@@ -3454,6 +3471,10 @@ class CallSession {
|
|
|
3454
3471
|
this.screensharing = false;
|
|
3455
3472
|
}
|
|
3456
3473
|
|
|
3474
|
+
setIsConference(conference ) {
|
|
3475
|
+
this.conference = conference;
|
|
3476
|
+
}
|
|
3477
|
+
|
|
3457
3478
|
isIncoming() {
|
|
3458
3479
|
return !this.isCaller && !this.answered;
|
|
3459
3480
|
}
|
|
@@ -3530,6 +3551,10 @@ class CallSession {
|
|
|
3530
3551
|
return this.sipStatus === SessionState.Terminated;
|
|
3531
3552
|
}
|
|
3532
3553
|
|
|
3554
|
+
isConference() {
|
|
3555
|
+
return this.conference;
|
|
3556
|
+
}
|
|
3557
|
+
|
|
3533
3558
|
getElapsedTimeInSeconds() {
|
|
3534
3559
|
if (!this.startTime) {
|
|
3535
3560
|
return 0;
|
|
@@ -3621,6 +3646,7 @@ class CallSession {
|
|
|
3621
3646
|
cameraEnabled: false,
|
|
3622
3647
|
dialedExtension: call.dialedExtension,
|
|
3623
3648
|
call,
|
|
3649
|
+
conference: false, // @FIXME?
|
|
3624
3650
|
});
|
|
3625
3651
|
}
|
|
3626
3652
|
}
|
|
@@ -3710,11 +3736,13 @@ class Recording {
|
|
|
3710
3736
|
|
|
3711
3737
|
|
|
3712
3738
|
|
|
3739
|
+
|
|
3713
3740
|
|
|
3714
3741
|
|
|
3715
3742
|
|
|
3716
3743
|
|
|
3717
3744
|
|
|
3745
|
+
|
|
3718
3746
|
|
|
3719
3747
|
|
|
3720
3748
|
|
|
@@ -3735,10 +3763,12 @@ class Recording {
|
|
|
3735
3763
|
|
|
3736
3764
|
|
|
3737
3765
|
|
|
3766
|
+
|
|
3738
3767
|
|
|
3739
3768
|
|
|
3740
3769
|
|
|
3741
3770
|
|
|
3771
|
+
|
|
3742
3772
|
|
|
3743
3773
|
|
|
3744
3774
|
|
|
@@ -3800,10 +3830,12 @@ class CallLog {
|
|
|
3800
3830
|
|| plain.destination_extension
|
|
3801
3831
|
|| `meeting-${plain.requested_name || plain.destination_name || ''}`,
|
|
3802
3832
|
name: plain.requested_name || plain.destination_name || '',
|
|
3833
|
+
uuid: plain.destination_user_uuid,
|
|
3803
3834
|
},
|
|
3804
3835
|
source: {
|
|
3805
3836
|
extension: plain.source_extension,
|
|
3806
3837
|
name: plain.source_name,
|
|
3838
|
+
uuid: plain.source_user_uuid,
|
|
3807
3839
|
},
|
|
3808
3840
|
id: plain.id,
|
|
3809
3841
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
@@ -10081,7 +10113,11 @@ class WebRTCPhone extends Emitter {
|
|
|
10081
10113
|
accept(callSession , cameraEnabled ) {
|
|
10082
10114
|
logger$7.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
|
|
10083
10115
|
if (this.currentSipSession) {
|
|
10084
|
-
this.holdSipSession(
|
|
10116
|
+
this.holdSipSession(
|
|
10117
|
+
this.currentSipSession,
|
|
10118
|
+
this.currentCallSession,
|
|
10119
|
+
true,
|
|
10120
|
+
);
|
|
10085
10121
|
}
|
|
10086
10122
|
|
|
10087
10123
|
if (!callSession) {
|
|
@@ -10174,22 +10210,22 @@ class WebRTCPhone extends Emitter {
|
|
|
10174
10210
|
}
|
|
10175
10211
|
}
|
|
10176
10212
|
|
|
10177
|
-
hold(callSession , withEvent = true
|
|
10213
|
+
hold(callSession , withEvent = true) {
|
|
10178
10214
|
logger$7.info('WebRTC hold', { id: callSession.getId() });
|
|
10179
10215
|
|
|
10180
10216
|
const sipSession = this.findSipSession(callSession);
|
|
10181
10217
|
|
|
10182
|
-
return sipSession ? this.holdSipSession(sipSession, callSession, withEvent
|
|
10218
|
+
return sipSession ? this.holdSipSession(sipSession, callSession, withEvent) : null;
|
|
10183
10219
|
}
|
|
10184
10220
|
|
|
10185
10221
|
// @Deprecated
|
|
10186
|
-
unhold(callSession , withEvent = true
|
|
10222
|
+
unhold(callSession , withEvent = true) {
|
|
10187
10223
|
console.warn('Please note that `phone.unhold()` is being deprecated; `phone.resume()` is the preferred method');
|
|
10188
10224
|
|
|
10189
|
-
return this.resume(callSession,
|
|
10225
|
+
return this.resume(callSession, withEvent);
|
|
10190
10226
|
}
|
|
10191
10227
|
|
|
10192
|
-
resume(callSession ,
|
|
10228
|
+
resume(callSession , withEvent = true) {
|
|
10193
10229
|
logger$7.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
|
|
10194
10230
|
|
|
10195
10231
|
const sipSession = this.findSipSession(callSession);
|
|
@@ -10202,10 +10238,14 @@ class WebRTCPhone extends Emitter {
|
|
|
10202
10238
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
10203
10239
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
10204
10240
|
logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
10205
|
-
this.holdSipSession(
|
|
10241
|
+
this.holdSipSession(
|
|
10242
|
+
this.currentSipSession,
|
|
10243
|
+
this.currentCallSession,
|
|
10244
|
+
withEvent,
|
|
10245
|
+
);
|
|
10206
10246
|
}
|
|
10207
10247
|
|
|
10208
|
-
const promise = this.unholdSipSession(sipSession, callSession, withEvent
|
|
10248
|
+
const promise = this.unholdSipSession(sipSession, callSession, withEvent);
|
|
10209
10249
|
this.currentSipSession = sipSession;
|
|
10210
10250
|
if (callSession) {
|
|
10211
10251
|
this.currentCallSession = callSession;
|
|
@@ -10218,7 +10258,6 @@ class WebRTCPhone extends Emitter {
|
|
|
10218
10258
|
sipSession ,
|
|
10219
10259
|
callSession ,
|
|
10220
10260
|
withEvent = true,
|
|
10221
|
-
isConference = false,
|
|
10222
10261
|
) {
|
|
10223
10262
|
if (!sipSession) {
|
|
10224
10263
|
return new Promise((resolve, reject) => reject(new Error('No session to hold')));
|
|
@@ -10239,6 +10278,8 @@ class WebRTCPhone extends Emitter {
|
|
|
10239
10278
|
await this.client.downgradeToAudio(sipSession);
|
|
10240
10279
|
}
|
|
10241
10280
|
|
|
10281
|
+
const isConference = !!callSession && callSession.isConference();
|
|
10282
|
+
|
|
10242
10283
|
const promise = this.client.hold(sipSession, isConference, hasVideo);
|
|
10243
10284
|
if (withEvent) {
|
|
10244
10285
|
this.eventEmitter.emit(ON_CALL_HELD, this._createCallSession(sipSession, callSession));
|
|
@@ -10251,11 +10292,13 @@ class WebRTCPhone extends Emitter {
|
|
|
10251
10292
|
sipSession ,
|
|
10252
10293
|
callSession ,
|
|
10253
10294
|
withEvent = true,
|
|
10254
|
-
isConference = false,
|
|
10255
10295
|
) {
|
|
10256
10296
|
if (!sipSession) {
|
|
10257
10297
|
return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
|
|
10258
10298
|
}
|
|
10299
|
+
|
|
10300
|
+
const isConference = !!callSession && callSession.isConference();
|
|
10301
|
+
|
|
10259
10302
|
const sessionId = this.getSipSessionId(sipSession);
|
|
10260
10303
|
logger$7.info('WebRTC unhold sip session', { sessionId, isConference });
|
|
10261
10304
|
|
|
@@ -10397,7 +10440,11 @@ class WebRTCPhone extends Emitter {
|
|
|
10397
10440
|
await this.client.register();
|
|
10398
10441
|
}
|
|
10399
10442
|
if (this.currentSipSession) {
|
|
10400
|
-
this.holdSipSession(
|
|
10443
|
+
this.holdSipSession(
|
|
10444
|
+
this.currentSipSession,
|
|
10445
|
+
this.currentCallSession,
|
|
10446
|
+
true,
|
|
10447
|
+
).catch(e => {
|
|
10401
10448
|
logger$7.warn('Unable to hold current session when making another call', e);
|
|
10402
10449
|
});
|
|
10403
10450
|
}
|
|
@@ -10412,6 +10459,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10412
10459
|
return Promise.resolve(null);
|
|
10413
10460
|
}
|
|
10414
10461
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
10462
|
+
callSession.setIsConference(conference);
|
|
10415
10463
|
callSession.creationTime = new Date();
|
|
10416
10464
|
this._updateCallSession(callSession);
|
|
10417
10465
|
|
|
@@ -10990,6 +11038,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10990
11038
|
recording: fromSession ? fromSession.isRecording() : false,
|
|
10991
11039
|
recordingPaused: false, // @TODO
|
|
10992
11040
|
sipSession,
|
|
11041
|
+
conference: !!fromSession && fromSession.isConference(),
|
|
10993
11042
|
...extra,
|
|
10994
11043
|
});
|
|
10995
11044
|
|
|
@@ -11648,6 +11697,7 @@ const getCallableNumber = (number , country ) => {
|
|
|
11648
11697
|
|
|
11649
11698
|
class InvalidSubscription extends Error {}
|
|
11650
11699
|
class InvalidAuthorization extends Error {}
|
|
11700
|
+
class NoTenantIdError extends Error {}
|
|
11651
11701
|
|
|
11652
11702
|
const logger$5 = IssueReporter$1.loggerFor('simple-auth');
|
|
11653
11703
|
|
|
@@ -11661,11 +11711,15 @@ class Auth {
|
|
|
11661
11711
|
|
|
11662
11712
|
|
|
11663
11713
|
|
|
11714
|
+
|
|
11715
|
+
|
|
11664
11716
|
|
|
11665
11717
|
constructor() {
|
|
11666
11718
|
this.expiration = DETAULT_EXPIRATION;
|
|
11667
11719
|
this.authenticated = false;
|
|
11668
11720
|
this.minSubscriptionType = null;
|
|
11721
|
+
this.BACKEND_WAZO = DEFAULT_BACKEND_USER;
|
|
11722
|
+
this.BACKEND_LDAP = BACKEND_LDAP_USER;
|
|
11669
11723
|
}
|
|
11670
11724
|
|
|
11671
11725
|
init(clientId ,
|
|
@@ -11698,12 +11752,18 @@ class Auth {
|
|
|
11698
11752
|
setFetchOptions(options);
|
|
11699
11753
|
}
|
|
11700
11754
|
|
|
11701
|
-
async logIn(username , password ) {
|
|
11755
|
+
async logIn(username , password , backend , tenantId ) {
|
|
11756
|
+
if (backend && backend !== this.BACKEND_WAZO && !tenantId) {
|
|
11757
|
+
throw new NoTenantIdError('No tenant id');
|
|
11758
|
+
}
|
|
11759
|
+
|
|
11702
11760
|
this.authenticated = false;
|
|
11703
11761
|
this.session = null;
|
|
11704
11762
|
const rawSession = await getApiClient().auth.logIn({
|
|
11705
11763
|
username,
|
|
11706
11764
|
password,
|
|
11765
|
+
backend,
|
|
11766
|
+
tenantId,
|
|
11707
11767
|
expiration: this.expiration,
|
|
11708
11768
|
mobile: this.mobile,
|
|
11709
11769
|
});
|
|
@@ -11979,6 +12039,10 @@ class AdHocAPIConference {
|
|
|
11979
12039
|
this.conferenceId = conferenceId || '';
|
|
11980
12040
|
this.muted = muted || false;
|
|
11981
12041
|
this.paused = paused || false;
|
|
12042
|
+
|
|
12043
|
+
if (this.host) {
|
|
12044
|
+
this.host.setIsConference(true);
|
|
12045
|
+
}
|
|
11982
12046
|
}
|
|
11983
12047
|
|
|
11984
12048
|
async start() {
|
|
@@ -12273,16 +12337,16 @@ class Phone extends Emitter {
|
|
|
12273
12337
|
}
|
|
12274
12338
|
}
|
|
12275
12339
|
|
|
12276
|
-
hold(callSession
|
|
12277
|
-
return this.phone && this.phone.hold(callSession, true
|
|
12340
|
+
hold(callSession ) {
|
|
12341
|
+
return this.phone && this.phone.hold(callSession, true);
|
|
12278
12342
|
}
|
|
12279
12343
|
|
|
12280
|
-
unhold(callSession
|
|
12281
|
-
return this.phone && this.phone.unhold(callSession, true
|
|
12344
|
+
unhold(callSession ) {
|
|
12345
|
+
return this.phone && this.phone.unhold(callSession, true);
|
|
12282
12346
|
}
|
|
12283
12347
|
|
|
12284
|
-
resume(callSession
|
|
12285
|
-
return this.phone && this.phone.resume(callSession
|
|
12348
|
+
resume(callSession ) {
|
|
12349
|
+
return this.phone && this.phone.resume(callSession);
|
|
12286
12350
|
}
|
|
12287
12351
|
|
|
12288
12352
|
reject(callSession ) {
|
|
@@ -14029,6 +14093,7 @@ const Wazo = {
|
|
|
14029
14093
|
InvalidAuthorization,
|
|
14030
14094
|
CanceledCallError,
|
|
14031
14095
|
SFUNotAvailableError,
|
|
14096
|
+
NoTenantIdError,
|
|
14032
14097
|
};
|
|
14033
14098
|
|
|
14034
14099
|
if (window) {
|
package/esm/service/CallApi.js
CHANGED
|
@@ -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
|
|