@wazo/sdk 0.37.20 → 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 +91 -21
- package/esm/__tests__/web-rtc-client.test.js +214 -165
- package/esm/api/agentd.js +25 -2
- package/esm/api/amid.js +26 -3
- package/esm/api/application.js +25 -2
- package/esm/api/auth.js +25 -2
- package/esm/api/call-logd.js +34 -4
- package/esm/api/calld.js +35 -2
- package/esm/api/chatd.js +32 -2
- package/esm/api/confd.js +56 -9
- package/esm/api/ctid-ng.js +38 -5
- package/esm/api/dird.js +29 -3
- package/esm/api/webhookd.js +26 -3
- package/esm/api-client.js +91 -21
- package/esm/checker/Checker.js +241 -190
- package/esm/checker/checks/aor.js +91 -21
- package/esm/checker/checks/api.js +91 -21
- package/esm/checker/checks/index.js +231 -180
- package/esm/checker/checks/wazo-websocket.js +42 -17
- package/esm/checker/checks/webrtc-transport.js +214 -165
- package/esm/checker/checks/webrtc.js +214 -165
- package/esm/domain/AdHocAPIConference.js +91 -21
- package/esm/domain/Call.js +3 -0
- package/esm/domain/CallLog.js +8 -1
- package/esm/domain/ChatMessage.js +4 -0
- package/esm/domain/ChatRoom.js +3 -0
- package/esm/domain/Contact.js +4 -1
- package/esm/domain/Features.js +91 -21
- package/esm/domain/Meeting.js +28 -5
- package/esm/domain/Phone/CTIPhone.js +109 -35
- package/esm/domain/Phone/WebRTCPhone.js +159 -102
- package/esm/domain/Recording.js +3 -0
- package/esm/domain/Voicemail.js +3 -0
- package/esm/domain/__tests__/Call.test.js +3 -0
- package/esm/domain/__tests__/CallLog.test.js +8 -1
- package/esm/domain/__tests__/Contact.test.js +4 -1
- package/esm/domain/__tests__/Meeting.test.js +144 -0
- package/esm/domain/__tests__/Voicemail.test.js +3 -0
- package/esm/index.js +509 -414
- package/esm/lib/WazoSessionDescriptionHandler.js +26 -41
- package/esm/service/CallApi.js +91 -21
- package/esm/service/IssueReporter.js +26 -3
- package/esm/service/__tests__/IssueReporter.test.js +26 -3
- package/esm/service/getApiClient.js +91 -21
- package/esm/simple/Auth.js +499 -404
- package/esm/simple/Configuration.js +499 -404
- package/esm/simple/Directory.js +91 -21
- package/esm/simple/Phone.js +499 -404
- package/esm/simple/Websocket.js +45 -19
- package/esm/simple/index.js +503 -408
- package/esm/simple/room/LocalParticipant.js +503 -408
- package/esm/simple/room/Participant.js +503 -408
- package/esm/simple/room/RemoteParticipant.js +503 -408
- package/esm/simple/room/Room.js +504 -409
- package/esm/simple/room/SipRoom.js +503 -408
- package/esm/simple/room/Stream.js +503 -408
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +503 -408
- package/esm/simple/utils.js +503 -408
- package/esm/types/WebSocketMessage.js +1 -1
- package/esm/utils/__tests__/api-requester.test.js +25 -2
- package/esm/utils/api-requester.js +25 -2
- package/esm/web-rtc-client.js +214 -165
- package/esm/websocket-client.js +43 -18
- package/lib/__tests__/api-client.test.js +91 -21
- package/lib/__tests__/web-rtc-client.test.js +214 -165
- package/lib/api/agentd.js +25 -2
- package/lib/api/amid.js +26 -3
- package/lib/api/application.js +25 -2
- package/lib/api/auth.js +25 -2
- package/lib/api/call-logd.js +34 -4
- package/lib/api/calld.js +35 -2
- package/lib/api/chatd.js +32 -2
- package/lib/api/confd.js +56 -9
- package/lib/api/ctid-ng.js +38 -5
- package/lib/api/dird.js +29 -3
- package/lib/api/webhookd.js +26 -3
- package/lib/api-client.js +91 -21
- package/lib/checker/Checker.js +241 -190
- package/lib/checker/checks/aor.js +91 -21
- package/lib/checker/checks/api.js +91 -21
- package/lib/checker/checks/index.js +231 -180
- package/lib/checker/checks/wazo-websocket.js +42 -17
- package/lib/checker/checks/webrtc-transport.js +214 -165
- package/lib/checker/checks/webrtc.js +214 -165
- package/lib/domain/AdHocAPIConference.js +91 -21
- package/lib/domain/Call.js +3 -0
- package/lib/domain/CallLog.js +8 -1
- package/lib/domain/ChatMessage.js +4 -0
- package/lib/domain/ChatRoom.js +3 -0
- package/lib/domain/Contact.js +4 -1
- package/lib/domain/Features.js +91 -21
- package/lib/domain/Meeting.js +32 -5
- package/lib/domain/Phone/CTIPhone.js +109 -35
- package/lib/domain/Phone/WebRTCPhone.js +159 -102
- package/lib/domain/Recording.js +3 -0
- package/lib/domain/Voicemail.js +3 -0
- package/lib/domain/__tests__/Call.test.js +3 -0
- package/lib/domain/__tests__/CallLog.test.js +8 -1
- package/lib/domain/__tests__/Contact.test.js +4 -1
- package/lib/domain/__tests__/Meeting.test.js +150 -0
- package/lib/domain/__tests__/Voicemail.test.js +3 -0
- package/lib/index.js +509 -414
- package/lib/lib/WazoSessionDescriptionHandler.js +26 -41
- package/lib/service/CallApi.js +91 -21
- package/lib/service/IssueReporter.js +26 -3
- package/lib/service/__tests__/IssueReporter.test.js +26 -3
- package/lib/service/getApiClient.js +91 -21
- package/lib/simple/Auth.js +499 -404
- package/lib/simple/Configuration.js +499 -404
- package/lib/simple/Directory.js +91 -21
- package/lib/simple/Phone.js +499 -404
- package/lib/simple/Websocket.js +45 -19
- package/lib/simple/index.js +503 -408
- package/lib/simple/room/LocalParticipant.js +503 -408
- package/lib/simple/room/Participant.js +503 -408
- package/lib/simple/room/RemoteParticipant.js +503 -408
- package/lib/simple/room/Room.js +504 -409
- package/lib/simple/room/SipRoom.js +503 -408
- package/lib/simple/room/Stream.js +503 -408
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +503 -408
- package/lib/simple/utils.js +503 -408
- package/lib/types/WebSocketMessage.js +2 -0
- package/lib/utils/__tests__/api-requester.test.js +25 -2
- package/lib/utils/api-requester.js +25 -2
- package/lib/web-rtc-client.js +214 -165
- package/lib/websocket-client.js +43 -17
- package/package.json +1 -1
- package/src/api/confd.js +5 -2
- package/src/domain/Call.js +3 -0
- package/src/domain/CallLog.js +4 -0
- package/src/domain/ChatMessage.js +4 -0
- package/src/domain/ChatRoom.js +3 -0
- package/src/domain/Contact.js +3 -0
- package/src/domain/Meeting.js +28 -5
- package/src/domain/Phone/CTIPhone.js +4 -0
- package/src/domain/Phone/Phone.js +2 -0
- package/src/domain/Phone/WebRTCPhone.js +49 -15
- package/src/domain/Recording.js +3 -0
- package/src/domain/Voicemail.js +3 -0
- package/src/domain/__tests__/Meeting.test.js +50 -0
- package/src/lib/WazoSessionDescriptionHandler.js +1 -35
- package/src/service/IssueReporter.js +25 -2
- package/src/simple/Phone.js +5 -0
- package/src/types/WebSocketMessage.js +5 -1
- package/src/web-rtc-client.js +41 -24
- package/src/websocket-client.js +2 -0
package/esm/domain/Recording.js
CHANGED
package/esm/domain/Voicemail.js
CHANGED
|
@@ -71,6 +71,9 @@ class Voicemail {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
static parseMany(plain ) {
|
|
74
|
+
if (!plain) {
|
|
75
|
+
return [];
|
|
76
|
+
}
|
|
74
77
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
75
78
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
76
79
|
|
|
@@ -26,7 +26,7 @@ BwIDAQAB
|
|
|
26
26
|
|
|
27
27
|
//
|
|
28
28
|
|
|
29
|
-
KEYUTIL.getKey(swarmPublicKey);
|
|
29
|
+
const swarmKey = KEYUTIL.getKey(swarmPublicKey);
|
|
30
30
|
|
|
31
31
|
//
|
|
32
32
|
|
|
@@ -54,6 +54,9 @@ class Recording {
|
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
static parseMany(recordings = []) {
|
|
57
|
+
if (!recordings) {
|
|
58
|
+
return [];
|
|
59
|
+
}
|
|
57
60
|
return recordings.map(item => Recording.parse(item));
|
|
58
61
|
}
|
|
59
62
|
|
|
@@ -155,6 +158,10 @@ class CallLog {
|
|
|
155
158
|
}
|
|
156
159
|
|
|
157
160
|
static parseMany(plain ) {
|
|
161
|
+
if (!plain || !plain.items) {
|
|
162
|
+
return [];
|
|
163
|
+
}
|
|
164
|
+
|
|
158
165
|
return plain.items.map(item => CallLog.parse(item));
|
|
159
166
|
}
|
|
160
167
|
|
|
@@ -44,7 +44,7 @@ const LINE_STATE = {
|
|
|
44
44
|
|
|
45
45
|
//
|
|
46
46
|
|
|
47
|
-
KEYUTIL.getKey(swarmPublicKey);
|
|
47
|
+
const swarmKey = KEYUTIL.getKey(swarmPublicKey);
|
|
48
48
|
|
|
49
49
|
//
|
|
50
50
|
|
|
@@ -325,6 +325,9 @@ class Contact {
|
|
|
325
325
|
}
|
|
326
326
|
|
|
327
327
|
static parseMany(response ) {
|
|
328
|
+
if (!response || !response.results) {
|
|
329
|
+
return [];
|
|
330
|
+
}
|
|
328
331
|
return response.results.map(r => Contact.parse(r, response.column_types));
|
|
329
332
|
}
|
|
330
333
|
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import moment from 'moment';
|
|
2
|
+
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
var newFrom = (instance , ToClass ) => {
|
|
6
|
+
const args = {};
|
|
7
|
+
Object.getOwnPropertyNames(instance).forEach(prop => {
|
|
8
|
+
args[prop] = instance[prop];
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
return new ToClass(args);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
//
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class Meeting {
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
static parse(plain ) {
|
|
42
|
+
return new Meeting({
|
|
43
|
+
guestSipAuthorization: plain.guest_sip_authorization,
|
|
44
|
+
uri: plain.ingress_http_uri,
|
|
45
|
+
name: plain.name,
|
|
46
|
+
ownerUuids: plain.owner_uuids,
|
|
47
|
+
port: plain.port,
|
|
48
|
+
uuid: plain.uuid,
|
|
49
|
+
extension: plain.exten,
|
|
50
|
+
persistent: plain.persistent,
|
|
51
|
+
creationTime: moment(plain.creation_time).toDate(),
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
static parseMany(items ) {
|
|
56
|
+
if (!items) {
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
59
|
+
return items.map(plain => Meeting.parse(plain));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
static newFrom(meeting ) {
|
|
63
|
+
return newFrom(meeting, Meeting);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
constructor({
|
|
67
|
+
uuid,
|
|
68
|
+
name,
|
|
69
|
+
guestSipAuthorization,
|
|
70
|
+
ownerUuids,
|
|
71
|
+
port,
|
|
72
|
+
uri,
|
|
73
|
+
extension,
|
|
74
|
+
persistent,
|
|
75
|
+
creationTime,
|
|
76
|
+
} = {}) {
|
|
77
|
+
this.guestSipAuthorization = guestSipAuthorization;
|
|
78
|
+
this.uri = uri;
|
|
79
|
+
this.name = name;
|
|
80
|
+
this.ownerUuids = ownerUuids;
|
|
81
|
+
this.port = port;
|
|
82
|
+
this.uuid = uuid;
|
|
83
|
+
this.extension = extension;
|
|
84
|
+
this.persistent = persistent;
|
|
85
|
+
this.creationTime = creationTime;
|
|
86
|
+
|
|
87
|
+
// Useful to compare instead of instanceof with minified code
|
|
88
|
+
this.type = 'Meeting';
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
getGuestSipCredentials() {
|
|
92
|
+
// eslint-disable-next-line no-undef
|
|
93
|
+
const [username, secret] = atob(this.guestSipAuthorization).split(':');
|
|
94
|
+
return { username, secret };
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
//
|
|
99
|
+
|
|
100
|
+
describe('Meeting domain', () => {
|
|
101
|
+
it('can return username and secret from an base64 encrypted string', () => {
|
|
102
|
+
const USERNAME = 'username';
|
|
103
|
+
const SECRET = 'secret';
|
|
104
|
+
|
|
105
|
+
const args = {
|
|
106
|
+
guest_sip_authorization: btoa(`${USERNAME}:${SECRET}`),
|
|
107
|
+
creation_time: '',
|
|
108
|
+
ingress_http_uri: '',
|
|
109
|
+
name: '',
|
|
110
|
+
owner_uuids: [],
|
|
111
|
+
port: '',
|
|
112
|
+
uuid: '',
|
|
113
|
+
exten: '',
|
|
114
|
+
persistent: false,
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const meeting = Meeting.parse(args);
|
|
118
|
+
|
|
119
|
+
const { username, secret } = meeting.getGuestSipCredentials();
|
|
120
|
+
|
|
121
|
+
expect(username).toEqual(USERNAME);
|
|
122
|
+
expect(secret).toEqual(SECRET);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it('should return a date from a string', () => {
|
|
126
|
+
const args = {
|
|
127
|
+
creation_time: '2021-12-21T15:56:42.880Z',
|
|
128
|
+
guest_sip_authorization: '',
|
|
129
|
+
ingress_http_uri: '',
|
|
130
|
+
name: '',
|
|
131
|
+
owner_uuids: [],
|
|
132
|
+
port: '',
|
|
133
|
+
uuid: '',
|
|
134
|
+
exten: '',
|
|
135
|
+
persistent: false,
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const { creationTime } = Meeting.parse(args);
|
|
139
|
+
|
|
140
|
+
expect(creationTime.getDate()).toEqual(21);
|
|
141
|
+
expect(creationTime.getFullYear()).toEqual(2021);
|
|
142
|
+
expect(creationTime.getMonth()).toEqual(11);
|
|
143
|
+
});
|
|
144
|
+
});
|
|
@@ -71,6 +71,9 @@ class Voicemail {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
static parseMany(plain ) {
|
|
74
|
+
if (!plain) {
|
|
75
|
+
return [];
|
|
76
|
+
}
|
|
74
77
|
const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
|
|
75
78
|
const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
|
|
76
79
|
|