@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/room/Room.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
|
|
|
@@ -5932,6 +5952,10 @@ class AdHocAPIConference {
|
|
|
5932
5952
|
this.conferenceId = conferenceId || '';
|
|
5933
5953
|
this.muted = muted || false;
|
|
5934
5954
|
this.paused = paused || false;
|
|
5955
|
+
|
|
5956
|
+
if (this.host) {
|
|
5957
|
+
this.host.setIsConference(true);
|
|
5958
|
+
}
|
|
5935
5959
|
}
|
|
5936
5960
|
|
|
5937
5961
|
async start() {
|
|
@@ -9641,7 +9665,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9641
9665
|
accept(callSession , cameraEnabled ) {
|
|
9642
9666
|
logger$7.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
|
|
9643
9667
|
if (this.currentSipSession) {
|
|
9644
|
-
this.holdSipSession(
|
|
9668
|
+
this.holdSipSession(
|
|
9669
|
+
this.currentSipSession,
|
|
9670
|
+
this.currentCallSession,
|
|
9671
|
+
true,
|
|
9672
|
+
);
|
|
9645
9673
|
}
|
|
9646
9674
|
|
|
9647
9675
|
if (!callSession) {
|
|
@@ -9734,22 +9762,22 @@ class WebRTCPhone extends Emitter {
|
|
|
9734
9762
|
}
|
|
9735
9763
|
}
|
|
9736
9764
|
|
|
9737
|
-
hold(callSession , withEvent = true
|
|
9765
|
+
hold(callSession , withEvent = true) {
|
|
9738
9766
|
logger$7.info('WebRTC hold', { id: callSession.getId() });
|
|
9739
9767
|
|
|
9740
9768
|
const sipSession = this.findSipSession(callSession);
|
|
9741
9769
|
|
|
9742
|
-
return sipSession ? this.holdSipSession(sipSession, callSession, withEvent
|
|
9770
|
+
return sipSession ? this.holdSipSession(sipSession, callSession, withEvent) : null;
|
|
9743
9771
|
}
|
|
9744
9772
|
|
|
9745
9773
|
// @Deprecated
|
|
9746
|
-
unhold(callSession , withEvent = true
|
|
9774
|
+
unhold(callSession , withEvent = true) {
|
|
9747
9775
|
console.warn('Please note that `phone.unhold()` is being deprecated; `phone.resume()` is the preferred method');
|
|
9748
9776
|
|
|
9749
|
-
return this.resume(callSession,
|
|
9777
|
+
return this.resume(callSession, withEvent);
|
|
9750
9778
|
}
|
|
9751
9779
|
|
|
9752
|
-
resume(callSession ,
|
|
9780
|
+
resume(callSession , withEvent = true) {
|
|
9753
9781
|
logger$7.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
|
|
9754
9782
|
|
|
9755
9783
|
const sipSession = this.findSipSession(callSession);
|
|
@@ -9762,10 +9790,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9762
9790
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
9763
9791
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
9764
9792
|
logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
9765
|
-
this.holdSipSession(
|
|
9793
|
+
this.holdSipSession(
|
|
9794
|
+
this.currentSipSession,
|
|
9795
|
+
this.currentCallSession,
|
|
9796
|
+
withEvent,
|
|
9797
|
+
);
|
|
9766
9798
|
}
|
|
9767
9799
|
|
|
9768
|
-
const promise = this.unholdSipSession(sipSession, callSession, withEvent
|
|
9800
|
+
const promise = this.unholdSipSession(sipSession, callSession, withEvent);
|
|
9769
9801
|
this.currentSipSession = sipSession;
|
|
9770
9802
|
if (callSession) {
|
|
9771
9803
|
this.currentCallSession = callSession;
|
|
@@ -9778,7 +9810,6 @@ class WebRTCPhone extends Emitter {
|
|
|
9778
9810
|
sipSession ,
|
|
9779
9811
|
callSession ,
|
|
9780
9812
|
withEvent = true,
|
|
9781
|
-
isConference = false,
|
|
9782
9813
|
) {
|
|
9783
9814
|
if (!sipSession) {
|
|
9784
9815
|
return new Promise((resolve, reject) => reject(new Error('No session to hold')));
|
|
@@ -9799,6 +9830,8 @@ class WebRTCPhone extends Emitter {
|
|
|
9799
9830
|
await this.client.downgradeToAudio(sipSession);
|
|
9800
9831
|
}
|
|
9801
9832
|
|
|
9833
|
+
const isConference = !!callSession && callSession.isConference();
|
|
9834
|
+
|
|
9802
9835
|
const promise = this.client.hold(sipSession, isConference, hasVideo);
|
|
9803
9836
|
if (withEvent) {
|
|
9804
9837
|
this.eventEmitter.emit(ON_CALL_HELD, this._createCallSession(sipSession, callSession));
|
|
@@ -9811,11 +9844,13 @@ class WebRTCPhone extends Emitter {
|
|
|
9811
9844
|
sipSession ,
|
|
9812
9845
|
callSession ,
|
|
9813
9846
|
withEvent = true,
|
|
9814
|
-
isConference = false,
|
|
9815
9847
|
) {
|
|
9816
9848
|
if (!sipSession) {
|
|
9817
9849
|
return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
|
|
9818
9850
|
}
|
|
9851
|
+
|
|
9852
|
+
const isConference = !!callSession && callSession.isConference();
|
|
9853
|
+
|
|
9819
9854
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9820
9855
|
logger$7.info('WebRTC unhold sip session', { sessionId, isConference });
|
|
9821
9856
|
|
|
@@ -9957,7 +9992,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9957
9992
|
await this.client.register();
|
|
9958
9993
|
}
|
|
9959
9994
|
if (this.currentSipSession) {
|
|
9960
|
-
this.holdSipSession(
|
|
9995
|
+
this.holdSipSession(
|
|
9996
|
+
this.currentSipSession,
|
|
9997
|
+
this.currentCallSession,
|
|
9998
|
+
true,
|
|
9999
|
+
).catch(e => {
|
|
9961
10000
|
logger$7.warn('Unable to hold current session when making another call', e);
|
|
9962
10001
|
});
|
|
9963
10002
|
}
|
|
@@ -9972,6 +10011,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9972
10011
|
return Promise.resolve(null);
|
|
9973
10012
|
}
|
|
9974
10013
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
10014
|
+
callSession.setIsConference(conference);
|
|
9975
10015
|
callSession.creationTime = new Date();
|
|
9976
10016
|
this._updateCallSession(callSession);
|
|
9977
10017
|
|
|
@@ -10550,6 +10590,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10550
10590
|
recording: fromSession ? fromSession.isRecording() : false,
|
|
10551
10591
|
recordingPaused: false, // @TODO
|
|
10552
10592
|
sipSession,
|
|
10593
|
+
conference: !!fromSession && fromSession.isConference(),
|
|
10553
10594
|
...extra,
|
|
10554
10595
|
});
|
|
10555
10596
|
|
|
@@ -10806,16 +10847,16 @@ class Phone extends Emitter {
|
|
|
10806
10847
|
}
|
|
10807
10848
|
}
|
|
10808
10849
|
|
|
10809
|
-
hold(callSession
|
|
10810
|
-
return this.phone && this.phone.hold(callSession, true
|
|
10850
|
+
hold(callSession ) {
|
|
10851
|
+
return this.phone && this.phone.hold(callSession, true);
|
|
10811
10852
|
}
|
|
10812
10853
|
|
|
10813
|
-
unhold(callSession
|
|
10814
|
-
return this.phone && this.phone.unhold(callSession, true
|
|
10854
|
+
unhold(callSession ) {
|
|
10855
|
+
return this.phone && this.phone.unhold(callSession, true);
|
|
10815
10856
|
}
|
|
10816
10857
|
|
|
10817
|
-
resume(callSession
|
|
10818
|
-
return this.phone && this.phone.resume(callSession
|
|
10858
|
+
resume(callSession ) {
|
|
10859
|
+
return this.phone && this.phone.resume(callSession);
|
|
10819
10860
|
}
|
|
10820
10861
|
|
|
10821
10862
|
reject(callSession ) {
|
|
@@ -1081,6 +1081,7 @@ const LINE_STATE = {
|
|
|
1081
1081
|
|
|
1082
1082
|
|
|
1083
1083
|
|
|
1084
|
+
|
|
1084
1085
|
|
|
1085
1086
|
|
|
1086
1087
|
|
|
@@ -1117,6 +1118,7 @@ const LINE_STATE = {
|
|
|
1117
1118
|
|
|
1118
1119
|
|
|
1119
1120
|
|
|
1121
|
+
|
|
1120
1122
|
|
|
1121
1123
|
|
|
1122
1124
|
|
|
@@ -1148,6 +1150,7 @@ class Profile {
|
|
|
1148
1150
|
|
|
1149
1151
|
|
|
1150
1152
|
|
|
1153
|
+
|
|
1151
1154
|
|
|
1152
1155
|
|
|
1153
1156
|
|
|
@@ -1164,6 +1167,7 @@ class Profile {
|
|
|
1164
1167
|
lines: plain.lines.map(line => Line.parse(line)),
|
|
1165
1168
|
username: plain.username,
|
|
1166
1169
|
mobileNumber: plain.mobile_phone_number || '',
|
|
1170
|
+
ringSeconds: plain.ring_seconds,
|
|
1167
1171
|
forwards: [
|
|
1168
1172
|
ForwardOption.parse(plain.forwards.unconditional, FORWARD_KEYS.UNCONDITIONAL),
|
|
1169
1173
|
ForwardOption.parse(plain.forwards.noanswer, FORWARD_KEYS.NO_ANSWER),
|
|
@@ -1200,6 +1204,7 @@ class Profile {
|
|
|
1200
1204
|
switchboards,
|
|
1201
1205
|
agent,
|
|
1202
1206
|
status,
|
|
1207
|
+
ringSeconds,
|
|
1203
1208
|
sipLines,
|
|
1204
1209
|
callPickupTargetUsers,
|
|
1205
1210
|
onlineCallRecordEnabled,
|
|
@@ -1221,6 +1226,7 @@ class Profile {
|
|
|
1221
1226
|
this.status = status;
|
|
1222
1227
|
this.callPickupTargetUsers = callPickupTargetUsers;
|
|
1223
1228
|
this.onlineCallRecordEnabled = onlineCallRecordEnabled;
|
|
1229
|
+
this.ringSeconds = ringSeconds;
|
|
1224
1230
|
|
|
1225
1231
|
this.sipLines = sipLines || [];
|
|
1226
1232
|
}
|
|
@@ -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 ) {
|