@wazo/sdk 0.38.8 → 0.38.11

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.
Files changed (78) hide show
  1. package/dist/wazo-sdk.js +2 -2
  2. package/esm/__tests__/api-client.test.js +21 -0
  3. package/esm/__tests__/web-rtc-client.test.js +31 -6
  4. package/esm/api/auth.js +12 -0
  5. package/esm/api/ctid-ng.js +1 -0
  6. package/esm/api-client.js +21 -0
  7. package/esm/checker/Checker.js +31 -6
  8. package/esm/checker/checks/aor.js +21 -0
  9. package/esm/checker/checks/api.js +21 -0
  10. package/esm/checker/checks/index.js +31 -6
  11. package/esm/checker/checks/webrtc-transport.js +31 -6
  12. package/esm/checker/checks/webrtc.js +31 -6
  13. package/esm/domain/AdHocAPIConference.js +28 -2
  14. package/esm/domain/Features.js +28 -2
  15. package/esm/domain/Phone/CTIPhone.js +28 -2
  16. package/esm/domain/Phone/WebRTCPhone.js +4 -5
  17. package/esm/index.js +86 -17
  18. package/esm/service/CallApi.js +28 -2
  19. package/esm/service/getApiClient.js +34 -3
  20. package/esm/simple/Auth.js +87 -18
  21. package/esm/simple/Configuration.js +86 -17
  22. package/esm/simple/Directory.js +28 -2
  23. package/esm/simple/Phone.js +86 -17
  24. package/esm/simple/Softphone.js +5 -0
  25. package/esm/simple/index.js +86 -17
  26. package/esm/simple/room/LocalParticipant.js +86 -17
  27. package/esm/simple/room/Participant.js +86 -17
  28. package/esm/simple/room/RemoteParticipant.js +86 -17
  29. package/esm/simple/room/Room.js +86 -17
  30. package/esm/simple/room/SipRoom.js +86 -17
  31. package/esm/simple/room/Stream.js +86 -17
  32. package/esm/simple/room/__tests__/Participant.test.js +86 -17
  33. package/esm/simple/room/__tests__/RemoteParticipant.test.js +86 -17
  34. package/esm/simple/utils.js +86 -17
  35. package/esm/web-rtc-client.js +31 -6
  36. package/lib/__tests__/api-client.test.js +21 -0
  37. package/lib/__tests__/web-rtc-client.test.js +31 -6
  38. package/lib/api/auth.js +12 -0
  39. package/lib/api/ctid-ng.js +1 -0
  40. package/lib/api-client.js +21 -0
  41. package/lib/checker/Checker.js +31 -6
  42. package/lib/checker/checks/aor.js +21 -0
  43. package/lib/checker/checks/api.js +21 -0
  44. package/lib/checker/checks/index.js +31 -6
  45. package/lib/checker/checks/webrtc-transport.js +31 -6
  46. package/lib/checker/checks/webrtc.js +31 -6
  47. package/lib/domain/AdHocAPIConference.js +28 -2
  48. package/lib/domain/Features.js +28 -2
  49. package/lib/domain/Phone/CTIPhone.js +28 -2
  50. package/lib/domain/Phone/WebRTCPhone.js +4 -5
  51. package/lib/index.js +86 -17
  52. package/lib/service/CallApi.js +28 -2
  53. package/lib/service/getApiClient.js +34 -2
  54. package/lib/simple/Auth.js +87 -17
  55. package/lib/simple/Configuration.js +86 -17
  56. package/lib/simple/Directory.js +28 -2
  57. package/lib/simple/Phone.js +86 -17
  58. package/lib/simple/Softphone.js +5 -0
  59. package/lib/simple/index.js +86 -17
  60. package/lib/simple/room/LocalParticipant.js +86 -17
  61. package/lib/simple/room/Participant.js +86 -17
  62. package/lib/simple/room/RemoteParticipant.js +86 -17
  63. package/lib/simple/room/Room.js +86 -17
  64. package/lib/simple/room/SipRoom.js +86 -17
  65. package/lib/simple/room/Stream.js +86 -17
  66. package/lib/simple/room/__tests__/Participant.test.js +86 -17
  67. package/lib/simple/room/__tests__/RemoteParticipant.test.js +86 -17
  68. package/lib/simple/utils.js +86 -17
  69. package/lib/web-rtc-client.js +31 -6
  70. package/package.json +2 -2
  71. package/src/api/auth.js +12 -0
  72. package/src/api-client.js +8 -0
  73. package/src/domain/Phone/WebRTCPhone.js +3 -5
  74. package/src/service/getApiClient.js +13 -2
  75. package/src/simple/Auth.js +35 -4
  76. package/src/simple/Softphone.js +5 -0
  77. package/src/simple/index.js +2 -1
  78. package/src/web-rtc-client.js +10 -6
