@wazo/sdk 0.37.23 → 0.37.24
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 +6 -6
- package/esm/__tests__/api-client.test.js +22 -17
- package/esm/__tests__/web-rtc-client.test.js +105 -100
- package/esm/api/amid.js +1 -1
- package/esm/api/call-logd.js +2 -2
- package/esm/api/confd.js +10 -5
- package/esm/api/ctid-ng.js +3 -3
- package/esm/api/dird.js +1 -1
- package/esm/api/webhookd.js +1 -1
- package/esm/api-client.js +22 -17
- package/esm/checker/Checker.js +130 -125
- package/esm/checker/checks/aor.js +22 -17
- package/esm/checker/checks/api.js +22 -17
- package/esm/checker/checks/index.js +120 -115
- package/esm/checker/checks/wazo-websocket.js +15 -15
- package/esm/checker/checks/webrtc-transport.js +105 -100
- package/esm/checker/checks/webrtc.js +105 -100
- package/esm/domain/AdHocAPIConference.js +22 -17
- package/esm/domain/CallLog.js +1 -1
- package/esm/domain/Contact.js +1 -1
- package/esm/domain/Features.js +22 -17
- package/esm/domain/Meeting.js +12 -5
- package/esm/domain/Phone/CTIPhone.js +36 -31
- package/esm/domain/Phone/WebRTCPhone.js +110 -87
- package/esm/domain/__tests__/CallLog.test.js +1 -1
- package/esm/domain/__tests__/Contact.test.js +1 -1
- package/esm/domain/__tests__/Meeting.test.js +144 -0
- package/esm/index.js +365 -337
- package/esm/lib/WazoSessionDescriptionHandler.js +1 -1
- package/esm/service/CallApi.js +22 -17
- package/esm/service/IssueReporter.js +1 -1
- package/esm/service/__tests__/IssueReporter.test.js +1 -1
- package/esm/service/getApiClient.js +22 -17
- package/esm/simple/Auth.js +355 -327
- package/esm/simple/Configuration.js +355 -327
- package/esm/simple/Directory.js +22 -17
- package/esm/simple/Phone.js +355 -327
- package/esm/simple/Websocket.js +17 -17
- package/esm/simple/index.js +359 -331
- package/esm/simple/room/LocalParticipant.js +359 -331
- package/esm/simple/room/Participant.js +359 -331
- package/esm/simple/room/RemoteParticipant.js +359 -331
- package/esm/simple/room/Room.js +360 -332
- package/esm/simple/room/SipRoom.js +359 -331
- package/esm/simple/room/Stream.js +359 -331
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +359 -331
- package/esm/simple/utils.js +359 -331
- package/esm/types/WebSocketMessage.js +1 -1
- package/esm/web-rtc-client.js +105 -100
- package/esm/websocket-client.js +15 -15
- package/lib/__tests__/api-client.test.js +22 -17
- package/lib/__tests__/web-rtc-client.test.js +105 -100
- package/lib/api/amid.js +1 -1
- package/lib/api/call-logd.js +2 -2
- package/lib/api/confd.js +10 -5
- package/lib/api/ctid-ng.js +3 -3
- package/lib/api/dird.js +1 -1
- package/lib/api/webhookd.js +1 -1
- package/lib/api-client.js +22 -17
- package/lib/checker/Checker.js +130 -125
- package/lib/checker/checks/aor.js +22 -17
- package/lib/checker/checks/api.js +22 -17
- package/lib/checker/checks/index.js +120 -115
- package/lib/checker/checks/wazo-websocket.js +15 -15
- package/lib/checker/checks/webrtc-transport.js +105 -100
- package/lib/checker/checks/webrtc.js +105 -100
- package/lib/domain/AdHocAPIConference.js +22 -17
- package/lib/domain/CallLog.js +1 -1
- package/lib/domain/Contact.js +1 -1
- package/lib/domain/Features.js +22 -17
- package/lib/domain/Meeting.js +16 -5
- package/lib/domain/Phone/CTIPhone.js +36 -31
- package/lib/domain/Phone/WebRTCPhone.js +110 -87
- package/lib/domain/__tests__/CallLog.test.js +1 -1
- package/lib/domain/__tests__/Contact.test.js +1 -1
- package/lib/domain/__tests__/Meeting.test.js +150 -0
- package/lib/index.js +365 -337
- package/lib/lib/WazoSessionDescriptionHandler.js +1 -1
- package/lib/service/CallApi.js +22 -17
- package/lib/service/IssueReporter.js +1 -1
- package/lib/service/__tests__/IssueReporter.test.js +1 -1
- package/lib/service/getApiClient.js +22 -17
- package/lib/simple/Auth.js +355 -327
- package/lib/simple/Configuration.js +355 -327
- package/lib/simple/Directory.js +22 -17
- package/lib/simple/Phone.js +355 -327
- package/lib/simple/Websocket.js +17 -17
- package/lib/simple/index.js +359 -331
- package/lib/simple/room/LocalParticipant.js +359 -331
- package/lib/simple/room/Participant.js +359 -331
- package/lib/simple/room/RemoteParticipant.js +359 -331
- package/lib/simple/room/Room.js +360 -332
- package/lib/simple/room/SipRoom.js +359 -331
- package/lib/simple/room/Stream.js +359 -331
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +359 -331
- package/lib/simple/utils.js +359 -331
- package/lib/types/WebSocketMessage.js +2 -0
- package/lib/web-rtc-client.js +105 -100
- package/lib/websocket-client.js +15 -15
- package/package.json +1 -1
- package/src/domain/Meeting.js +12 -5
- package/src/domain/Phone/WebRTCPhone.js +24 -1
- package/src/domain/__tests__/Meeting.test.js +50 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var moment = require('moment');
|
|
4
|
+
|
|
5
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
6
|
+
|
|
7
|
+
var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
|
|
8
|
+
|
|
9
|
+
//
|
|
10
|
+
|
|
11
|
+
var newFrom = (instance , ToClass ) => {
|
|
12
|
+
const args = {};
|
|
13
|
+
Object.getOwnPropertyNames(instance).forEach(prop => {
|
|
14
|
+
args[prop] = instance[prop];
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
return new ToClass(args);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
//
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class Meeting {
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
static parse(plain ) {
|
|
48
|
+
return new Meeting({
|
|
49
|
+
guestSipAuthorization: plain.guest_sip_authorization,
|
|
50
|
+
uri: plain.ingress_http_uri,
|
|
51
|
+
name: plain.name,
|
|
52
|
+
ownerUuids: plain.owner_uuids,
|
|
53
|
+
port: plain.port,
|
|
54
|
+
uuid: plain.uuid,
|
|
55
|
+
extension: plain.exten,
|
|
56
|
+
persistent: plain.persistent,
|
|
57
|
+
creationTime: moment__default['default'](plain.creation_time).toDate(),
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
static parseMany(items ) {
|
|
62
|
+
if (!items) {
|
|
63
|
+
return [];
|
|
64
|
+
}
|
|
65
|
+
return items.map(plain => Meeting.parse(plain));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
static newFrom(meeting ) {
|
|
69
|
+
return newFrom(meeting, Meeting);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
constructor({
|
|
73
|
+
uuid,
|
|
74
|
+
name,
|
|
75
|
+
guestSipAuthorization,
|
|
76
|
+
ownerUuids,
|
|
77
|
+
port,
|
|
78
|
+
uri,
|
|
79
|
+
extension,
|
|
80
|
+
persistent,
|
|
81
|
+
creationTime,
|
|
82
|
+
} = {}) {
|
|
83
|
+
this.guestSipAuthorization = guestSipAuthorization;
|
|
84
|
+
this.uri = uri;
|
|
85
|
+
this.name = name;
|
|
86
|
+
this.ownerUuids = ownerUuids;
|
|
87
|
+
this.port = port;
|
|
88
|
+
this.uuid = uuid;
|
|
89
|
+
this.extension = extension;
|
|
90
|
+
this.persistent = persistent;
|
|
91
|
+
this.creationTime = creationTime;
|
|
92
|
+
|
|
93
|
+
// Useful to compare instead of instanceof with minified code
|
|
94
|
+
this.type = 'Meeting';
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
getGuestSipCredentials() {
|
|
98
|
+
// eslint-disable-next-line no-undef
|
|
99
|
+
const [username, secret] = atob(this.guestSipAuthorization).split(':');
|
|
100
|
+
return { username, secret };
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
//
|
|
105
|
+
|
|
106
|
+
describe('Meeting domain', () => {
|
|
107
|
+
it('can return username and secret from an base64 encrypted string', () => {
|
|
108
|
+
const USERNAME = 'username';
|
|
109
|
+
const SECRET = 'secret';
|
|
110
|
+
|
|
111
|
+
const args = {
|
|
112
|
+
guest_sip_authorization: btoa(`${USERNAME}:${SECRET}`),
|
|
113
|
+
creation_time: '',
|
|
114
|
+
ingress_http_uri: '',
|
|
115
|
+
name: '',
|
|
116
|
+
owner_uuids: [],
|
|
117
|
+
port: '',
|
|
118
|
+
uuid: '',
|
|
119
|
+
exten: '',
|
|
120
|
+
persistent: false,
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const meeting = Meeting.parse(args);
|
|
124
|
+
|
|
125
|
+
const { username, secret } = meeting.getGuestSipCredentials();
|
|
126
|
+
|
|
127
|
+
expect(username).toEqual(USERNAME);
|
|
128
|
+
expect(secret).toEqual(SECRET);
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it('should return a date from a string', () => {
|
|
132
|
+
const args = {
|
|
133
|
+
creation_time: '2021-12-21T15:56:42.880Z',
|
|
134
|
+
guest_sip_authorization: '',
|
|
135
|
+
ingress_http_uri: '',
|
|
136
|
+
name: '',
|
|
137
|
+
owner_uuids: [],
|
|
138
|
+
port: '',
|
|
139
|
+
uuid: '',
|
|
140
|
+
exten: '',
|
|
141
|
+
persistent: false,
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
const { creationTime } = Meeting.parse(args);
|
|
145
|
+
|
|
146
|
+
expect(creationTime.getDate()).toEqual(21);
|
|
147
|
+
expect(creationTime.getFullYear()).toEqual(2021);
|
|
148
|
+
expect(creationTime.getMonth()).toEqual(11);
|
|
149
|
+
});
|
|
150
|
+
});
|