|
@@ -1,6 +1,6 @@
|
1
|
1
|
// @flow
|
2
|
2
|
|
3
|
|
-import { Alert, Platform } from 'react-native';
|
|
3
|
+import { Alert, NativeModules, Platform } from 'react-native';
|
4
|
4
|
import uuid from 'uuid';
|
5
|
5
|
|
6
|
6
|
import { createTrackMutedEvent, sendAnalytics } from '../../analytics';
|
|
@@ -36,6 +36,7 @@ import CallKit from './CallKit';
|
36
|
36
|
import ConnectionService from './ConnectionService';
|
37
|
37
|
import { isCallIntegrationEnabled } from './functions';
|
38
|
38
|
|
|
39
|
+const { AudioMode } = NativeModules;
|
39
|
40
|
const CallIntegration = CallKit || ConnectionService;
|
40
|
41
|
|
41
|
42
|
/**
|
|
@@ -276,7 +277,8 @@ function _conferenceWillJoin({ dispatch, getState }, next, action) {
|
276
|
277
|
}
|
277
|
278
|
})
|
278
|
279
|
.catch(error => {
|
279
|
|
- // Currently this error code is emitted only by Android.
|
|
280
|
+ // Currently this error codes are emitted only by Android.
|
|
281
|
+ //
|
280
|
282
|
if (error.code === 'CREATE_OUTGOING_CALL_FAILED') {
|
281
|
283
|
// We're not tracking the call anymore - it doesn't exist on
|
282
|
284
|
// the native side.
|
|
@@ -290,6 +292,18 @@ function _conferenceWillJoin({ dispatch, getState }, next, action) {
|
290
|
292
|
{ text: 'OK' }
|
291
|
293
|
],
|
292
|
294
|
{ cancelable: false });
|
|
295
|
+ } else if (error.code === 'SECURITY_ERROR') {
|
|
296
|
+ // Some devices fail because the CALL_PHONE permission is not granted, which is
|
|
297
|
+ // nonsense, because it's not needed for self-managed connections. Alas, this also
|
|
298
|
+ // means audio device management would be broken, so fallback to not using ConnectionService.
|
|
299
|
+ // NOTE: We are not storing this in Settings, in case it's a transient issue, as far fetched as
|
|
300
|
+ // that may be.
|
|
301
|
+ if (AudioMode.setUseConnectionService) {
|
|
302
|
+ AudioMode.setUseConnectionService(false);
|
|
303
|
+
|
|
304
|
+ // Set the desired audio mode, since we just reset the whole thing.
|
|
305
|
+ AudioMode.setMode(hasVideo ? AudioMode.VIDEO_CALL : AudioMode.AUDIO_CALL);
|
|
306
|
+ }
|
293
|
307
|
}
|
294
|
308
|
});
|
295
|
309
|
|