@@ -2797,6 +2797,7 @@ var authMethods = (client , baseUrl ) => ({
2797
2797
 
2798
2798
 
2799
2799
 
2800
+
2800
2801
  ) {
2801
2802
  const body = {
2802
2803
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -2817,9 +2818,14 @@ var authMethods = (client , baseUrl ) => ({
2817
2818
  }
2818
2819
 
2819
2820
  if (params.tenantId) {
2821
+ console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
2820
2822
  body.tenant_id = params.tenantId;
2821
2823
  }
2822
2824
 
2825
+ if (params.domainName) {
2826
+ body.domain_name = params.domainName;
2827
+ }
2828
+
2823
2829
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
2824
2830
  },
2825
2831
 
@@ -2832,6 +2838,7 @@ var authMethods = (client , baseUrl ) => ({
2832
2838
  expiration ,
2833
2839
  isMobile = false,
2834
2840
  tenantId ,
2841
+ domainName ,
2835
2842
  ) => {
2836
2843
  const body = {
2837
2844
  backend: backend || DEFAULT_BACKEND_USER,
@@ -2841,9 +2848,14 @@ var authMethods = (client , baseUrl ) => ({
2841
2848
  };
2842
2849
 
2843
2850
  if (tenantId) {
2851
+ console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
2844
2852
  body.tenant_id = tenantId;
2845
2853
  }
2846
2854
 
2855
+ if (domainName) {
2856
+ body.domain_name = domainName;
2857
+ }
2858
+
2847
2859
  const headers = {
2848
2860
  'Content-Type': 'application/json',
2849
2861
  ...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
@@ -4270,6 +4282,7 @@ global.wazoClientId = global.wazoClientId || {};
4270
4282
  global.wazoClientToken = global.wazoClientToken || {};
4271
4283
  global.wazoRefreshToken = global.wazoRefreshToken || {};
4272
4284
  global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
4285
+ global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
4273
4286
  global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
4274
4287
  global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
4275
4288
  global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
@@ -5329,6 +5342,7 @@ class ApiClient {
5329
5342
 
5330
5343
 
5331
5344
 
5345
+
5332
5346
 
5333
5347
 
5334
5348
 
@@ -5370,6 +5384,7 @@ class ApiClient {
5370
5384
  refreshToken: this.refreshToken,
5371
5385
  refreshBackend: this.refreshBackend,
5372
5386
  refreshTenantId: this.refreshTenantId,
5387
+ refreshDomainName: this.refreshDomainName,
5373
5388
  refreshExpiration: this.refreshExpiration,
5374
5389
  isMobile: this.isMobile,
5375
5390
  });
@@ -5385,6 +5400,7 @@ class ApiClient {
5385
5400
  this.refreshExpiration,
5386
5401
  this.isMobile,
5387
5402
  this.refreshTenantId,
5403
+ this.refreshDomainName,
5388
5404
  );
5389
5405
 
5390
5406
  logger$1.info('token refreshed', { token: session.token });
@@ -5438,9 +5454,14 @@ class ApiClient {
5438
5454
  }
5439
5455
 
5440
5456
  setRefreshTenantId(tenantId ) {
5457
+ console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead');
5441
5458
  this.refreshTenantId = tenantId;
5442
5459
  }
5443
5460
 
5461
+ setRefreshDomainName(domainName ) {
5462
+ this.refreshDomainName = domainName;
5463
+ }
5464
+
5444
5465
  setIsMobile(isMobile ) {
5445
5466
  this.isMobile = isMobile;
5446
5467
  }
@@ -6402,9 +6423,11 @@ class WebRTCClient extends Emitter {
6402
6423
  const videoTracks = localStream.getVideoTracks();
6403
6424
 
6404
6425
  // Remove video senders
6405
- pc.getSenders().filter(sender => sender.track && sender.track.kind === 'video').forEach(videoSender => {
6406
- videoSender.replaceTrack(null);
6407
- });
6426
+ if (pc.getSenders) {
6427
+ pc.getSenders().filter(sender => sender.track && sender.track.kind === 'video').forEach(videoSender => {
6428
+ videoSender.replaceTrack(null);
6429
+ });
6430
+ }
6408
6431
 
6409
6432
  videoTracks.forEach(videoTrack => {
6410
6433
  videoTrack.enabled = false;
@@ -6637,7 +6660,8 @@ class WebRTCClient extends Emitter {
6637
6660
  const constraints = { audio: { deviceId: { exact: deviceId } } };
6638
6661
  const stream = await navigator.mediaDevices.getUserMedia(constraints);
6639
6662
  const audioTrack = stream.getAudioTracks()[0];
6640
- const sender = pc && pc.getSenders().find(s => audioTrack && s && s.track && s.track.kind === audioTrack.kind);
6663
+ const sender = pc && pc.getSenders
6664
+ && pc.getSenders().find(s => audioTrack && s && s.track && s.track.kind === audioTrack.kind);
6641
6665
 
6642
6666
  if (sender) {
6643
6667
  if (sender.track) {
@@ -6700,10 +6724,11 @@ class WebRTCClient extends Emitter {
6700
6724
  // $FlowFixMe
6701
6725
  return navigator.mediaDevices.getUserMedia(constraints).then(async stream => {
6702
6726
  const videoTrack = stream.getVideoTracks()[0];
6703
- let sender = pc && pc.getSenders().find(s => videoTrack && s && s.track && s.track.kind === videoTrack.kind);
6727
+ let sender = pc && pc.getSenders
6728
+ && pc.getSenders().find(s => videoTrack && s && s.track && s.track.kind === videoTrack.kind);
6704
6729
  let wasTrackEnabled = false;
6705
6730
  if (!sender) {
6706
- sender = pc && pc.getSenders().find(s => !s.track);
6731
+ sender = pc && pc.getSenders && pc.getSenders().find(s => !s.track);
6707
6732
  }
6708
6733
 
6709
6734
  if (sender) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wazo/sdk",
3
- "version": "0.38.8",
3
+ "version": "0.38.11",
4
4
  "description": "Wazo's JavaScript Software Development Kit.",
5
5
  "main": "dist/wazo-sdk.js",
6
6
  "author": "Wazo (http://wazo.io)",
@@ -100,4 +100,4 @@
100
100
  "react-native": {
101
101
  "node-fetch/lib/index": false
102
102
  }
103
- }
103
+ }
package/src/api/auth.js CHANGED
@@ -33,6 +33,7 @@ export default (client: ApiRequester, baseUrl: string) => ({
33
33
  expiration: number,
34
34
  mobile?: boolean,
35
35
  tenantId?: string,
36
+ domainName?: string,
36
37
  }): Promise<?Session> {
37
38
  const body: Object = {
38
39
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -53,9 +54,14 @@ export default (client: ApiRequester, baseUrl: string) => ({
53
54
  }
54
55
 
55
56
  if (params.tenantId) {
57
+ console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
56
58
  body.tenant_id = params.tenantId;
57
59
  }
58
60
 
61
+ if (params.domainName) {
62
+ body.domain_name = params.domainName;
63
+ }
64
+
59
65
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
60
66
  },
61
67
 
@@ -68,6 +74,7 @@ export default (client: ApiRequester, baseUrl: string) => ({
68
74
  expiration: number,
69
75
  isMobile: boolean = false,
70
76
  tenantId: ?string,
77
+ domainName?: string,
71
78
  ): Promise<?Session> => {
72
79
  const body: Object = {
73
80
  backend: backend || DEFAULT_BACKEND_USER,
@@ -77,9 +84,14 @@ export default (client: ApiRequester, baseUrl: string) => ({
77
84
  };
78
85
 
79
86
  if (tenantId) {
87
+ console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
80
88
  body.tenant_id = tenantId;
81
89
  }
82
90
 
91
+ if (domainName) {
92
+ body.domain_name = domainName;
93
+ }
94
+
83
95
  const headers: Object = {
84
96
  'Content-Type': 'application/json',
85
97
  ...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
package/src/api-client.js CHANGED
@@ -57,6 +57,7 @@ export default class ApiClient {
57
57
  refreshExpiration: ?number;
58
58
  refreshBackend: ?string;
59
59
  refreshTenantId: ?string;
60
+ refreshDomainName: ?string;
60
61
  isMobile: boolean;
61
62
  fetchOptions: Object;
62
63
 
@@ -98,6 +99,7 @@ export default class ApiClient {
98
99
  refreshToken: this.refreshToken,
99
100
  refreshBackend: this.refreshBackend,
100
101
  refreshTenantId: this.refreshTenantId,
102
+ refreshDomainName: this.refreshDomainName,
101
103
  refreshExpiration: this.refreshExpiration,
102
104
  isMobile: this.isMobile,
103
105
  });
@@ -113,6 +115,7 @@ export default class ApiClient {
113
115
  this.refreshExpiration,
114
116
  this.isMobile,
115
117
  this.refreshTenantId,
118
+ this.refreshDomainName,
116
119
  );
117
120
 
118
121
  logger.info('token refreshed', { token: session.token });
@@ -166,9 +169,14 @@ export default class ApiClient {
166
169
  }
167
170
 
168
171
  setRefreshTenantId(tenantId: ?string) {
172
+ console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead');
169
173
  this.refreshTenantId = tenantId;
170
174
  }
171
175
 
176
+ setRefreshDomainName(domainName: ?string) {
177
+ this.refreshDomainName = domainName;
178
+ }
179
+
172
180
  setIsMobile(isMobile: boolean) {
173
181
  this.isMobile = isMobile;
174
182
  }
@@ -493,7 +493,7 @@ export default class WebRTCPhone extends Emitter implements Phone {
493
493
  const screenTrack = screenShareStream.getVideoTracks()[0];
494
494
  const sipSession = this.currentSipSession;
495
495
  const pc = this.client.getPeerConnection(this.getSipSessionId(sipSession));
496
- const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
496
+ const sender = pc && pc.getSenders && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
497
497
  const localStream = this.client.getLocalStream(this.getSipSessionId(sipSession));
498
498
  const videoTrack = localStream ? localStream.getTracks().find(track => track.kind === 'video') : null;
499
499
  const hadVideo = !!videoTrack;
@@ -531,9 +531,7 @@ export default class WebRTCPhone extends Emitter implements Phone {
531
531
 
532
532
  try {
533
533
  if (this.currentScreenShare.stream) {
534
- this.currentScreenShare.stream.getTracks()
535
- .filter(track => track.kind === 'video')
536
- .forEach(track => track.stop());
534
+ this.currentScreenShare.stream.getTracks().forEach(track => track.stop());
537
535
  }
538
536
 
539
537
  if (restoreLocalStream) {
@@ -577,7 +575,7 @@ export default class WebRTCPhone extends Emitter implements Phone {
577
575
  const screenTrack = screenStream.getVideoTracks()[0];
578
576
  const sipSessionId = this.getSipSessionId(sipSession);
579
577
  const pc = this.client.getPeerConnection(sipSessionId);
580
- const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
578
+ const sender = pc && pc.getSenders && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
581
579
 
582
580
  logger.info('WebRTC phone - on screensharing', {
583
581
  hadVideo,
@@ -11,6 +11,7 @@ global.wazoClientId = global.wazoClientId || {};
11
11
  global.wazoClientToken = global.wazoClientToken || {};
12
12
  global.wazoRefreshToken = global.wazoRefreshToken || {};
13
13
  global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
14
+ global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
14
15
  global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
15
16
  global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
16
17
  global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
@@ -35,9 +36,14 @@ export const setRefreshToken = (newRefreshToken: ?string, forServer: ?string = n
35
36
  };
36
37
 
37
38
  export const setRefreshTenantId = (refreshTenantId: ?string, forServer: ?string = null) => {
39
+ console.warn('Use of `setRefreshTenantId` is deprecated, please use `setRefreshDomainName` instead');
38
40
  global.wazoRefreshTenantId[forServer] = refreshTenantId;
39
41
  };
40
42
 
43
+ export const setRefreshDomainName = (refreshDomainName: ?string, forServer: ?string = null) => {
44
+ global.wazoRefreshDomainName[forServer] = refreshDomainName;
45
+ };
46
+
41
47
  export const setOnRefreshToken = (onRefreshToken: Function, forServer: ?string = null) => {
42
48
  global.wazoOnRefreshToken[forServer] = onRefreshToken;
43
49
  };
@@ -64,6 +70,7 @@ export const setFetchOptions = (fetchOptions: Object, forServer: ?string = null)
64
70
 
65
71
  const fillClient = (apiClient: WazoApiClient) => {
66
72
  const { server, token, clientId } = apiClient.client;
73
+ const tenantId = global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId;
67
74
 
68
75
  // try with null server when dealing with non-related server info
69
76
  apiClient.setToken(global.wazoClientToken[server] || global.wazoClientToken[null] || token);
@@ -72,8 +79,12 @@ const fillClient = (apiClient: WazoApiClient) => {
72
79
 
73
80
  apiClient.setRefreshToken(global.wazoRefreshToken[server] || global.wazoRefreshToken[null] || apiClient.refreshToken);
74
81
 
75
- apiClient.setRefreshTenantId(
76
- global.wazoRefreshTenantId[server] || global.wazoRefreshTenantId[null] || apiClient.refreshTenantId,
82
+ if (tenantId) {
83
+ apiClient.setRefreshTenantId(tenantId);
84
+ }
85
+
86
+ apiClient.setRefreshDomainName(
87
+ global.wazoRefreshDomainName[server] || global.wazoRefreshDomainName[null] || apiClient.refreshDomainName,
77
88
  );
78
89
 
79
90
  apiClient.setFetchOptions(global.wazoFetchOptions[server] || global.wazoFetchOptions[null] || apiClient.fetchOptions);
@@ -11,6 +11,7 @@ import getApiClient, {
11
11
  setOnRefreshToken,
12
12
  setFetchOptions,
13
13
  setRefreshTenantId,
14
+ setRefreshDomainName,
14
15
  setOnRefreshTokenError,
15
16
  } from '../service/getApiClient';
16
17
  import IssueReporter from '../service/IssueReporter';
@@ -20,6 +21,7 @@ import Wazo from './index';
20
21
  export class InvalidSubscription extends Error {}
21
22
  export class InvalidAuthorization extends Error {}
22
23
  export class NoTenantIdError extends Error {}
24
+ export class NoDomainNameError extends Error {}
23
25
 
24
26
  const logger = IssueReporter.loggerFor('simple-auth');
25
27
 
@@ -83,9 +85,24 @@ class Auth {
83
85
  setFetchOptions(options);
84
86
  }
85
87
 
86
- async logIn(username: string, password: string, backend?: string, tenantId?: string) {
87
- if (backend && backend !== this.BACKEND_WAZO && !tenantId) {
88
- throw new NoTenantIdError('No tenant id');
88
+ async logIn(username: string, password: string, backend?: string, extra?: string | Object) {
89
+ let tenantId = null;
90
+ let domainName = null;
91
+ if (typeof extra === 'string') {
92
+ tenantId = extra;
93
+ }
94
+ if (extra && typeof extra === 'object') {
95
+ domainName = extra.domainName;
96
+ }
97
+
98
+ if (backend && backend !== this.BACKEND_WAZO && !tenantId && !domainName) {
99
+ if (!tenantId) {
100
+ throw new NoTenantIdError('No tenant id');
101
+ }
102
+
103
+ if (!domainName) {
104
+ throw new NoDomainNameError('No domain name');
105
+ }
89
106
  }
90
107
 
91
108
  this.authenticated = false;
@@ -95,6 +112,7 @@ class Auth {
95
112
  password,
96
113
  backend,
97
114
  tenantId,
115
+ domainName,
98
116
  expiration: this.expiration,
99
117
  mobile: this.mobile,
100
118
  });
@@ -103,7 +121,13 @@ class Auth {
103
121
  getApiClient().setRefreshBackend(backend);
104
122
  }
105
123
 
106
- getApiClient().setRefreshTenantId(tenantId);
124
+ if (tenantId) {
125
+ getApiClient().setRefreshTenantId(tenantId);
126
+ }
127
+
128
+ if (domainName) {
129
+ getApiClient().setRefreshDomainName(domainName);
130
+ }
107
131
 
108
132
  return this._onAuthenticated(rawSession);
109
133
  }
@@ -202,11 +226,18 @@ class Auth {
202
226
  }
203
227
 
204
228
  setRefreshTenantId(refreshTenantId: string) {
229
+ console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead.');
205
230
  setRefreshTenantId(refreshTenantId);
206
231
 
207
232
  getApiClient().setRefreshTenantId(refreshTenantId);
208
233
  }
209
234
 
235
+ setRefreshDomainName(domainName: string) {
236
+ setRefreshDomainName(domainName);
237
+
238
+ getApiClient().setRefreshDomainName(domainName);
239
+ }
240
+
210
241
  forceRefreshToken() {
211
242
  getApiClient().forceRefreshToken();
212
243
  }
@@ -107,6 +107,7 @@ class Softphone {
107
107
  wrapUpDuration,
108
108
  enableAgent = true,
109
109
  tenantId,
110
+ domainName,
110
111
  debug = false,
111
112
  }: Object = {}) {
112
113
  this.url = url || 'https://softphone.wazo.io';
@@ -131,8 +132,12 @@ class Softphone {
131
132
  config.port = port;
132
133
  }
133
134
  if (tenantId) {
135
+ console.warn('Use of `tenantId` is deprecated when calling `Softphone.init()`, use `domainName` instead');
134
136
  config.tenantId = tenantId;
135
137
  }
138
+ if (domainName) {
139
+ config.domainName = domainName;
140
+ }
136
141
  if (wrapUpDuration) {
137
142
  config.wrapUpDuration = wrapUpDuration;
138
143
  }
@@ -1,5 +1,5 @@
1
1
  /* global window */
2
- import Auth, { InvalidSubscription, InvalidAuthorization, NoTenantIdError } from './Auth';
2
+ import Auth, { InvalidSubscription, InvalidAuthorization, NoTenantIdError, NoDomainNameError } from './Auth';
3
3
  import Phone from './Phone';
4
4
  import Websocket from './Websocket';
5
5
  import Room from './room/Room';
@@ -106,6 +106,7 @@ const Wazo = {
106
106
  CanceledCallError,
107
107
  SFUNotAvailableError,
108
108
  NoTenantIdError,
109
+ NoDomainNameError,
109
110
  };
110
111
 
111
112
  if (window) {
@@ -877,9 +877,11 @@ export default class WebRTCClient extends Emitter {
877
877
  const videoTracks = localStream.getVideoTracks();
878
878
 
879
879
  // Remove video senders
880
- pc.getSenders().filter(sender => sender.track && sender.track.kind === 'video').forEach(videoSender => {
881
- videoSender.replaceTrack(null);
882
- });
880
+ if (pc.getSenders) {
881
+ pc.getSenders().filter(sender => sender.track && sender.track.kind === 'video').forEach(videoSender => {
882
+ videoSender.replaceTrack(null);
883
+ });
884
+ }
883
885
 
884
886
  videoTracks.forEach(videoTrack => {
885
887
  videoTrack.enabled = false;
@@ -1112,7 +1114,8 @@ export default class WebRTCClient extends Emitter {
1112
1114
  const constraints = { audio: { deviceId: { exact: deviceId } } };
1113
1115
  const stream = await navigator.mediaDevices.getUserMedia(constraints);
1114
1116
  const audioTrack = stream.getAudioTracks()[0];
1115
- const sender = pc && pc.getSenders().find(s => audioTrack && s && s.track && s.track.kind === audioTrack.kind);
1117
+ const sender = pc && pc.getSenders
1118
+ && pc.getSenders().find(s => audioTrack && s && s.track && s.track.kind === audioTrack.kind);
1116
1119
 
1117
1120
  if (sender) {
1118
1121
  if (sender.track) {
@@ -1175,10 +1178,11 @@ export default class WebRTCClient extends Emitter {
1175
1178
  // $FlowFixMe
1176
1179
  return navigator.mediaDevices.getUserMedia(constraints).then(async stream => {
1177
1180
  const videoTrack = stream.getVideoTracks()[0];
1178
- let sender = pc && pc.getSenders().find(s => videoTrack && s && s.track && s.track.kind === videoTrack.kind);
1181
+ let sender = pc && pc.getSenders
1182
+ && pc.getSenders().find(s => videoTrack && s && s.track && s.track.kind === videoTrack.kind);
1179
1183
  let wasTrackEnabled = false;
1180
1184
  if (!sender) {
1181
- sender = pc && pc.getSenders().find(s => !s.track);
1185
+ sender = pc && pc.getSenders && pc.getSenders().find(s => !s.track);
1182
1186
  }
1183
1187
 
1184
1188
  if (sender) {