@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
package/esm/domain/Features.js
CHANGED
|
@@ -1052,6 +1052,7 @@ const LINE_STATE = {
|
|
|
1052
1052
|
|
|
1053
1053
|
|
|
1054
1054
|
|
|
1055
|
+
|
|
1055
1056
|
|
|
1056
1057
|
|
|
1057
1058
|
|
|
@@ -1088,6 +1089,7 @@ const LINE_STATE = {
|
|
|
1088
1089
|
|
|
1089
1090
|
|
|
1090
1091
|
|
|
1092
|
+
|
|
1091
1093
|
|
|
1092
1094
|
|
|
1093
1095
|
|
|
@@ -1119,6 +1121,7 @@ class Profile {
|
|
|
1119
1121
|
|
|
1120
1122
|
|
|
1121
1123
|
|
|
1124
|
+
|
|
1122
1125
|
|
|
1123
1126
|
|
|
1124
1127
|
|
|
@@ -1135,6 +1138,7 @@ class Profile {
|
|
|
1135
1138
|
lines: plain.lines.map(line => Line.parse(line)),
|
|
1136
1139
|
username: plain.username,
|
|
1137
1140
|
mobileNumber: plain.mobile_phone_number || '',
|
|
1141
|
+
ringSeconds: plain.ring_seconds,
|
|
1138
1142
|
forwards: [
|
|
1139
1143
|
ForwardOption.parse(plain.forwards.unconditional, FORWARD_KEYS.UNCONDITIONAL),
|
|
1140
1144
|
ForwardOption.parse(plain.forwards.noanswer, FORWARD_KEYS.NO_ANSWER),
|
|
@@ -1171,6 +1175,7 @@ class Profile {
|
|
|
1171
1175
|
switchboards,
|
|
1172
1176
|
agent,
|
|
1173
1177
|
status,
|
|
1178
|
+
ringSeconds,
|
|
1174
1179
|
sipLines,
|
|
1175
1180
|
callPickupTargetUsers,
|
|
1176
1181
|
onlineCallRecordEnabled,
|
|
@@ -1192,6 +1197,7 @@ class Profile {
|
|
|
1192
1197
|
this.status = status;
|
|
1193
1198
|
this.callPickupTargetUsers = callPickupTargetUsers;
|
|
1194
1199
|
this.onlineCallRecordEnabled = onlineCallRecordEnabled;
|
|
1200
|
+
this.ringSeconds = ringSeconds;
|
|
1195
1201
|
|
|
1196
1202
|
this.sipLines = sipLines || [];
|
|
1197
1203
|
}
|
|
@@ -2197,6 +2203,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2197
2203
|
|
|
2198
2204
|
|
|
2199
2205
|
|
|
2206
|
+
|
|
2200
2207
|
) {
|
|
2201
2208
|
const body = {
|
|
2202
2209
|
backend: params.backend || DEFAULT_BACKEND_USER,
|
|
@@ -2216,6 +2223,10 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2216
2223
|
headers['Wazo-Session-Type'] = 'mobile';
|
|
2217
2224
|
}
|
|
2218
2225
|
|
|
2226
|
+
if (params.tenantId) {
|
|
2227
|
+
body.tenant_id = params.tenantId;
|
|
2228
|
+
}
|
|
2229
|
+
|
|
2219
2230
|
return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
|
|
2220
2231
|
},
|
|
2221
2232
|
|
|
@@ -3284,11 +3295,13 @@ class Recording {
|
|
|
3284
3295
|
|
|
3285
3296
|
|
|
3286
3297
|
|
|
3298
|
+
|
|
3287
3299
|
|
|
3288
3300
|
|
|
3289
3301
|
|
|
3290
3302
|
|
|
3291
3303
|
|
|
3304
|
+
|
|
3292
3305
|
|
|
3293
3306
|
|
|
3294
3307
|
|
|
@@ -3309,10 +3322,12 @@ class Recording {
|
|
|
3309
3322
|
|
|
3310
3323
|
|
|
3311
3324
|
|
|
3325
|
+
|
|
3312
3326
|
|
|
3313
3327
|
|
|
3314
3328
|
|
|
3315
3329
|
|
|
3330
|
+
|
|
3316
3331
|
|
|
3317
3332
|
|
|
3318
3333
|
|
|
@@ -3374,10 +3389,12 @@ class CallLog {
|
|
|
3374
3389
|
|| plain.destination_extension
|
|
3375
3390
|
|| `meeting-${plain.requested_name || plain.destination_name || ''}`,
|
|
3376
3391
|
name: plain.requested_name || plain.destination_name || '',
|
|
3392
|
+
uuid: plain.destination_user_uuid,
|
|
3377
3393
|
},
|
|
3378
3394
|
source: {
|
|
3379
3395
|
extension: plain.source_extension,
|
|
3380
3396
|
name: plain.source_name,
|
|
3397
|
+
uuid: plain.source_user_uuid,
|
|
3381
3398
|
},
|
|
3382
3399
|
id: plain.id,
|
|
3383
3400
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
@@ -365,6 +365,7 @@ const LINE_STATE = {
|
|
|
365
365
|
|
|
366
366
|
|
|
367
367
|
|
|
368
|
+
|
|
368
369
|
|
|
369
370
|
|
|
370
371
|
|
|
@@ -401,6 +402,7 @@ const LINE_STATE = {
|
|
|
401
402
|
|
|
402
403
|
|
|
403
404
|
|
|
405
|
+
|
|
404
406
|
|
|
405
407
|
|
|
406
408
|
|
|
@@ -432,6 +434,7 @@ class Profile {
|
|
|
432
434
|
|
|
433
435
|
|
|
434
436
|
|
|
437
|
+
|
|
435
438
|
|
|
436
439
|
|
|
437
440
|
|
|
@@ -448,6 +451,7 @@ class Profile {
|
|
|
448
451
|
lines: plain.lines.map(line => Line.parse(line)),
|
|
449
452
|
username: plain.username,
|
|
450
453
|
mobileNumber: plain.mobile_phone_number || '',
|
|
454
|
+
ringSeconds: plain.ring_seconds,
|
|
451
455
|
forwards: [
|
|
452
456
|
ForwardOption.parse(plain.forwards.unconditional, FORWARD_KEYS.UNCONDITIONAL),
|
|
453
457
|
ForwardOption.parse(plain.forwards.noanswer, FORWARD_KEYS.NO_ANSWER),
|
|
@@ -484,6 +488,7 @@ class Profile {
|
|
|
484
488
|
switchboards,
|
|
485
489
|
agent,
|
|
486
490
|
status,
|
|
491
|
+
ringSeconds,
|
|
487
492
|
sipLines,
|
|
488
493
|
callPickupTargetUsers,
|
|
489
494
|
onlineCallRecordEnabled,
|
|
@@ -505,6 +510,7 @@ class Profile {
|
|
|
505
510
|
this.status = status;
|
|
506
511
|
this.callPickupTargetUsers = callPickupTargetUsers;
|
|
507
512
|
this.onlineCallRecordEnabled = onlineCallRecordEnabled;
|
|
513
|
+
this.ringSeconds = ringSeconds;
|
|
508
514
|
|
|
509
515
|
this.sipLines = sipLines || [];
|
|
510
516
|
}
|
|
@@ -1733,6 +1739,7 @@ var updateFrom = (instance , from ) => {
|
|
|
1733
1739
|
|
|
1734
1740
|
|
|
1735
1741
|
|
|
1742
|
+
|
|
1736
1743
|
|
|
1737
1744
|
|
|
1738
1745
|
class CallSession {
|
|
@@ -1795,6 +1802,8 @@ class CallSession {
|
|
|
1795
1802
|
|
|
1796
1803
|
|
|
1797
1804
|
|
|
1805
|
+
|
|
1806
|
+
|
|
1798
1807
|
|
|
1799
1808
|
|
|
1800
1809
|
|
|
@@ -1826,6 +1835,7 @@ class CallSession {
|
|
|
1826
1835
|
videoRemotelyDowngraded,
|
|
1827
1836
|
sipSession,
|
|
1828
1837
|
answerTime,
|
|
1838
|
+
conference,
|
|
1829
1839
|
} ) {
|
|
1830
1840
|
this.callId = callId;
|
|
1831
1841
|
this.sipCallId = sipCallId;
|
|
@@ -1854,6 +1864,7 @@ class CallSession {
|
|
|
1854
1864
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
1855
1865
|
this.sipSession = sipSession;
|
|
1856
1866
|
this.answerTime = answerTime || this.answerTime;
|
|
1867
|
+
this.conference = conference;
|
|
1857
1868
|
|
|
1858
1869
|
// Useful to compare instead of instanceof with minified code
|
|
1859
1870
|
this.type = 'CallSession';
|
|
@@ -1911,6 +1922,10 @@ class CallSession {
|
|
|
1911
1922
|
this.screensharing = false;
|
|
1912
1923
|
}
|
|
1913
1924
|
|
|
1925
|
+
setIsConference(conference ) {
|
|
1926
|
+
this.conference = conference;
|
|
1927
|
+
}
|
|
1928
|
+
|
|
1914
1929
|
isIncoming() {
|
|
1915
1930
|
return !this.isCaller && !this.answered;
|
|
1916
1931
|
}
|
|
@@ -1987,6 +2002,10 @@ class CallSession {
|
|
|
1987
2002
|
return this.sipStatus === SessionState.Terminated;
|
|
1988
2003
|
}
|
|
1989
2004
|
|
|
2005
|
+
isConference() {
|
|
2006
|
+
return this.conference;
|
|
2007
|
+
}
|
|
2008
|
+
|
|
1990
2009
|
getElapsedTimeInSeconds() {
|
|
1991
2010
|
if (!this.startTime) {
|
|
1992
2011
|
return 0;
|
|
@@ -2078,6 +2097,7 @@ class CallSession {
|
|
|
2078
2097
|
cameraEnabled: false,
|
|
2079
2098
|
dialedExtension: call.dialedExtension,
|
|
2080
2099
|
call,
|
|
2100
|
+
conference: false, // @FIXME?
|
|
2081
2101
|
});
|
|
2082
2102
|
}
|
|
2083
2103
|
}
|
|
@@ -2167,11 +2187,13 @@ class Recording {
|
|
|
2167
2187
|
|
|
2168
2188
|
|
|
2169
2189
|
|
|
2190
|
+
|
|
2170
2191
|
|
|
2171
2192
|
|
|
2172
2193
|
|
|
2173
2194
|
|
|
2174
2195
|
|
|
2196
|
+
|
|
2175
2197
|
|
|
2176
2198
|
|
|
2177
2199
|
|
|
@@ -2192,10 +2214,12 @@ class Recording {
|
|
|
2192
2214
|
|
|
2193
2215
|
|
|
2194
2216
|
|
|
2217
|
+
|
|
2195
2218
|
|
|
2196
2219
|
|
|
2197
2220
|
|
|
2198
2221
|
|
|
2222
|
+
|
|
2199
2223
|
|
|
2200
2224
|
|
|
2201
2225
|
|
|
@@ -2257,10 +2281,12 @@ class CallLog {
|
|
|
2257
2281
|
|| plain.destination_extension
|
|
2258
2282
|
|| `meeting-${plain.requested_name || plain.destination_name || ''}`,
|
|
2259
2283
|
name: plain.requested_name || plain.destination_name || '',
|
|
2284
|
+
uuid: plain.destination_user_uuid,
|
|
2260
2285
|
},
|
|
2261
2286
|
source: {
|
|
2262
2287
|
extension: plain.source_extension,
|
|
2263
2288
|
name: plain.source_name,
|
|
2289
|
+
uuid: plain.source_user_uuid,
|
|
2264
2290
|
},
|
|
2265
2291
|
id: plain.id,
|
|
2266
2292
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
@@ -3137,6 +3163,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
3137
3163
|
|
|
3138
3164
|
|
|
3139
3165
|
|
|
3166
|
+
|
|
3140
3167
|
) {
|
|
3141
3168
|
const body = {
|
|
3142
3169
|
backend: params.backend || DEFAULT_BACKEND_USER,
|
|
@@ -3156,6 +3183,10 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
3156
3183
|
headers['Wazo-Session-Type'] = 'mobile';
|
|
3157
3184
|
}
|
|
3158
3185
|
|
|
3186
|
+
if (params.tenantId) {
|
|
3187
|
+
body.tenant_id = params.tenantId;
|
|
3188
|
+
}
|
|
3189
|
+
|
|
3159
3190
|
return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
|
|
3160
3191
|
},
|
|
3161
3192
|
|
|
@@ -81,6 +81,7 @@ var updateFrom = (instance , from ) => {
|
|
|
81
81
|
|
|
82
82
|
|
|
83
83
|
|
|
84
|
+
|
|
84
85
|
|
|
85
86
|
|
|
86
87
|
class CallSession {
|
|
@@ -143,6 +144,8 @@ class CallSession {
|
|
|
143
144
|
|
|
144
145
|
|
|
145
146
|
|
|
147
|
+
|
|
148
|
+
|
|
146
149
|
|
|
147
150
|
|
|
148
151
|
|
|
@@ -174,6 +177,7 @@ class CallSession {
|
|
|
174
177
|
videoRemotelyDowngraded,
|
|
175
178
|
sipSession,
|
|
176
179
|
answerTime,
|
|
180
|
+
conference,
|
|
177
181
|
} ) {
|
|
178
182
|
this.callId = callId;
|
|
179
183
|
this.sipCallId = sipCallId;
|
|
@@ -202,6 +206,7 @@ class CallSession {
|
|
|
202
206
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
203
207
|
this.sipSession = sipSession;
|
|
204
208
|
this.answerTime = answerTime || this.answerTime;
|
|
209
|
+
this.conference = conference;
|
|
205
210
|
|
|
206
211
|
// Useful to compare instead of instanceof with minified code
|
|
207
212
|
this.type = 'CallSession';
|
|
@@ -259,6 +264,10 @@ class CallSession {
|
|
|
259
264
|
this.screensharing = false;
|
|
260
265
|
}
|
|
261
266
|
|
|
267
|
+
setIsConference(conference ) {
|
|
268
|
+
this.conference = conference;
|
|
269
|
+
}
|
|
270
|
+
|
|
262
271
|
isIncoming() {
|
|
263
272
|
return !this.isCaller && !this.answered;
|
|
264
273
|
}
|
|
@@ -335,6 +344,10 @@ class CallSession {
|
|
|
335
344
|
return this.sipStatus === SessionState.Terminated;
|
|
336
345
|
}
|
|
337
346
|
|
|
347
|
+
isConference() {
|
|
348
|
+
return this.conference;
|
|
349
|
+
}
|
|
350
|
+
|
|
338
351
|
getElapsedTimeInSeconds() {
|
|
339
352
|
if (!this.startTime) {
|
|
340
353
|
return 0;
|
|
@@ -426,6 +439,7 @@ class CallSession {
|
|
|
426
439
|
cameraEnabled: false,
|
|
427
440
|
dialedExtension: call.dialedExtension,
|
|
428
441
|
call,
|
|
442
|
+
conference: false, // @FIXME?
|
|
429
443
|
});
|
|
430
444
|
}
|
|
431
445
|
}
|
|
@@ -1714,7 +1728,11 @@ class WebRTCPhone extends Emitter {
|
|
|
1714
1728
|
accept(callSession , cameraEnabled ) {
|
|
1715
1729
|
logger.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
|
|
1716
1730
|
if (this.currentSipSession) {
|
|
1717
|
-
this.holdSipSession(
|
|
1731
|
+
this.holdSipSession(
|
|
1732
|
+
this.currentSipSession,
|
|
1733
|
+
this.currentCallSession,
|
|
1734
|
+
true,
|
|
1735
|
+
);
|
|
1718
1736
|
}
|
|
1719
1737
|
|
|
1720
1738
|
if (!callSession) {
|
|
@@ -1807,22 +1825,22 @@ class WebRTCPhone extends Emitter {
|
|
|
1807
1825
|
}
|
|
1808
1826
|
}
|
|
1809
1827
|
|
|
1810
|
-
hold(callSession , withEvent = true
|
|
1828
|
+
hold(callSession , withEvent = true) {
|
|
1811
1829
|
logger.info('WebRTC hold', { id: callSession.getId() });
|
|
1812
1830
|
|
|
1813
1831
|
const sipSession = this.findSipSession(callSession);
|
|
1814
1832
|
|
|
1815
|
-
return sipSession ? this.holdSipSession(sipSession, callSession, withEvent
|
|
1833
|
+
return sipSession ? this.holdSipSession(sipSession, callSession, withEvent) : null;
|
|
1816
1834
|
}
|
|
1817
1835
|
|
|
1818
1836
|
// @Deprecated
|
|
1819
|
-
unhold(callSession , withEvent = true
|
|
1837
|
+
unhold(callSession , withEvent = true) {
|
|
1820
1838
|
console.warn('Please note that `phone.unhold()` is being deprecated; `phone.resume()` is the preferred method');
|
|
1821
1839
|
|
|
1822
|
-
return this.resume(callSession,
|
|
1840
|
+
return this.resume(callSession, withEvent);
|
|
1823
1841
|
}
|
|
1824
1842
|
|
|
1825
|
-
resume(callSession ,
|
|
1843
|
+
resume(callSession , withEvent = true) {
|
|
1826
1844
|
logger.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
|
|
1827
1845
|
|
|
1828
1846
|
const sipSession = this.findSipSession(callSession);
|
|
@@ -1835,10 +1853,14 @@ class WebRTCPhone extends Emitter {
|
|
|
1835
1853
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
1836
1854
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
1837
1855
|
logger.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
1838
|
-
this.holdSipSession(
|
|
1856
|
+
this.holdSipSession(
|
|
1857
|
+
this.currentSipSession,
|
|
1858
|
+
this.currentCallSession,
|
|
1859
|
+
withEvent,
|
|
1860
|
+
);
|
|
1839
1861
|
}
|
|
1840
1862
|
|
|
1841
|
-
const promise = this.unholdSipSession(sipSession, callSession, withEvent
|
|
1863
|
+
const promise = this.unholdSipSession(sipSession, callSession, withEvent);
|
|
1842
1864
|
this.currentSipSession = sipSession;
|
|
1843
1865
|
if (callSession) {
|
|
1844
1866
|
this.currentCallSession = callSession;
|
|
@@ -1851,7 +1873,6 @@ class WebRTCPhone extends Emitter {
|
|
|
1851
1873
|
sipSession ,
|
|
1852
1874
|
callSession ,
|
|
1853
1875
|
withEvent = true,
|
|
1854
|
-
isConference = false,
|
|
1855
1876
|
) {
|
|
1856
1877
|
if (!sipSession) {
|
|
1857
1878
|
return new Promise((resolve, reject) => reject(new Error('No session to hold')));
|
|
@@ -1872,6 +1893,8 @@ class WebRTCPhone extends Emitter {
|
|
|
1872
1893
|
await this.client.downgradeToAudio(sipSession);
|
|
1873
1894
|
}
|
|
1874
1895
|
|
|
1896
|
+
const isConference = !!callSession && callSession.isConference();
|
|
1897
|
+
|
|
1875
1898
|
const promise = this.client.hold(sipSession, isConference, hasVideo);
|
|
1876
1899
|
if (withEvent) {
|
|
1877
1900
|
this.eventEmitter.emit(ON_CALL_HELD, this._createCallSession(sipSession, callSession));
|
|
@@ -1884,11 +1907,13 @@ class WebRTCPhone extends Emitter {
|
|
|
1884
1907
|
sipSession ,
|
|
1885
1908
|
callSession ,
|
|
1886
1909
|
withEvent = true,
|
|
1887
|
-
isConference = false,
|
|
1888
1910
|
) {
|
|
1889
1911
|
if (!sipSession) {
|
|
1890
1912
|
return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
|
|
1891
1913
|
}
|
|
1914
|
+
|
|
1915
|
+
const isConference = !!callSession && callSession.isConference();
|
|
1916
|
+
|
|
1892
1917
|
const sessionId = this.getSipSessionId(sipSession);
|
|
1893
1918
|
logger.info('WebRTC unhold sip session', { sessionId, isConference });
|
|
1894
1919
|
|
|
@@ -2030,7 +2055,11 @@ class WebRTCPhone extends Emitter {
|
|
|
2030
2055
|
await this.client.register();
|
|
2031
2056
|
}
|
|
2032
2057
|
if (this.currentSipSession) {
|
|
2033
|
-
this.holdSipSession(
|
|
2058
|
+
this.holdSipSession(
|
|
2059
|
+
this.currentSipSession,
|
|
2060
|
+
this.currentCallSession,
|
|
2061
|
+
true,
|
|
2062
|
+
).catch(e => {
|
|
2034
2063
|
logger.warn('Unable to hold current session when making another call', e);
|
|
2035
2064
|
});
|
|
2036
2065
|
}
|
|
@@ -2045,6 +2074,7 @@ class WebRTCPhone extends Emitter {
|
|
|
2045
2074
|
return Promise.resolve(null);
|
|
2046
2075
|
}
|
|
2047
2076
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
2077
|
+
callSession.setIsConference(conference);
|
|
2048
2078
|
callSession.creationTime = new Date();
|
|
2049
2079
|
this._updateCallSession(callSession);
|
|
2050
2080
|
|
|
@@ -2623,6 +2653,7 @@ class WebRTCPhone extends Emitter {
|
|
|
2623
2653
|
recording: fromSession ? fromSession.isRecording() : false,
|
|
2624
2654
|
recordingPaused: false, // @TODO
|
|
2625
2655
|
sipSession,
|
|
2656
|
+
conference: !!fromSession && fromSession.isConference(),
|
|
2626
2657
|
...extra,
|
|
2627
2658
|
});
|
|
2628
2659
|
|
package/esm/domain/Profile.js
CHANGED
|
@@ -199,6 +199,7 @@ const LINE_STATE = {
|
|
|
199
199
|
|
|
200
200
|
|
|
201
201
|
|
|
202
|
+
|
|
202
203
|
|
|
203
204
|
|
|
204
205
|
|
|
@@ -235,6 +236,7 @@ const LINE_STATE = {
|
|
|
235
236
|
|
|
236
237
|
|
|
237
238
|
|
|
239
|
+
|
|
238
240
|
|
|
239
241
|
|
|
240
242
|
|
|
@@ -266,6 +268,7 @@ class Profile {
|
|
|
266
268
|
|
|
267
269
|
|
|
268
270
|
|
|
271
|
+
|
|
269
272
|
|
|
270
273
|
|
|
271
274
|
|
|
@@ -282,6 +285,7 @@ class Profile {
|
|
|
282
285
|
lines: plain.lines.map(line => Line.parse(line)),
|
|
283
286
|
username: plain.username,
|
|
284
287
|
mobileNumber: plain.mobile_phone_number || '',
|
|
288
|
+
ringSeconds: plain.ring_seconds,
|
|
285
289
|
forwards: [
|
|
286
290
|
ForwardOption.parse(plain.forwards.unconditional, FORWARD_KEYS.UNCONDITIONAL),
|
|
287
291
|
ForwardOption.parse(plain.forwards.noanswer, FORWARD_KEYS.NO_ANSWER),
|
|
@@ -318,6 +322,7 @@ class Profile {
|
|
|
318
322
|
switchboards,
|
|
319
323
|
agent,
|
|
320
324
|
status,
|
|
325
|
+
ringSeconds,
|
|
321
326
|
sipLines,
|
|
322
327
|
callPickupTargetUsers,
|
|
323
328
|
onlineCallRecordEnabled,
|
|
@@ -339,6 +344,7 @@ class Profile {
|
|
|
339
344
|
this.status = status;
|
|
340
345
|
this.callPickupTargetUsers = callPickupTargetUsers;
|
|
341
346
|
this.onlineCallRecordEnabled = onlineCallRecordEnabled;
|
|
347
|
+
this.ringSeconds = ringSeconds;
|
|
342
348
|
|
|
343
349
|
this.sipLines = sipLines || [];
|
|
344
350
|
}
|
|
@@ -87,11 +87,13 @@ class Recording {
|
|
|
87
87
|
|
|
88
88
|
|
|
89
89
|
|
|
90
|
+
|
|
90
91
|
|
|
91
92
|
|
|
92
93
|
|
|
93
94
|
|
|
94
95
|
|
|
96
|
+
|
|
95
97
|
|
|
96
98
|
|
|
97
99
|
|
|
@@ -112,10 +114,12 @@ class Recording {
|
|
|
112
114
|
|
|
113
115
|
|
|
114
116
|
|
|
117
|
+
|
|
115
118
|
|
|
116
119
|
|
|
117
120
|
|
|
118
121
|
|
|
122
|
+
|
|
119
123
|
|
|
120
124
|
|
|
121
125
|
|
|
@@ -177,10 +181,12 @@ class CallLog {
|
|
|
177
181
|
|| plain.destination_extension
|
|
178
182
|
|| `meeting-${plain.requested_name || plain.destination_name || ''}`,
|
|
179
183
|
name: plain.requested_name || plain.destination_name || '',
|
|
184
|
+
uuid: plain.destination_user_uuid,
|
|
180
185
|
},
|
|
181
186
|
source: {
|
|
182
187
|
extension: plain.source_extension,
|
|
183
188
|
name: plain.source_name,
|
|
189
|
+
uuid: plain.source_user_uuid,
|
|
184
190
|
},
|
|
185
191
|
id: plain.id,
|
|
186
192
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
@@ -323,8 +329,10 @@ describe('CallLog domain', () => {
|
|
|
323
329
|
call_direction: 'outbound',
|
|
324
330
|
source_extension: '8020',
|
|
325
331
|
source_name: 'Jonathan Lessard',
|
|
332
|
+
source_user_uuid: '123',
|
|
326
333
|
destination_extension: '4182250459',
|
|
327
334
|
destination_name: null,
|
|
335
|
+
destination_user_uuid: '456',
|
|
328
336
|
duration: 4,
|
|
329
337
|
start: '2017-08-06T13:50:55.819057+00:00',
|
|
330
338
|
end: '2017-08-08T13:51:23.822529+00:00',
|
|
@@ -355,10 +363,12 @@ describe('CallLog domain', () => {
|
|
|
355
363
|
destination: {
|
|
356
364
|
extension: '4182250459',
|
|
357
365
|
name: '',
|
|
366
|
+
uuid: '456',
|
|
358
367
|
},
|
|
359
368
|
source: {
|
|
360
369
|
extension: '8020',
|
|
361
370
|
name: 'Jonathan Lessard',
|
|
371
|
+
uuid: '123',
|
|
362
372
|
},
|
|
363
373
|
id: 215,
|
|
364
374
|
duration: 4000,
|
|
@@ -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
|
}
|
|
@@ -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
|
}
|