@wazo/sdk 0.37.35 → 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.
- package/README.md +1 -0
- package/dist/wazo-sdk.js +2 -2
- package/esm/__tests__/api-client.test.js +7 -1
- package/esm/__tests__/web-rtc-client.test.js +7 -1
- package/esm/api/call-logd.js +1 -1
- package/esm/api/chatd.js +6 -0
- package/esm/api/confd.js +6 -0
- package/esm/api-client.js +7 -1
- package/esm/checker/Checker.js +7 -1
- package/esm/checker/checks/aor.js +7 -1
- package/esm/checker/checks/api.js +7 -1
- package/esm/checker/checks/index.js +7 -1
- package/esm/checker/checks/webrtc-transport.js +7 -1
- package/esm/checker/checks/webrtc.js +7 -1
- package/esm/domain/AdHocAPIConference.js +11 -1
- package/esm/domain/CallLog.js +1 -1
- package/esm/domain/CallSession.js +14 -0
- package/esm/domain/Features.js +7 -1
- package/esm/domain/Phone/CTIPhone.js +21 -1
- package/esm/domain/Phone/WebRTCPhone.js +42 -11
- package/esm/domain/Profile.js +6 -0
- package/esm/domain/__tests__/CallLog.test.js +5 -1
- 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 +59 -18
- package/esm/service/CallApi.js +7 -1
- package/esm/service/getApiClient.js +7 -1
- package/esm/simple/Auth.js +59 -18
- package/esm/simple/Configuration.js +59 -18
- package/esm/simple/Directory.js +7 -1
- package/esm/simple/Phone.js +59 -18
- package/esm/simple/index.js +59 -18
- package/esm/simple/room/LocalParticipant.js +59 -18
- package/esm/simple/room/Participant.js +59 -18
- package/esm/simple/room/RemoteParticipant.js +59 -18
- package/esm/simple/room/Room.js +59 -18
- package/esm/simple/room/SipRoom.js +59 -18
- package/esm/simple/room/Stream.js +59 -18
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +59 -18
- package/esm/simple/utils.js +59 -18
- package/esm/web-rtc-client.js +7 -1
- package/lib/__tests__/api-client.test.js +7 -1
- package/lib/__tests__/web-rtc-client.test.js +7 -1
- package/lib/api/call-logd.js +1 -1
- package/lib/api/chatd.js +6 -0
- package/lib/api/confd.js +6 -0
- package/lib/api-client.js +7 -1
- package/lib/checker/Checker.js +7 -1
- package/lib/checker/checks/aor.js +7 -1
- package/lib/checker/checks/api.js +7 -1
- package/lib/checker/checks/index.js +7 -1
- package/lib/checker/checks/webrtc-transport.js +7 -1
- package/lib/checker/checks/webrtc.js +7 -1
- package/lib/domain/AdHocAPIConference.js +11 -1
- package/lib/domain/CallLog.js +1 -1
- package/lib/domain/CallSession.js +14 -0
- package/lib/domain/Features.js +7 -1
- package/lib/domain/Phone/CTIPhone.js +21 -1
- package/lib/domain/Phone/WebRTCPhone.js +42 -11
- package/lib/domain/Profile.js +6 -0
- package/lib/domain/__tests__/CallLog.test.js +5 -1
- 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 +59 -18
- package/lib/service/CallApi.js +7 -1
- package/lib/service/getApiClient.js +7 -1
- package/lib/simple/Auth.js +59 -18
- package/lib/simple/Configuration.js +59 -18
- package/lib/simple/Directory.js +7 -1
- package/lib/simple/Phone.js +59 -18
- package/lib/simple/index.js +59 -18
- package/lib/simple/room/LocalParticipant.js +59 -18
- package/lib/simple/room/Participant.js +59 -18
- package/lib/simple/room/RemoteParticipant.js +59 -18
- package/lib/simple/room/Room.js +59 -18
- package/lib/simple/room/SipRoom.js +59 -18
- package/lib/simple/room/Stream.js +59 -18
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +59 -18
- package/lib/simple/utils.js +59 -18
- package/lib/web-rtc-client.js +7 -1
- package/package.json +1 -1
- package/src/domain/AdHocAPIConference.js +4 -0
- package/src/domain/CallLog.js +1 -1
- 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/Phone.js +6 -6
package/lib/index.js
CHANGED
|
@@ -1083,6 +1083,7 @@ const LINE_STATE = {
|
|
|
1083
1083
|
|
|
1084
1084
|
|
|
1085
1085
|
|
|
1086
|
+
|
|
1086
1087
|
|
|
1087
1088
|
|
|
1088
1089
|
|
|
@@ -1119,6 +1120,7 @@ const LINE_STATE = {
|
|
|
1119
1120
|
|
|
1120
1121
|
|
|
1121
1122
|
|
|
1123
|
+
|
|
1122
1124
|
|
|
1123
1125
|
|
|
1124
1126
|
|
|
@@ -1150,6 +1152,7 @@ class Profile {
|
|
|
1150
1152
|
|
|
1151
1153
|
|
|
1152
1154
|
|
|
1155
|
+
|
|
1153
1156
|
|
|
1154
1157
|
|
|
1155
1158
|
|
|
@@ -1166,6 +1169,7 @@ class Profile {
|
|
|
1166
1169
|
lines: plain.lines.map(line => Line.parse(line)),
|
|
1167
1170
|
username: plain.username,
|
|
1168
1171
|
mobileNumber: plain.mobile_phone_number || '',
|
|
1172
|
+
ringSeconds: plain.ring_seconds,
|
|
1169
1173
|
forwards: [
|
|
1170
1174
|
ForwardOption.parse(plain.forwards.unconditional, FORWARD_KEYS.UNCONDITIONAL),
|
|
1171
1175
|
ForwardOption.parse(plain.forwards.noanswer, FORWARD_KEYS.NO_ANSWER),
|
|
@@ -1202,6 +1206,7 @@ class Profile {
|
|
|
1202
1206
|
switchboards,
|
|
1203
1207
|
agent,
|
|
1204
1208
|
status,
|
|
1209
|
+
ringSeconds,
|
|
1205
1210
|
sipLines,
|
|
1206
1211
|
callPickupTargetUsers,
|
|
1207
1212
|
onlineCallRecordEnabled,
|
|
@@ -1223,6 +1228,7 @@ class Profile {
|
|
|
1223
1228
|
this.status = status;
|
|
1224
1229
|
this.callPickupTargetUsers = callPickupTargetUsers;
|
|
1225
1230
|
this.onlineCallRecordEnabled = onlineCallRecordEnabled;
|
|
1231
|
+
this.ringSeconds = ringSeconds;
|
|
1226
1232
|
|
|
1227
1233
|
this.sipLines = sipLines || [];
|
|
1228
1234
|
}
|
|
@@ -3292,6 +3298,7 @@ var updateFrom = (instance , from ) => {
|
|
|
3292
3298
|
|
|
3293
3299
|
|
|
3294
3300
|
|
|
3301
|
+
|
|
3295
3302
|
|
|
3296
3303
|
|
|
3297
3304
|
class CallSession {
|
|
@@ -3354,6 +3361,8 @@ class CallSession {
|
|
|
3354
3361
|
|
|
3355
3362
|
|
|
3356
3363
|
|
|
3364
|
+
|
|
3365
|
+
|
|
3357
3366
|
|
|
3358
3367
|
|
|
3359
3368
|
|
|
@@ -3385,6 +3394,7 @@ class CallSession {
|
|
|
3385
3394
|
videoRemotelyDowngraded,
|
|
3386
3395
|
sipSession,
|
|
3387
3396
|
answerTime,
|
|
3397
|
+
conference,
|
|
3388
3398
|
} ) {
|
|
3389
3399
|
this.callId = callId;
|
|
3390
3400
|
this.sipCallId = sipCallId;
|
|
@@ -3413,6 +3423,7 @@ class CallSession {
|
|
|
3413
3423
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
3414
3424
|
this.sipSession = sipSession;
|
|
3415
3425
|
this.answerTime = answerTime || this.answerTime;
|
|
3426
|
+
this.conference = conference;
|
|
3416
3427
|
|
|
3417
3428
|
// Useful to compare instead of instanceof with minified code
|
|
3418
3429
|
this.type = 'CallSession';
|
|
@@ -3470,6 +3481,10 @@ class CallSession {
|
|
|
3470
3481
|
this.screensharing = false;
|
|
3471
3482
|
}
|
|
3472
3483
|
|
|
3484
|
+
setIsConference(conference ) {
|
|
3485
|
+
this.conference = conference;
|
|
3486
|
+
}
|
|
3487
|
+
|
|
3473
3488
|
isIncoming() {
|
|
3474
3489
|
return !this.isCaller && !this.answered;
|
|
3475
3490
|
}
|
|
@@ -3546,6 +3561,10 @@ class CallSession {
|
|
|
3546
3561
|
return this.sipStatus === sessionState.SessionState.Terminated;
|
|
3547
3562
|
}
|
|
3548
3563
|
|
|
3564
|
+
isConference() {
|
|
3565
|
+
return this.conference;
|
|
3566
|
+
}
|
|
3567
|
+
|
|
3549
3568
|
getElapsedTimeInSeconds() {
|
|
3550
3569
|
if (!this.startTime) {
|
|
3551
3570
|
return 0;
|
|
@@ -3637,6 +3656,7 @@ class CallSession {
|
|
|
3637
3656
|
cameraEnabled: false,
|
|
3638
3657
|
dialedExtension: call.dialedExtension,
|
|
3639
3658
|
call,
|
|
3659
|
+
conference: false, // @FIXME?
|
|
3640
3660
|
});
|
|
3641
3661
|
}
|
|
3642
3662
|
}
|
|
@@ -3732,7 +3752,7 @@ class Recording {
|
|
|
3732
3752
|
|
|
3733
3753
|
|
|
3734
3754
|
|
|
3735
|
-
|
|
3755
|
+
|
|
3736
3756
|
|
|
3737
3757
|
|
|
3738
3758
|
|
|
@@ -10103,7 +10123,11 @@ class WebRTCPhone extends Emitter {
|
|
|
10103
10123
|
accept(callSession , cameraEnabled ) {
|
|
10104
10124
|
logger$7.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
|
|
10105
10125
|
if (this.currentSipSession) {
|
|
10106
|
-
this.holdSipSession(
|
|
10126
|
+
this.holdSipSession(
|
|
10127
|
+
this.currentSipSession,
|
|
10128
|
+
this.currentCallSession,
|
|
10129
|
+
true,
|
|
10130
|
+
);
|
|
10107
10131
|
}
|
|
10108
10132
|
|
|
10109
10133
|
if (!callSession) {
|
|
@@ -10196,22 +10220,22 @@ class WebRTCPhone extends Emitter {
|
|
|
10196
10220
|
}
|
|
10197
10221
|
}
|
|
10198
10222
|
|
|
10199
|
-
hold(callSession , withEvent = true
|
|
10223
|
+
hold(callSession , withEvent = true) {
|
|
10200
10224
|
logger$7.info('WebRTC hold', { id: callSession.getId() });
|
|
10201
10225
|
|
|
10202
10226
|
const sipSession = this.findSipSession(callSession);
|
|
10203
10227
|
|
|
10204
|
-
return sipSession ? this.holdSipSession(sipSession, callSession, withEvent
|
|
10228
|
+
return sipSession ? this.holdSipSession(sipSession, callSession, withEvent) : null;
|
|
10205
10229
|
}
|
|
10206
10230
|
|
|
10207
10231
|
// @Deprecated
|
|
10208
|
-
unhold(callSession , withEvent = true
|
|
10232
|
+
unhold(callSession , withEvent = true) {
|
|
10209
10233
|
console.warn('Please note that `phone.unhold()` is being deprecated; `phone.resume()` is the preferred method');
|
|
10210
10234
|
|
|
10211
|
-
return this.resume(callSession,
|
|
10235
|
+
return this.resume(callSession, withEvent);
|
|
10212
10236
|
}
|
|
10213
10237
|
|
|
10214
|
-
resume(callSession ,
|
|
10238
|
+
resume(callSession , withEvent = true) {
|
|
10215
10239
|
logger$7.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
|
|
10216
10240
|
|
|
10217
10241
|
const sipSession = this.findSipSession(callSession);
|
|
@@ -10224,10 +10248,14 @@ class WebRTCPhone extends Emitter {
|
|
|
10224
10248
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
10225
10249
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
10226
10250
|
logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
10227
|
-
this.holdSipSession(
|
|
10251
|
+
this.holdSipSession(
|
|
10252
|
+
this.currentSipSession,
|
|
10253
|
+
this.currentCallSession,
|
|
10254
|
+
withEvent,
|
|
10255
|
+
);
|
|
10228
10256
|
}
|
|
10229
10257
|
|
|
10230
|
-
const promise = this.unholdSipSession(sipSession, callSession, withEvent
|
|
10258
|
+
const promise = this.unholdSipSession(sipSession, callSession, withEvent);
|
|
10231
10259
|
this.currentSipSession = sipSession;
|
|
10232
10260
|
if (callSession) {
|
|
10233
10261
|
this.currentCallSession = callSession;
|
|
@@ -10240,7 +10268,6 @@ class WebRTCPhone extends Emitter {
|
|
|
10240
10268
|
sipSession ,
|
|
10241
10269
|
callSession ,
|
|
10242
10270
|
withEvent = true,
|
|
10243
|
-
isConference = false,
|
|
10244
10271
|
) {
|
|
10245
10272
|
if (!sipSession) {
|
|
10246
10273
|
return new Promise((resolve, reject) => reject(new Error('No session to hold')));
|
|
@@ -10261,6 +10288,8 @@ class WebRTCPhone extends Emitter {
|
|
|
10261
10288
|
await this.client.downgradeToAudio(sipSession);
|
|
10262
10289
|
}
|
|
10263
10290
|
|
|
10291
|
+
const isConference = !!callSession && callSession.isConference();
|
|
10292
|
+
|
|
10264
10293
|
const promise = this.client.hold(sipSession, isConference, hasVideo);
|
|
10265
10294
|
if (withEvent) {
|
|
10266
10295
|
this.eventEmitter.emit(ON_CALL_HELD, this._createCallSession(sipSession, callSession));
|
|
@@ -10273,11 +10302,13 @@ class WebRTCPhone extends Emitter {
|
|
|
10273
10302
|
sipSession ,
|
|
10274
10303
|
callSession ,
|
|
10275
10304
|
withEvent = true,
|
|
10276
|
-
isConference = false,
|
|
10277
10305
|
) {
|
|
10278
10306
|
if (!sipSession) {
|
|
10279
10307
|
return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
|
|
10280
10308
|
}
|
|
10309
|
+
|
|
10310
|
+
const isConference = !!callSession && callSession.isConference();
|
|
10311
|
+
|
|
10281
10312
|
const sessionId = this.getSipSessionId(sipSession);
|
|
10282
10313
|
logger$7.info('WebRTC unhold sip session', { sessionId, isConference });
|
|
10283
10314
|
|
|
@@ -10419,7 +10450,11 @@ class WebRTCPhone extends Emitter {
|
|
|
10419
10450
|
await this.client.register();
|
|
10420
10451
|
}
|
|
10421
10452
|
if (this.currentSipSession) {
|
|
10422
|
-
this.holdSipSession(
|
|
10453
|
+
this.holdSipSession(
|
|
10454
|
+
this.currentSipSession,
|
|
10455
|
+
this.currentCallSession,
|
|
10456
|
+
true,
|
|
10457
|
+
).catch(e => {
|
|
10423
10458
|
logger$7.warn('Unable to hold current session when making another call', e);
|
|
10424
10459
|
});
|
|
10425
10460
|
}
|
|
@@ -10434,6 +10469,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10434
10469
|
return Promise.resolve(null);
|
|
10435
10470
|
}
|
|
10436
10471
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
10472
|
+
callSession.setIsConference(conference);
|
|
10437
10473
|
callSession.creationTime = new Date();
|
|
10438
10474
|
this._updateCallSession(callSession);
|
|
10439
10475
|
|
|
@@ -11012,6 +11048,7 @@ class WebRTCPhone extends Emitter {
|
|
|
11012
11048
|
recording: fromSession ? fromSession.isRecording() : false,
|
|
11013
11049
|
recordingPaused: false, // @TODO
|
|
11014
11050
|
sipSession,
|
|
11051
|
+
conference: !!fromSession && fromSession.isConference(),
|
|
11015
11052
|
...extra,
|
|
11016
11053
|
});
|
|
11017
11054
|
|
|
@@ -12001,6 +12038,10 @@ class AdHocAPIConference {
|
|
|
12001
12038
|
this.conferenceId = conferenceId || '';
|
|
12002
12039
|
this.muted = muted || false;
|
|
12003
12040
|
this.paused = paused || false;
|
|
12041
|
+
|
|
12042
|
+
if (this.host) {
|
|
12043
|
+
this.host.setIsConference(true);
|
|
12044
|
+
}
|
|
12004
12045
|
}
|
|
12005
12046
|
|
|
12006
12047
|
async start() {
|
|
@@ -12295,16 +12336,16 @@ class Phone extends Emitter {
|
|
|
12295
12336
|
}
|
|
12296
12337
|
}
|
|
12297
12338
|
|
|
12298
|
-
hold(callSession
|
|
12299
|
-
return this.phone && this.phone.hold(callSession, true
|
|
12339
|
+
hold(callSession ) {
|
|
12340
|
+
return this.phone && this.phone.hold(callSession, true);
|
|
12300
12341
|
}
|
|
12301
12342
|
|
|
12302
|
-
unhold(callSession
|
|
12303
|
-
return this.phone && this.phone.unhold(callSession, true
|
|
12343
|
+
unhold(callSession ) {
|
|
12344
|
+
return this.phone && this.phone.unhold(callSession, true);
|
|
12304
12345
|
}
|
|
12305
12346
|
|
|
12306
|
-
resume(callSession
|
|
12307
|
-
return this.phone && this.phone.resume(callSession
|
|
12347
|
+
resume(callSession ) {
|
|
12348
|
+
return this.phone && this.phone.resume(callSession);
|
|
12308
12349
|
}
|
|
12309
12350
|
|
|
12310
12351
|
reject(callSession ) {
|
package/lib/service/CallApi.js
CHANGED
|
@@ -564,6 +564,7 @@ const LINE_STATE = {
|
|
|
564
564
|
|
|
565
565
|
|
|
566
566
|
|
|
567
|
+
|
|
567
568
|
|
|
568
569
|
|
|
569
570
|
|
|
@@ -600,6 +601,7 @@ const LINE_STATE = {
|
|
|
600
601
|
|
|
601
602
|
|
|
602
603
|
|
|
604
|
+
|
|
603
605
|
|
|
604
606
|
|
|
605
607
|
|
|
@@ -631,6 +633,7 @@ class Profile {
|
|
|
631
633
|
|
|
632
634
|
|
|
633
635
|
|
|
636
|
+
|
|
634
637
|
|
|
635
638
|
|
|
636
639
|
|
|
@@ -647,6 +650,7 @@ class Profile {
|
|
|
647
650
|
lines: plain.lines.map(line => Line.parse(line)),
|
|
648
651
|
username: plain.username,
|
|
649
652
|
mobileNumber: plain.mobile_phone_number || '',
|
|
653
|
+
ringSeconds: plain.ring_seconds,
|
|
650
654
|
forwards: [
|
|
651
655
|
ForwardOption.parse(plain.forwards.unconditional, FORWARD_KEYS.UNCONDITIONAL),
|
|
652
656
|
ForwardOption.parse(plain.forwards.noanswer, FORWARD_KEYS.NO_ANSWER),
|
|
@@ -683,6 +687,7 @@ class Profile {
|
|
|
683
687
|
switchboards,
|
|
684
688
|
agent,
|
|
685
689
|
status,
|
|
690
|
+
ringSeconds,
|
|
686
691
|
sipLines,
|
|
687
692
|
callPickupTargetUsers,
|
|
688
693
|
onlineCallRecordEnabled,
|
|
@@ -704,6 +709,7 @@ class Profile {
|
|
|
704
709
|
this.status = status;
|
|
705
710
|
this.callPickupTargetUsers = callPickupTargetUsers;
|
|
706
711
|
this.onlineCallRecordEnabled = onlineCallRecordEnabled;
|
|
712
|
+
this.ringSeconds = ringSeconds;
|
|
707
713
|
|
|
708
714
|
this.sipLines = sipLines || [];
|
|
709
715
|
}
|
|
@@ -1757,7 +1763,7 @@ class Recording {
|
|
|
1757
1763
|
|
|
1758
1764
|
|
|
1759
1765
|
|
|
1760
|
-
|
|
1766
|
+
|
|
1761
1767
|
|
|
1762
1768
|
|
|
1763
1769
|
|
|
@@ -1060,6 +1060,7 @@ const LINE_STATE = {
|
|
|
1060
1060
|
|
|
1061
1061
|
|
|
1062
1062
|
|
|
1063
|
+
|
|
1063
1064
|
|
|
1064
1065
|
|
|
1065
1066
|
|
|
@@ -1096,6 +1097,7 @@ const LINE_STATE = {
|
|
|
1096
1097
|
|
|
1097
1098
|
|
|
1098
1099
|
|
|
1100
|
+
|
|
1099
1101
|
|
|
1100
1102
|
|
|
1101
1103
|
|
|
@@ -1127,6 +1129,7 @@ class Profile {
|
|
|
1127
1129
|
|
|
1128
1130
|
|
|
1129
1131
|
|
|
1132
|
+
|
|
1130
1133
|
|
|
1131
1134
|
|
|
1132
1135
|
|
|
@@ -1143,6 +1146,7 @@ class Profile {
|
|
|
1143
1146
|
lines: plain.lines.map(line => Line.parse(line)),
|
|
1144
1147
|
username: plain.username,
|
|
1145
1148
|
mobileNumber: plain.mobile_phone_number || '',
|
|
1149
|
+
ringSeconds: plain.ring_seconds,
|
|
1146
1150
|
forwards: [
|
|
1147
1151
|
ForwardOption.parse(plain.forwards.unconditional, FORWARD_KEYS.UNCONDITIONAL),
|
|
1148
1152
|
ForwardOption.parse(plain.forwards.noanswer, FORWARD_KEYS.NO_ANSWER),
|
|
@@ -1179,6 +1183,7 @@ class Profile {
|
|
|
1179
1183
|
switchboards,
|
|
1180
1184
|
agent,
|
|
1181
1185
|
status,
|
|
1186
|
+
ringSeconds,
|
|
1182
1187
|
sipLines,
|
|
1183
1188
|
callPickupTargetUsers,
|
|
1184
1189
|
onlineCallRecordEnabled,
|
|
@@ -1200,6 +1205,7 @@ class Profile {
|
|
|
1200
1205
|
this.status = status;
|
|
1201
1206
|
this.callPickupTargetUsers = callPickupTargetUsers;
|
|
1202
1207
|
this.onlineCallRecordEnabled = onlineCallRecordEnabled;
|
|
1208
|
+
this.ringSeconds = ringSeconds;
|
|
1203
1209
|
|
|
1204
1210
|
this.sipLines = sipLines || [];
|
|
1205
1211
|
}
|
|
@@ -3303,7 +3309,7 @@ class Recording {
|
|
|
3303
3309
|
|
|
3304
3310
|
|
|
3305
3311
|
|
|
3306
|
-
|
|
3312
|
+
|
|
3307
3313
|
|
|
3308
3314
|
|
|
3309
3315
|
|
package/lib/simple/Auth.js
CHANGED
|
@@ -396,6 +396,7 @@ const LINE_STATE = {
|
|
|
396
396
|
|
|
397
397
|
|
|
398
398
|
|
|
399
|
+
|
|
399
400
|
|
|
400
401
|
|
|
401
402
|
|
|
@@ -432,6 +433,7 @@ const LINE_STATE = {
|
|
|
432
433
|
|
|
433
434
|
|
|
434
435
|
|
|
436
|
+
|
|
435
437
|
|
|
436
438
|
|
|
437
439
|
|
|
@@ -463,6 +465,7 @@ class Profile {
|
|
|
463
465
|
|
|
464
466
|
|
|
465
467
|
|
|
468
|
+
|
|
466
469
|
|
|
467
470
|
|
|
468
471
|
|
|
@@ -479,6 +482,7 @@ class Profile {
|
|
|
479
482
|
lines: plain.lines.map(line => Line.parse(line)),
|
|
480
483
|
username: plain.username,
|
|
481
484
|
mobileNumber: plain.mobile_phone_number || '',
|
|
485
|
+
ringSeconds: plain.ring_seconds,
|
|
482
486
|
forwards: [
|
|
483
487
|
ForwardOption.parse(plain.forwards.unconditional, FORWARD_KEYS.UNCONDITIONAL),
|
|
484
488
|
ForwardOption.parse(plain.forwards.noanswer, FORWARD_KEYS.NO_ANSWER),
|
|
@@ -515,6 +519,7 @@ class Profile {
|
|
|
515
519
|
switchboards,
|
|
516
520
|
agent,
|
|
517
521
|
status,
|
|
522
|
+
ringSeconds,
|
|
518
523
|
sipLines,
|
|
519
524
|
callPickupTargetUsers,
|
|
520
525
|
onlineCallRecordEnabled,
|
|
@@ -536,6 +541,7 @@ class Profile {
|
|
|
536
541
|
this.status = status;
|
|
537
542
|
this.callPickupTargetUsers = callPickupTargetUsers;
|
|
538
543
|
this.onlineCallRecordEnabled = onlineCallRecordEnabled;
|
|
544
|
+
this.ringSeconds = ringSeconds;
|
|
539
545
|
|
|
540
546
|
this.sipLines = sipLines || [];
|
|
541
547
|
}
|
|
@@ -3292,6 +3298,7 @@ var updateFrom = (instance , from ) => {
|
|
|
3292
3298
|
|
|
3293
3299
|
|
|
3294
3300
|
|
|
3301
|
+
|
|
3295
3302
|
|
|
3296
3303
|
|
|
3297
3304
|
class CallSession {
|
|
@@ -3354,6 +3361,8 @@ class CallSession {
|
|
|
3354
3361
|
|
|
3355
3362
|
|
|
3356
3363
|
|
|
3364
|
+
|
|
3365
|
+
|
|
3357
3366
|
|
|
3358
3367
|
|
|
3359
3368
|
|
|
@@ -3385,6 +3394,7 @@ class CallSession {
|
|
|
3385
3394
|
videoRemotelyDowngraded,
|
|
3386
3395
|
sipSession,
|
|
3387
3396
|
answerTime,
|
|
3397
|
+
conference,
|
|
3388
3398
|
} ) {
|
|
3389
3399
|
this.callId = callId;
|
|
3390
3400
|
this.sipCallId = sipCallId;
|
|
@@ -3413,6 +3423,7 @@ class CallSession {
|
|
|
3413
3423
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
3414
3424
|
this.sipSession = sipSession;
|
|
3415
3425
|
this.answerTime = answerTime || this.answerTime;
|
|
3426
|
+
this.conference = conference;
|
|
3416
3427
|
|
|
3417
3428
|
// Useful to compare instead of instanceof with minified code
|
|
3418
3429
|
this.type = 'CallSession';
|
|
@@ -3470,6 +3481,10 @@ class CallSession {
|
|
|
3470
3481
|
this.screensharing = false;
|
|
3471
3482
|
}
|
|
3472
3483
|
|
|
3484
|
+
setIsConference(conference ) {
|
|
3485
|
+
this.conference = conference;
|
|
3486
|
+
}
|
|
3487
|
+
|
|
3473
3488
|
isIncoming() {
|
|
3474
3489
|
return !this.isCaller && !this.answered;
|
|
3475
3490
|
}
|
|
@@ -3546,6 +3561,10 @@ class CallSession {
|
|
|
3546
3561
|
return this.sipStatus === sessionState.SessionState.Terminated;
|
|
3547
3562
|
}
|
|
3548
3563
|
|
|
3564
|
+
isConference() {
|
|
3565
|
+
return this.conference;
|
|
3566
|
+
}
|
|
3567
|
+
|
|
3549
3568
|
getElapsedTimeInSeconds() {
|
|
3550
3569
|
if (!this.startTime) {
|
|
3551
3570
|
return 0;
|
|
@@ -3637,6 +3656,7 @@ class CallSession {
|
|
|
3637
3656
|
cameraEnabled: false,
|
|
3638
3657
|
dialedExtension: call.dialedExtension,
|
|
3639
3658
|
call,
|
|
3659
|
+
conference: false, // @FIXME?
|
|
3640
3660
|
});
|
|
3641
3661
|
}
|
|
3642
3662
|
}
|
|
@@ -3732,7 +3752,7 @@ class Recording {
|
|
|
3732
3752
|
|
|
3733
3753
|
|
|
3734
3754
|
|
|
3735
|
-
|
|
3755
|
+
|
|
3736
3756
|
|
|
3737
3757
|
|
|
3738
3758
|
|
|
@@ -5668,6 +5688,10 @@ class AdHocAPIConference {
|
|
|
5668
5688
|
this.conferenceId = conferenceId || '';
|
|
5669
5689
|
this.muted = muted || false;
|
|
5670
5690
|
this.paused = paused || false;
|
|
5691
|
+
|
|
5692
|
+
if (this.host) {
|
|
5693
|
+
this.host.setIsConference(true);
|
|
5694
|
+
}
|
|
5671
5695
|
}
|
|
5672
5696
|
|
|
5673
5697
|
async start() {
|
|
@@ -9377,7 +9401,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9377
9401
|
accept(callSession , cameraEnabled ) {
|
|
9378
9402
|
logger$8.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
|
|
9379
9403
|
if (this.currentSipSession) {
|
|
9380
|
-
this.holdSipSession(
|
|
9404
|
+
this.holdSipSession(
|
|
9405
|
+
this.currentSipSession,
|
|
9406
|
+
this.currentCallSession,
|
|
9407
|
+
true,
|
|
9408
|
+
);
|
|
9381
9409
|
}
|
|
9382
9410
|
|
|
9383
9411
|
if (!callSession) {
|
|
@@ -9470,22 +9498,22 @@ class WebRTCPhone extends Emitter {
|
|
|
9470
9498
|
}
|
|
9471
9499
|
}
|
|
9472
9500
|
|
|
9473
|
-
hold(callSession , withEvent = true
|
|
9501
|
+
hold(callSession , withEvent = true) {
|
|
9474
9502
|
logger$8.info('WebRTC hold', { id: callSession.getId() });
|
|
9475
9503
|
|
|
9476
9504
|
const sipSession = this.findSipSession(callSession);
|
|
9477
9505
|
|
|
9478
|
-
return sipSession ? this.holdSipSession(sipSession, callSession, withEvent
|
|
9506
|
+
return sipSession ? this.holdSipSession(sipSession, callSession, withEvent) : null;
|
|
9479
9507
|
}
|
|
9480
9508
|
|
|
9481
9509
|
// @Deprecated
|
|
9482
|
-
unhold(callSession , withEvent = true
|
|
9510
|
+
unhold(callSession , withEvent = true) {
|
|
9483
9511
|
console.warn('Please note that `phone.unhold()` is being deprecated; `phone.resume()` is the preferred method');
|
|
9484
9512
|
|
|
9485
|
-
return this.resume(callSession,
|
|
9513
|
+
return this.resume(callSession, withEvent);
|
|
9486
9514
|
}
|
|
9487
9515
|
|
|
9488
|
-
resume(callSession ,
|
|
9516
|
+
resume(callSession , withEvent = true) {
|
|
9489
9517
|
logger$8.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
|
|
9490
9518
|
|
|
9491
9519
|
const sipSession = this.findSipSession(callSession);
|
|
@@ -9498,10 +9526,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9498
9526
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
9499
9527
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
9500
9528
|
logger$8.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
9501
|
-
this.holdSipSession(
|
|
9529
|
+
this.holdSipSession(
|
|
9530
|
+
this.currentSipSession,
|
|
9531
|
+
this.currentCallSession,
|
|
9532
|
+
withEvent,
|
|
9533
|
+
);
|
|
9502
9534
|
}
|
|
9503
9535
|
|
|
9504
|
-
const promise = this.unholdSipSession(sipSession, callSession, withEvent
|
|
9536
|
+
const promise = this.unholdSipSession(sipSession, callSession, withEvent);
|
|
9505
9537
|
this.currentSipSession = sipSession;
|
|
9506
9538
|
if (callSession) {
|
|
9507
9539
|
this.currentCallSession = callSession;
|
|
@@ -9514,7 +9546,6 @@ class WebRTCPhone extends Emitter {
|
|
|
9514
9546
|
sipSession ,
|
|
9515
9547
|
callSession ,
|
|
9516
9548
|
withEvent = true,
|
|
9517
|
-
isConference = false,
|
|
9518
9549
|
) {
|
|
9519
9550
|
if (!sipSession) {
|
|
9520
9551
|
return new Promise((resolve, reject) => reject(new Error('No session to hold')));
|
|
@@ -9535,6 +9566,8 @@ class WebRTCPhone extends Emitter {
|
|
|
9535
9566
|
await this.client.downgradeToAudio(sipSession);
|
|
9536
9567
|
}
|
|
9537
9568
|
|
|
9569
|
+
const isConference = !!callSession && callSession.isConference();
|
|
9570
|
+
|
|
9538
9571
|
const promise = this.client.hold(sipSession, isConference, hasVideo);
|
|
9539
9572
|
if (withEvent) {
|
|
9540
9573
|
this.eventEmitter.emit(ON_CALL_HELD, this._createCallSession(sipSession, callSession));
|
|
@@ -9547,11 +9580,13 @@ class WebRTCPhone extends Emitter {
|
|
|
9547
9580
|
sipSession ,
|
|
9548
9581
|
callSession ,
|
|
9549
9582
|
withEvent = true,
|
|
9550
|
-
isConference = false,
|
|
9551
9583
|
) {
|
|
9552
9584
|
if (!sipSession) {
|
|
9553
9585
|
return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
|
|
9554
9586
|
}
|
|
9587
|
+
|
|
9588
|
+
const isConference = !!callSession && callSession.isConference();
|
|
9589
|
+
|
|
9555
9590
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9556
9591
|
logger$8.info('WebRTC unhold sip session', { sessionId, isConference });
|
|
9557
9592
|
|
|
@@ -9693,7 +9728,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9693
9728
|
await this.client.register();
|
|
9694
9729
|
}
|
|
9695
9730
|
if (this.currentSipSession) {
|
|
9696
|
-
this.holdSipSession(
|
|
9731
|
+
this.holdSipSession(
|
|
9732
|
+
this.currentSipSession,
|
|
9733
|
+
this.currentCallSession,
|
|
9734
|
+
true,
|
|
9735
|
+
).catch(e => {
|
|
9697
9736
|
logger$8.warn('Unable to hold current session when making another call', e);
|
|
9698
9737
|
});
|
|
9699
9738
|
}
|
|
@@ -9708,6 +9747,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9708
9747
|
return Promise.resolve(null);
|
|
9709
9748
|
}
|
|
9710
9749
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
9750
|
+
callSession.setIsConference(conference);
|
|
9711
9751
|
callSession.creationTime = new Date();
|
|
9712
9752
|
this._updateCallSession(callSession);
|
|
9713
9753
|
|
|
@@ -10286,6 +10326,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10286
10326
|
recording: fromSession ? fromSession.isRecording() : false,
|
|
10287
10327
|
recordingPaused: false, // @TODO
|
|
10288
10328
|
sipSession,
|
|
10329
|
+
conference: !!fromSession && fromSession.isConference(),
|
|
10289
10330
|
...extra,
|
|
10290
10331
|
});
|
|
10291
10332
|
|
|
@@ -10542,16 +10583,16 @@ class Phone extends Emitter {
|
|
|
10542
10583
|
}
|
|
10543
10584
|
}
|
|
10544
10585
|
|
|
10545
|
-
hold(callSession
|
|
10546
|
-
return this.phone && this.phone.hold(callSession, true
|
|
10586
|
+
hold(callSession ) {
|
|
10587
|
+
return this.phone && this.phone.hold(callSession, true);
|
|
10547
10588
|
}
|
|
10548
10589
|
|
|
10549
|
-
unhold(callSession
|
|
10550
|
-
return this.phone && this.phone.unhold(callSession, true
|
|
10590
|
+
unhold(callSession ) {
|
|
10591
|
+
return this.phone && this.phone.unhold(callSession, true);
|
|
10551
10592
|
}
|
|
10552
10593
|
|
|
10553
|
-
resume(callSession
|
|
10554
|
-
return this.phone && this.phone.resume(callSession
|
|
10594
|
+
resume(callSession ) {
|
|
10595
|
+
return this.phone && this.phone.resume(callSession);
|
|
10555
10596
|
}
|
|
10556
10597
|
|
|
10557
10598
|
reject(callSession ) {
|