@wazo/sdk 0.37.41 → 0.38.0
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 +3 -3
- package/esm/__tests__/api-client.test.js +45 -22
- package/esm/__tests__/web-rtc-client.test.js +49 -24
- package/esm/api/agentd.js +12 -7
- package/esm/api/amid.js +12 -7
- package/esm/api/application.js +12 -7
- package/esm/api/auth.js +16 -8
- package/esm/api/call-logd.js +12 -7
- package/esm/api/calld.js +12 -7
- package/esm/api/chatd.js +12 -7
- package/esm/api/confd.js +12 -7
- package/esm/api/ctid-ng.js +14 -7
- package/esm/api/dird.js +12 -7
- package/esm/api/webhookd.js +12 -7
- package/esm/api-client.js +45 -22
- package/esm/checker/Checker.js +50 -25
- package/esm/checker/checks/aor.js +45 -22
- package/esm/checker/checks/api.js +45 -22
- package/esm/checker/checks/index.js +50 -25
- package/esm/checker/checks/wazo-websocket.js +13 -8
- package/esm/checker/checks/webrtc-transport.js +49 -24
- package/esm/checker/checks/webrtc.js +49 -24
- package/esm/domain/AdHocAPIConference.js +54 -23
- package/esm/domain/Features.js +54 -23
- package/esm/domain/Phone/CTIPhone.js +54 -23
- package/esm/domain/Phone/WebRTCPhone.js +14 -7
- package/esm/index.js +233 -25
- package/esm/lib/WazoSessionDescriptionHandler.js +12 -7
- package/esm/service/CallApi.js +54 -23
- package/esm/service/IssueReporter.js +12 -7
- package/esm/service/__tests__/IssueReporter.test.js +18 -7
- package/esm/service/getApiClient.js +63 -24
- package/esm/simple/Auth.js +233 -25
- package/esm/simple/Configuration.js +233 -25
- package/esm/simple/Directory.js +54 -23
- package/esm/simple/Phone.js +233 -25
- package/esm/simple/Softphone.js +148 -0
- package/esm/simple/Websocket.js +13 -8
- package/esm/simple/index.js +233 -25
- package/esm/simple/room/LocalParticipant.js +233 -25
- package/esm/simple/room/Participant.js +233 -25
- package/esm/simple/room/RemoteParticipant.js +233 -25
- package/esm/simple/room/Room.js +233 -25
- package/esm/simple/room/SipRoom.js +233 -25
- package/esm/simple/room/Stream.js +233 -25
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +233 -25
- package/esm/simple/utils.js +233 -25
- package/esm/utils/__tests__/api-requester.test.js +12 -7
- package/esm/utils/api-requester.js +12 -7
- package/esm/web-rtc-client.js +49 -24
- package/esm/websocket-client.js +13 -8
- package/lib/__tests__/api-client.test.js +45 -22
- package/lib/__tests__/web-rtc-client.test.js +49 -24
- package/lib/api/agentd.js +12 -7
- package/lib/api/amid.js +12 -7
- package/lib/api/application.js +12 -7
- package/lib/api/auth.js +16 -8
- package/lib/api/call-logd.js +12 -7
- package/lib/api/calld.js +12 -7
- package/lib/api/chatd.js +12 -7
- package/lib/api/confd.js +12 -7
- package/lib/api/ctid-ng.js +14 -7
- package/lib/api/dird.js +12 -7
- package/lib/api/webhookd.js +12 -7
- package/lib/api-client.js +45 -22
- package/lib/checker/Checker.js +50 -25
- package/lib/checker/checks/aor.js +45 -22
- package/lib/checker/checks/api.js +45 -22
- package/lib/checker/checks/index.js +50 -25
- package/lib/checker/checks/wazo-websocket.js +13 -8
- package/lib/checker/checks/webrtc-transport.js +49 -24
- package/lib/checker/checks/webrtc.js +49 -24
- package/lib/domain/AdHocAPIConference.js +54 -23
- package/lib/domain/Features.js +54 -23
- package/lib/domain/Phone/CTIPhone.js +54 -23
- package/lib/domain/Phone/WebRTCPhone.js +14 -7
- package/lib/index.js +233 -25
- package/lib/lib/WazoSessionDescriptionHandler.js +12 -7
- package/lib/service/CallApi.js +54 -23
- package/lib/service/IssueReporter.js +12 -7
- package/lib/service/__tests__/IssueReporter.test.js +18 -7
- package/lib/service/getApiClient.js +64 -23
- package/lib/simple/Auth.js +233 -25
- package/lib/simple/Configuration.js +233 -25
- package/lib/simple/Directory.js +54 -23
- package/lib/simple/Phone.js +233 -25
- package/lib/simple/Softphone.js +150 -0
- package/lib/simple/Websocket.js +13 -8
- package/lib/simple/index.js +233 -25
- package/lib/simple/room/LocalParticipant.js +233 -25
- package/lib/simple/room/Participant.js +233 -25
- package/lib/simple/room/RemoteParticipant.js +233 -25
- package/lib/simple/room/Room.js +233 -25
- package/lib/simple/room/SipRoom.js +233 -25
- package/lib/simple/room/Stream.js +233 -25
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +233 -25
- package/lib/simple/utils.js +233 -25
- package/lib/utils/__tests__/api-requester.test.js +12 -7
- package/lib/utils/api-requester.js +12 -7
- package/lib/web-rtc-client.js +49 -24
- package/lib/websocket-client.js +13 -8
- package/package.json +1 -1
- package/src/api/auth.js +4 -1
- package/src/api-client.js +26 -13
- package/src/service/IssueReporter.js +12 -7
- package/src/service/__tests__/IssueReporter.test.js +6 -0
- package/src/service/getApiClient.js +19 -1
- package/src/simple/Auth.js +21 -0
- package/src/simple/Softphone.js +148 -0
- package/src/simple/index.js +2 -0
- package/src/web-rtc-client.js +4 -2
- package/src/websocket-client.js +1 -1
package/src/api-client.js
CHANGED
|
@@ -53,6 +53,7 @@ export default class ApiClient {
|
|
|
53
53
|
|
|
54
54
|
refreshToken: ?string;
|
|
55
55
|
onRefreshToken: ?Function;
|
|
56
|
+
onRefreshTokenError: ?Function;
|
|
56
57
|
refreshExpiration: ?number;
|
|
57
58
|
refreshBackend: ?string;
|
|
58
59
|
refreshTenantId: ?string;
|
|
@@ -105,23 +106,31 @@ export default class ApiClient {
|
|
|
105
106
|
return null;
|
|
106
107
|
}
|
|
107
108
|
|
|
108
|
-
|
|
109
|
-
this.refreshToken
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
109
|
+
try {
|
|
110
|
+
const session = await this.auth.refreshToken(
|
|
111
|
+
this.refreshToken,
|
|
112
|
+
this.refreshBackend,
|
|
113
|
+
this.refreshExpiration,
|
|
114
|
+
this.isMobile,
|
|
115
|
+
this.refreshTenantId,
|
|
116
|
+
);
|
|
115
117
|
|
|
116
|
-
|
|
118
|
+
logger.info('token refreshed', { token: session.token });
|
|
117
119
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
120
|
+
if (this.onRefreshToken) {
|
|
121
|
+
this.onRefreshToken(session.token, session);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
this.setToken(session.token);
|
|
121
125
|
|
|
122
|
-
|
|
126
|
+
return session.token;
|
|
127
|
+
} catch (error) {
|
|
128
|
+
logger.error('token refresh, error', error);
|
|
123
129
|
|
|
124
|
-
|
|
130
|
+
if (this.onRefreshTokenError) {
|
|
131
|
+
this.onRefreshTokenError(error);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
125
134
|
}
|
|
126
135
|
|
|
127
136
|
setToken(token: string) {
|
|
@@ -144,6 +153,10 @@ export default class ApiClient {
|
|
|
144
153
|
this.onRefreshToken = onRefreshToken;
|
|
145
154
|
}
|
|
146
155
|
|
|
156
|
+
setOnRefreshTokenError(callback: Function) {
|
|
157
|
+
this.onRefreshTokenError = callback;
|
|
158
|
+
}
|
|
159
|
+
|
|
147
160
|
setRefreshExpiration(refreshExpiration: number) {
|
|
148
161
|
this.refreshExpiration = refreshExpiration;
|
|
149
162
|
}
|
|
@@ -330,13 +330,9 @@ class IssueReporter {
|
|
|
330
330
|
|
|
331
331
|
setTimeout(() => {
|
|
332
332
|
if (isArray) {
|
|
333
|
-
payload = payload.map(message =>
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
});
|
|
337
|
-
} else {
|
|
338
|
-
// $FlowFixMe
|
|
339
|
-
payload._retry = retry + 1;
|
|
333
|
+
payload = payload.map(message => this._writeRetryCount(message, retry + 1));
|
|
334
|
+
} else if (payload && typeof payload === 'object') {
|
|
335
|
+
payload = this._writeRetryCount(payload, retry + 1);
|
|
340
336
|
}
|
|
341
337
|
|
|
342
338
|
this._sendDebugToGrafana(payload, retry + 1);
|
|
@@ -344,6 +340,15 @@ class IssueReporter {
|
|
|
344
340
|
});
|
|
345
341
|
}
|
|
346
342
|
|
|
343
|
+
_writeRetryCount(message: string | Object, count: number): string | Object {
|
|
344
|
+
if (message && typeof message === 'object') {
|
|
345
|
+
// $FlowFixMe
|
|
346
|
+
message._retry = count;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
return message;
|
|
350
|
+
}
|
|
351
|
+
|
|
347
352
|
_isLevelAbove(level1: string, level2: string) {
|
|
348
353
|
const index1 = LOG_LEVELS.indexOf(level1);
|
|
349
354
|
const index2 = LOG_LEVELS.indexOf(level2);
|
|
@@ -100,4 +100,10 @@ describe('IssueReporter', () => {
|
|
|
100
100
|
expect(IssueReporter.removeSlashes('\"')).toBe("'");
|
|
101
101
|
expect(IssueReporter.removeSlashes('\\\"')).toBe("'");
|
|
102
102
|
});
|
|
103
|
+
|
|
104
|
+
it('Add retry count', () => {
|
|
105
|
+
expect(IssueReporter._writeRetryCount('', 1)).toBe('');
|
|
106
|
+
expect(IssueReporter._writeRetryCount('{}', 1)).toBe('{}');
|
|
107
|
+
expect(IssueReporter._writeRetryCount({}, 1)).toEqual({ _retry: 1 });
|
|
108
|
+
});
|
|
103
109
|
});
|
|
@@ -10,7 +10,9 @@ global.wazoClients = global.wazoClients || {};
|
|
|
10
10
|
global.wazoClientId = global.wazoClientId || {};
|
|
11
11
|
global.wazoClientToken = global.wazoClientToken || {};
|
|
12
12
|
global.wazoRefreshToken = global.wazoRefreshToken || {};
|
|
13
|
+
global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
|
|
13
14
|
global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
|
|
15
|
+
global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
|
|
14
16
|
global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
|
|
15
17
|
global.wazoRefreshBackend = global.wazoRefreshBackend || {};
|
|
16
18
|
global.wazoIsMobile = global.wazoIsMobile || {};
|
|
@@ -32,10 +34,18 @@ export const setRefreshToken = (newRefreshToken: ?string, forServer: ?string = n
|
|
|
32
34
|
global.wazoRefreshToken[forServer] = newRefreshToken;
|
|
33
35
|
};
|
|
34
36
|
|
|
37
|
+
export const setRefreshTenantId = (refreshTenantId: ?string, forServer: ?string = null) => {
|
|
38
|
+
global.wazoRefreshTenantId[forServer] = refreshTenantId;
|
|
39
|
+
};
|
|
40
|
+
|
|
35
41
|
export const setOnRefreshToken = (onRefreshToken: Function, forServer: ?string = null) => {
|
|
36
42
|
global.wazoOnRefreshToken[forServer] = onRefreshToken;
|
|
37
43
|
};
|
|
38
44
|
|
|
45
|
+
export const setOnRefreshTokenError = (callback: Function, forServer: ?string = null) => {
|
|
46
|
+
global.wazoOnRefreshTokenError[forServer] = callback;
|
|
47
|
+
};
|
|
48
|
+
|
|
39
49
|
export const setRefreshExpiration = (refreshExpiration: number, forServer: ?string = null) => {
|
|
40
50
|
global.wazoRefreshExpiration[forServer] = refreshExpiration;
|
|
41
51
|
};
|
|
@@ -62,12 +72,20 @@ const fillClient = (apiClient: WazoApiClient) => {
|
|
|
62
72
|
|
|
63
73
|
apiClient.setRefreshToken(global.wazoRefreshToken[server] || global.wazoRefreshToken[null] || apiClient.refreshToken);
|
|
64
74
|
|
|
75
|
+
apiClient.setRefreshTenantId(
|
|
76
|
+
global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId,
|
|
77
|
+
);
|
|
78
|
+
|
|
65
79
|
apiClient.setFetchOptions(global.wazoFetchOptions[server] || global.wazoFetchOptions[null] || apiClient.fetchOptions);
|
|
66
80
|
|
|
67
81
|
apiClient.setOnRefreshToken(
|
|
68
82
|
global.wazoOnRefreshToken[server] || global.wazoOnRefreshToken[null] || apiClient.onRefreshToken,
|
|
69
83
|
);
|
|
70
84
|
|
|
85
|
+
apiClient.setOnRefreshTokenError(
|
|
86
|
+
global.wazoOnRefreshTokenError[server] || global.wazoOnRefreshTokenError[null] || apiClient.onRefreshTokenError,
|
|
87
|
+
);
|
|
88
|
+
|
|
71
89
|
apiClient.setRefreshExpiration(
|
|
72
90
|
global.wazoRefreshExpiration[server] || global.wazoRefreshExpiration[null] || apiClient.refreshExpiration,
|
|
73
91
|
);
|
|
@@ -81,7 +99,7 @@ const fillClient = (apiClient: WazoApiClient) => {
|
|
|
81
99
|
return apiClient;
|
|
82
100
|
};
|
|
83
101
|
|
|
84
|
-
export default (forServer: ?string): WazoApiClient => {
|
|
102
|
+
export default (forServer: ?string = null): WazoApiClient => {
|
|
85
103
|
const server: string = forServer || global.wazoCurrentServer || '';
|
|
86
104
|
if (server in global.wazoClients) {
|
|
87
105
|
return fillClient(global.wazoClients[server]);
|
package/src/simple/Auth.js
CHANGED
|
@@ -10,6 +10,8 @@ import getApiClient, {
|
|
|
10
10
|
setRefreshExpiration,
|
|
11
11
|
setOnRefreshToken,
|
|
12
12
|
setFetchOptions,
|
|
13
|
+
setRefreshTenantId,
|
|
14
|
+
setOnRefreshTokenError,
|
|
13
15
|
} from '../service/getApiClient';
|
|
14
16
|
import IssueReporter from '../service/IssueReporter';
|
|
15
17
|
|
|
@@ -29,6 +31,7 @@ class Auth {
|
|
|
29
31
|
host: ?string;
|
|
30
32
|
session: ?Session;
|
|
31
33
|
onRefreshTokenCallback: ?Function;
|
|
34
|
+
onRefreshTokenCallbackError: ?Function;
|
|
32
35
|
authenticated: boolean;
|
|
33
36
|
mobile: boolean;
|
|
34
37
|
BACKEND_WAZO: string;
|
|
@@ -66,6 +69,14 @@ class Auth {
|
|
|
66
69
|
this.onRefreshTokenCallback(token, session);
|
|
67
70
|
}
|
|
68
71
|
});
|
|
72
|
+
|
|
73
|
+
setOnRefreshTokenError(error => {
|
|
74
|
+
logger.error('on refresh token error', error);
|
|
75
|
+
|
|
76
|
+
if (this.onRefreshTokenCallbackError) {
|
|
77
|
+
this.onRefreshTokenCallbackError(error);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
69
80
|
}
|
|
70
81
|
|
|
71
82
|
setFetchOptions(options: Object) {
|
|
@@ -154,6 +165,10 @@ class Auth {
|
|
|
154
165
|
this.onRefreshTokenCallback = callback;
|
|
155
166
|
}
|
|
156
167
|
|
|
168
|
+
setOnRefreshTokenError(callback: Function) {
|
|
169
|
+
this.onRefreshTokenCallbackError = callback;
|
|
170
|
+
}
|
|
171
|
+
|
|
157
172
|
checkAuthorizations(session: Session, authorizationName: ?string) {
|
|
158
173
|
if (!authorizationName) {
|
|
159
174
|
return;
|
|
@@ -186,6 +201,12 @@ class Auth {
|
|
|
186
201
|
setRefreshToken(refreshToken);
|
|
187
202
|
}
|
|
188
203
|
|
|
204
|
+
setRefreshTenantId(refreshTenantId: string) {
|
|
205
|
+
setRefreshTenantId(refreshTenantId);
|
|
206
|
+
|
|
207
|
+
getApiClient().setRefreshTenantId(refreshTenantId);
|
|
208
|
+
}
|
|
209
|
+
|
|
189
210
|
forceRefreshToken() {
|
|
190
211
|
getApiClient().forceRefreshToken();
|
|
191
212
|
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
/* eslint-disable no-unused-vars */
|
|
3
|
+
/* global window, document */
|
|
4
|
+
const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
|
|
5
|
+
const SDK_ON_CALL_MADE = 'sdk/SDK_ON_CALL_MADE';
|
|
6
|
+
const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
|
|
7
|
+
const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
|
|
8
|
+
const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
|
|
9
|
+
|
|
10
|
+
class Softphone {
|
|
11
|
+
url: string = 'https://softphone.wazo.io';
|
|
12
|
+
width: number = 500;
|
|
13
|
+
height: number = 600;
|
|
14
|
+
displayed: boolean = false;
|
|
15
|
+
iframe: ?Object = null;
|
|
16
|
+
|
|
17
|
+
onLinkEnabled(link: Object) {}
|
|
18
|
+
|
|
19
|
+
onCallMade(call: Object) {}
|
|
20
|
+
onCallIncoming(call: Object) {}
|
|
21
|
+
onCallEnded(call: Object, card: Object, direction: string, fromExtension: string) {}
|
|
22
|
+
onAuthenticated(session: Object) {}
|
|
23
|
+
|
|
24
|
+
init(url: string, width: number, height: number) {
|
|
25
|
+
if (url) {
|
|
26
|
+
this.url = url;
|
|
27
|
+
}
|
|
28
|
+
if (width) {
|
|
29
|
+
this.width = width;
|
|
30
|
+
}
|
|
31
|
+
if (height) {
|
|
32
|
+
this.height = height;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
36
|
+
|
|
37
|
+
this._createIframe();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
parseLinks() {
|
|
41
|
+
const links = this._getLinks();
|
|
42
|
+
|
|
43
|
+
links.forEach(link => {
|
|
44
|
+
link.setAttribute('data-wazo-parsed', true);
|
|
45
|
+
link.addEventListener('click', this._onLinkClick.bind(this));
|
|
46
|
+
this.onLinkEnabled(link);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
makeCall(number: string) {
|
|
51
|
+
this.displaySoftphone();
|
|
52
|
+
|
|
53
|
+
if (this.iframe) {
|
|
54
|
+
this.iframe.contentWindow.postMessage({ type: SDK_CLICK_TO_CALL, number }, '*');
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
toggleSoftphoneDisplay() {
|
|
59
|
+
if (this.displayed) {
|
|
60
|
+
this.hideSoftphone();
|
|
61
|
+
} else {
|
|
62
|
+
this.displaySoftphone();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
this.displayed = !this.displayed;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
displaySoftphone() {
|
|
69
|
+
if (!this.iframe) {
|
|
70
|
+
this._createIframe();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (this.iframe) {
|
|
74
|
+
this.iframe.style.display = 'block';
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
hideSoftphone() {
|
|
79
|
+
if (this.iframe) {
|
|
80
|
+
this.iframe.style.display = 'none';
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
_createIframe() {
|
|
85
|
+
this.iframe = document.createElement('iframe');
|
|
86
|
+
// $FlowFixMe
|
|
87
|
+
this.iframe.width = this.width;
|
|
88
|
+
// $FlowFixMe
|
|
89
|
+
this.iframe.height = this.height;
|
|
90
|
+
// $FlowFixMe
|
|
91
|
+
this.iframe.allow = 'camera *; microphone *; autoplay *; display-capture *';
|
|
92
|
+
this.iframe.style.position = 'absolute';
|
|
93
|
+
this.iframe.style.left = '0';
|
|
94
|
+
this.iframe.style.bottom = '0';
|
|
95
|
+
this.iframe.style.border = '1px solid #aaa';
|
|
96
|
+
this.iframe.src = this.url;
|
|
97
|
+
this.iframe.style.display = 'none';
|
|
98
|
+
this.iframe.id = 'wazo-softphone';
|
|
99
|
+
|
|
100
|
+
// $FlowFixMe
|
|
101
|
+
document.body.appendChild(this.iframe);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
_getLinks() {
|
|
105
|
+
return [].slice.call(document.querySelectorAll('a:not([data-wazo-parsed])'), 0)
|
|
106
|
+
.filter(link => link.href.indexOf('tel:') === 0 || link.href.indexOf('callto:') === 0);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
_onLinkClick(e: Object) {
|
|
110
|
+
e.preventDefault();
|
|
111
|
+
const number = e.target.href.split(':')[1];
|
|
112
|
+
|
|
113
|
+
this.makeCall(number);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
_onAuthenticated() {
|
|
117
|
+
this.parseLinks();
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
_onMessage(event: Object) {
|
|
121
|
+
if (!event.data) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
switch (event.data.type) {
|
|
126
|
+
case SDK_ON_CALL_MADE:
|
|
127
|
+
this.onCallMade(event.data.callSession);
|
|
128
|
+
break;
|
|
129
|
+
case SDK_CALL_ENDED: {
|
|
130
|
+
const { callSession, content, direction, userExtension } = event.data;
|
|
131
|
+
this.onCallEnded(callSession, content, direction, userExtension);
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
case SDK_CALL_INCOMING:
|
|
135
|
+
this.onCallIncoming(event.data.callSession);
|
|
136
|
+
break;
|
|
137
|
+
case SDK_AUTHENTICATED:
|
|
138
|
+
// $FlowFixMe
|
|
139
|
+
this._onAuthenticated(event.data.session);
|
|
140
|
+
this.onAuthenticated(event.data.session);
|
|
141
|
+
break;
|
|
142
|
+
default:
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export default new Softphone();
|
package/src/simple/index.js
CHANGED
|
@@ -39,6 +39,7 @@ import IssueReporter from '../service/IssueReporter';
|
|
|
39
39
|
import Features from '../domain/Features';
|
|
40
40
|
import Meeting from '../domain/Meeting';
|
|
41
41
|
import Checker from '../checker/Checker';
|
|
42
|
+
import Softphone from './Softphone';
|
|
42
43
|
|
|
43
44
|
const Wazo = {
|
|
44
45
|
Auth,
|
|
@@ -58,6 +59,7 @@ const Wazo = {
|
|
|
58
59
|
loggerFor: IssueReporter.loggerFor.bind(IssueReporter),
|
|
59
60
|
Features,
|
|
60
61
|
Checker,
|
|
62
|
+
Softphone,
|
|
61
63
|
|
|
62
64
|
// Domain
|
|
63
65
|
domain: {
|
package/src/web-rtc-client.js
CHANGED
|
@@ -771,8 +771,10 @@ export default class WebRTCClient extends Emitter {
|
|
|
771
771
|
conference: isConference,
|
|
772
772
|
};
|
|
773
773
|
|
|
774
|
-
// Avoid sdh to
|
|
775
|
-
session.sessionDescriptionHandler
|
|
774
|
+
// Avoid sdh to create a new stream
|
|
775
|
+
if (session.sessionDescriptionHandler) {
|
|
776
|
+
session.sessionDescriptionHandler.localMediaStreamConstraints = options.constraints;
|
|
777
|
+
}
|
|
776
778
|
|
|
777
779
|
// Send re-INVITE
|
|
778
780
|
return session.invite(options);
|
package/src/websocket-client.js
CHANGED
|
@@ -356,7 +356,7 @@ class WebSocketClient extends Emitter {
|
|
|
356
356
|
this.close();
|
|
357
357
|
}
|
|
358
358
|
const url = `wss://${this.host || ''}/api/websocketd/?token=${this.token || ''}&version=${this.version}`;
|
|
359
|
-
logger.
|
|
359
|
+
logger.info('Wazo WS url computed to reconnect', { url });
|
|
360
360
|
|
|
361
361
|
return url;
|
|
362
362
|
}
|