@wazo/sdk 0.37.0 → 0.37.4
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/dist/wazo-sdk.js +5 -5
- package/esm/__tests__/api-client.test.js +91 -23
- package/esm/__tests__/web-rtc-client.test.js +165 -56
- package/esm/api/agentd.js +7 -1
- package/esm/api/amid.js +7 -1
- package/esm/api/application.js +7 -1
- package/esm/api/auth.js +7 -1
- package/esm/api/call-logd.js +17 -23
- package/esm/api/calld.js +10 -18
- package/esm/api/chatd.js +7 -1
- package/esm/api/confd.js +78 -1
- package/esm/api/ctid-ng.js +7 -1
- package/esm/api/dird.js +7 -1
- package/esm/api/webhookd.js +7 -1
- package/esm/api-client.js +91 -23
- package/esm/checker/Checker.js +169 -56
- package/esm/checker/checks/aor.js +91 -23
- package/esm/checker/checks/api.js +91 -23
- package/esm/checker/checks/index.js +169 -56
- package/esm/checker/checks/wazo-websocket.js +11 -1
- package/esm/checker/checks/webrtc-transport.js +165 -56
- package/esm/checker/checks/webrtc.js +165 -56
- package/esm/domain/AdHocAPIConference.js +1722 -1654
- package/esm/domain/CallLog.js +10 -22
- package/esm/domain/CallSession.js +1 -18
- package/esm/domain/Features.js +91 -23
- package/esm/domain/IndirectTransfer.js +0 -17
- package/esm/domain/Meeting.js +71 -0
- package/esm/domain/Phone/CTIPhone.js +98 -26
- package/esm/domain/Phone/Phone.js +0 -17
- package/esm/domain/Phone/WebRTCPhone.js +47 -27
- package/esm/domain/Room.js +0 -17
- package/esm/domain/SwitchboardCall.js +0 -17
- package/esm/domain/__tests__/CallLog.test.js +10 -22
- package/esm/domain/__tests__/CallSession.test.js +1 -18
- package/esm/domain/__tests__/IndirectTransfer.test.js +1 -18
- package/esm/domain/__tests__/Room.test.js +1 -18
- package/esm/index.js +3880 -3111
- package/esm/lib/WazoSessionDescriptionHandler.js +24 -10
- package/esm/service/CallApi.js +91 -23
- package/esm/service/IssueReporter.js +7 -1
- package/esm/service/__tests__/IssueReporter.test.js +9 -1
- package/esm/service/getApiClient.js +91 -23
- package/esm/simple/Auth.js +1126 -360
- package/esm/simple/Configuration.js +1126 -360
- package/esm/simple/Directory.js +91 -23
- package/esm/simple/Phone.js +3724 -2958
- package/esm/simple/Websocket.js +13 -1
- package/esm/simple/index.js +1128 -362
- package/esm/simple/room/LocalParticipant.js +1097 -331
- package/esm/simple/room/Participant.js +1097 -331
- package/esm/simple/room/RemoteParticipant.js +1097 -331
- package/esm/simple/room/Room.js +1097 -331
- package/esm/simple/room/SipRoom.js +12996 -0
- package/esm/simple/room/Stream.js +1128 -362
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +5157 -4389
- package/esm/simple/utils.js +1128 -362
- package/esm/utils/__tests__/api-requester.test.js +7 -1
- package/esm/utils/api-requester.js +7 -1
- package/esm/web-rtc-client.js +165 -56
- package/esm/websocket-client.js +12 -2
- package/lib/__tests__/api-client.test.js +91 -23
- package/lib/__tests__/web-rtc-client.test.js +165 -56
- package/lib/api/agentd.js +7 -1
- package/lib/api/amid.js +7 -1
- package/lib/api/application.js +7 -1
- package/lib/api/auth.js +7 -1
- package/lib/api/call-logd.js +17 -23
- package/lib/api/calld.js +10 -18
- package/lib/api/chatd.js +7 -1
- package/lib/api/confd.js +78 -1
- package/lib/api/ctid-ng.js +7 -1
- package/lib/api/dird.js +7 -1
- package/lib/api/webhookd.js +7 -1
- package/lib/api-client.js +91 -23
- package/lib/checker/Checker.js +169 -56
- package/lib/checker/checks/aor.js +91 -23
- package/lib/checker/checks/api.js +91 -23
- package/lib/checker/checks/index.js +169 -56
- package/lib/checker/checks/wazo-websocket.js +11 -1
- package/lib/checker/checks/webrtc-transport.js +165 -56
- package/lib/checker/checks/webrtc.js +165 -56
- package/lib/domain/AdHocAPIConference.js +1722 -1654
- package/lib/domain/CallLog.js +10 -22
- package/lib/domain/CallSession.js +1 -18
- package/lib/domain/Features.js +91 -23
- package/lib/domain/IndirectTransfer.js +0 -17
- package/lib/domain/Meeting.js +73 -0
- package/lib/domain/Phone/CTIPhone.js +98 -26
- package/lib/domain/Phone/Phone.js +0 -16
- package/lib/domain/Phone/WebRTCPhone.js +47 -27
- package/lib/domain/Room.js +0 -17
- package/lib/domain/SwitchboardCall.js +0 -17
- package/lib/domain/__tests__/CallLog.test.js +10 -22
- package/lib/domain/__tests__/CallSession.test.js +1 -18
- package/lib/domain/__tests__/IndirectTransfer.test.js +1 -18
- package/lib/domain/__tests__/Room.test.js +1 -18
- package/lib/index.js +3880 -3111
- package/lib/lib/WazoSessionDescriptionHandler.js +24 -10
- package/lib/service/CallApi.js +91 -23
- package/lib/service/IssueReporter.js +7 -1
- package/lib/service/__tests__/IssueReporter.test.js +9 -1
- package/lib/service/getApiClient.js +91 -23
- package/lib/simple/Auth.js +1126 -360
- package/lib/simple/Configuration.js +1126 -360
- package/lib/simple/Directory.js +91 -23
- package/lib/simple/Phone.js +3724 -2958
- package/lib/simple/Websocket.js +13 -1
- package/lib/simple/index.js +1128 -362
- package/lib/simple/room/LocalParticipant.js +1097 -331
- package/lib/simple/room/Participant.js +1097 -331
- package/lib/simple/room/RemoteParticipant.js +1097 -331
- package/lib/simple/room/Room.js +1097 -331
- package/lib/simple/room/SipRoom.js +13006 -0
- package/lib/simple/room/Stream.js +1128 -362
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +5157 -4389
- package/lib/simple/utils.js +1128 -362
- package/lib/utils/__tests__/api-requester.test.js +7 -1
- package/lib/utils/api-requester.js +7 -1
- package/lib/web-rtc-client.js +165 -56
- package/lib/websocket-client.js +13 -1
- package/package.json +1 -1
- package/src/api/calld.js +3 -0
- package/src/api/confd.js +13 -0
- package/src/domain/CallLog.js +10 -22
- package/src/domain/CallSession.js +1 -2
- package/src/domain/Meeting.js +59 -0
- package/src/domain/Phone/CTIPhone.js +6 -2
- package/src/domain/Phone/Phone.js +2 -0
- package/src/domain/Phone/WebRTCPhone.js +22 -8
- package/src/index.js +6 -0
- package/src/lib/WazoSessionDescriptionHandler.js +17 -9
- package/src/service/IssueReporter.js +7 -1
- package/src/service/__tests__/IssueReporter.test.js +2 -0
- package/src/simple/Phone.js +13 -4
- package/src/simple/index.js +8 -0
- package/src/simple/room/Participant.js +7 -0
- package/src/simple/room/Room.js +157 -79
- package/src/simple/room/SipRoom.js +147 -0
- package/src/simple/room/Stream.js +1 -3
- package/src/simple/room/__tests__/RemoteParticipant.test.js +3 -2
- package/src/types/WebSocketMessage.js +21 -0
- package/src/web-rtc-client.js +57 -24
- package/src/websocket-client.js +4 -0
|
@@ -276,7 +276,13 @@ class IssueReporter {
|
|
|
276
276
|
}
|
|
277
277
|
|
|
278
278
|
_isLevelAbove(level1 , level2 ) {
|
|
279
|
-
|
|
279
|
+
const index1 = LOG_LEVELS.indexOf(level1);
|
|
280
|
+
const index2 = LOG_LEVELS.indexOf(level2);
|
|
281
|
+
if (index1 === -1 || index2 === -1) {
|
|
282
|
+
return false;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
return index1 > index2;
|
|
280
286
|
}
|
|
281
287
|
|
|
282
288
|
_makeCategory(category ) {
|
|
@@ -437,7 +443,9 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
437
443
|
.then(() => {
|
|
438
444
|
if (isConference && (options.constraints && !options.constraints.video) && !('hold' in options) && !audioOnly) {
|
|
439
445
|
// Add a video an empty bundle to be able to replaceTrack when joining a conference without video
|
|
440
|
-
this.peerConnection.addTransceiver
|
|
446
|
+
if (this.peerConnection.addTransceiver) {
|
|
447
|
+
this.peerConnection.addTransceiver('video', { streams: [this._localMediaStream], direction: 'sendrecv' });
|
|
448
|
+
}
|
|
441
449
|
}
|
|
442
450
|
})
|
|
443
451
|
.then(() => this.createLocalOfferOrAnswer(options))
|
|
@@ -464,12 +472,6 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
464
472
|
};
|
|
465
473
|
})
|
|
466
474
|
.then((sessionDescription) => this.applyModifiers(sessionDescription, modifiers))
|
|
467
|
-
.then((sessionDescription) => {
|
|
468
|
-
// Set new constraints to avoid the constraints check issue in `sdh.getLocalMediaStream` later.
|
|
469
|
-
this.localMediaStreamConstraints = options.constraints;
|
|
470
|
-
|
|
471
|
-
return sessionDescription;
|
|
472
|
-
})
|
|
473
475
|
.then((sessionDescription) => ({ body: sessionDescription.sdp, contentType: 'application/sdp' }))
|
|
474
476
|
.catch((error) => {
|
|
475
477
|
wazoLogger.error('error when creating media', error);
|
|
@@ -664,6 +666,9 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
664
666
|
|
|
665
667
|
// set the transceiver direction to the answer direction
|
|
666
668
|
this._peerConnection.getTransceivers().forEach((transceiver) => {
|
|
669
|
+
if (transceiver.stopped) {
|
|
670
|
+
return;
|
|
671
|
+
}
|
|
667
672
|
if (transceiver.direction /* guarding, but should always be true */) {
|
|
668
673
|
const { receiver } = transceiver;
|
|
669
674
|
if (isConference && audioOnly && receiver.track && receiver.track.kind === 'video') {
|
|
@@ -708,10 +713,15 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
708
713
|
if (kind !== 'audio' && kind !== 'video') {
|
|
709
714
|
throw new Error(`Unknown new track kind ${kind}.`);
|
|
710
715
|
}
|
|
711
|
-
const sender = pc.getSenders().find((otherSender) =>
|
|
716
|
+
const sender = pc.getSenders && pc.getSenders().find((otherSender) =>
|
|
717
|
+
otherSender.track && otherSender.track.kind === kind);
|
|
712
718
|
|
|
713
719
|
// Do not reuse sender video tracks in SFU
|
|
714
720
|
if (sender && (!sfu || newTrack.kind === 'audio')) {
|
|
721
|
+
if (sender.track) {
|
|
722
|
+
// eslint-disable-next-line no-param-reassign
|
|
723
|
+
newTrack.enabled = sender.track.enabled;
|
|
724
|
+
}
|
|
715
725
|
trackUpdates.push(
|
|
716
726
|
new Promise((resolve) => {
|
|
717
727
|
this.logger.debug(`SessionDescriptionHandler.setLocalMediaStream - replacing sender ${kind} track`);
|
|
@@ -745,7 +755,11 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
745
755
|
// Review: could make streamless tracks a configurable option?
|
|
746
756
|
// https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/addTrack#Usage_notes
|
|
747
757
|
try {
|
|
748
|
-
pc.addTrack
|
|
758
|
+
if (pc.addTrack) {
|
|
759
|
+
pc.addTrack(newTrack, localStream);
|
|
760
|
+
} else {
|
|
761
|
+
pc.addStream(localStream);
|
|
762
|
+
}
|
|
749
763
|
} catch (error) {
|
|
750
764
|
this.logger.error(`SessionDescriptionHandler.setLocalMediaStream - failed to add sender ${kind} track`);
|
|
751
765
|
throw error;
|
package/esm/service/CallApi.js
CHANGED
|
@@ -1810,7 +1810,11 @@ class CallLog {
|
|
|
1810
1810
|
answered: plain.answered,
|
|
1811
1811
|
callDirection: plain.call_direction,
|
|
1812
1812
|
destination: {
|
|
1813
|
-
|
|
1813
|
+
// @TEMP: Temporarily assuming empty numbers are meetings
|
|
1814
|
+
// which is admittedly a very dangerous assumption. Did i mention it was temporary?
|
|
1815
|
+
extension: plain.requested_extension
|
|
1816
|
+
|| plain.destination_extension
|
|
1817
|
+
|| `meeting-${plain.requested_name || plain.destination_name || ''}`,
|
|
1814
1818
|
name: plain.requested_name || plain.destination_name || '',
|
|
1815
1819
|
},
|
|
1816
1820
|
source: {
|
|
@@ -1826,27 +1830,11 @@ class CallLog {
|
|
|
1826
1830
|
}
|
|
1827
1831
|
|
|
1828
1832
|
static parseNew(plain , session ) {
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
extension: plain.requested_extension || plain.destination_extension,
|
|
1835
|
-
name: plain.requested_name || plain.destination_name || '',
|
|
1836
|
-
},
|
|
1837
|
-
source: {
|
|
1838
|
-
extension: plain.source_extension,
|
|
1839
|
-
name: plain.source_name,
|
|
1840
|
-
},
|
|
1841
|
-
id: plain.id,
|
|
1842
|
-
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
1843
|
-
start: moment(plain.start).toDate(),
|
|
1844
|
-
end: plain.end ? moment(plain.end).toDate() : null,
|
|
1845
|
-
recordings: Recording.parseMany(plain.recordings),
|
|
1846
|
-
// @TODO: FIXME add verification declined vs missed call
|
|
1847
|
-
newMissedCall: session
|
|
1848
|
-
&& session.hasExtension(plain.requested_extension || plain.destination_extension) && !plain.answered,
|
|
1849
|
-
});
|
|
1833
|
+
const callLog = CallLog.parse(plain);
|
|
1834
|
+
// @TODO: FIXME add verification declined vs missed call
|
|
1835
|
+
callLog.newMissedCall = session
|
|
1836
|
+
&& session.hasExtension(plain.requested_extension || plain.destination_extension) && !plain.answered;
|
|
1837
|
+
return callLog;
|
|
1850
1838
|
}
|
|
1851
1839
|
|
|
1852
1840
|
static newFrom(profile ) {
|
|
@@ -2318,7 +2306,13 @@ class IssueReporter {
|
|
|
2318
2306
|
}
|
|
2319
2307
|
|
|
2320
2308
|
_isLevelAbove(level1 , level2 ) {
|
|
2321
|
-
|
|
2309
|
+
const index1 = LOG_LEVELS.indexOf(level1);
|
|
2310
|
+
const index2 = LOG_LEVELS.indexOf(level2);
|
|
2311
|
+
if (index1 === -1 || index2 === -1) {
|
|
2312
|
+
return false;
|
|
2313
|
+
}
|
|
2314
|
+
|
|
2315
|
+
return index1 > index2;
|
|
2322
2316
|
}
|
|
2323
2317
|
|
|
2324
2318
|
_makeCategory(category ) {
|
|
@@ -3015,6 +3009,65 @@ class ExternalApp {
|
|
|
3015
3009
|
}
|
|
3016
3010
|
}
|
|
3017
3011
|
|
|
3012
|
+
//
|
|
3013
|
+
|
|
3014
|
+
|
|
3015
|
+
|
|
3016
|
+
|
|
3017
|
+
|
|
3018
|
+
|
|
3019
|
+
|
|
3020
|
+
|
|
3021
|
+
|
|
3022
|
+
|
|
3023
|
+
|
|
3024
|
+
class Meeting {
|
|
3025
|
+
|
|
3026
|
+
|
|
3027
|
+
|
|
3028
|
+
|
|
3029
|
+
|
|
3030
|
+
|
|
3031
|
+
|
|
3032
|
+
|
|
3033
|
+
|
|
3034
|
+
|
|
3035
|
+
static parse(plain ) {
|
|
3036
|
+
return new Meeting({
|
|
3037
|
+
guestSipAuthorization: plain.guest_sip_authorization,
|
|
3038
|
+
hostname: plain.hostname,
|
|
3039
|
+
name: plain.name,
|
|
3040
|
+
ownerUuids: plain.owner_uuids,
|
|
3041
|
+
port: plain.port,
|
|
3042
|
+
uuid: plain.uuid,
|
|
3043
|
+
number: plain.number,
|
|
3044
|
+
});
|
|
3045
|
+
}
|
|
3046
|
+
|
|
3047
|
+
static newFrom(meeting ) {
|
|
3048
|
+
return newFrom(meeting, Meeting);
|
|
3049
|
+
}
|
|
3050
|
+
|
|
3051
|
+
constructor({ uuid, name, guestSipAuthorization, ownerUuids, port, hostname, number } = {}) {
|
|
3052
|
+
this.guestSipAuthorization = guestSipAuthorization;
|
|
3053
|
+
this.hostname = hostname;
|
|
3054
|
+
this.name = name;
|
|
3055
|
+
this.ownerUuids = ownerUuids;
|
|
3056
|
+
this.port = port;
|
|
3057
|
+
this.uuid = uuid;
|
|
3058
|
+
this.number = number;
|
|
3059
|
+
|
|
3060
|
+
// Useful to compare instead of instanceof with minified code
|
|
3061
|
+
this.type = 'Meeting';
|
|
3062
|
+
}
|
|
3063
|
+
|
|
3064
|
+
getGuestSipCredentials() {
|
|
3065
|
+
// eslint-disable-next-line no-undef
|
|
3066
|
+
const [username, secret] = atob(this.guestSipAuthorization).split(':');
|
|
3067
|
+
return { username, secret };
|
|
3068
|
+
}
|
|
3069
|
+
}
|
|
3070
|
+
|
|
3018
3071
|
/* */
|
|
3019
3072
|
|
|
3020
3073
|
var confdMethods = (client , baseUrl ) => ({
|
|
@@ -3079,6 +3132,18 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
3079
3132
|
return null;
|
|
3080
3133
|
}
|
|
3081
3134
|
},
|
|
3135
|
+
|
|
3136
|
+
createMyMeeting: (name ) =>
|
|
3137
|
+
client.post(`${baseUrl}/users/me/meetings`, { name }).then(Meeting.parse),
|
|
3138
|
+
|
|
3139
|
+
deleteMyMeeting: (meetingUuid ) =>
|
|
3140
|
+
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
3141
|
+
|
|
3142
|
+
getMeeting: (meetingUuid ) =>
|
|
3143
|
+
client.get(`${baseUrl}/meetings/${meetingUuid}`, null).then(Meeting.parse),
|
|
3144
|
+
|
|
3145
|
+
guestGetMeeting: (meetingUuid ) =>
|
|
3146
|
+
client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}`, null).then(Meeting.parse),
|
|
3082
3147
|
});
|
|
3083
3148
|
|
|
3084
3149
|
//
|
|
@@ -3913,6 +3978,9 @@ var calldMethods = (client , baseUrl ) => ({
|
|
|
3913
3978
|
getConferenceParticipantsAsUser: async (conferenceId ) =>
|
|
3914
3979
|
client.get(`${baseUrl}/users/me/conferences/${conferenceId}/participants`),
|
|
3915
3980
|
|
|
3981
|
+
getMeetingParticipantsAsUser: async (meetingUuid ) =>
|
|
3982
|
+
client.get(`${baseUrl}/users/me/meetings/${meetingUuid}/participants`),
|
|
3983
|
+
|
|
3916
3984
|
listTrunks: () => client.get(`${baseUrl}/trunks`),
|
|
3917
3985
|
|
|
3918
3986
|
mute: (callId ) =>
|
|
@@ -272,7 +272,13 @@ class IssueReporter {
|
|
|
272
272
|
}
|
|
273
273
|
|
|
274
274
|
_isLevelAbove(level1 , level2 ) {
|
|
275
|
-
|
|
275
|
+
const index1 = LOG_LEVELS.indexOf(level1);
|
|
276
|
+
const index2 = LOG_LEVELS.indexOf(level2);
|
|
277
|
+
if (index1 === -1 || index2 === -1) {
|
|
278
|
+
return false;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
return index1 > index2;
|
|
276
282
|
}
|
|
277
283
|
|
|
278
284
|
_makeCategory(category ) {
|
|
@@ -272,7 +272,13 @@ class IssueReporter {
|
|
|
272
272
|
}
|
|
273
273
|
|
|
274
274
|
_isLevelAbove(level1 , level2 ) {
|
|
275
|
-
|
|
275
|
+
const index1 = LOG_LEVELS.indexOf(level1);
|
|
276
|
+
const index2 = LOG_LEVELS.indexOf(level2);
|
|
277
|
+
if (index1 === -1 || index2 === -1) {
|
|
278
|
+
return false;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
return index1 > index2;
|
|
276
282
|
}
|
|
277
283
|
|
|
278
284
|
_makeCategory(category ) {
|
|
@@ -321,6 +327,8 @@ describe('IssueReporter', () => {
|
|
|
321
327
|
expect(IssueReporter$1._isLevelAbove('error', 'warn')).toBeTruthy();
|
|
322
328
|
expect(IssueReporter$1._isLevelAbove('info', 'warn')).toBeFalsy();
|
|
323
329
|
expect(IssueReporter$1._isLevelAbove('trace', 'trace')).toBeFalsy();
|
|
330
|
+
expect(IssueReporter$1._isLevelAbove('trace', 'something')).toBeFalsy();
|
|
331
|
+
expect(IssueReporter$1._isLevelAbove('something', 'trace')).toBeFalsy();
|
|
324
332
|
});
|
|
325
333
|
|
|
326
334
|
it('should send if verbosity is higher than required', () => {
|
|
@@ -309,7 +309,13 @@ class IssueReporter {
|
|
|
309
309
|
}
|
|
310
310
|
|
|
311
311
|
_isLevelAbove(level1 , level2 ) {
|
|
312
|
-
|
|
312
|
+
const index1 = LOG_LEVELS.indexOf(level1);
|
|
313
|
+
const index2 = LOG_LEVELS.indexOf(level2);
|
|
314
|
+
if (index1 === -1 || index2 === -1) {
|
|
315
|
+
return false;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
return index1 > index2;
|
|
313
319
|
}
|
|
314
320
|
|
|
315
321
|
_makeCategory(category ) {
|
|
@@ -2487,6 +2493,65 @@ class ExternalApp {
|
|
|
2487
2493
|
}
|
|
2488
2494
|
}
|
|
2489
2495
|
|
|
2496
|
+
//
|
|
2497
|
+
|
|
2498
|
+
|
|
2499
|
+
|
|
2500
|
+
|
|
2501
|
+
|
|
2502
|
+
|
|
2503
|
+
|
|
2504
|
+
|
|
2505
|
+
|
|
2506
|
+
|
|
2507
|
+
|
|
2508
|
+
class Meeting {
|
|
2509
|
+
|
|
2510
|
+
|
|
2511
|
+
|
|
2512
|
+
|
|
2513
|
+
|
|
2514
|
+
|
|
2515
|
+
|
|
2516
|
+
|
|
2517
|
+
|
|
2518
|
+
|
|
2519
|
+
static parse(plain ) {
|
|
2520
|
+
return new Meeting({
|
|
2521
|
+
guestSipAuthorization: plain.guest_sip_authorization,
|
|
2522
|
+
hostname: plain.hostname,
|
|
2523
|
+
name: plain.name,
|
|
2524
|
+
ownerUuids: plain.owner_uuids,
|
|
2525
|
+
port: plain.port,
|
|
2526
|
+
uuid: plain.uuid,
|
|
2527
|
+
number: plain.number,
|
|
2528
|
+
});
|
|
2529
|
+
}
|
|
2530
|
+
|
|
2531
|
+
static newFrom(meeting ) {
|
|
2532
|
+
return newFrom(meeting, Meeting);
|
|
2533
|
+
}
|
|
2534
|
+
|
|
2535
|
+
constructor({ uuid, name, guestSipAuthorization, ownerUuids, port, hostname, number } = {}) {
|
|
2536
|
+
this.guestSipAuthorization = guestSipAuthorization;
|
|
2537
|
+
this.hostname = hostname;
|
|
2538
|
+
this.name = name;
|
|
2539
|
+
this.ownerUuids = ownerUuids;
|
|
2540
|
+
this.port = port;
|
|
2541
|
+
this.uuid = uuid;
|
|
2542
|
+
this.number = number;
|
|
2543
|
+
|
|
2544
|
+
// Useful to compare instead of instanceof with minified code
|
|
2545
|
+
this.type = 'Meeting';
|
|
2546
|
+
}
|
|
2547
|
+
|
|
2548
|
+
getGuestSipCredentials() {
|
|
2549
|
+
// eslint-disable-next-line no-undef
|
|
2550
|
+
const [username, secret] = atob(this.guestSipAuthorization).split(':');
|
|
2551
|
+
return { username, secret };
|
|
2552
|
+
}
|
|
2553
|
+
}
|
|
2554
|
+
|
|
2490
2555
|
/* */
|
|
2491
2556
|
|
|
2492
2557
|
var confdMethods = (client , baseUrl ) => ({
|
|
@@ -2551,6 +2616,18 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
2551
2616
|
return null;
|
|
2552
2617
|
}
|
|
2553
2618
|
},
|
|
2619
|
+
|
|
2620
|
+
createMyMeeting: (name ) =>
|
|
2621
|
+
client.post(`${baseUrl}/users/me/meetings`, { name }).then(Meeting.parse),
|
|
2622
|
+
|
|
2623
|
+
deleteMyMeeting: (meetingUuid ) =>
|
|
2624
|
+
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
2625
|
+
|
|
2626
|
+
getMeeting: (meetingUuid ) =>
|
|
2627
|
+
client.get(`${baseUrl}/meetings/${meetingUuid}`, null).then(Meeting.parse),
|
|
2628
|
+
|
|
2629
|
+
guestGetMeeting: (meetingUuid ) =>
|
|
2630
|
+
client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}`, null).then(Meeting.parse),
|
|
2554
2631
|
});
|
|
2555
2632
|
|
|
2556
2633
|
//
|
|
@@ -3135,7 +3212,11 @@ class CallLog {
|
|
|
3135
3212
|
answered: plain.answered,
|
|
3136
3213
|
callDirection: plain.call_direction,
|
|
3137
3214
|
destination: {
|
|
3138
|
-
|
|
3215
|
+
// @TEMP: Temporarily assuming empty numbers are meetings
|
|
3216
|
+
// which is admittedly a very dangerous assumption. Did i mention it was temporary?
|
|
3217
|
+
extension: plain.requested_extension
|
|
3218
|
+
|| plain.destination_extension
|
|
3219
|
+
|| `meeting-${plain.requested_name || plain.destination_name || ''}`,
|
|
3139
3220
|
name: plain.requested_name || plain.destination_name || '',
|
|
3140
3221
|
},
|
|
3141
3222
|
source: {
|
|
@@ -3151,27 +3232,11 @@ class CallLog {
|
|
|
3151
3232
|
}
|
|
3152
3233
|
|
|
3153
3234
|
static parseNew(plain , session ) {
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
extension: plain.requested_extension || plain.destination_extension,
|
|
3160
|
-
name: plain.requested_name || plain.destination_name || '',
|
|
3161
|
-
},
|
|
3162
|
-
source: {
|
|
3163
|
-
extension: plain.source_extension,
|
|
3164
|
-
name: plain.source_name,
|
|
3165
|
-
},
|
|
3166
|
-
id: plain.id,
|
|
3167
|
-
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
3168
|
-
start: moment(plain.start).toDate(),
|
|
3169
|
-
end: plain.end ? moment(plain.end).toDate() : null,
|
|
3170
|
-
recordings: Recording.parseMany(plain.recordings),
|
|
3171
|
-
// @TODO: FIXME add verification declined vs missed call
|
|
3172
|
-
newMissedCall: session
|
|
3173
|
-
&& session.hasExtension(plain.requested_extension || plain.destination_extension) && !plain.answered,
|
|
3174
|
-
});
|
|
3235
|
+
const callLog = CallLog.parse(plain);
|
|
3236
|
+
// @TODO: FIXME add verification declined vs missed call
|
|
3237
|
+
callLog.newMissedCall = session
|
|
3238
|
+
&& session.hasExtension(plain.requested_extension || plain.destination_extension) && !plain.answered;
|
|
3239
|
+
return callLog;
|
|
3175
3240
|
}
|
|
3176
3241
|
|
|
3177
3242
|
static newFrom(profile ) {
|
|
@@ -3913,6 +3978,9 @@ var calldMethods = (client , baseUrl ) => ({
|
|
|
3913
3978
|
getConferenceParticipantsAsUser: async (conferenceId ) =>
|
|
3914
3979
|
client.get(`${baseUrl}/users/me/conferences/${conferenceId}/participants`),
|
|
3915
3980
|
|
|
3981
|
+
getMeetingParticipantsAsUser: async (meetingUuid ) =>
|
|
3982
|
+
client.get(`${baseUrl}/users/me/meetings/${meetingUuid}/participants`),
|
|
3983
|
+
|
|
3916
3984
|
listTrunks: () => client.get(`${baseUrl}/trunks`),
|
|
3917
3985
|
|
|
3918
3986
|
mute: (callId ) =>
|