@wazo/sdk 0.37.0-rc.5 → 0.37.2
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 +93 -16
- package/esm/__tests__/web-rtc-client.test.js +153 -54
- package/esm/api/agentd.js +24 -3
- package/esm/api/amid.js +7 -1
- package/esm/api/application.js +24 -3
- package/esm/api/auth.js +24 -3
- package/esm/api/call-logd.js +78 -20
- package/esm/api/calld.js +24 -20
- package/esm/api/chatd.js +24 -3
- package/esm/api/confd.js +24 -3
- package/esm/api/ctid-ng.js +24 -3
- package/esm/api/dird.js +27 -6
- package/esm/api/webhookd.js +7 -1
- package/esm/api-client.js +93 -16
- package/esm/checker/Checker.js +156 -54
- package/esm/checker/checks/aor.js +95 -16
- package/esm/checker/checks/api.js +94 -16
- package/esm/checker/checks/index.js +156 -54
- package/esm/checker/checks/wazo-websocket.js +7 -1
- package/esm/checker/checks/webrtc-transport.js +153 -54
- package/esm/checker/checks/webrtc.js +153 -54
- package/esm/domain/AdHocAPIConference.js +1717 -1640
- package/esm/domain/CallLog.js +71 -19
- package/esm/domain/CallSession.js +1 -18
- package/esm/domain/Contact.js +3 -3
- package/esm/domain/Features.js +93 -16
- package/esm/domain/IndirectTransfer.js +0 -17
- package/esm/domain/Phone/CTIPhone.js +100 -19
- package/esm/domain/Phone/Phone.js +0 -17
- package/esm/domain/Phone/WebRTCPhone.js +51 -36
- package/esm/domain/Recording.js +51 -0
- package/esm/domain/Room.js +0 -17
- package/esm/domain/SwitchboardCall.js +0 -17
- package/esm/domain/__tests__/CallLog.test.js +89 -19
- package/esm/domain/__tests__/CallSession.test.js +1 -18
- package/esm/domain/__tests__/Contact.test.js +3 -3
- package/esm/domain/__tests__/IndirectTransfer.test.js +1 -18
- package/esm/domain/__tests__/Room.test.js +1 -18
- package/esm/domain/__tests__/Session.test.js +7 -0
- package/esm/index.js +3436 -2911
- package/esm/lib/WazoSessionDescriptionHandler.js +28 -10
- package/esm/service/CallApi.js +93 -16
- package/esm/service/IssueReporter.js +7 -1
- package/esm/service/__tests__/IssueReporter.test.js +26 -2
- package/esm/service/getApiClient.js +93 -16
- package/esm/simple/Auth.js +619 -97
- package/esm/simple/Configuration.js +619 -97
- package/esm/simple/Directory.js +93 -16
- package/esm/simple/Phone.js +3261 -2739
- package/esm/simple/Websocket.js +7 -1
- package/esm/simple/index.js +619 -97
- package/esm/simple/room/LocalParticipant.js +619 -97
- package/esm/simple/room/Participant.js +619 -97
- package/esm/simple/room/RemoteParticipant.js +619 -97
- package/esm/simple/room/Room.js +619 -97
- package/esm/simple/room/Stream.js +619 -97
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +619 -97
- package/esm/simple/utils.js +619 -97
- package/esm/utils/__tests__/api-requester.test.js +32 -6
- package/esm/utils/api-requester.js +24 -3
- package/esm/web-rtc-client.js +153 -54
- package/esm/websocket-client.js +7 -1
- package/lib/__tests__/api-client.test.js +93 -16
- package/lib/__tests__/web-rtc-client.test.js +154 -55
- package/lib/api/agentd.js +24 -3
- package/lib/api/amid.js +7 -1
- package/lib/api/application.js +24 -3
- package/lib/api/auth.js +24 -3
- package/lib/api/call-logd.js +78 -20
- package/lib/api/calld.js +24 -20
- package/lib/api/chatd.js +24 -3
- package/lib/api/confd.js +24 -3
- package/lib/api/ctid-ng.js +24 -3
- package/lib/api/dird.js +27 -6
- package/lib/api/webhookd.js +7 -1
- package/lib/api-client.js +93 -16
- package/lib/checker/Checker.js +157 -55
- package/lib/checker/checks/aor.js +95 -16
- package/lib/checker/checks/api.js +94 -16
- package/lib/checker/checks/index.js +157 -55
- package/lib/checker/checks/wazo-websocket.js +7 -1
- package/lib/checker/checks/webrtc-transport.js +154 -55
- package/lib/checker/checks/webrtc.js +154 -55
- package/lib/domain/AdHocAPIConference.js +1717 -1640
- package/lib/domain/CallLog.js +71 -19
- package/lib/domain/CallSession.js +1 -18
- package/lib/domain/Contact.js +3 -3
- package/lib/domain/Features.js +93 -16
- package/lib/domain/IndirectTransfer.js +0 -17
- package/lib/domain/Phone/CTIPhone.js +100 -19
- package/lib/domain/Phone/Phone.js +0 -16
- package/lib/domain/Phone/WebRTCPhone.js +51 -36
- package/lib/domain/Recording.js +57 -0
- package/lib/domain/Room.js +0 -17
- package/lib/domain/SwitchboardCall.js +0 -17
- package/lib/domain/__tests__/CallLog.test.js +89 -19
- package/lib/domain/__tests__/CallSession.test.js +1 -18
- package/lib/domain/__tests__/Contact.test.js +3 -3
- package/lib/domain/__tests__/IndirectTransfer.test.js +1 -18
- package/lib/domain/__tests__/Room.test.js +1 -18
- package/lib/domain/__tests__/Session.test.js +7 -0
- package/lib/index.js +3437 -2912
- package/lib/lib/WazoSessionDescriptionHandler.js +28 -10
- package/lib/service/CallApi.js +93 -16
- package/lib/service/IssueReporter.js +7 -1
- package/lib/service/__tests__/IssueReporter.test.js +26 -2
- package/lib/service/getApiClient.js +93 -16
- package/lib/simple/Auth.js +620 -98
- package/lib/simple/Configuration.js +620 -98
- package/lib/simple/Directory.js +93 -16
- package/lib/simple/Phone.js +3262 -2740
- package/lib/simple/Websocket.js +7 -1
- package/lib/simple/index.js +620 -98
- package/lib/simple/room/LocalParticipant.js +620 -98
- package/lib/simple/room/Participant.js +620 -98
- package/lib/simple/room/RemoteParticipant.js +620 -98
- package/lib/simple/room/Room.js +620 -98
- package/lib/simple/room/Stream.js +620 -98
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +620 -98
- package/lib/simple/utils.js +620 -98
- package/lib/utils/__tests__/api-requester.test.js +32 -6
- package/lib/utils/api-requester.js +24 -3
- package/lib/web-rtc-client.js +154 -55
- package/lib/websocket-client.js +7 -1
- package/package.json +1 -1
- package/src/api-client.js +4 -0
- package/src/checker/checks/aor.js +2 -0
- package/src/checker/checks/api.js +1 -0
- package/src/domain/CallLog.js +18 -11
- package/src/domain/CallSession.js +1 -2
- package/src/domain/Contact.js +3 -3
- package/src/domain/Phone/CTIPhone.js +6 -2
- package/src/domain/Phone/Phone.js +2 -0
- package/src/domain/Phone/WebRTCPhone.js +26 -16
- package/src/domain/Recording.js +48 -0
- package/src/domain/__tests__/CallLog.test.js +19 -0
- package/src/domain/__tests__/Session.test.js +7 -0
- package/src/index.js +6 -0
- package/src/lib/WazoSessionDescriptionHandler.js +21 -9
- package/src/service/IssueReporter.js +7 -1
- package/src/service/__tests__/IssueReporter.test.js +20 -1
- package/src/simple/Phone.js +5 -1
- package/src/simple/index.js +6 -0
- package/src/simple/room/Room.js +18 -15
- package/src/simple/room/Stream.js +1 -4
- package/src/utils/__tests__/api-requester.test.js +9 -4
- package/src/utils/api-requester.js +17 -2
- package/src/web-rtc-client.js +40 -13
package/lib/domain/CallLog.js
CHANGED
|
@@ -9,6 +9,17 @@ var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
|
|
|
9
9
|
|
|
10
10
|
//
|
|
11
11
|
|
|
12
|
+
var newFrom = (instance , ToClass ) => {
|
|
13
|
+
const args = {};
|
|
14
|
+
Object.getOwnPropertyNames(instance).forEach(prop => {
|
|
15
|
+
args[prop] = instance[prop];
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
return new ToClass(args);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
//
|
|
22
|
+
|
|
12
23
|
const swarmPublicKey = `-----BEGIN PUBLIC KEY-----
|
|
13
24
|
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmkXOuNfY8u5xoTiIhkb8
|
|
14
25
|
djnbIwG/Wrz3vpo8BZir8L5e1a1nSy740qBjP7ZINBQoALDhFfmdOfJnCyEGiHuz
|
|
@@ -21,32 +32,70 @@ BwIDAQAB
|
|
|
21
32
|
|
|
22
33
|
//
|
|
23
34
|
|
|
24
|
-
|
|
25
|
-
const args = {};
|
|
26
|
-
Object.getOwnPropertyNames(instance).forEach(prop => {
|
|
27
|
-
args[prop] = instance[prop];
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
return new ToClass(args);
|
|
31
|
-
};
|
|
35
|
+
jsrsasign.KEYUTIL.getKey(swarmPublicKey);
|
|
32
36
|
|
|
33
37
|
//
|
|
34
38
|
|
|
35
|
-
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class Recording {
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
static parseMany(recordings ) {
|
|
63
|
+
return recordings.map(item => Recording.parse(item));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
static parse(plain ) {
|
|
67
|
+
return new Recording({
|
|
68
|
+
deleted: plain.deleted,
|
|
69
|
+
fileName: plain.filename,
|
|
70
|
+
end: plain.end_time ? moment__default['default'](plain.end_time).toDate() : null,
|
|
71
|
+
start: moment__default['default'](plain.start_time).toDate(),
|
|
72
|
+
uuid: plain.uuid,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
constructor({ deleted, end, fileName, start, uuid } ) {
|
|
77
|
+
this.deleted = deleted;
|
|
78
|
+
this.end = end;
|
|
79
|
+
this.fileName = fileName;
|
|
80
|
+
this.start = start;
|
|
81
|
+
this.uuid = uuid;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
36
84
|
|
|
37
85
|
//
|
|
38
86
|
|
|
39
87
|
|
|
40
|
-
|
|
88
|
+
|
|
41
89
|
|
|
42
90
|
|
|
43
91
|
|
|
44
92
|
|
|
45
93
|
|
|
46
|
-
|
|
94
|
+
|
|
47
95
|
|
|
48
96
|
|
|
49
97
|
|
|
98
|
+
|
|
50
99
|
|
|
51
100
|
|
|
52
101
|
|
|
@@ -59,7 +108,7 @@ jsrsasign.KEYUTIL.getKey(swarmPublicKey);
|
|
|
59
108
|
|
|
60
109
|
|
|
61
110
|
|
|
62
|
-
|
|
111
|
+
|
|
63
112
|
|
|
64
113
|
|
|
65
114
|
|
|
@@ -74,13 +123,14 @@ jsrsasign.KEYUTIL.getKey(swarmPublicKey);
|
|
|
74
123
|
|
|
75
124
|
|
|
76
125
|
|
|
77
|
-
|
|
126
|
+
|
|
127
|
+
|
|
78
128
|
|
|
79
129
|
|
|
80
130
|
class CallLog {
|
|
81
131
|
|
|
82
132
|
|
|
83
|
-
|
|
133
|
+
|
|
84
134
|
|
|
85
135
|
|
|
86
136
|
|
|
@@ -97,7 +147,7 @@ class CallLog {
|
|
|
97
147
|
|
|
98
148
|
|
|
99
149
|
|
|
100
|
-
|
|
150
|
+
|
|
101
151
|
|
|
102
152
|
static merge(current , toMerge ) {
|
|
103
153
|
const onlyUnique = (value, index, self) => self.indexOf(value) === index;
|
|
@@ -114,7 +164,7 @@ class CallLog {
|
|
|
114
164
|
|
|
115
165
|
static parse(plain ) {
|
|
116
166
|
return new CallLog({
|
|
117
|
-
answer: moment__default['default'](plain.answer).toDate(),
|
|
167
|
+
answer: plain.answer ? moment__default['default'](plain.answer).toDate() : null,
|
|
118
168
|
answered: plain.answered,
|
|
119
169
|
callDirection: plain.call_direction,
|
|
120
170
|
destination: {
|
|
@@ -128,13 +178,14 @@ class CallLog {
|
|
|
128
178
|
id: plain.id,
|
|
129
179
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
130
180
|
start: moment__default['default'](plain.start).toDate(),
|
|
131
|
-
end: moment__default['default'](plain.end).toDate(),
|
|
181
|
+
end: plain.end ? moment__default['default'](plain.end).toDate() : null,
|
|
182
|
+
recordings: Recording.parseMany(plain.recordings),
|
|
132
183
|
});
|
|
133
184
|
}
|
|
134
185
|
|
|
135
186
|
static parseNew(plain , session ) {
|
|
136
187
|
return new CallLog({
|
|
137
|
-
answer: moment__default['default'](plain.answer).toDate(),
|
|
188
|
+
answer: plain.answer ? moment__default['default'](plain.answer).toDate() : null,
|
|
138
189
|
answered: plain.answered,
|
|
139
190
|
callDirection: plain.call_direction,
|
|
140
191
|
destination: {
|
|
@@ -148,7 +199,8 @@ class CallLog {
|
|
|
148
199
|
id: plain.id,
|
|
149
200
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
150
201
|
start: moment__default['default'](plain.start).toDate(),
|
|
151
|
-
end: moment__default['default'](plain.end).toDate(),
|
|
202
|
+
end: plain.end ? moment__default['default'](plain.end).toDate() : null,
|
|
203
|
+
recordings: Recording.parseMany(plain.recordings),
|
|
152
204
|
// @TODO: FIXME add verification declined vs missed call
|
|
153
205
|
newMissedCall: session
|
|
154
206
|
&& session.hasExtension(plain.requested_extension || plain.destination_extension) && !plain.answered,
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var sessionState = require('sip.js/lib/api/session-state');
|
|
4
4
|
require('moment');
|
|
5
|
-
var jsrsasign = require('jsrsasign');
|
|
6
5
|
|
|
7
6
|
//
|
|
8
7
|
|
|
@@ -15,22 +14,6 @@ var newFrom = (instance , ToClass ) => {
|
|
|
15
14
|
return new ToClass(args);
|
|
16
15
|
};
|
|
17
16
|
|
|
18
|
-
//
|
|
19
|
-
|
|
20
|
-
const swarmPublicKey = `-----BEGIN PUBLIC KEY-----
|
|
21
|
-
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmkXOuNfY8u5xoTiIhkb8
|
|
22
|
-
djnbIwG/Wrz3vpo8BZir8L5e1a1nSy740qBjP7ZINBQoALDhFfmdOfJnCyEGiHuz
|
|
23
|
-
ZW6jbG6C3PryE3Bu6GKwqSmD6k3q4Zk27fpwYAnNl+rWhYYM563rJZBda/INyHNN
|
|
24
|
-
pK7M1mixWi7gNdjjXwoEXSSBx+VpYMkY6LiAB2mvHXTY9M1qI14dvgGoQISZQoKi
|
|
25
|
-
NMTRCg5UP2ic0Dd9nSz/XpcOxGfa+0fwIl1F7RC1tJXOqvkGGPTOV4LLfg/Yta3h
|
|
26
|
-
nUPX9EZZDIX6vO/0IBV1LzjSl2A1bYFYAjJfowv3i1CpvONBOClHjSY5t9Y8MH6p
|
|
27
|
-
BwIDAQAB
|
|
28
|
-
-----END PUBLIC KEY-----`;
|
|
29
|
-
|
|
30
|
-
//
|
|
31
|
-
|
|
32
|
-
jsrsasign.KEYUTIL.getKey(swarmPublicKey);
|
|
33
|
-
|
|
34
17
|
//
|
|
35
18
|
/* eslint-disable no-param-reassign */
|
|
36
19
|
|
|
@@ -354,7 +337,7 @@ class CallSession {
|
|
|
354
337
|
return newFrom(callSession, CallSession);
|
|
355
338
|
}
|
|
356
339
|
|
|
357
|
-
static parseCall(
|
|
340
|
+
static parseCall(call ) {
|
|
358
341
|
return new CallSession({
|
|
359
342
|
callId: call.id,
|
|
360
343
|
sipCallId: call.sipCallId,
|
package/lib/domain/Contact.js
CHANGED
|
@@ -468,7 +468,7 @@ class Contact {
|
|
|
468
468
|
|
|
469
469
|
return new Contact({
|
|
470
470
|
sourceId: single.id || '',
|
|
471
|
-
name: single.displayName,
|
|
471
|
+
name: single.displayName || '',
|
|
472
472
|
number: numbers.length ? numbers[0].number : '',
|
|
473
473
|
numbers,
|
|
474
474
|
emails,
|
|
@@ -499,7 +499,7 @@ class Contact {
|
|
|
499
499
|
|
|
500
500
|
return new Contact({
|
|
501
501
|
sourceId: single.id || '',
|
|
502
|
-
name: single.name,
|
|
502
|
+
name: single.name || '',
|
|
503
503
|
number: numbers.length ? numbers[0].number : '',
|
|
504
504
|
numbers,
|
|
505
505
|
emails,
|
|
@@ -600,7 +600,7 @@ class Contact {
|
|
|
600
600
|
} = {}) {
|
|
601
601
|
this.id = id;
|
|
602
602
|
this.uuid = uuid;
|
|
603
|
-
this.name = name;
|
|
603
|
+
this.name = name || '';
|
|
604
604
|
this.number = number;
|
|
605
605
|
this.numbers = numbers;
|
|
606
606
|
this.email = email;
|
package/lib/domain/Features.js
CHANGED
|
@@ -317,7 +317,13 @@ class IssueReporter {
|
|
|
317
317
|
}
|
|
318
318
|
|
|
319
319
|
_isLevelAbove(level1 , level2 ) {
|
|
320
|
-
|
|
320
|
+
const index1 = LOG_LEVELS.indexOf(level1);
|
|
321
|
+
const index2 = LOG_LEVELS.indexOf(level2);
|
|
322
|
+
if (index1 === -1 || index2 === -1) {
|
|
323
|
+
return false;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
return index1 > index2;
|
|
321
327
|
}
|
|
322
328
|
|
|
323
329
|
_makeCategory(category ) {
|
|
@@ -375,6 +381,7 @@ class ApiRequester {
|
|
|
375
381
|
|
|
376
382
|
|
|
377
383
|
|
|
384
|
+
|
|
378
385
|
|
|
379
386
|
|
|
380
387
|
|
|
@@ -414,6 +421,8 @@ class ApiRequester {
|
|
|
414
421
|
this.token = token;
|
|
415
422
|
}
|
|
416
423
|
|
|
424
|
+
this.shouldLogErrors = true;
|
|
425
|
+
|
|
417
426
|
methods.forEach(method => {
|
|
418
427
|
// $FlowFixMe
|
|
419
428
|
ApiRequester.prototype[method] = function sugar(...args) {
|
|
@@ -437,6 +446,14 @@ class ApiRequester {
|
|
|
437
446
|
this.fetchOptions = options;
|
|
438
447
|
}
|
|
439
448
|
|
|
449
|
+
disableErrorLogging() {
|
|
450
|
+
this.shouldLogErrors = false;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
enableErrorLogging() {
|
|
454
|
+
this.shouldLogErrors = true;
|
|
455
|
+
}
|
|
456
|
+
|
|
440
457
|
async call(
|
|
441
458
|
path ,
|
|
442
459
|
method = 'get',
|
|
@@ -497,7 +514,9 @@ class ApiRequester {
|
|
|
497
514
|
? exceptionClass.fromText(err, response.status)
|
|
498
515
|
: exceptionClass.fromResponse(err, response.status);
|
|
499
516
|
|
|
500
|
-
|
|
517
|
+
if (this.shouldLogErrors) {
|
|
518
|
+
logger$1.error('API error', error);
|
|
519
|
+
}
|
|
501
520
|
|
|
502
521
|
throw error;
|
|
503
522
|
});
|
|
@@ -505,7 +524,9 @@ class ApiRequester {
|
|
|
505
524
|
|
|
506
525
|
return newParse(response, isJson);
|
|
507
526
|
}).catch(error => {
|
|
508
|
-
|
|
527
|
+
if (this.shouldLogErrors) {
|
|
528
|
+
logger$1.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
529
|
+
}
|
|
509
530
|
|
|
510
531
|
throw error;
|
|
511
532
|
});
|
|
@@ -1555,7 +1576,7 @@ class Contact {
|
|
|
1555
1576
|
|
|
1556
1577
|
return new Contact({
|
|
1557
1578
|
sourceId: single.id || '',
|
|
1558
|
-
name: single.displayName,
|
|
1579
|
+
name: single.displayName || '',
|
|
1559
1580
|
number: numbers.length ? numbers[0].number : '',
|
|
1560
1581
|
numbers,
|
|
1561
1582
|
emails,
|
|
@@ -1586,7 +1607,7 @@ class Contact {
|
|
|
1586
1607
|
|
|
1587
1608
|
return new Contact({
|
|
1588
1609
|
sourceId: single.id || '',
|
|
1589
|
-
name: single.name,
|
|
1610
|
+
name: single.name || '',
|
|
1590
1611
|
number: numbers.length ? numbers[0].number : '',
|
|
1591
1612
|
numbers,
|
|
1592
1613
|
emails,
|
|
@@ -1687,7 +1708,7 @@ class Contact {
|
|
|
1687
1708
|
} = {}) {
|
|
1688
1709
|
this.id = id;
|
|
1689
1710
|
this.uuid = uuid;
|
|
1690
|
-
this.name = name;
|
|
1711
|
+
this.name = name || '';
|
|
1691
1712
|
this.number = number;
|
|
1692
1713
|
this.numbers = numbers;
|
|
1693
1714
|
this.email = email;
|
|
@@ -2996,17 +3017,66 @@ var updateFrom = (instance , from ) => {
|
|
|
2996
3017
|
|
|
2997
3018
|
//
|
|
2998
3019
|
|
|
3020
|
+
|
|
3021
|
+
|
|
3022
|
+
|
|
3023
|
+
|
|
3024
|
+
|
|
3025
|
+
|
|
3026
|
+
|
|
3027
|
+
|
|
3028
|
+
|
|
3029
|
+
|
|
3030
|
+
|
|
3031
|
+
|
|
3032
|
+
|
|
3033
|
+
|
|
3034
|
+
|
|
3035
|
+
|
|
3036
|
+
class Recording {
|
|
3037
|
+
|
|
3038
|
+
|
|
3039
|
+
|
|
3040
|
+
|
|
3041
|
+
|
|
3042
|
+
|
|
3043
|
+
static parseMany(recordings ) {
|
|
3044
|
+
return recordings.map(item => Recording.parse(item));
|
|
3045
|
+
}
|
|
3046
|
+
|
|
3047
|
+
static parse(plain ) {
|
|
3048
|
+
return new Recording({
|
|
3049
|
+
deleted: plain.deleted,
|
|
3050
|
+
fileName: plain.filename,
|
|
3051
|
+
end: plain.end_time ? moment__default['default'](plain.end_time).toDate() : null,
|
|
3052
|
+
start: moment__default['default'](plain.start_time).toDate(),
|
|
3053
|
+
uuid: plain.uuid,
|
|
3054
|
+
});
|
|
3055
|
+
}
|
|
3056
|
+
|
|
3057
|
+
constructor({ deleted, end, fileName, start, uuid } ) {
|
|
3058
|
+
this.deleted = deleted;
|
|
3059
|
+
this.end = end;
|
|
3060
|
+
this.fileName = fileName;
|
|
3061
|
+
this.start = start;
|
|
3062
|
+
this.uuid = uuid;
|
|
3063
|
+
}
|
|
3064
|
+
}
|
|
3065
|
+
|
|
3066
|
+
//
|
|
3067
|
+
|
|
2999
3068
|
|
|
3000
|
-
|
|
3069
|
+
|
|
3001
3070
|
|
|
3002
3071
|
|
|
3003
3072
|
|
|
3004
3073
|
|
|
3005
3074
|
|
|
3006
|
-
|
|
3075
|
+
|
|
3007
3076
|
|
|
3008
3077
|
|
|
3009
3078
|
|
|
3079
|
+
|
|
3010
3080
|
|
|
3011
3081
|
|
|
3012
3082
|
|
|
@@ -3019,7 +3089,7 @@ var updateFrom = (instance , from ) => {
|
|
|
3019
3089
|
|
|
3020
3090
|
|
|
3021
3091
|
|
|
3022
|
-
|
|
3092
|
+
|
|
3023
3093
|
|
|
3024
3094
|
|
|
3025
3095
|
|
|
@@ -3034,13 +3104,14 @@ var updateFrom = (instance , from ) => {
|
|
|
3034
3104
|
|
|
3035
3105
|
|
|
3036
3106
|
|
|
3037
|
-
|
|
3107
|
+
|
|
3108
|
+
|
|
3038
3109
|
|
|
3039
3110
|
|
|
3040
3111
|
class CallLog {
|
|
3041
3112
|
|
|
3042
3113
|
|
|
3043
|
-
|
|
3114
|
+
|
|
3044
3115
|
|
|
3045
3116
|
|
|
3046
3117
|
|
|
@@ -3057,7 +3128,7 @@ class CallLog {
|
|
|
3057
3128
|
|
|
3058
3129
|
|
|
3059
3130
|
|
|
3060
|
-
|
|
3131
|
+
|
|
3061
3132
|
|
|
3062
3133
|
static merge(current , toMerge ) {
|
|
3063
3134
|
const onlyUnique = (value, index, self) => self.indexOf(value) === index;
|
|
@@ -3074,7 +3145,7 @@ class CallLog {
|
|
|
3074
3145
|
|
|
3075
3146
|
static parse(plain ) {
|
|
3076
3147
|
return new CallLog({
|
|
3077
|
-
answer: moment__default['default'](plain.answer).toDate(),
|
|
3148
|
+
answer: plain.answer ? moment__default['default'](plain.answer).toDate() : null,
|
|
3078
3149
|
answered: plain.answered,
|
|
3079
3150
|
callDirection: plain.call_direction,
|
|
3080
3151
|
destination: {
|
|
@@ -3088,13 +3159,14 @@ class CallLog {
|
|
|
3088
3159
|
id: plain.id,
|
|
3089
3160
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
3090
3161
|
start: moment__default['default'](plain.start).toDate(),
|
|
3091
|
-
end: moment__default['default'](plain.end).toDate(),
|
|
3162
|
+
end: plain.end ? moment__default['default'](plain.end).toDate() : null,
|
|
3163
|
+
recordings: Recording.parseMany(plain.recordings),
|
|
3092
3164
|
});
|
|
3093
3165
|
}
|
|
3094
3166
|
|
|
3095
3167
|
static parseNew(plain , session ) {
|
|
3096
3168
|
return new CallLog({
|
|
3097
|
-
answer: moment__default['default'](plain.answer).toDate(),
|
|
3169
|
+
answer: plain.answer ? moment__default['default'](plain.answer).toDate() : null,
|
|
3098
3170
|
answered: plain.answered,
|
|
3099
3171
|
callDirection: plain.call_direction,
|
|
3100
3172
|
destination: {
|
|
@@ -3108,7 +3180,8 @@ class CallLog {
|
|
|
3108
3180
|
id: plain.id,
|
|
3109
3181
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
3110
3182
|
start: moment__default['default'](plain.start).toDate(),
|
|
3111
|
-
end: moment__default['default'](plain.end).toDate(),
|
|
3183
|
+
end: plain.end ? moment__default['default'](plain.end).toDate() : null,
|
|
3184
|
+
recordings: Recording.parseMany(plain.recordings),
|
|
3112
3185
|
// @TODO: FIXME add verification declined vs missed call
|
|
3113
3186
|
newMissedCall: session
|
|
3114
3187
|
&& session.hasExtension(plain.requested_extension || plain.destination_extension) && !plain.answered,
|
|
@@ -4329,6 +4402,10 @@ class ApiClient {
|
|
|
4329
4402
|
this.fetchOptions = fetchOptions;
|
|
4330
4403
|
this.client.setFetchOptions(fetchOptions);
|
|
4331
4404
|
}
|
|
4405
|
+
|
|
4406
|
+
disableErrorLogging() {
|
|
4407
|
+
this.client.disableErrorLogging();
|
|
4408
|
+
}
|
|
4332
4409
|
}
|
|
4333
4410
|
|
|
4334
4411
|
/* eslint-disable dot-notation */
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
require('sip.js/lib/api/session-state');
|
|
4
4
|
require('moment');
|
|
5
|
-
var jsrsasign = require('jsrsasign');
|
|
6
5
|
|
|
7
6
|
//
|
|
8
7
|
|
|
@@ -15,22 +14,6 @@ var newFrom = (instance , ToClass ) => {
|
|
|
15
14
|
return new ToClass(args);
|
|
16
15
|
};
|
|
17
16
|
|
|
18
|
-
//
|
|
19
|
-
|
|
20
|
-
const swarmPublicKey = `-----BEGIN PUBLIC KEY-----
|
|
21
|
-
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmkXOuNfY8u5xoTiIhkb8
|
|
22
|
-
djnbIwG/Wrz3vpo8BZir8L5e1a1nSy740qBjP7ZINBQoALDhFfmdOfJnCyEGiHuz
|
|
23
|
-
ZW6jbG6C3PryE3Bu6GKwqSmD6k3q4Zk27fpwYAnNl+rWhYYM563rJZBda/INyHNN
|
|
24
|
-
pK7M1mixWi7gNdjjXwoEXSSBx+VpYMkY6LiAB2mvHXTY9M1qI14dvgGoQISZQoKi
|
|
25
|
-
NMTRCg5UP2ic0Dd9nSz/XpcOxGfa+0fwIl1F7RC1tJXOqvkGGPTOV4LLfg/Yta3h
|
|
26
|
-
nUPX9EZZDIX6vO/0IBV1LzjSl2A1bYFYAjJfowv3i1CpvONBOClHjSY5t9Y8MH6p
|
|
27
|
-
BwIDAQAB
|
|
28
|
-
-----END PUBLIC KEY-----`;
|
|
29
|
-
|
|
30
|
-
//
|
|
31
|
-
|
|
32
|
-
jsrsasign.KEYUTIL.getKey(swarmPublicKey);
|
|
33
|
-
|
|
34
17
|
//
|
|
35
18
|
/* eslint-disable no-param-reassign */
|
|
36
19
|
|