@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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wazo/sdk",
|
|
3
|
-
"version": "0.37.
|
|
3
|
+
"version": "0.37.22",
|
|
4
4
|
"description": "Wazo's JavaScript Software Development Kit.",
|
|
5
5
|
"main": "dist/wazo-sdk.js",
|
|
6
6
|
"author": "Wazo (http://wazo.io)",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"events": "^3.3.0",
|
|
49
49
|
"fstream": "^1.0.12",
|
|
50
|
-
"getstats": "manuquentin/getStats#
|
|
50
|
+
"getstats": "manuquentin/getStats#fix_stats_mobile",
|
|
51
51
|
"globby": "^11.0.3",
|
|
52
52
|
"google-libphonenumber": "^3.2.18",
|
|
53
53
|
"js-base64": "^3.6.0",
|
package/src/api/confd.js
CHANGED
|
@@ -69,8 +69,11 @@ export default (client: ApiRequester, baseUrl: string) => ({
|
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
client.
|
|
72
|
+
getMyMeetings: (): Promise<Meeting> =>
|
|
73
|
+
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
74
|
+
|
|
75
|
+
createMyMeeting: (name: string, persistent: boolean): Promise<Meeting> =>
|
|
76
|
+
client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
|
|
74
77
|
|
|
75
78
|
deleteMyMeeting: (meetingUuid: string): Promise<Meeting> =>
|
|
76
79
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
package/src/domain/CallLog.js
CHANGED
|
@@ -108,7 +108,7 @@ export default class CallLog {
|
|
|
108
108
|
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
109
109
|
start: moment(plain.start).toDate(),
|
|
110
110
|
end: plain.end ? moment(plain.end).toDate() : null,
|
|
111
|
-
recordings: Recording.parseMany(plain.recordings),
|
|
111
|
+
recordings: Recording.parseMany(plain.recordings || []),
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
114
|
|
package/src/domain/Meeting.js
CHANGED
|
@@ -8,7 +8,8 @@ export type MeetingCreationResponse = {
|
|
|
8
8
|
owner_uuids: Array<string>,
|
|
9
9
|
port: string,
|
|
10
10
|
uuid: string,
|
|
11
|
-
number: string
|
|
11
|
+
number: string,
|
|
12
|
+
persistent: boolean,
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
export default class Meeting {
|
|
@@ -20,6 +21,7 @@ export default class Meeting {
|
|
|
20
21
|
name: string;
|
|
21
22
|
port: string;
|
|
22
23
|
number: string;
|
|
24
|
+
persistent: boolean;
|
|
23
25
|
ownerUuids: Array<string>;
|
|
24
26
|
|
|
25
27
|
static parse(plain: MeetingCreationResponse): Meeting {
|
|
@@ -31,14 +33,28 @@ export default class Meeting {
|
|
|
31
33
|
port: plain.port,
|
|
32
34
|
uuid: plain.uuid,
|
|
33
35
|
number: plain.number,
|
|
36
|
+
persistent: plain.persistent,
|
|
34
37
|
});
|
|
35
38
|
}
|
|
36
39
|
|
|
40
|
+
static parseMany(items: MeetingCreationResponse[]): Array<Meeting> {
|
|
41
|
+
return items.map(plain => Meeting.parse(plain));
|
|
42
|
+
}
|
|
43
|
+
|
|
37
44
|
static newFrom(meeting: Meeting) {
|
|
38
45
|
return newFrom(meeting, Meeting);
|
|
39
46
|
}
|
|
40
47
|
|
|
41
|
-
constructor({
|
|
48
|
+
constructor({
|
|
49
|
+
uuid,
|
|
50
|
+
name,
|
|
51
|
+
guestSipAuthorization,
|
|
52
|
+
ownerUuids,
|
|
53
|
+
port,
|
|
54
|
+
uri,
|
|
55
|
+
number,
|
|
56
|
+
persistent,
|
|
57
|
+
}: Object = {}) {
|
|
42
58
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
43
59
|
this.uri = uri;
|
|
44
60
|
this.name = name;
|
|
@@ -46,6 +62,7 @@ export default class Meeting {
|
|
|
46
62
|
this.port = port;
|
|
47
63
|
this.uuid = uuid;
|
|
48
64
|
this.number = number;
|
|
65
|
+
this.persistent = persistent;
|
|
49
66
|
|
|
50
67
|
// Useful to compare instead of instanceof with minified code
|
|
51
68
|
this.type = 'Meeting';
|
|
@@ -385,7 +385,10 @@ export default class WebRTCPhone extends Emitter implements Phone {
|
|
|
385
385
|
|
|
386
386
|
onCancel(message);
|
|
387
387
|
const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
|
|
388
|
-
|
|
388
|
+
const callSession = this._createCallSession(sipSession);
|
|
389
|
+
delete this.callSessions[callSession.getId()];
|
|
390
|
+
|
|
391
|
+
this.eventEmitter.emit(ON_CALL_CANCELED, callSession, elsewhere);
|
|
389
392
|
};
|
|
390
393
|
} else if (sipSession instanceof Invitation) {
|
|
391
394
|
console.warn('sipSession._onCancel not found, please update the wazo SDK accordingly');
|
|
@@ -414,9 +417,11 @@ export default class WebRTCPhone extends Emitter implements Phone {
|
|
|
414
417
|
case SessionState.Terminated: {
|
|
415
418
|
logger.info('WebRTC phone - call terminated', { sipId: sipSession.id });
|
|
416
419
|
|
|
420
|
+
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
421
|
+
const callSession = this._createCallSession(sipSession);
|
|
417
422
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
418
423
|
|
|
419
|
-
return this.eventEmitter.emit(ON_CALL_ENDED,
|
|
424
|
+
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
420
425
|
}
|
|
421
426
|
default:
|
|
422
427
|
break;
|
|
@@ -1366,6 +1371,10 @@ export default class WebRTCPhone extends Emitter implements Phone {
|
|
|
1366
1371
|
return callSession ? this.client.getRemoteVideoStream(callSession.sipCallId) : null;
|
|
1367
1372
|
}
|
|
1368
1373
|
|
|
1374
|
+
getRemoteVideoStreamFromPc(callSession: CallSession): ?MediaStream {
|
|
1375
|
+
return callSession ? this.client.getRemoteVideoStreamFromPc(callSession.sipCallId) : null;
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1369
1378
|
hasRemoteVideo(callSession: CallSession): boolean {
|
|
1370
1379
|
return callSession ? this.client.hasRemoteVideo(callSession.sipCallId) : false;
|
|
1371
1380
|
}
|
package/src/domain/Recording.js
CHANGED
|
@@ -24,7 +24,7 @@ export default class Recording {
|
|
|
24
24
|
start: Date;
|
|
25
25
|
uuid: string;
|
|
26
26
|
|
|
27
|
-
static parseMany(recordings: RecordingResponse[]): Recording[] {
|
|
27
|
+
static parseMany(recordings: RecordingResponse[] = []): Recording[] {
|
|
28
28
|
return recordings.map(item => Recording.parse(item));
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -64,6 +64,7 @@ class IssueReporter {
|
|
|
64
64
|
bufferTimeout: ?TimeoutID;
|
|
65
65
|
_boundProcessBuffer: Function;
|
|
66
66
|
_boundParseLoggerBody: Function;
|
|
67
|
+
_callback: ?Function;
|
|
67
68
|
|
|
68
69
|
constructor() {
|
|
69
70
|
addLevelsTo(this);
|
|
@@ -75,12 +76,17 @@ class IssueReporter {
|
|
|
75
76
|
this.bufferTimeout = null;
|
|
76
77
|
this._boundProcessBuffer = this._processBuffer.bind(this);
|
|
77
78
|
this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
|
|
79
|
+
this._callback = null;
|
|
78
80
|
}
|
|
79
81
|
|
|
80
82
|
init() {
|
|
81
83
|
this._catchConsole();
|
|
82
84
|
}
|
|
83
85
|
|
|
86
|
+
setCallback(cb: Function) {
|
|
87
|
+
this._callback = cb;
|
|
88
|
+
}
|
|
89
|
+
|
|
84
90
|
configureRemoteClient(configuration: Object = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
|
|
85
91
|
this.remoteClientConfiguration = configuration;
|
|
86
92
|
}
|
|
@@ -116,6 +122,7 @@ class IssueReporter {
|
|
|
116
122
|
|
|
117
123
|
// Handle category label
|
|
118
124
|
let category = null;
|
|
125
|
+
let skipSendToRemote = false;
|
|
119
126
|
let extra = {};
|
|
120
127
|
if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
|
|
121
128
|
category = args[0].split('=')[1];
|
|
@@ -131,6 +138,7 @@ class IssueReporter {
|
|
|
131
138
|
errorMessage: lastArg.message,
|
|
132
139
|
errorStack: lastArg.stack,
|
|
133
140
|
errorType: lastArg.constructor.name,
|
|
141
|
+
skipSendToRemote: lastArg.skipSendToRemote,
|
|
134
142
|
};
|
|
135
143
|
} else {
|
|
136
144
|
extra = lastArg;
|
|
@@ -139,6 +147,11 @@ class IssueReporter {
|
|
|
139
147
|
args.splice(1, 1);
|
|
140
148
|
}
|
|
141
149
|
|
|
150
|
+
if (extra.skipSendToRemote) {
|
|
151
|
+
skipSendToRemote = true;
|
|
152
|
+
delete extra.skipSendToRemote;
|
|
153
|
+
}
|
|
154
|
+
|
|
142
155
|
const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
|
|
143
156
|
const message = args.join(', ');
|
|
144
157
|
let consoleMessage = message;
|
|
@@ -159,7 +172,13 @@ class IssueReporter {
|
|
|
159
172
|
const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
|
|
160
173
|
oldMethod.apply(oldMethod, [date, consoleMessage]);
|
|
161
174
|
|
|
162
|
-
this.
|
|
175
|
+
if (this._callback) {
|
|
176
|
+
this._callback(level, consoleMessage);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (!skipSendToRemote) {
|
|
180
|
+
this._sendToRemoteLogger(level, { date, message, category, ...extra });
|
|
181
|
+
}
|
|
163
182
|
}
|
|
164
183
|
|
|
165
184
|
logRequest(url: string, options: Object, response: Object, start: Date) {
|
|
@@ -304,7 +323,11 @@ class IssueReporter {
|
|
|
304
323
|
},
|
|
305
324
|
// $FlowFixMe
|
|
306
325
|
body,
|
|
307
|
-
}).catch(() => {
|
|
326
|
+
}).catch((e: Error) => {
|
|
327
|
+
// $FlowFixMe
|
|
328
|
+
e.skipSendToRemote = true;
|
|
329
|
+
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
330
|
+
|
|
308
331
|
setTimeout(() => {
|
|
309
332
|
if (isArray) {
|
|
310
333
|
payload = payload.map(message => {
|
|
@@ -316,7 +339,7 @@ class IssueReporter {
|
|
|
316
339
|
payload._retry = retry + 1;
|
|
317
340
|
}
|
|
318
341
|
|
|
319
|
-
this._sendDebugToGrafana(
|
|
342
|
+
this._sendDebugToGrafana(payload, retry + 1);
|
|
320
343
|
}, 5000 + retry * 1000);
|
|
321
344
|
});
|
|
322
345
|
}
|
package/src/simple/Phone.js
CHANGED
|
@@ -347,6 +347,11 @@ class Phone extends Emitter {
|
|
|
347
347
|
return this.getRemoteVideoStream(callSession);
|
|
348
348
|
}
|
|
349
349
|
|
|
350
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
351
|
+
getRemoteVideoStreamFromPc(callSession: CallSession) {
|
|
352
|
+
return this.phone ? this.phone.getRemoteVideoStreamFromPc(callSession) : false;
|
|
353
|
+
}
|
|
354
|
+
|
|
350
355
|
hasVideo(callSession: CallSession): boolean {
|
|
351
356
|
return this.phone ? this.phone.hasVideo(callSession) : false;
|
|
352
357
|
}
|
|
@@ -7,6 +7,7 @@ import type {
|
|
|
7
7
|
} from '../domain/SwitchboardCall';
|
|
8
8
|
import type { ChatMessageResponse } from '../domain/ChatMessage';
|
|
9
9
|
import ChatRoom from '../domain/ChatRoom';
|
|
10
|
+
import Meeting from '../domain/Meeting';
|
|
10
11
|
|
|
11
12
|
type WebSocketBaseMessage = {
|
|
12
13
|
op: string,
|
|
@@ -187,6 +188,8 @@ type AgentStatusUpdate = WebSocketBaseMessage & { data: AgentStatusUpdateEvent,
|
|
|
187
188
|
type AgentPaused = WebSocketBaseMessage & { data: any, name: 'agent_paused' };
|
|
188
189
|
type AgentUnpaused = WebSocketBaseMessage & { data: any, name: 'agent_unpaused' };
|
|
189
190
|
|
|
191
|
+
type MeetingUserProgress = WebSocketBaseMessage & { data: Meeting, name: 'meeting_user_progress' };
|
|
192
|
+
|
|
190
193
|
export type WebSocketMessage =
|
|
191
194
|
| CallCreated
|
|
192
195
|
| CallUpdated
|
|
@@ -219,4 +222,5 @@ export type WebSocketMessage =
|
|
|
219
222
|
| FaxOutboundSucceeded
|
|
220
223
|
| AgentStatusUpdate
|
|
221
224
|
| AgentPaused
|
|
222
|
-
| AgentUnpaused
|
|
225
|
+
| AgentUnpaused
|
|
226
|
+
| MeetingUserProgress;
|
package/src/web-rtc-client.js
CHANGED
|
@@ -478,7 +478,9 @@ export default class WebRTCClient extends Emitter {
|
|
|
478
478
|
const inviteOptions: InviterInviteOptions = {
|
|
479
479
|
requestDelegate: {
|
|
480
480
|
onAccept: (response: IncomingResponse) => {
|
|
481
|
-
session.sessionDescriptionHandler.peerConnection
|
|
481
|
+
if (session.sessionDescriptionHandler.peerConnection) {
|
|
482
|
+
session.sessionDescriptionHandler.peerConnection.sfu = conference;
|
|
483
|
+
}
|
|
482
484
|
this._onAccepted(session, response.session, true);
|
|
483
485
|
},
|
|
484
486
|
onReject: (response: IncomingResponse) => {
|
|
@@ -814,7 +816,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
814
816
|
// We search for the last transceiver without `video-` in the mid (video- means remote transceiver)
|
|
815
817
|
const transceivers = pc.getTransceivers();
|
|
816
818
|
const transceiverIdx = lastIndexOf(transceivers, transceiver =>
|
|
817
|
-
transceiver.sender.track === null && transceiver.mid.indexOf('video') === -1);
|
|
819
|
+
transceiver.sender.track === null && transceiver.mid && transceiver.mid.indexOf('video') === -1);
|
|
818
820
|
|
|
819
821
|
videoSender = transceiverIdx !== -1 ? transceivers[transceiverIdx].sender : null;
|
|
820
822
|
} else {
|
|
@@ -1350,6 +1352,16 @@ export default class WebRTCClient extends Emitter {
|
|
|
1350
1352
|
return this.hasRemoteVideo(sessionId) ? this.getRemoteStream(sessionId) : null;
|
|
1351
1353
|
}
|
|
1352
1354
|
|
|
1355
|
+
// Useful in a react-native environment when remoteMediaStream is not updated
|
|
1356
|
+
getRemoteVideoStreamFromPc(sessionId: string): ?MediaStream {
|
|
1357
|
+
const pc = this.getPeerConnection(sessionId);
|
|
1358
|
+
if (!pc) {
|
|
1359
|
+
return null;
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
return pc.getRemoteStreams().find(stream => !!stream.getVideoTracks().length);
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1353
1365
|
hasVideo(sessionId: string): boolean {
|
|
1354
1366
|
return this.hasLocalVideo(sessionId) || this.hasRemoteVideo(sessionId);
|
|
1355
1367
|
}
|
|
@@ -1860,6 +1872,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
1860
1872
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
1861
1873
|
|
|
1862
1874
|
pc.oniceconnectionstatechange = () => {
|
|
1875
|
+
logger.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
1863
1876
|
if (pc.iceConnectionState === 'disconnected') {
|
|
1864
1877
|
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
1865
1878
|
}
|
|
@@ -2128,18 +2141,22 @@ export default class WebRTCClient extends Emitter {
|
|
|
2128
2141
|
});
|
|
2129
2142
|
|
|
2130
2143
|
networkStats.packetsLost = packetsLost;
|
|
2131
|
-
networkStats.
|
|
2144
|
+
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
2145
|
+
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
2146
|
+
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
2132
2147
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
2133
|
-
networkStats.
|
|
2134
|
-
networkStats.
|
|
2148
|
+
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
2149
|
+
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
2150
|
+
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
2151
|
+
networkStats.videoBytesReceived = videoBytesReceived - lastVideoReceived;
|
|
2152
|
+
networkStats.totalTransportSent = transportSent - lastTransportSent;
|
|
2135
2153
|
networkStats.transportSent = transportSent;
|
|
2136
|
-
networkStats.
|
|
2137
|
-
|
|
2138
|
-
const bandwidth = (networkStats.audioBytesSent - lastAudioSent) + (networkStats.videoBytesSent - lastVideoSent)
|
|
2139
|
-
+ (networkStats.audioBytesReceived - lastAudioReceived) + (networkStats.videoBytesReceived - lastVideoReceived)
|
|
2140
|
-
+ (networkStats.transportReceived - lastTransportReceived) + (networkStats.transportSent - lastTransportSent);
|
|
2154
|
+
networkStats.totalTransportReceived = transportReceived;
|
|
2155
|
+
networkStats.transportReceived = transportReceived - lastTransportReceived;
|
|
2141
2156
|
|
|
2142
|
-
networkStats.bandwidth =
|
|
2157
|
+
networkStats.bandwidth = networkStats.audioBytesSent + networkStats.audioBytesReceived
|
|
2158
|
+
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
2159
|
+
+ networkStats.transportSent;
|
|
2143
2160
|
|
|
2144
2161
|
this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
2145
2162
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
package/src/websocket-client.js
CHANGED
|
@@ -93,6 +93,7 @@ export const AGENT_PAUSED = 'agent_paused';
|
|
|
93
93
|
export const AGENT_UNPAUSED = 'agent_unpaused';
|
|
94
94
|
export const CONFERENCE_ADHOC_PARTICIPANT_LEFT = 'conference_adhoc_participant_left';
|
|
95
95
|
export const CONFERENCE_ADHOC_DELETED = 'conference_adhoc_deleted';
|
|
96
|
+
export const MEETING_USER_PROGRESS = 'meeting_user_progress';
|
|
96
97
|
|
|
97
98
|
const BLACKLIST_EVENTS = [
|
|
98
99
|
CHAT_MESSAGE_SENT,
|
|
@@ -446,6 +447,7 @@ WebSocketClient.eventLists = [
|
|
|
446
447
|
AGENT_UNPAUSED,
|
|
447
448
|
CONFERENCE_ADHOC_PARTICIPANT_LEFT,
|
|
448
449
|
CONFERENCE_ADHOC_DELETED,
|
|
450
|
+
MEETING_USER_PROGRESS,
|
|
449
451
|
];
|
|
450
452
|
|
|
451
453
|
export default WebSocketClient;
|