@wazo/sdk 0.37.18 → 0.37.22
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 +13 -5
- package/esm/__tests__/api-client.test.js +52 -9
- package/esm/__tests__/web-rtc-client.test.js +80 -20
- package/esm/api/agentd.js +27 -4
- package/esm/api/amid.js +27 -4
- package/esm/api/application.js +27 -4
- package/esm/api/auth.js +29 -5
- package/esm/api/call-logd.js +29 -6
- package/esm/api/calld.js +27 -4
- package/esm/api/chatd.js +27 -4
- package/esm/api/confd.js +51 -8
- package/esm/api/ctid-ng.js +27 -4
- package/esm/api/dird.js +27 -4
- package/esm/api/webhookd.js +27 -4
- package/esm/api-client.js +54 -11
- package/esm/checker/Checker.js +83 -21
- package/esm/checker/checks/aor.js +54 -11
- package/esm/checker/checks/api.js +54 -11
- package/esm/checker/checks/ice-ipv4.js +1 -1
- package/esm/checker/checks/index.js +84 -22
- package/esm/checker/checks/symmetric-nat.js +1 -1
- package/esm/checker/checks/wazo-websocket.js +29 -4
- package/esm/checker/checks/webrtc-transport.js +82 -22
- package/esm/checker/checks/webrtc.js +82 -22
- package/esm/domain/AdHocAPIConference.js +54 -11
- package/esm/domain/Agent.js +1 -1
- package/esm/domain/BadResponse.js +1 -1
- package/esm/domain/Call.js +1 -1
- package/esm/domain/CallLog.js +3 -3
- package/esm/domain/CallSession.js +1 -1
- package/esm/domain/ChatMessage.js +1 -1
- package/esm/domain/ChatRoom.js +1 -1
- package/esm/domain/Contact.js +2 -1
- package/esm/domain/Country.js +1 -1
- package/esm/domain/Device/DebugDevice.js +1 -1
- package/esm/domain/ExternalApp.js +1 -1
- package/esm/domain/Features.js +54 -10
- package/esm/domain/ForwardOption.js +2 -1
- package/esm/domain/IndirectTransfer.js +1 -1
- package/esm/domain/Line.js +1 -1
- package/esm/domain/Meeting.js +20 -3
- package/esm/domain/NotificationOptions.js +1 -1
- package/esm/domain/Phone/CTIPhone.js +55 -11
- package/esm/domain/Phone/WebRTCPhone.js +39 -6
- package/esm/domain/Profile.js +2 -1
- package/esm/domain/Recording.js +2 -2
- package/esm/domain/Relocation.js +1 -1
- package/esm/domain/Room.js +1 -1
- package/esm/domain/ServerError.js +1 -1
- package/esm/domain/Session.js +2 -2
- package/esm/domain/SipLine.js +1 -1
- package/esm/domain/Subscription.js +1 -1
- package/esm/domain/SwitchboardCall.js +1 -1
- package/esm/domain/Voicemail.js +1 -1
- package/esm/domain/__tests__/CallLog.test.js +2 -2
- package/esm/index.js +101 -24
- package/esm/lib/WazoSessionDescriptionHandler.js +28 -4
- package/esm/service/CallApi.js +54 -11
- package/esm/service/IssueReporter.js +27 -4
- package/esm/service/__tests__/IssueReporter.test.js +26 -3
- package/esm/service/getApiClient.js +55 -11
- package/esm/simple/Auth.js +101 -23
- package/esm/simple/Configuration.js +100 -23
- package/esm/simple/Directory.js +53 -10
- package/esm/simple/Phone.js +100 -23
- package/esm/simple/Websocket.js +30 -4
- package/esm/simple/index.js +100 -23
- package/esm/simple/room/LocalParticipant.js +113 -40
- package/esm/simple/room/Participant.js +112 -37
- package/esm/simple/room/RemoteParticipant.js +114 -41
- package/esm/simple/room/Room.js +113 -37
- package/esm/simple/room/SipRoom.js +101 -26
- package/esm/simple/room/Stream.js +101 -26
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +99 -22
- package/esm/simple/utils.js +99 -22
- package/esm/utils/Emitter.js +1 -1
- package/esm/utils/Heartbeat.js +1 -1
- package/esm/utils/__tests__/api-requester.test.js +26 -3
- package/esm/utils/api-requester.js +28 -4
- package/esm/utils/compare-version.js +1 -1
- package/esm/utils/isMobile.js +1 -1
- package/esm/utils/new-from.js +1 -1
- package/esm/utils/once.js +1 -1
- package/esm/utils/update-from.js +1 -1
- package/esm/web-rtc-client.js +83 -22
- package/esm/websocket-client.js +30 -4
- package/lib/__tests__/api-client.test.js +61 -18
- package/lib/__tests__/web-rtc-client.test.js +97 -37
- package/lib/api/agentd.js +27 -4
- package/lib/api/amid.js +27 -4
- package/lib/api/application.js +27 -4
- package/lib/api/auth.js +28 -5
- package/lib/api/call-logd.js +34 -11
- package/lib/api/calld.js +30 -7
- package/lib/api/chatd.js +28 -5
- package/lib/api/confd.js +51 -8
- package/lib/api/ctid-ng.js +30 -7
- package/lib/api/dird.js +27 -4
- package/lib/api/webhookd.js +27 -4
- package/lib/api-client.js +61 -18
- package/lib/checker/Checker.js +100 -38
- package/lib/checker/checks/aor.js +61 -18
- package/lib/checker/checks/api.js +61 -18
- package/lib/checker/checks/index.js +100 -38
- package/lib/checker/checks/wazo-websocket.js +31 -6
- package/lib/checker/checks/webrtc-transport.js +97 -37
- package/lib/checker/checks/webrtc.js +97 -37
- package/lib/domain/AdHocAPIConference.js +61 -18
- package/lib/domain/Call.js +1 -1
- package/lib/domain/CallLog.js +7 -7
- package/lib/domain/ChatMessage.js +1 -1
- package/lib/domain/Contact.js +1 -1
- package/lib/domain/Features.js +62 -19
- package/lib/domain/ForwardOption.js +1 -1
- package/lib/domain/Meeting.js +19 -2
- package/lib/domain/Phone/CTIPhone.js +63 -20
- package/lib/domain/Phone/WebRTCPhone.js +40 -8
- package/lib/domain/Profile.js +1 -1
- package/lib/domain/Recording.js +3 -3
- package/lib/domain/Voicemail.js +1 -1
- package/lib/domain/__tests__/Call.test.js +1 -1
- package/lib/domain/__tests__/CallLog.test.js +13 -13
- package/lib/domain/__tests__/Voicemail.test.js +1 -1
- package/lib/index.js +120 -43
- package/lib/lib/WazoSessionDescriptionHandler.js +32 -9
- package/lib/service/CallApi.js +61 -18
- package/lib/service/IssueReporter.js +27 -4
- package/lib/service/__tests__/IssueReporter.test.js +27 -4
- package/lib/service/getApiClient.js +62 -19
- package/lib/simple/Auth.js +119 -42
- package/lib/simple/Configuration.js +118 -41
- package/lib/simple/Directory.js +61 -18
- package/lib/simple/Phone.js +118 -41
- package/lib/simple/Websocket.js +32 -6
- package/lib/simple/index.js +118 -41
- package/lib/simple/room/LocalParticipant.js +132 -59
- package/lib/simple/room/Participant.js +130 -55
- package/lib/simple/room/RemoteParticipant.js +133 -60
- package/lib/simple/room/Room.js +131 -56
- package/lib/simple/room/SipRoom.js +120 -45
- package/lib/simple/room/Stream.js +120 -45
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +118 -41
- package/lib/simple/utils.js +118 -41
- package/lib/utils/Emitter.js +1 -1
- package/lib/utils/PhoneNumberUtil.js +2 -2
- package/lib/utils/__tests__/PhoneNumberUtil.test.js +2 -2
- package/lib/utils/__tests__/api-requester.test.js +27 -4
- package/lib/utils/__tests__/sdp.test.js +12 -12
- package/lib/utils/api-requester.js +28 -5
- package/lib/utils/sdp.js +10 -10
- package/lib/web-rtc-client.js +98 -38
- package/lib/websocket-client.js +33 -7
- package/package.json +2 -2
- package/src/api/confd.js +5 -2
- package/src/domain/CallLog.js +1 -1
- package/src/domain/Meeting.js +19 -2
- package/src/domain/Phone/WebRTCPhone.js +11 -2
- package/src/domain/Recording.js +1 -1
- package/src/service/IssueReporter.js +26 -3
- package/src/simple/Phone.js +5 -0
- package/src/types/WebSocketMessage.js +5 -1
- package/src/web-rtc-client.js +28 -11
- package/src/websocket-client.js +2 -0
package/lib/domain/Features.js
CHANGED
|
@@ -138,6 +138,7 @@ class IssueReporter {
|
|
|
138
138
|
|
|
139
139
|
|
|
140
140
|
|
|
141
|
+
|
|
141
142
|
|
|
142
143
|
constructor() {
|
|
143
144
|
addLevelsTo(this);
|
|
@@ -149,12 +150,17 @@ class IssueReporter {
|
|
|
149
150
|
this.bufferTimeout = null;
|
|
150
151
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
151
152
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
153
|
+
this._callback = null;
|
|
152
154
|
}
|
|
153
155
|
|
|
154
156
|
init() {
|
|
155
157
|
this._catchConsole();
|
|
156
158
|
}
|
|
157
159
|
|
|
160
|
+
setCallback(cb ) {
|
|
161
|
+
this._callback = cb;
|
|
162
|
+
}
|
|
163
|
+
|
|
158
164
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
159
165
|
this.remoteClientConfiguration = configuration;
|
|
160
166
|
}
|
|
@@ -190,6 +196,7 @@ class IssueReporter {
|
|
|
190
196
|
|
|
191
197
|
// Handle category label
|
|
192
198
|
let category = null;
|
|
199
|
+
let skipSendToRemote = false;
|
|
193
200
|
let extra = {};
|
|
194
201
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
195
202
|
category = args[0].split('=')[1];
|
|
@@ -205,6 +212,7 @@ class IssueReporter {
|
|
|
205
212
|
errorMessage: lastArg.message,
|
|
206
213
|
errorStack: lastArg.stack,
|
|
207
214
|
errorType: lastArg.constructor.name,
|
|
215
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
208
216
|
};
|
|
209
217
|
} else {
|
|
210
218
|
extra = lastArg;
|
|
@@ -213,7 +221,12 @@ class IssueReporter {
|
|
|
213
221
|
args.splice(1, 1);
|
|
214
222
|
}
|
|
215
223
|
|
|
216
|
-
|
|
224
|
+
if (extra.skipSendToRemote) {
|
|
225
|
+
skipSendToRemote = true;
|
|
226
|
+
delete extra.skipSendToRemote;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
217
230
|
const message = args.join(', ');
|
|
218
231
|
let consoleMessage = message;
|
|
219
232
|
|
|
@@ -233,7 +246,13 @@ class IssueReporter {
|
|
|
233
246
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
234
247
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
235
248
|
|
|
236
|
-
this.
|
|
249
|
+
if (this._callback) {
|
|
250
|
+
this._callback(level, consoleMessage);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
if (!skipSendToRemote) {
|
|
254
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
255
|
+
}
|
|
237
256
|
}
|
|
238
257
|
|
|
239
258
|
logRequest(url , options , response , start ) {
|
|
@@ -378,7 +397,11 @@ class IssueReporter {
|
|
|
378
397
|
},
|
|
379
398
|
// $FlowFixMe
|
|
380
399
|
body,
|
|
381
|
-
}).catch(() => {
|
|
400
|
+
}).catch((e ) => {
|
|
401
|
+
// $FlowFixMe
|
|
402
|
+
e.skipSendToRemote = true;
|
|
403
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
404
|
+
|
|
382
405
|
setTimeout(() => {
|
|
383
406
|
if (isArray) {
|
|
384
407
|
payload = payload.map(message => {
|
|
@@ -390,7 +413,7 @@ class IssueReporter {
|
|
|
390
413
|
payload._retry = retry + 1;
|
|
391
414
|
}
|
|
392
415
|
|
|
393
|
-
this._sendDebugToGrafana(
|
|
416
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
394
417
|
}, 5000 + retry * 1000);
|
|
395
418
|
});
|
|
396
419
|
}
|
|
@@ -2593,7 +2616,8 @@ class ExternalApp {
|
|
|
2593
2616
|
|
|
2594
2617
|
|
|
2595
2618
|
|
|
2596
|
-
|
|
2619
|
+
|
|
2620
|
+
|
|
2597
2621
|
|
|
2598
2622
|
|
|
2599
2623
|
class Meeting {
|
|
@@ -2605,6 +2629,7 @@ class Meeting {
|
|
|
2605
2629
|
|
|
2606
2630
|
|
|
2607
2631
|
|
|
2632
|
+
|
|
2608
2633
|
|
|
2609
2634
|
|
|
2610
2635
|
static parse(plain ) {
|
|
@@ -2616,14 +2641,28 @@ class Meeting {
|
|
|
2616
2641
|
port: plain.port,
|
|
2617
2642
|
uuid: plain.uuid,
|
|
2618
2643
|
number: plain.number,
|
|
2644
|
+
persistent: plain.persistent,
|
|
2619
2645
|
});
|
|
2620
2646
|
}
|
|
2621
2647
|
|
|
2648
|
+
static parseMany(items ) {
|
|
2649
|
+
return items.map(plain => Meeting.parse(plain));
|
|
2650
|
+
}
|
|
2651
|
+
|
|
2622
2652
|
static newFrom(meeting ) {
|
|
2623
2653
|
return newFrom(meeting, Meeting);
|
|
2624
2654
|
}
|
|
2625
2655
|
|
|
2626
|
-
constructor({
|
|
2656
|
+
constructor({
|
|
2657
|
+
uuid,
|
|
2658
|
+
name,
|
|
2659
|
+
guestSipAuthorization,
|
|
2660
|
+
ownerUuids,
|
|
2661
|
+
port,
|
|
2662
|
+
uri,
|
|
2663
|
+
number,
|
|
2664
|
+
persistent,
|
|
2665
|
+
} = {}) {
|
|
2627
2666
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2628
2667
|
this.uri = uri;
|
|
2629
2668
|
this.name = name;
|
|
@@ -2631,6 +2670,7 @@ class Meeting {
|
|
|
2631
2670
|
this.port = port;
|
|
2632
2671
|
this.uuid = uuid;
|
|
2633
2672
|
this.number = number;
|
|
2673
|
+
this.persistent = persistent;
|
|
2634
2674
|
|
|
2635
2675
|
// Useful to compare instead of instanceof with minified code
|
|
2636
2676
|
this.type = 'Meeting';
|
|
@@ -2708,8 +2748,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
2708
2748
|
}
|
|
2709
2749
|
},
|
|
2710
2750
|
|
|
2711
|
-
|
|
2712
|
-
client.
|
|
2751
|
+
getMyMeetings: () =>
|
|
2752
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
2753
|
+
|
|
2754
|
+
createMyMeeting: (name , persistent ) =>
|
|
2755
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
2713
2756
|
|
|
2714
2757
|
deleteMyMeeting: (meetingUuid ) =>
|
|
2715
2758
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -2811,7 +2854,7 @@ class ChatMessage {
|
|
|
2811
2854
|
static parse(plain ) {
|
|
2812
2855
|
return new ChatMessage({
|
|
2813
2856
|
uuid: plain.uuid,
|
|
2814
|
-
date: moment__default[
|
|
2857
|
+
date: moment__default['default'](plain.created_at).toDate(),
|
|
2815
2858
|
content: plain.content,
|
|
2816
2859
|
alias: plain.alias,
|
|
2817
2860
|
userUuid: plain.user_uuid,
|
|
@@ -2903,7 +2946,7 @@ class Voicemail {
|
|
|
2903
2946
|
static parse(plain ) {
|
|
2904
2947
|
return new Voicemail({
|
|
2905
2948
|
id: plain.id,
|
|
2906
|
-
date: moment__default[
|
|
2949
|
+
date: moment__default['default'](plain.timestamp * 1000).toDate(),
|
|
2907
2950
|
duration: plain.duration * 1000,
|
|
2908
2951
|
caller: {
|
|
2909
2952
|
name: plain.caller_id_name,
|
|
@@ -3040,7 +3083,7 @@ class Call {
|
|
|
3040
3083
|
onHold: plain.on_hold,
|
|
3041
3084
|
status: plain.status,
|
|
3042
3085
|
lineId: plain.line_id,
|
|
3043
|
-
startingTime: moment__default[
|
|
3086
|
+
startingTime: moment__default['default'](plain.creation_time).toDate(),
|
|
3044
3087
|
talkingToIds: Object.keys(plain.talking_to || {}),
|
|
3045
3088
|
recording: plain.record_state === RECORD_STATE_ACTIVE,
|
|
3046
3089
|
});
|
|
@@ -3194,7 +3237,7 @@ class Recording {
|
|
|
3194
3237
|
|
|
3195
3238
|
|
|
3196
3239
|
|
|
3197
|
-
static parseMany(recordings
|
|
3240
|
+
static parseMany(recordings = []) {
|
|
3198
3241
|
return recordings.map(item => Recording.parse(item));
|
|
3199
3242
|
}
|
|
3200
3243
|
|
|
@@ -3202,8 +3245,8 @@ class Recording {
|
|
|
3202
3245
|
return new Recording({
|
|
3203
3246
|
deleted: plain.deleted,
|
|
3204
3247
|
fileName: plain.filename,
|
|
3205
|
-
end: plain.end_time ? moment__default[
|
|
3206
|
-
start: moment__default[
|
|
3248
|
+
end: plain.end_time ? moment__default['default'](plain.end_time).toDate() : null,
|
|
3249
|
+
start: moment__default['default'](plain.start_time).toDate(),
|
|
3207
3250
|
uuid: plain.uuid,
|
|
3208
3251
|
});
|
|
3209
3252
|
}
|
|
@@ -3301,7 +3344,7 @@ class CallLog {
|
|
|
3301
3344
|
|
|
3302
3345
|
static parse(plain ) {
|
|
3303
3346
|
return new CallLog({
|
|
3304
|
-
answer: plain.answer ? moment__default[
|
|
3347
|
+
answer: plain.answer ? moment__default['default'](plain.answer).toDate() : null,
|
|
3305
3348
|
answered: plain.answered,
|
|
3306
3349
|
callDirection: plain.call_direction,
|
|
3307
3350
|
destination: {
|
|
@@ -3318,9 +3361,9 @@ class CallLog {
|
|
|
3318
3361
|
},
|
|
3319
3362
|
id: plain.id,
|
|
3320
3363
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
3321
|
-
start: moment__default[
|
|
3322
|
-
end: plain.end ? moment__default[
|
|
3323
|
-
recordings: Recording.parseMany(plain.recordings),
|
|
3364
|
+
start: moment__default['default'](plain.start).toDate(),
|
|
3365
|
+
end: plain.end ? moment__default['default'](plain.end).toDate() : null,
|
|
3366
|
+
recordings: Recording.parseMany(plain.recordings || []),
|
|
3324
3367
|
});
|
|
3325
3368
|
}
|
|
3326
3369
|
|
|
@@ -4683,5 +4726,5 @@ class Features {
|
|
|
4683
4726
|
var Features$1 = new Features();
|
|
4684
4727
|
|
|
4685
4728
|
exports.FEATURES = FEATURES;
|
|
4686
|
-
exports
|
|
4729
|
+
exports.default = Features$1;
|
|
4687
4730
|
exports.getScopeName = getScopeName;
|
package/lib/domain/Meeting.js
CHANGED
|
@@ -20,7 +20,8 @@ var newFrom = (instance , ToClass ) => {
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
|
|
24
|
+
|
|
24
25
|
|
|
25
26
|
|
|
26
27
|
class Meeting {
|
|
@@ -32,6 +33,7 @@ class Meeting {
|
|
|
32
33
|
|
|
33
34
|
|
|
34
35
|
|
|
36
|
+
|
|
35
37
|
|
|
36
38
|
|
|
37
39
|
static parse(plain ) {
|
|
@@ -43,14 +45,28 @@ class Meeting {
|
|
|
43
45
|
port: plain.port,
|
|
44
46
|
uuid: plain.uuid,
|
|
45
47
|
number: plain.number,
|
|
48
|
+
persistent: plain.persistent,
|
|
46
49
|
});
|
|
47
50
|
}
|
|
48
51
|
|
|
52
|
+
static parseMany(items ) {
|
|
53
|
+
return items.map(plain => Meeting.parse(plain));
|
|
54
|
+
}
|
|
55
|
+
|
|
49
56
|
static newFrom(meeting ) {
|
|
50
57
|
return newFrom(meeting, Meeting);
|
|
51
58
|
}
|
|
52
59
|
|
|
53
|
-
constructor({
|
|
60
|
+
constructor({
|
|
61
|
+
uuid,
|
|
62
|
+
name,
|
|
63
|
+
guestSipAuthorization,
|
|
64
|
+
ownerUuids,
|
|
65
|
+
port,
|
|
66
|
+
uri,
|
|
67
|
+
number,
|
|
68
|
+
persistent,
|
|
69
|
+
} = {}) {
|
|
54
70
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
55
71
|
this.uri = uri;
|
|
56
72
|
this.name = name;
|
|
@@ -58,6 +74,7 @@ class Meeting {
|
|
|
58
74
|
this.port = port;
|
|
59
75
|
this.uuid = uuid;
|
|
60
76
|
this.number = number;
|
|
77
|
+
this.persistent = persistent;
|
|
61
78
|
|
|
62
79
|
// Useful to compare instead of instanceof with minified code
|
|
63
80
|
this.type = 'Meeting';
|
|
@@ -1576,7 +1576,7 @@ class Call {
|
|
|
1576
1576
|
onHold: plain.on_hold,
|
|
1577
1577
|
status: plain.status,
|
|
1578
1578
|
lineId: plain.line_id,
|
|
1579
|
-
startingTime: moment__default[
|
|
1579
|
+
startingTime: moment__default['default'](plain.creation_time).toDate(),
|
|
1580
1580
|
talkingToIds: Object.keys(plain.talking_to || {}),
|
|
1581
1581
|
recording: plain.record_state === RECORD_STATE_ACTIVE,
|
|
1582
1582
|
});
|
|
@@ -2056,7 +2056,7 @@ class Emitter {
|
|
|
2056
2056
|
|
|
2057
2057
|
|
|
2058
2058
|
constructor() {
|
|
2059
|
-
this.eventEmitter = new EventEmitter__default[
|
|
2059
|
+
this.eventEmitter = new EventEmitter__default['default']();
|
|
2060
2060
|
}
|
|
2061
2061
|
|
|
2062
2062
|
on(event , callback ) {
|
|
@@ -2101,7 +2101,7 @@ class Recording {
|
|
|
2101
2101
|
|
|
2102
2102
|
|
|
2103
2103
|
|
|
2104
|
-
static parseMany(recordings
|
|
2104
|
+
static parseMany(recordings = []) {
|
|
2105
2105
|
return recordings.map(item => Recording.parse(item));
|
|
2106
2106
|
}
|
|
2107
2107
|
|
|
@@ -2109,8 +2109,8 @@ class Recording {
|
|
|
2109
2109
|
return new Recording({
|
|
2110
2110
|
deleted: plain.deleted,
|
|
2111
2111
|
fileName: plain.filename,
|
|
2112
|
-
end: plain.end_time ? moment__default[
|
|
2113
|
-
start: moment__default[
|
|
2112
|
+
end: plain.end_time ? moment__default['default'](plain.end_time).toDate() : null,
|
|
2113
|
+
start: moment__default['default'](plain.start_time).toDate(),
|
|
2114
2114
|
uuid: plain.uuid,
|
|
2115
2115
|
});
|
|
2116
2116
|
}
|
|
@@ -2208,7 +2208,7 @@ class CallLog {
|
|
|
2208
2208
|
|
|
2209
2209
|
static parse(plain ) {
|
|
2210
2210
|
return new CallLog({
|
|
2211
|
-
answer: plain.answer ? moment__default[
|
|
2211
|
+
answer: plain.answer ? moment__default['default'](plain.answer).toDate() : null,
|
|
2212
2212
|
answered: plain.answered,
|
|
2213
2213
|
callDirection: plain.call_direction,
|
|
2214
2214
|
destination: {
|
|
@@ -2225,9 +2225,9 @@ class CallLog {
|
|
|
2225
2225
|
},
|
|
2226
2226
|
id: plain.id,
|
|
2227
2227
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
2228
|
-
start: moment__default[
|
|
2229
|
-
end: plain.end ? moment__default[
|
|
2230
|
-
recordings: Recording.parseMany(plain.recordings),
|
|
2228
|
+
start: moment__default['default'](plain.start).toDate(),
|
|
2229
|
+
end: plain.end ? moment__default['default'](plain.end).toDate() : null,
|
|
2230
|
+
recordings: Recording.parseMany(plain.recordings || []),
|
|
2231
2231
|
});
|
|
2232
2232
|
}
|
|
2233
2233
|
|
|
@@ -2519,6 +2519,7 @@ class IssueReporter {
|
|
|
2519
2519
|
|
|
2520
2520
|
|
|
2521
2521
|
|
|
2522
|
+
|
|
2522
2523
|
|
|
2523
2524
|
constructor() {
|
|
2524
2525
|
addLevelsTo(this);
|
|
@@ -2530,12 +2531,17 @@ class IssueReporter {
|
|
|
2530
2531
|
this.bufferTimeout = null;
|
|
2531
2532
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
2532
2533
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
2534
|
+
this._callback = null;
|
|
2533
2535
|
}
|
|
2534
2536
|
|
|
2535
2537
|
init() {
|
|
2536
2538
|
this._catchConsole();
|
|
2537
2539
|
}
|
|
2538
2540
|
|
|
2541
|
+
setCallback(cb ) {
|
|
2542
|
+
this._callback = cb;
|
|
2543
|
+
}
|
|
2544
|
+
|
|
2539
2545
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
2540
2546
|
this.remoteClientConfiguration = configuration;
|
|
2541
2547
|
}
|
|
@@ -2571,6 +2577,7 @@ class IssueReporter {
|
|
|
2571
2577
|
|
|
2572
2578
|
// Handle category label
|
|
2573
2579
|
let category = null;
|
|
2580
|
+
let skipSendToRemote = false;
|
|
2574
2581
|
let extra = {};
|
|
2575
2582
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
2576
2583
|
category = args[0].split('=')[1];
|
|
@@ -2586,6 +2593,7 @@ class IssueReporter {
|
|
|
2586
2593
|
errorMessage: lastArg.message,
|
|
2587
2594
|
errorStack: lastArg.stack,
|
|
2588
2595
|
errorType: lastArg.constructor.name,
|
|
2596
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
2589
2597
|
};
|
|
2590
2598
|
} else {
|
|
2591
2599
|
extra = lastArg;
|
|
@@ -2594,7 +2602,12 @@ class IssueReporter {
|
|
|
2594
2602
|
args.splice(1, 1);
|
|
2595
2603
|
}
|
|
2596
2604
|
|
|
2597
|
-
|
|
2605
|
+
if (extra.skipSendToRemote) {
|
|
2606
|
+
skipSendToRemote = true;
|
|
2607
|
+
delete extra.skipSendToRemote;
|
|
2608
|
+
}
|
|
2609
|
+
|
|
2610
|
+
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
2598
2611
|
const message = args.join(', ');
|
|
2599
2612
|
let consoleMessage = message;
|
|
2600
2613
|
|
|
@@ -2614,7 +2627,13 @@ class IssueReporter {
|
|
|
2614
2627
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
2615
2628
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
2616
2629
|
|
|
2617
|
-
this.
|
|
2630
|
+
if (this._callback) {
|
|
2631
|
+
this._callback(level, consoleMessage);
|
|
2632
|
+
}
|
|
2633
|
+
|
|
2634
|
+
if (!skipSendToRemote) {
|
|
2635
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
2636
|
+
}
|
|
2618
2637
|
}
|
|
2619
2638
|
|
|
2620
2639
|
logRequest(url , options , response , start ) {
|
|
@@ -2759,7 +2778,11 @@ class IssueReporter {
|
|
|
2759
2778
|
},
|
|
2760
2779
|
// $FlowFixMe
|
|
2761
2780
|
body,
|
|
2762
|
-
}).catch(() => {
|
|
2781
|
+
}).catch((e ) => {
|
|
2782
|
+
// $FlowFixMe
|
|
2783
|
+
e.skipSendToRemote = true;
|
|
2784
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
2785
|
+
|
|
2763
2786
|
setTimeout(() => {
|
|
2764
2787
|
if (isArray) {
|
|
2765
2788
|
payload = payload.map(message => {
|
|
@@ -2771,7 +2794,7 @@ class IssueReporter {
|
|
|
2771
2794
|
payload._retry = retry + 1;
|
|
2772
2795
|
}
|
|
2773
2796
|
|
|
2774
|
-
this._sendDebugToGrafana(
|
|
2797
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
2775
2798
|
}, 5000 + retry * 1000);
|
|
2776
2799
|
});
|
|
2777
2800
|
}
|
|
@@ -3489,7 +3512,8 @@ class ExternalApp {
|
|
|
3489
3512
|
|
|
3490
3513
|
|
|
3491
3514
|
|
|
3492
|
-
|
|
3515
|
+
|
|
3516
|
+
|
|
3493
3517
|
|
|
3494
3518
|
|
|
3495
3519
|
class Meeting {
|
|
@@ -3501,6 +3525,7 @@ class Meeting {
|
|
|
3501
3525
|
|
|
3502
3526
|
|
|
3503
3527
|
|
|
3528
|
+
|
|
3504
3529
|
|
|
3505
3530
|
|
|
3506
3531
|
static parse(plain ) {
|
|
@@ -3512,14 +3537,28 @@ class Meeting {
|
|
|
3512
3537
|
port: plain.port,
|
|
3513
3538
|
uuid: plain.uuid,
|
|
3514
3539
|
number: plain.number,
|
|
3540
|
+
persistent: plain.persistent,
|
|
3515
3541
|
});
|
|
3516
3542
|
}
|
|
3517
3543
|
|
|
3544
|
+
static parseMany(items ) {
|
|
3545
|
+
return items.map(plain => Meeting.parse(plain));
|
|
3546
|
+
}
|
|
3547
|
+
|
|
3518
3548
|
static newFrom(meeting ) {
|
|
3519
3549
|
return newFrom(meeting, Meeting);
|
|
3520
3550
|
}
|
|
3521
3551
|
|
|
3522
|
-
constructor({
|
|
3552
|
+
constructor({
|
|
3553
|
+
uuid,
|
|
3554
|
+
name,
|
|
3555
|
+
guestSipAuthorization,
|
|
3556
|
+
ownerUuids,
|
|
3557
|
+
port,
|
|
3558
|
+
uri,
|
|
3559
|
+
number,
|
|
3560
|
+
persistent,
|
|
3561
|
+
} = {}) {
|
|
3523
3562
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
3524
3563
|
this.uri = uri;
|
|
3525
3564
|
this.name = name;
|
|
@@ -3527,6 +3566,7 @@ class Meeting {
|
|
|
3527
3566
|
this.port = port;
|
|
3528
3567
|
this.uuid = uuid;
|
|
3529
3568
|
this.number = number;
|
|
3569
|
+
this.persistent = persistent;
|
|
3530
3570
|
|
|
3531
3571
|
// Useful to compare instead of instanceof with minified code
|
|
3532
3572
|
this.type = 'Meeting';
|
|
@@ -3604,8 +3644,11 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
3604
3644
|
}
|
|
3605
3645
|
},
|
|
3606
3646
|
|
|
3607
|
-
|
|
3608
|
-
client.
|
|
3647
|
+
getMyMeetings: () =>
|
|
3648
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
3649
|
+
|
|
3650
|
+
createMyMeeting: (name , persistent ) =>
|
|
3651
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
3609
3652
|
|
|
3610
3653
|
deleteMyMeeting: (meetingUuid ) =>
|
|
3611
3654
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -3664,7 +3707,7 @@ class ChatMessage {
|
|
|
3664
3707
|
static parse(plain ) {
|
|
3665
3708
|
return new ChatMessage({
|
|
3666
3709
|
uuid: plain.uuid,
|
|
3667
|
-
date: moment__default[
|
|
3710
|
+
date: moment__default['default'](plain.created_at).toDate(),
|
|
3668
3711
|
content: plain.content,
|
|
3669
3712
|
alias: plain.alias,
|
|
3670
3713
|
userUuid: plain.user_uuid,
|
|
@@ -3756,7 +3799,7 @@ class Voicemail {
|
|
|
3756
3799
|
static parse(plain ) {
|
|
3757
3800
|
return new Voicemail({
|
|
3758
3801
|
id: plain.id,
|
|
3759
|
-
date: moment__default[
|
|
3802
|
+
date: moment__default['default'](plain.timestamp * 1000).toDate(),
|
|
3760
3803
|
duration: plain.duration * 1000,
|
|
3761
3804
|
caller: {
|
|
3762
3805
|
name: plain.caller_id_name,
|
|
@@ -5395,4 +5438,4 @@ class CTIPhone extends Emitter {
|
|
|
5395
5438
|
|
|
5396
5439
|
exports.TRANSFER_FLOW_ATTENDED = TRANSFER_FLOW_ATTENDED;
|
|
5397
5440
|
exports.TRANSFER_FLOW_BLIND = TRANSFER_FLOW_BLIND;
|
|
5398
|
-
exports
|
|
5441
|
+
exports.default = CTIPhone;
|
|
@@ -496,6 +496,7 @@ class IssueReporter {
|
|
|
496
496
|
|
|
497
497
|
|
|
498
498
|
|
|
499
|
+
|
|
499
500
|
|
|
500
501
|
constructor() {
|
|
501
502
|
addLevelsTo(this);
|
|
@@ -507,12 +508,17 @@ class IssueReporter {
|
|
|
507
508
|
this.bufferTimeout = null;
|
|
508
509
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
509
510
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
511
|
+
this._callback = null;
|
|
510
512
|
}
|
|
511
513
|
|
|
512
514
|
init() {
|
|
513
515
|
this._catchConsole();
|
|
514
516
|
}
|
|
515
517
|
|
|
518
|
+
setCallback(cb ) {
|
|
519
|
+
this._callback = cb;
|
|
520
|
+
}
|
|
521
|
+
|
|
516
522
|
configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
517
523
|
this.remoteClientConfiguration = configuration;
|
|
518
524
|
}
|
|
@@ -548,6 +554,7 @@ class IssueReporter {
|
|
|
548
554
|
|
|
549
555
|
// Handle category label
|
|
550
556
|
let category = null;
|
|
557
|
+
let skipSendToRemote = false;
|
|
551
558
|
let extra = {};
|
|
552
559
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
553
560
|
category = args[0].split('=')[1];
|
|
@@ -563,6 +570,7 @@ class IssueReporter {
|
|
|
563
570
|
errorMessage: lastArg.message,
|
|
564
571
|
errorStack: lastArg.stack,
|
|
565
572
|
errorType: lastArg.constructor.name,
|
|
573
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
566
574
|
};
|
|
567
575
|
} else {
|
|
568
576
|
extra = lastArg;
|
|
@@ -571,7 +579,12 @@ class IssueReporter {
|
|
|
571
579
|
args.splice(1, 1);
|
|
572
580
|
}
|
|
573
581
|
|
|
574
|
-
|
|
582
|
+
if (extra.skipSendToRemote) {
|
|
583
|
+
skipSendToRemote = true;
|
|
584
|
+
delete extra.skipSendToRemote;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
const date = moment__default['default']().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
575
588
|
const message = args.join(', ');
|
|
576
589
|
let consoleMessage = message;
|
|
577
590
|
|
|
@@ -591,7 +604,13 @@ class IssueReporter {
|
|
|
591
604
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
592
605
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
593
606
|
|
|
594
|
-
this.
|
|
607
|
+
if (this._callback) {
|
|
608
|
+
this._callback(level, consoleMessage);
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
if (!skipSendToRemote) {
|
|
612
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
613
|
+
}
|
|
595
614
|
}
|
|
596
615
|
|
|
597
616
|
logRequest(url , options , response , start ) {
|
|
@@ -736,7 +755,11 @@ class IssueReporter {
|
|
|
736
755
|
},
|
|
737
756
|
// $FlowFixMe
|
|
738
757
|
body,
|
|
739
|
-
}).catch(() => {
|
|
758
|
+
}).catch((e ) => {
|
|
759
|
+
// $FlowFixMe
|
|
760
|
+
e.skipSendToRemote = true;
|
|
761
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
762
|
+
|
|
740
763
|
setTimeout(() => {
|
|
741
764
|
if (isArray) {
|
|
742
765
|
payload = payload.map(message => {
|
|
@@ -748,7 +771,7 @@ class IssueReporter {
|
|
|
748
771
|
payload._retry = retry + 1;
|
|
749
772
|
}
|
|
750
773
|
|
|
751
|
-
this._sendDebugToGrafana(
|
|
774
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
752
775
|
}, 5000 + retry * 1000);
|
|
753
776
|
});
|
|
754
777
|
}
|
|
@@ -780,7 +803,7 @@ class Emitter {
|
|
|
780
803
|
|
|
781
804
|
|
|
782
805
|
constructor() {
|
|
783
|
-
this.eventEmitter = new EventEmitter__default[
|
|
806
|
+
this.eventEmitter = new EventEmitter__default['default']();
|
|
784
807
|
}
|
|
785
808
|
|
|
786
809
|
on(event , callback ) {
|
|
@@ -1219,7 +1242,10 @@ class WebRTCPhone extends Emitter {
|
|
|
1219
1242
|
|
|
1220
1243
|
onCancel(message);
|
|
1221
1244
|
const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
|
|
1222
|
-
|
|
1245
|
+
const callSession = this._createCallSession(sipSession);
|
|
1246
|
+
delete this.callSessions[callSession.getId()];
|
|
1247
|
+
|
|
1248
|
+
this.eventEmitter.emit(ON_CALL_CANCELED, callSession, elsewhere);
|
|
1223
1249
|
};
|
|
1224
1250
|
} else if (sipSession instanceof invitation.Invitation) {
|
|
1225
1251
|
console.warn('sipSession._onCancel not found, please update the wazo SDK accordingly');
|
|
@@ -1248,9 +1274,11 @@ class WebRTCPhone extends Emitter {
|
|
|
1248
1274
|
case sessionState.SessionState.Terminated: {
|
|
1249
1275
|
logger.info('WebRTC phone - call terminated', { sipId: sipSession.id });
|
|
1250
1276
|
|
|
1277
|
+
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
1278
|
+
const callSession = this._createCallSession(sipSession);
|
|
1251
1279
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
1252
1280
|
|
|
1253
|
-
return this.eventEmitter.emit(ON_CALL_ENDED,
|
|
1281
|
+
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
1254
1282
|
}
|
|
1255
1283
|
}
|
|
1256
1284
|
});
|
|
@@ -2198,6 +2226,10 @@ class WebRTCPhone extends Emitter {
|
|
|
2198
2226
|
return callSession ? this.client.getRemoteVideoStream(callSession.sipCallId) : null;
|
|
2199
2227
|
}
|
|
2200
2228
|
|
|
2229
|
+
getRemoteVideoStreamFromPc(callSession ) {
|
|
2230
|
+
return callSession ? this.client.getRemoteVideoStreamFromPc(callSession.sipCallId) : null;
|
|
2231
|
+
}
|
|
2232
|
+
|
|
2201
2233
|
hasRemoteVideo(callSession ) {
|
|
2202
2234
|
return callSession ? this.client.hasRemoteVideo(callSession.sipCallId) : false;
|
|
2203
2235
|
}
|
|
@@ -2541,5 +2573,5 @@ exports.ON_UNREGISTERED = ON_UNREGISTERED;
|
|
|
2541
2573
|
exports.ON_USER_AGENT = ON_USER_AGENT;
|
|
2542
2574
|
exports.ON_VIDEO_INPUT_CHANGE = ON_VIDEO_INPUT_CHANGE;
|
|
2543
2575
|
exports.ON_VIDEO_STREAM = ON_VIDEO_STREAM;
|
|
2544
|
-
exports
|
|
2576
|
+
exports.default = WebRTCPhone;
|
|
2545
2577
|
exports.events = events;
|
package/lib/domain/Profile.js
CHANGED