@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
|
@@ -394,6 +394,7 @@ const LINE_STATE = {
|
|
|
394
394
|
|
|
395
395
|
|
|
396
396
|
|
|
397
|
+
|
|
397
398
|
|
|
398
399
|
|
|
399
400
|
|
|
@@ -430,6 +431,7 @@ const LINE_STATE = {
|
|
|
430
431
|
|
|
431
432
|
|
|
432
433
|
|
|
434
|
+
|
|
433
435
|
|
|
434
436
|
|
|
435
437
|
|
|
@@ -461,6 +463,7 @@ class Profile {
|
|
|
461
463
|
|
|
462
464
|
|
|
463
465
|
|
|
466
|
+
|
|
464
467
|
|
|
465
468
|
|
|
466
469
|
|
|
@@ -477,6 +480,7 @@ class Profile {
|
|
|
477
480
|
lines: plain.lines.map(line => Line.parse(line)),
|
|
478
481
|
username: plain.username,
|
|
479
482
|
mobileNumber: plain.mobile_phone_number || '',
|
|
483
|
+
ringSeconds: plain.ring_seconds,
|
|
480
484
|
forwards: [
|
|
481
485
|
ForwardOption.parse(plain.forwards.unconditional, FORWARD_KEYS.UNCONDITIONAL),
|
|
482
486
|
ForwardOption.parse(plain.forwards.noanswer, FORWARD_KEYS.NO_ANSWER),
|
|
@@ -513,6 +517,7 @@ class Profile {
|
|
|
513
517
|
switchboards,
|
|
514
518
|
agent,
|
|
515
519
|
status,
|
|
520
|
+
ringSeconds,
|
|
516
521
|
sipLines,
|
|
517
522
|
callPickupTargetUsers,
|
|
518
523
|
onlineCallRecordEnabled,
|
|
@@ -534,6 +539,7 @@ class Profile {
|
|
|
534
539
|
this.status = status;
|
|
535
540
|
this.callPickupTargetUsers = callPickupTargetUsers;
|
|
536
541
|
this.onlineCallRecordEnabled = onlineCallRecordEnabled;
|
|
542
|
+
this.ringSeconds = ringSeconds;
|
|
537
543
|
|
|
538
544
|
this.sipLines = sipLines || [];
|
|
539
545
|
}
|
|
@@ -3290,6 +3296,7 @@ var updateFrom = (instance , from ) => {
|
|
|
3290
3296
|
|
|
3291
3297
|
|
|
3292
3298
|
|
|
3299
|
+
|
|
3293
3300
|
|
|
3294
3301
|
|
|
3295
3302
|
class CallSession {
|
|
@@ -3352,6 +3359,8 @@ class CallSession {
|
|
|
3352
3359
|
|
|
3353
3360
|
|
|
3354
3361
|
|
|
3362
|
+
|
|
3363
|
+
|
|
3355
3364
|
|
|
3356
3365
|
|
|
3357
3366
|
|
|
@@ -3383,6 +3392,7 @@ class CallSession {
|
|
|
3383
3392
|
videoRemotelyDowngraded,
|
|
3384
3393
|
sipSession,
|
|
3385
3394
|
answerTime,
|
|
3395
|
+
conference,
|
|
3386
3396
|
} ) {
|
|
3387
3397
|
this.callId = callId;
|
|
3388
3398
|
this.sipCallId = sipCallId;
|
|
@@ -3411,6 +3421,7 @@ class CallSession {
|
|
|
3411
3421
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
3412
3422
|
this.sipSession = sipSession;
|
|
3413
3423
|
this.answerTime = answerTime || this.answerTime;
|
|
3424
|
+
this.conference = conference;
|
|
3414
3425
|
|
|
3415
3426
|
// Useful to compare instead of instanceof with minified code
|
|
3416
3427
|
this.type = 'CallSession';
|
|
@@ -3468,6 +3479,10 @@ class CallSession {
|
|
|
3468
3479
|
this.screensharing = false;
|
|
3469
3480
|
}
|
|
3470
3481
|
|
|
3482
|
+
setIsConference(conference ) {
|
|
3483
|
+
this.conference = conference;
|
|
3484
|
+
}
|
|
3485
|
+
|
|
3471
3486
|
isIncoming() {
|
|
3472
3487
|
return !this.isCaller && !this.answered;
|
|
3473
3488
|
}
|
|
@@ -3544,6 +3559,10 @@ class CallSession {
|
|
|
3544
3559
|
return this.sipStatus === sessionState.SessionState.Terminated;
|
|
3545
3560
|
}
|
|
3546
3561
|
|
|
3562
|
+
isConference() {
|
|
3563
|
+
return this.conference;
|
|
3564
|
+
}
|
|
3565
|
+
|
|
3547
3566
|
getElapsedTimeInSeconds() {
|
|
3548
3567
|
if (!this.startTime) {
|
|
3549
3568
|
return 0;
|
|
@@ -3635,6 +3654,7 @@ class CallSession {
|
|
|
3635
3654
|
cameraEnabled: false,
|
|
3636
3655
|
dialedExtension: call.dialedExtension,
|
|
3637
3656
|
call,
|
|
3657
|
+
conference: false, // @FIXME?
|
|
3638
3658
|
});
|
|
3639
3659
|
}
|
|
3640
3660
|
}
|
|
@@ -3730,7 +3750,7 @@ class Recording {
|
|
|
3730
3750
|
|
|
3731
3751
|
|
|
3732
3752
|
|
|
3733
|
-
|
|
3753
|
+
|
|
3734
3754
|
|
|
3735
3755
|
|
|
3736
3756
|
|
|
@@ -5666,6 +5686,10 @@ class AdHocAPIConference {
|
|
|
5666
5686
|
this.conferenceId = conferenceId || '';
|
|
5667
5687
|
this.muted = muted || false;
|
|
5668
5688
|
this.paused = paused || false;
|
|
5689
|
+
|
|
5690
|
+
if (this.host) {
|
|
5691
|
+
this.host.setIsConference(true);
|
|
5692
|
+
}
|
|
5669
5693
|
}
|
|
5670
5694
|
|
|
5671
5695
|
async start() {
|
|
@@ -9375,7 +9399,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9375
9399
|
accept(callSession , cameraEnabled ) {
|
|
9376
9400
|
logger$8.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
|
|
9377
9401
|
if (this.currentSipSession) {
|
|
9378
|
-
this.holdSipSession(
|
|
9402
|
+
this.holdSipSession(
|
|
9403
|
+
this.currentSipSession,
|
|
9404
|
+
this.currentCallSession,
|
|
9405
|
+
true,
|
|
9406
|
+
);
|
|
9379
9407
|
}
|
|
9380
9408
|
|
|
9381
9409
|
if (!callSession) {
|
|
@@ -9468,22 +9496,22 @@ class WebRTCPhone extends Emitter {
|
|
|
9468
9496
|
}
|
|
9469
9497
|
}
|
|
9470
9498
|
|
|
9471
|
-
hold(callSession , withEvent = true
|
|
9499
|
+
hold(callSession , withEvent = true) {
|
|
9472
9500
|
logger$8.info('WebRTC hold', { id: callSession.getId() });
|
|
9473
9501
|
|
|
9474
9502
|
const sipSession = this.findSipSession(callSession);
|
|
9475
9503
|
|
|
9476
|
-
return sipSession ? this.holdSipSession(sipSession, callSession, withEvent
|
|
9504
|
+
return sipSession ? this.holdSipSession(sipSession, callSession, withEvent) : null;
|
|
9477
9505
|
}
|
|
9478
9506
|
|
|
9479
9507
|
// @Deprecated
|
|
9480
|
-
unhold(callSession , withEvent = true
|
|
9508
|
+
unhold(callSession , withEvent = true) {
|
|
9481
9509
|
console.warn('Please note that `phone.unhold()` is being deprecated; `phone.resume()` is the preferred method');
|
|
9482
9510
|
|
|
9483
|
-
return this.resume(callSession,
|
|
9511
|
+
return this.resume(callSession, withEvent);
|
|
9484
9512
|
}
|
|
9485
9513
|
|
|
9486
|
-
resume(callSession ,
|
|
9514
|
+
resume(callSession , withEvent = true) {
|
|
9487
9515
|
logger$8.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
|
|
9488
9516
|
|
|
9489
9517
|
const sipSession = this.findSipSession(callSession);
|
|
@@ -9496,10 +9524,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9496
9524
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
9497
9525
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
9498
9526
|
logger$8.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
9499
|
-
this.holdSipSession(
|
|
9527
|
+
this.holdSipSession(
|
|
9528
|
+
this.currentSipSession,
|
|
9529
|
+
this.currentCallSession,
|
|
9530
|
+
withEvent,
|
|
9531
|
+
);
|
|
9500
9532
|
}
|
|
9501
9533
|
|
|
9502
|
-
const promise = this.unholdSipSession(sipSession, callSession, withEvent
|
|
9534
|
+
const promise = this.unholdSipSession(sipSession, callSession, withEvent);
|
|
9503
9535
|
this.currentSipSession = sipSession;
|
|
9504
9536
|
if (callSession) {
|
|
9505
9537
|
this.currentCallSession = callSession;
|
|
@@ -9512,7 +9544,6 @@ class WebRTCPhone extends Emitter {
|
|
|
9512
9544
|
sipSession ,
|
|
9513
9545
|
callSession ,
|
|
9514
9546
|
withEvent = true,
|
|
9515
|
-
isConference = false,
|
|
9516
9547
|
) {
|
|
9517
9548
|
if (!sipSession) {
|
|
9518
9549
|
return new Promise((resolve, reject) => reject(new Error('No session to hold')));
|
|
@@ -9533,6 +9564,8 @@ class WebRTCPhone extends Emitter {
|
|
|
9533
9564
|
await this.client.downgradeToAudio(sipSession);
|
|
9534
9565
|
}
|
|
9535
9566
|
|
|
9567
|
+
const isConference = !!callSession && callSession.isConference();
|
|
9568
|
+
|
|
9536
9569
|
const promise = this.client.hold(sipSession, isConference, hasVideo);
|
|
9537
9570
|
if (withEvent) {
|
|
9538
9571
|
this.eventEmitter.emit(ON_CALL_HELD, this._createCallSession(sipSession, callSession));
|
|
@@ -9545,11 +9578,13 @@ class WebRTCPhone extends Emitter {
|
|
|
9545
9578
|
sipSession ,
|
|
9546
9579
|
callSession ,
|
|
9547
9580
|
withEvent = true,
|
|
9548
|
-
isConference = false,
|
|
9549
9581
|
) {
|
|
9550
9582
|
if (!sipSession) {
|
|
9551
9583
|
return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
|
|
9552
9584
|
}
|
|
9585
|
+
|
|
9586
|
+
const isConference = !!callSession && callSession.isConference();
|
|
9587
|
+
|
|
9553
9588
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9554
9589
|
logger$8.info('WebRTC unhold sip session', { sessionId, isConference });
|
|
9555
9590
|
|
|
@@ -9691,7 +9726,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9691
9726
|
await this.client.register();
|
|
9692
9727
|
}
|
|
9693
9728
|
if (this.currentSipSession) {
|
|
9694
|
-
this.holdSipSession(
|
|
9729
|
+
this.holdSipSession(
|
|
9730
|
+
this.currentSipSession,
|
|
9731
|
+
this.currentCallSession,
|
|
9732
|
+
true,
|
|
9733
|
+
).catch(e => {
|
|
9695
9734
|
logger$8.warn('Unable to hold current session when making another call', e);
|
|
9696
9735
|
});
|
|
9697
9736
|
}
|
|
@@ -9706,6 +9745,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9706
9745
|
return Promise.resolve(null);
|
|
9707
9746
|
}
|
|
9708
9747
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
9748
|
+
callSession.setIsConference(conference);
|
|
9709
9749
|
callSession.creationTime = new Date();
|
|
9710
9750
|
this._updateCallSession(callSession);
|
|
9711
9751
|
|
|
@@ -10284,6 +10324,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10284
10324
|
recording: fromSession ? fromSession.isRecording() : false,
|
|
10285
10325
|
recordingPaused: false, // @TODO
|
|
10286
10326
|
sipSession,
|
|
10327
|
+
conference: !!fromSession && fromSession.isConference(),
|
|
10287
10328
|
...extra,
|
|
10288
10329
|
});
|
|
10289
10330
|
|
|
@@ -10540,16 +10581,16 @@ class Phone extends Emitter {
|
|
|
10540
10581
|
}
|
|
10541
10582
|
}
|
|
10542
10583
|
|
|
10543
|
-
hold(callSession
|
|
10544
|
-
return this.phone && this.phone.hold(callSession, true
|
|
10584
|
+
hold(callSession ) {
|
|
10585
|
+
return this.phone && this.phone.hold(callSession, true);
|
|
10545
10586
|
}
|
|
10546
10587
|
|
|
10547
|
-
unhold(callSession
|
|
10548
|
-
return this.phone && this.phone.unhold(callSession, true
|
|
10588
|
+
unhold(callSession ) {
|
|
10589
|
+
return this.phone && this.phone.unhold(callSession, true);
|
|
10549
10590
|
}
|
|
10550
10591
|
|
|
10551
|
-
resume(callSession
|
|
10552
|
-
return this.phone && this.phone.resume(callSession
|
|
10592
|
+
resume(callSession ) {
|
|
10593
|
+
return this.phone && this.phone.resume(callSession);
|
|
10553
10594
|
}
|
|
10554
10595
|
|
|
10555
10596
|
reject(callSession ) {
|
package/lib/simple/Directory.js
CHANGED
|
@@ -1058,6 +1058,7 @@ const LINE_STATE = {
|
|
|
1058
1058
|
|
|
1059
1059
|
|
|
1060
1060
|
|
|
1061
|
+
|
|
1061
1062
|
|
|
1062
1063
|
|
|
1063
1064
|
|
|
@@ -1094,6 +1095,7 @@ const LINE_STATE = {
|
|
|
1094
1095
|
|
|
1095
1096
|
|
|
1096
1097
|
|
|
1098
|
+
|
|
1097
1099
|
|
|
1098
1100
|
|
|
1099
1101
|
|
|
@@ -1125,6 +1127,7 @@ class Profile {
|
|
|
1125
1127
|
|
|
1126
1128
|
|
|
1127
1129
|
|
|
1130
|
+
|
|
1128
1131
|
|
|
1129
1132
|
|
|
1130
1133
|
|
|
@@ -1141,6 +1144,7 @@ class Profile {
|
|
|
1141
1144
|
lines: plain.lines.map(line => Line.parse(line)),
|
|
1142
1145
|
username: plain.username,
|
|
1143
1146
|
mobileNumber: plain.mobile_phone_number || '',
|
|
1147
|
+
ringSeconds: plain.ring_seconds,
|
|
1144
1148
|
forwards: [
|
|
1145
1149
|
ForwardOption.parse(plain.forwards.unconditional, FORWARD_KEYS.UNCONDITIONAL),
|
|
1146
1150
|
ForwardOption.parse(plain.forwards.noanswer, FORWARD_KEYS.NO_ANSWER),
|
|
@@ -1177,6 +1181,7 @@ class Profile {
|
|
|
1177
1181
|
switchboards,
|
|
1178
1182
|
agent,
|
|
1179
1183
|
status,
|
|
1184
|
+
ringSeconds,
|
|
1180
1185
|
sipLines,
|
|
1181
1186
|
callPickupTargetUsers,
|
|
1182
1187
|
onlineCallRecordEnabled,
|
|
@@ -1198,6 +1203,7 @@ class Profile {
|
|
|
1198
1203
|
this.status = status;
|
|
1199
1204
|
this.callPickupTargetUsers = callPickupTargetUsers;
|
|
1200
1205
|
this.onlineCallRecordEnabled = onlineCallRecordEnabled;
|
|
1206
|
+
this.ringSeconds = ringSeconds;
|
|
1201
1207
|
|
|
1202
1208
|
this.sipLines = sipLines || [];
|
|
1203
1209
|
}
|
|
@@ -3301,7 +3307,7 @@ class Recording {
|
|
|
3301
3307
|
|
|
3302
3308
|
|
|
3303
3309
|
|
|
3304
|
-
|
|
3310
|
+
|
|
3305
3311
|
|
|
3306
3312
|
|
|
3307
3313
|
|
package/lib/simple/Phone.js
CHANGED
|
@@ -285,6 +285,7 @@ var updateFrom = (instance , from ) => {
|
|
|
285
285
|
|
|
286
286
|
|
|
287
287
|
|
|
288
|
+
|
|
288
289
|
|
|
289
290
|
|
|
290
291
|
class CallSession {
|
|
@@ -347,6 +348,8 @@ class CallSession {
|
|
|
347
348
|
|
|
348
349
|
|
|
349
350
|
|
|
351
|
+
|
|
352
|
+
|
|
350
353
|
|
|
351
354
|
|
|
352
355
|
|
|
@@ -378,6 +381,7 @@ class CallSession {
|
|
|
378
381
|
videoRemotelyDowngraded,
|
|
379
382
|
sipSession,
|
|
380
383
|
answerTime,
|
|
384
|
+
conference,
|
|
381
385
|
} ) {
|
|
382
386
|
this.callId = callId;
|
|
383
387
|
this.sipCallId = sipCallId;
|
|
@@ -406,6 +410,7 @@ class CallSession {
|
|
|
406
410
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
407
411
|
this.sipSession = sipSession;
|
|
408
412
|
this.answerTime = answerTime || this.answerTime;
|
|
413
|
+
this.conference = conference;
|
|
409
414
|
|
|
410
415
|
// Useful to compare instead of instanceof with minified code
|
|
411
416
|
this.type = 'CallSession';
|
|
@@ -463,6 +468,10 @@ class CallSession {
|
|
|
463
468
|
this.screensharing = false;
|
|
464
469
|
}
|
|
465
470
|
|
|
471
|
+
setIsConference(conference ) {
|
|
472
|
+
this.conference = conference;
|
|
473
|
+
}
|
|
474
|
+
|
|
466
475
|
isIncoming() {
|
|
467
476
|
return !this.isCaller && !this.answered;
|
|
468
477
|
}
|
|
@@ -539,6 +548,10 @@ class CallSession {
|
|
|
539
548
|
return this.sipStatus === sessionState.SessionState.Terminated;
|
|
540
549
|
}
|
|
541
550
|
|
|
551
|
+
isConference() {
|
|
552
|
+
return this.conference;
|
|
553
|
+
}
|
|
554
|
+
|
|
542
555
|
getElapsedTimeInSeconds() {
|
|
543
556
|
if (!this.startTime) {
|
|
544
557
|
return 0;
|
|
@@ -630,6 +643,7 @@ class CallSession {
|
|
|
630
643
|
cameraEnabled: false,
|
|
631
644
|
dialedExtension: call.dialedExtension,
|
|
632
645
|
call,
|
|
646
|
+
conference: false, // @FIXME?
|
|
633
647
|
});
|
|
634
648
|
}
|
|
635
649
|
}
|
|
@@ -1670,6 +1684,7 @@ const LINE_STATE = {
|
|
|
1670
1684
|
|
|
1671
1685
|
|
|
1672
1686
|
|
|
1687
|
+
|
|
1673
1688
|
|
|
1674
1689
|
|
|
1675
1690
|
|
|
@@ -1706,6 +1721,7 @@ const LINE_STATE = {
|
|
|
1706
1721
|
|
|
1707
1722
|
|
|
1708
1723
|
|
|
1724
|
+
|
|
1709
1725
|
|
|
1710
1726
|
|
|
1711
1727
|
|
|
@@ -1737,6 +1753,7 @@ class Profile {
|
|
|
1737
1753
|
|
|
1738
1754
|
|
|
1739
1755
|
|
|
1756
|
+
|
|
1740
1757
|
|
|
1741
1758
|
|
|
1742
1759
|
|
|
@@ -1753,6 +1770,7 @@ class Profile {
|
|
|
1753
1770
|
lines: plain.lines.map(line => Line.parse(line)),
|
|
1754
1771
|
username: plain.username,
|
|
1755
1772
|
mobileNumber: plain.mobile_phone_number || '',
|
|
1773
|
+
ringSeconds: plain.ring_seconds,
|
|
1756
1774
|
forwards: [
|
|
1757
1775
|
ForwardOption.parse(plain.forwards.unconditional, FORWARD_KEYS.UNCONDITIONAL),
|
|
1758
1776
|
ForwardOption.parse(plain.forwards.noanswer, FORWARD_KEYS.NO_ANSWER),
|
|
@@ -1789,6 +1807,7 @@ class Profile {
|
|
|
1789
1807
|
switchboards,
|
|
1790
1808
|
agent,
|
|
1791
1809
|
status,
|
|
1810
|
+
ringSeconds,
|
|
1792
1811
|
sipLines,
|
|
1793
1812
|
callPickupTargetUsers,
|
|
1794
1813
|
onlineCallRecordEnabled,
|
|
@@ -1810,6 +1829,7 @@ class Profile {
|
|
|
1810
1829
|
this.status = status;
|
|
1811
1830
|
this.callPickupTargetUsers = callPickupTargetUsers;
|
|
1812
1831
|
this.onlineCallRecordEnabled = onlineCallRecordEnabled;
|
|
1832
|
+
this.ringSeconds = ringSeconds;
|
|
1813
1833
|
|
|
1814
1834
|
this.sipLines = sipLines || [];
|
|
1815
1835
|
}
|
|
@@ -3730,7 +3750,7 @@ class Recording {
|
|
|
3730
3750
|
|
|
3731
3751
|
|
|
3732
3752
|
|
|
3733
|
-
|
|
3753
|
+
|
|
3734
3754
|
|
|
3735
3755
|
|
|
3736
3756
|
|
|
@@ -5666,6 +5686,10 @@ class AdHocAPIConference {
|
|
|
5666
5686
|
this.conferenceId = conferenceId || '';
|
|
5667
5687
|
this.muted = muted || false;
|
|
5668
5688
|
this.paused = paused || false;
|
|
5689
|
+
|
|
5690
|
+
if (this.host) {
|
|
5691
|
+
this.host.setIsConference(true);
|
|
5692
|
+
}
|
|
5669
5693
|
}
|
|
5670
5694
|
|
|
5671
5695
|
async start() {
|
|
@@ -9375,7 +9399,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9375
9399
|
accept(callSession , cameraEnabled ) {
|
|
9376
9400
|
logger$8.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
|
|
9377
9401
|
if (this.currentSipSession) {
|
|
9378
|
-
this.holdSipSession(
|
|
9402
|
+
this.holdSipSession(
|
|
9403
|
+
this.currentSipSession,
|
|
9404
|
+
this.currentCallSession,
|
|
9405
|
+
true,
|
|
9406
|
+
);
|
|
9379
9407
|
}
|
|
9380
9408
|
|
|
9381
9409
|
if (!callSession) {
|
|
@@ -9468,22 +9496,22 @@ class WebRTCPhone extends Emitter {
|
|
|
9468
9496
|
}
|
|
9469
9497
|
}
|
|
9470
9498
|
|
|
9471
|
-
hold(callSession , withEvent = true
|
|
9499
|
+
hold(callSession , withEvent = true) {
|
|
9472
9500
|
logger$8.info('WebRTC hold', { id: callSession.getId() });
|
|
9473
9501
|
|
|
9474
9502
|
const sipSession = this.findSipSession(callSession);
|
|
9475
9503
|
|
|
9476
|
-
return sipSession ? this.holdSipSession(sipSession, callSession, withEvent
|
|
9504
|
+
return sipSession ? this.holdSipSession(sipSession, callSession, withEvent) : null;
|
|
9477
9505
|
}
|
|
9478
9506
|
|
|
9479
9507
|
// @Deprecated
|
|
9480
|
-
unhold(callSession , withEvent = true
|
|
9508
|
+
unhold(callSession , withEvent = true) {
|
|
9481
9509
|
console.warn('Please note that `phone.unhold()` is being deprecated; `phone.resume()` is the preferred method');
|
|
9482
9510
|
|
|
9483
|
-
return this.resume(callSession,
|
|
9511
|
+
return this.resume(callSession, withEvent);
|
|
9484
9512
|
}
|
|
9485
9513
|
|
|
9486
|
-
resume(callSession ,
|
|
9514
|
+
resume(callSession , withEvent = true) {
|
|
9487
9515
|
logger$8.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
|
|
9488
9516
|
|
|
9489
9517
|
const sipSession = this.findSipSession(callSession);
|
|
@@ -9496,10 +9524,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9496
9524
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
9497
9525
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
9498
9526
|
logger$8.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
9499
|
-
this.holdSipSession(
|
|
9527
|
+
this.holdSipSession(
|
|
9528
|
+
this.currentSipSession,
|
|
9529
|
+
this.currentCallSession,
|
|
9530
|
+
withEvent,
|
|
9531
|
+
);
|
|
9500
9532
|
}
|
|
9501
9533
|
|
|
9502
|
-
const promise = this.unholdSipSession(sipSession, callSession, withEvent
|
|
9534
|
+
const promise = this.unholdSipSession(sipSession, callSession, withEvent);
|
|
9503
9535
|
this.currentSipSession = sipSession;
|
|
9504
9536
|
if (callSession) {
|
|
9505
9537
|
this.currentCallSession = callSession;
|
|
@@ -9512,7 +9544,6 @@ class WebRTCPhone extends Emitter {
|
|
|
9512
9544
|
sipSession ,
|
|
9513
9545
|
callSession ,
|
|
9514
9546
|
withEvent = true,
|
|
9515
|
-
isConference = false,
|
|
9516
9547
|
) {
|
|
9517
9548
|
if (!sipSession) {
|
|
9518
9549
|
return new Promise((resolve, reject) => reject(new Error('No session to hold')));
|
|
@@ -9533,6 +9564,8 @@ class WebRTCPhone extends Emitter {
|
|
|
9533
9564
|
await this.client.downgradeToAudio(sipSession);
|
|
9534
9565
|
}
|
|
9535
9566
|
|
|
9567
|
+
const isConference = !!callSession && callSession.isConference();
|
|
9568
|
+
|
|
9536
9569
|
const promise = this.client.hold(sipSession, isConference, hasVideo);
|
|
9537
9570
|
if (withEvent) {
|
|
9538
9571
|
this.eventEmitter.emit(ON_CALL_HELD, this._createCallSession(sipSession, callSession));
|
|
@@ -9545,11 +9578,13 @@ class WebRTCPhone extends Emitter {
|
|
|
9545
9578
|
sipSession ,
|
|
9546
9579
|
callSession ,
|
|
9547
9580
|
withEvent = true,
|
|
9548
|
-
isConference = false,
|
|
9549
9581
|
) {
|
|
9550
9582
|
if (!sipSession) {
|
|
9551
9583
|
return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
|
|
9552
9584
|
}
|
|
9585
|
+
|
|
9586
|
+
const isConference = !!callSession && callSession.isConference();
|
|
9587
|
+
|
|
9553
9588
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9554
9589
|
logger$8.info('WebRTC unhold sip session', { sessionId, isConference });
|
|
9555
9590
|
|
|
@@ -9691,7 +9726,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9691
9726
|
await this.client.register();
|
|
9692
9727
|
}
|
|
9693
9728
|
if (this.currentSipSession) {
|
|
9694
|
-
this.holdSipSession(
|
|
9729
|
+
this.holdSipSession(
|
|
9730
|
+
this.currentSipSession,
|
|
9731
|
+
this.currentCallSession,
|
|
9732
|
+
true,
|
|
9733
|
+
).catch(e => {
|
|
9695
9734
|
logger$8.warn('Unable to hold current session when making another call', e);
|
|
9696
9735
|
});
|
|
9697
9736
|
}
|
|
@@ -9706,6 +9745,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9706
9745
|
return Promise.resolve(null);
|
|
9707
9746
|
}
|
|
9708
9747
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
9748
|
+
callSession.setIsConference(conference);
|
|
9709
9749
|
callSession.creationTime = new Date();
|
|
9710
9750
|
this._updateCallSession(callSession);
|
|
9711
9751
|
|
|
@@ -10284,6 +10324,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10284
10324
|
recording: fromSession ? fromSession.isRecording() : false,
|
|
10285
10325
|
recordingPaused: false, // @TODO
|
|
10286
10326
|
sipSession,
|
|
10327
|
+
conference: !!fromSession && fromSession.isConference(),
|
|
10287
10328
|
...extra,
|
|
10288
10329
|
});
|
|
10289
10330
|
|
|
@@ -13701,16 +13742,16 @@ class Phone extends Emitter {
|
|
|
13701
13742
|
}
|
|
13702
13743
|
}
|
|
13703
13744
|
|
|
13704
|
-
hold(callSession
|
|
13705
|
-
return this.phone && this.phone.hold(callSession, true
|
|
13745
|
+
hold(callSession ) {
|
|
13746
|
+
return this.phone && this.phone.hold(callSession, true);
|
|
13706
13747
|
}
|
|
13707
13748
|
|
|
13708
|
-
unhold(callSession
|
|
13709
|
-
return this.phone && this.phone.unhold(callSession, true
|
|
13749
|
+
unhold(callSession ) {
|
|
13750
|
+
return this.phone && this.phone.unhold(callSession, true);
|
|
13710
13751
|
}
|
|
13711
13752
|
|
|
13712
|
-
resume(callSession
|
|
13713
|
-
return this.phone && this.phone.resume(callSession
|
|
13753
|
+
resume(callSession ) {
|
|
13754
|
+
return this.phone && this.phone.resume(callSession);
|
|
13714
13755
|
}
|
|
13715
13756
|
|
|
13716
13757
|
reject(callSession ) {
|