@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/simple/index.js
CHANGED
|
@@ -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
|
|
|
@@ -5930,6 +5950,10 @@ class AdHocAPIConference {
|
|
|
5930
5950
|
this.conferenceId = conferenceId || '';
|
|
5931
5951
|
this.muted = muted || false;
|
|
5932
5952
|
this.paused = paused || false;
|
|
5953
|
+
|
|
5954
|
+
if (this.host) {
|
|
5955
|
+
this.host.setIsConference(true);
|
|
5956
|
+
}
|
|
5933
5957
|
}
|
|
5934
5958
|
|
|
5935
5959
|
async start() {
|
|
@@ -9639,7 +9663,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9639
9663
|
accept(callSession , cameraEnabled ) {
|
|
9640
9664
|
logger$7.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
|
|
9641
9665
|
if (this.currentSipSession) {
|
|
9642
|
-
this.holdSipSession(
|
|
9666
|
+
this.holdSipSession(
|
|
9667
|
+
this.currentSipSession,
|
|
9668
|
+
this.currentCallSession,
|
|
9669
|
+
true,
|
|
9670
|
+
);
|
|
9643
9671
|
}
|
|
9644
9672
|
|
|
9645
9673
|
if (!callSession) {
|
|
@@ -9732,22 +9760,22 @@ class WebRTCPhone extends Emitter {
|
|
|
9732
9760
|
}
|
|
9733
9761
|
}
|
|
9734
9762
|
|
|
9735
|
-
hold(callSession , withEvent = true
|
|
9763
|
+
hold(callSession , withEvent = true) {
|
|
9736
9764
|
logger$7.info('WebRTC hold', { id: callSession.getId() });
|
|
9737
9765
|
|
|
9738
9766
|
const sipSession = this.findSipSession(callSession);
|
|
9739
9767
|
|
|
9740
|
-
return sipSession ? this.holdSipSession(sipSession, callSession, withEvent
|
|
9768
|
+
return sipSession ? this.holdSipSession(sipSession, callSession, withEvent) : null;
|
|
9741
9769
|
}
|
|
9742
9770
|
|
|
9743
9771
|
// @Deprecated
|
|
9744
|
-
unhold(callSession , withEvent = true
|
|
9772
|
+
unhold(callSession , withEvent = true) {
|
|
9745
9773
|
console.warn('Please note that `phone.unhold()` is being deprecated; `phone.resume()` is the preferred method');
|
|
9746
9774
|
|
|
9747
|
-
return this.resume(callSession,
|
|
9775
|
+
return this.resume(callSession, withEvent);
|
|
9748
9776
|
}
|
|
9749
9777
|
|
|
9750
|
-
resume(callSession ,
|
|
9778
|
+
resume(callSession , withEvent = true) {
|
|
9751
9779
|
logger$7.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
|
|
9752
9780
|
|
|
9753
9781
|
const sipSession = this.findSipSession(callSession);
|
|
@@ -9760,10 +9788,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9760
9788
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
9761
9789
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
9762
9790
|
logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
9763
|
-
this.holdSipSession(
|
|
9791
|
+
this.holdSipSession(
|
|
9792
|
+
this.currentSipSession,
|
|
9793
|
+
this.currentCallSession,
|
|
9794
|
+
withEvent,
|
|
9795
|
+
);
|
|
9764
9796
|
}
|
|
9765
9797
|
|
|
9766
|
-
const promise = this.unholdSipSession(sipSession, callSession, withEvent
|
|
9798
|
+
const promise = this.unholdSipSession(sipSession, callSession, withEvent);
|
|
9767
9799
|
this.currentSipSession = sipSession;
|
|
9768
9800
|
if (callSession) {
|
|
9769
9801
|
this.currentCallSession = callSession;
|
|
@@ -9776,7 +9808,6 @@ class WebRTCPhone extends Emitter {
|
|
|
9776
9808
|
sipSession ,
|
|
9777
9809
|
callSession ,
|
|
9778
9810
|
withEvent = true,
|
|
9779
|
-
isConference = false,
|
|
9780
9811
|
) {
|
|
9781
9812
|
if (!sipSession) {
|
|
9782
9813
|
return new Promise((resolve, reject) => reject(new Error('No session to hold')));
|
|
@@ -9797,6 +9828,8 @@ class WebRTCPhone extends Emitter {
|
|
|
9797
9828
|
await this.client.downgradeToAudio(sipSession);
|
|
9798
9829
|
}
|
|
9799
9830
|
|
|
9831
|
+
const isConference = !!callSession && callSession.isConference();
|
|
9832
|
+
|
|
9800
9833
|
const promise = this.client.hold(sipSession, isConference, hasVideo);
|
|
9801
9834
|
if (withEvent) {
|
|
9802
9835
|
this.eventEmitter.emit(ON_CALL_HELD, this._createCallSession(sipSession, callSession));
|
|
@@ -9809,11 +9842,13 @@ class WebRTCPhone extends Emitter {
|
|
|
9809
9842
|
sipSession ,
|
|
9810
9843
|
callSession ,
|
|
9811
9844
|
withEvent = true,
|
|
9812
|
-
isConference = false,
|
|
9813
9845
|
) {
|
|
9814
9846
|
if (!sipSession) {
|
|
9815
9847
|
return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
|
|
9816
9848
|
}
|
|
9849
|
+
|
|
9850
|
+
const isConference = !!callSession && callSession.isConference();
|
|
9851
|
+
|
|
9817
9852
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9818
9853
|
logger$7.info('WebRTC unhold sip session', { sessionId, isConference });
|
|
9819
9854
|
|
|
@@ -9955,7 +9990,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9955
9990
|
await this.client.register();
|
|
9956
9991
|
}
|
|
9957
9992
|
if (this.currentSipSession) {
|
|
9958
|
-
this.holdSipSession(
|
|
9993
|
+
this.holdSipSession(
|
|
9994
|
+
this.currentSipSession,
|
|
9995
|
+
this.currentCallSession,
|
|
9996
|
+
true,
|
|
9997
|
+
).catch(e => {
|
|
9959
9998
|
logger$7.warn('Unable to hold current session when making another call', e);
|
|
9960
9999
|
});
|
|
9961
10000
|
}
|
|
@@ -9970,6 +10009,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9970
10009
|
return Promise.resolve(null);
|
|
9971
10010
|
}
|
|
9972
10011
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
10012
|
+
callSession.setIsConference(conference);
|
|
9973
10013
|
callSession.creationTime = new Date();
|
|
9974
10014
|
this._updateCallSession(callSession);
|
|
9975
10015
|
|
|
@@ -10548,6 +10588,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10548
10588
|
recording: fromSession ? fromSession.isRecording() : false,
|
|
10549
10589
|
recordingPaused: false, // @TODO
|
|
10550
10590
|
sipSession,
|
|
10591
|
+
conference: !!fromSession && fromSession.isConference(),
|
|
10551
10592
|
...extra,
|
|
10552
10593
|
});
|
|
10553
10594
|
|
|
@@ -10804,16 +10845,16 @@ class Phone extends Emitter {
|
|
|
10804
10845
|
}
|
|
10805
10846
|
}
|
|
10806
10847
|
|
|
10807
|
-
hold(callSession
|
|
10808
|
-
return this.phone && this.phone.hold(callSession, true
|
|
10848
|
+
hold(callSession ) {
|
|
10849
|
+
return this.phone && this.phone.hold(callSession, true);
|
|
10809
10850
|
}
|
|
10810
10851
|
|
|
10811
|
-
unhold(callSession
|
|
10812
|
-
return this.phone && this.phone.unhold(callSession, true
|
|
10852
|
+
unhold(callSession ) {
|
|
10853
|
+
return this.phone && this.phone.unhold(callSession, true);
|
|
10813
10854
|
}
|
|
10814
10855
|
|
|
10815
|
-
resume(callSession
|
|
10816
|
-
return this.phone && this.phone.resume(callSession
|
|
10856
|
+
resume(callSession ) {
|
|
10857
|
+
return this.phone && this.phone.resume(callSession);
|
|
10817
10858
|
}
|
|
10818
10859
|
|
|
10819
10860
|
reject(callSession ) {
|
|
@@ -1107,6 +1107,7 @@ const LINE_STATE = {
|
|
|
1107
1107
|
|
|
1108
1108
|
|
|
1109
1109
|
|
|
1110
|
+
|
|
1110
1111
|
|
|
1111
1112
|
|
|
1112
1113
|
|
|
@@ -1143,6 +1144,7 @@ const LINE_STATE = {
|
|
|
1143
1144
|
|
|
1144
1145
|
|
|
1145
1146
|
|
|
1147
|
+
|
|
1146
1148
|
|
|
1147
1149
|
|
|
1148
1150
|
|
|
@@ -1174,6 +1176,7 @@ class Profile {
|
|
|
1174
1176
|
|
|
1175
1177
|
|
|
1176
1178
|
|
|
1179
|
+
|
|
1177
1180
|
|
|
1178
1181
|
|
|
1179
1182
|
|
|
@@ -1190,6 +1193,7 @@ class Profile {
|
|
|
1190
1193
|
lines: plain.lines.map(line => Line.parse(line)),
|
|
1191
1194
|
username: plain.username,
|
|
1192
1195
|
mobileNumber: plain.mobile_phone_number || '',
|
|
1196
|
+
ringSeconds: plain.ring_seconds,
|
|
1193
1197
|
forwards: [
|
|
1194
1198
|
ForwardOption.parse(plain.forwards.unconditional, FORWARD_KEYS.UNCONDITIONAL),
|
|
1195
1199
|
ForwardOption.parse(plain.forwards.noanswer, FORWARD_KEYS.NO_ANSWER),
|
|
@@ -1226,6 +1230,7 @@ class Profile {
|
|
|
1226
1230
|
switchboards,
|
|
1227
1231
|
agent,
|
|
1228
1232
|
status,
|
|
1233
|
+
ringSeconds,
|
|
1229
1234
|
sipLines,
|
|
1230
1235
|
callPickupTargetUsers,
|
|
1231
1236
|
onlineCallRecordEnabled,
|
|
@@ -1247,6 +1252,7 @@ class Profile {
|
|
|
1247
1252
|
this.status = status;
|
|
1248
1253
|
this.callPickupTargetUsers = callPickupTargetUsers;
|
|
1249
1254
|
this.onlineCallRecordEnabled = onlineCallRecordEnabled;
|
|
1255
|
+
this.ringSeconds = ringSeconds;
|
|
1250
1256
|
|
|
1251
1257
|
this.sipLines = sipLines || [];
|
|
1252
1258
|
}
|
|
@@ -3316,6 +3322,7 @@ var updateFrom = (instance , from ) => {
|
|
|
3316
3322
|
|
|
3317
3323
|
|
|
3318
3324
|
|
|
3325
|
+
|
|
3319
3326
|
|
|
3320
3327
|
|
|
3321
3328
|
class CallSession {
|
|
@@ -3378,6 +3385,8 @@ class CallSession {
|
|
|
3378
3385
|
|
|
3379
3386
|
|
|
3380
3387
|
|
|
3388
|
+
|
|
3389
|
+
|
|
3381
3390
|
|
|
3382
3391
|
|
|
3383
3392
|
|
|
@@ -3409,6 +3418,7 @@ class CallSession {
|
|
|
3409
3418
|
videoRemotelyDowngraded,
|
|
3410
3419
|
sipSession,
|
|
3411
3420
|
answerTime,
|
|
3421
|
+
conference,
|
|
3412
3422
|
} ) {
|
|
3413
3423
|
this.callId = callId;
|
|
3414
3424
|
this.sipCallId = sipCallId;
|
|
@@ -3437,6 +3447,7 @@ class CallSession {
|
|
|
3437
3447
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
3438
3448
|
this.sipSession = sipSession;
|
|
3439
3449
|
this.answerTime = answerTime || this.answerTime;
|
|
3450
|
+
this.conference = conference;
|
|
3440
3451
|
|
|
3441
3452
|
// Useful to compare instead of instanceof with minified code
|
|
3442
3453
|
this.type = 'CallSession';
|
|
@@ -3494,6 +3505,10 @@ class CallSession {
|
|
|
3494
3505
|
this.screensharing = false;
|
|
3495
3506
|
}
|
|
3496
3507
|
|
|
3508
|
+
setIsConference(conference ) {
|
|
3509
|
+
this.conference = conference;
|
|
3510
|
+
}
|
|
3511
|
+
|
|
3497
3512
|
isIncoming() {
|
|
3498
3513
|
return !this.isCaller && !this.answered;
|
|
3499
3514
|
}
|
|
@@ -3570,6 +3585,10 @@ class CallSession {
|
|
|
3570
3585
|
return this.sipStatus === sessionState.SessionState.Terminated;
|
|
3571
3586
|
}
|
|
3572
3587
|
|
|
3588
|
+
isConference() {
|
|
3589
|
+
return this.conference;
|
|
3590
|
+
}
|
|
3591
|
+
|
|
3573
3592
|
getElapsedTimeInSeconds() {
|
|
3574
3593
|
if (!this.startTime) {
|
|
3575
3594
|
return 0;
|
|
@@ -3661,6 +3680,7 @@ class CallSession {
|
|
|
3661
3680
|
cameraEnabled: false,
|
|
3662
3681
|
dialedExtension: call.dialedExtension,
|
|
3663
3682
|
call,
|
|
3683
|
+
conference: false, // @FIXME?
|
|
3664
3684
|
});
|
|
3665
3685
|
}
|
|
3666
3686
|
}
|
|
@@ -3730,7 +3750,7 @@ class Recording {
|
|
|
3730
3750
|
|
|
3731
3751
|
|
|
3732
3752
|
|
|
3733
|
-
|
|
3753
|
+
|
|
3734
3754
|
|
|
3735
3755
|
|
|
3736
3756
|
|
|
@@ -5930,6 +5950,10 @@ class AdHocAPIConference {
|
|
|
5930
5950
|
this.conferenceId = conferenceId || '';
|
|
5931
5951
|
this.muted = muted || false;
|
|
5932
5952
|
this.paused = paused || false;
|
|
5953
|
+
|
|
5954
|
+
if (this.host) {
|
|
5955
|
+
this.host.setIsConference(true);
|
|
5956
|
+
}
|
|
5933
5957
|
}
|
|
5934
5958
|
|
|
5935
5959
|
async start() {
|
|
@@ -9639,7 +9663,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9639
9663
|
accept(callSession , cameraEnabled ) {
|
|
9640
9664
|
logger$7.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
|
|
9641
9665
|
if (this.currentSipSession) {
|
|
9642
|
-
this.holdSipSession(
|
|
9666
|
+
this.holdSipSession(
|
|
9667
|
+
this.currentSipSession,
|
|
9668
|
+
this.currentCallSession,
|
|
9669
|
+
true,
|
|
9670
|
+
);
|
|
9643
9671
|
}
|
|
9644
9672
|
|
|
9645
9673
|
if (!callSession) {
|
|
@@ -9732,22 +9760,22 @@ class WebRTCPhone extends Emitter {
|
|
|
9732
9760
|
}
|
|
9733
9761
|
}
|
|
9734
9762
|
|
|
9735
|
-
hold(callSession , withEvent = true
|
|
9763
|
+
hold(callSession , withEvent = true) {
|
|
9736
9764
|
logger$7.info('WebRTC hold', { id: callSession.getId() });
|
|
9737
9765
|
|
|
9738
9766
|
const sipSession = this.findSipSession(callSession);
|
|
9739
9767
|
|
|
9740
|
-
return sipSession ? this.holdSipSession(sipSession, callSession, withEvent
|
|
9768
|
+
return sipSession ? this.holdSipSession(sipSession, callSession, withEvent) : null;
|
|
9741
9769
|
}
|
|
9742
9770
|
|
|
9743
9771
|
// @Deprecated
|
|
9744
|
-
unhold(callSession , withEvent = true
|
|
9772
|
+
unhold(callSession , withEvent = true) {
|
|
9745
9773
|
console.warn('Please note that `phone.unhold()` is being deprecated; `phone.resume()` is the preferred method');
|
|
9746
9774
|
|
|
9747
|
-
return this.resume(callSession,
|
|
9775
|
+
return this.resume(callSession, withEvent);
|
|
9748
9776
|
}
|
|
9749
9777
|
|
|
9750
|
-
resume(callSession ,
|
|
9778
|
+
resume(callSession , withEvent = true) {
|
|
9751
9779
|
logger$7.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
|
|
9752
9780
|
|
|
9753
9781
|
const sipSession = this.findSipSession(callSession);
|
|
@@ -9760,10 +9788,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9760
9788
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
9761
9789
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
9762
9790
|
logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
9763
|
-
this.holdSipSession(
|
|
9791
|
+
this.holdSipSession(
|
|
9792
|
+
this.currentSipSession,
|
|
9793
|
+
this.currentCallSession,
|
|
9794
|
+
withEvent,
|
|
9795
|
+
);
|
|
9764
9796
|
}
|
|
9765
9797
|
|
|
9766
|
-
const promise = this.unholdSipSession(sipSession, callSession, withEvent
|
|
9798
|
+
const promise = this.unholdSipSession(sipSession, callSession, withEvent);
|
|
9767
9799
|
this.currentSipSession = sipSession;
|
|
9768
9800
|
if (callSession) {
|
|
9769
9801
|
this.currentCallSession = callSession;
|
|
@@ -9776,7 +9808,6 @@ class WebRTCPhone extends Emitter {
|
|
|
9776
9808
|
sipSession ,
|
|
9777
9809
|
callSession ,
|
|
9778
9810
|
withEvent = true,
|
|
9779
|
-
isConference = false,
|
|
9780
9811
|
) {
|
|
9781
9812
|
if (!sipSession) {
|
|
9782
9813
|
return new Promise((resolve, reject) => reject(new Error('No session to hold')));
|
|
@@ -9797,6 +9828,8 @@ class WebRTCPhone extends Emitter {
|
|
|
9797
9828
|
await this.client.downgradeToAudio(sipSession);
|
|
9798
9829
|
}
|
|
9799
9830
|
|
|
9831
|
+
const isConference = !!callSession && callSession.isConference();
|
|
9832
|
+
|
|
9800
9833
|
const promise = this.client.hold(sipSession, isConference, hasVideo);
|
|
9801
9834
|
if (withEvent) {
|
|
9802
9835
|
this.eventEmitter.emit(ON_CALL_HELD, this._createCallSession(sipSession, callSession));
|
|
@@ -9809,11 +9842,13 @@ class WebRTCPhone extends Emitter {
|
|
|
9809
9842
|
sipSession ,
|
|
9810
9843
|
callSession ,
|
|
9811
9844
|
withEvent = true,
|
|
9812
|
-
isConference = false,
|
|
9813
9845
|
) {
|
|
9814
9846
|
if (!sipSession) {
|
|
9815
9847
|
return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
|
|
9816
9848
|
}
|
|
9849
|
+
|
|
9850
|
+
const isConference = !!callSession && callSession.isConference();
|
|
9851
|
+
|
|
9817
9852
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9818
9853
|
logger$7.info('WebRTC unhold sip session', { sessionId, isConference });
|
|
9819
9854
|
|
|
@@ -9955,7 +9990,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9955
9990
|
await this.client.register();
|
|
9956
9991
|
}
|
|
9957
9992
|
if (this.currentSipSession) {
|
|
9958
|
-
this.holdSipSession(
|
|
9993
|
+
this.holdSipSession(
|
|
9994
|
+
this.currentSipSession,
|
|
9995
|
+
this.currentCallSession,
|
|
9996
|
+
true,
|
|
9997
|
+
).catch(e => {
|
|
9959
9998
|
logger$7.warn('Unable to hold current session when making another call', e);
|
|
9960
9999
|
});
|
|
9961
10000
|
}
|
|
@@ -9970,6 +10009,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9970
10009
|
return Promise.resolve(null);
|
|
9971
10010
|
}
|
|
9972
10011
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
10012
|
+
callSession.setIsConference(conference);
|
|
9973
10013
|
callSession.creationTime = new Date();
|
|
9974
10014
|
this._updateCallSession(callSession);
|
|
9975
10015
|
|
|
@@ -10548,6 +10588,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10548
10588
|
recording: fromSession ? fromSession.isRecording() : false,
|
|
10549
10589
|
recordingPaused: false, // @TODO
|
|
10550
10590
|
sipSession,
|
|
10591
|
+
conference: !!fromSession && fromSession.isConference(),
|
|
10551
10592
|
...extra,
|
|
10552
10593
|
});
|
|
10553
10594
|
|
|
@@ -10804,16 +10845,16 @@ class Phone extends Emitter {
|
|
|
10804
10845
|
}
|
|
10805
10846
|
}
|
|
10806
10847
|
|
|
10807
|
-
hold(callSession
|
|
10808
|
-
return this.phone && this.phone.hold(callSession, true
|
|
10848
|
+
hold(callSession ) {
|
|
10849
|
+
return this.phone && this.phone.hold(callSession, true);
|
|
10809
10850
|
}
|
|
10810
10851
|
|
|
10811
|
-
unhold(callSession
|
|
10812
|
-
return this.phone && this.phone.unhold(callSession, true
|
|
10852
|
+
unhold(callSession ) {
|
|
10853
|
+
return this.phone && this.phone.unhold(callSession, true);
|
|
10813
10854
|
}
|
|
10814
10855
|
|
|
10815
|
-
resume(callSession
|
|
10816
|
-
return this.phone && this.phone.resume(callSession
|
|
10856
|
+
resume(callSession ) {
|
|
10857
|
+
return this.phone && this.phone.resume(callSession);
|
|
10817
10858
|
}
|
|
10818
10859
|
|
|
10819
10860
|
reject(callSession ) {
|