diff --git a/src/CallHandler.js b/src/CallHandler.js
index 5b58400ae657..6f67a5f9efd0 100644
--- a/src/CallHandler.js
+++ b/src/CallHandler.js
@@ -1,6 +1,7 @@
/*
Copyright 2015, 2016 OpenMarket Ltd
Copyright 2017, 2018 New Vector Ltd
+Copyright 2019 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -64,6 +65,7 @@ import { showUnknownDeviceDialogForCalls } from './cryptodevices';
import WidgetUtils from './utils/WidgetUtils';
import WidgetEchoStore from './stores/WidgetEchoStore';
import ScalarAuthClient from './ScalarAuthClient';
+import SettingsStore, { SettingLevel } from './settings/SettingsStore';
global.mxCalls = {
//room_id: MatrixCall
@@ -117,8 +119,7 @@ function _reAttemptCall(call) {
function _setCallListeners(call) {
call.on("error", function(err) {
- console.error("Call error: %s", err);
- console.error(err.stack);
+ console.error("Call error:", err);
if (err.code === 'unknown_devices') {
const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
@@ -146,8 +147,15 @@ function _setCallListeners(call) {
},
});
} else {
- const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
+ if (
+ MatrixClientPeg.get().getTurnServers().length === 0 &&
+ SettingsStore.getValue("fallbackICEServerAllowed") === null
+ ) {
+ _showICEFallbackPrompt(_t("Call Failed"));
+ return;
+ }
+ const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createTrackedDialog('Call Failed', '', ErrorDialog, {
title: _t('Call Failed'),
description: err.message,
@@ -217,6 +225,39 @@ function _setCallState(call, roomId, status) {
});
}
+function _showICEFallbackPrompt(title) {
+ const cli = MatrixClientPeg.get();
+ const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
+ const code = sub => {sub}
;
+ Modal.createTrackedDialog('No TURN servers', '', QuestionDialog, {
+ title,
+ description:
{ _t(
+ "Your homeserver %(homeserverDomain)s
is " +
+ "currently not configured to assist with calls by offering a " +
+ "TURN server, which means it is likely that voice and video " +
+ "calls will fail. Please notify your homeserver administrator " +
+ "so that they can address this.",
+ { homeserverDomain: cli.getDomain() }, { code },
+ ) }
{ _t(
+ "Riot can use a fallback server turn.matrix.org
" +
+ "if you urgently need to make a call. Your IP address would be " +
+ "shared with this fallback server only if you agree and later " +
+ "place or receive a call. You can change this permission later " +
+ "in the Voice & Video section of Settings.",
+ null, { code },
+ )}
{sub}
;
- Modal.createTrackedDialog('No TURN servers', '', QuestionDialog, {
- title: _t('Homeserver not configured to support calls'),
- description: { _t(
- "Your homeserver %(homeserverDomain)s
is " +
- "currently not configured to assist with calls by offering a " +
- "TURN server, which means it is likely that voice and video " +
- "calls will fail. Please notify your homeserver administrator " +
- "so that they can address this.",
- { homeserverDomain: cli.getDomain() }, { code },
- ) }
{ _t(
- "Riot can use a fallback server turn.matrix.org
" +
- "if you urgently need to make a call. Your IP address would be " +
- "shared with this fallback server only if you agree and later " +
- "place or receive a call. You can change this permission later " +
- "in the Voice & Video section of Settings.",
- null, { code },
- )}
%(homeserverDomain)s
is currently not configured to assist with calls by offering a TURN server, which means it is likely that voice and video calls will fail. Please notify your homeserver administrator so that they can address this.": "Your homeserver %(homeserverDomain)s
is currently not configured to assist with calls by offering a TURN server, which means it is likely that voice and video calls will fail. Please notify your homeserver administrator so that they can address this.",
+ "Riot can use a fallback server turn.matrix.org
if you urgently need to make a call. Your IP address would be shared with this fallback server only if you agree and later place or receive a call. You can change this permission later in the Voice & Video section of Settings.": "Riot can use a fallback server turn.matrix.org
if you urgently need to make a call. Your IP address would be shared with this fallback server only if you agree and later place or receive a call. You can change this permission later in the Voice & Video section of Settings.",
+ "Allow Fallback": "Allow Fallback",
+ "Dismiss": "Dismiss",
"Unable to capture screen": "Unable to capture screen",
"Existing Call": "Existing Call",
"You are already in a call.": "You are already in a call.",
"VoIP is unsupported": "VoIP is unsupported",
"You cannot place VoIP calls in this browser.": "You cannot place VoIP calls in this browser.",
+ "Homeserver not configured to support calls": "Homeserver not configured to support calls",
"You cannot place a call with yourself.": "You cannot place a call with yourself.",
"Could not connect to the integration server": "Could not connect to the integration server",
"A conference call could not be started because the integrations server is not available": "A conference call could not be started because the integrations server is not available",
@@ -94,7 +99,6 @@
"Unnamed Room": "Unnamed Room",
"Error": "Error",
"Unable to load! Check your network connectivity and try again.": "Unable to load! Check your network connectivity and try again.",
- "Dismiss": "Dismiss",
"Riot does not have permission to send you notifications - please check your browser settings": "Riot does not have permission to send you notifications - please check your browser settings",
"Riot was not given permission to send notifications - please try again": "Riot was not given permission to send notifications - please try again",
"Unable to enable Notifications": "Unable to enable Notifications",
@@ -1490,10 +1494,6 @@
"Failed to leave room": "Failed to leave room",
"Can't leave Server Notices room": "Can't leave Server Notices room",
"This room is used for important messages from the Homeserver, so you cannot leave it.": "This room is used for important messages from the Homeserver, so you cannot leave it.",
- "Homeserver not configured to support calls": "Homeserver not configured to support calls",
- "Your homeserver %(homeserverDomain)s
is currently not configured to assist with calls by offering a TURN server, which means it is likely that voice and video calls will fail. Please notify your homeserver administrator so that they can address this.": "Your homeserver %(homeserverDomain)s
is currently not configured to assist with calls by offering a TURN server, which means it is likely that voice and video calls will fail. Please notify your homeserver administrator so that they can address this.",
- "Riot can use a fallback server turn.matrix.org
if you urgently need to make a call. Your IP address would be shared with this fallback server only if you agree and later place or receive a call. You can change this permission later in the Voice & Video section of Settings.": "Riot can use a fallback server turn.matrix.org
if you urgently need to make a call. Your IP address would be shared with this fallback server only if you agree and later place or receive a call. You can change this permission later in the Voice & Video section of Settings.",
- "Allow Fallback": "Allow Fallback",
"Signed Out": "Signed Out",
"For security, this session has been signed out. Please sign in again.": "For security, this session has been signed out. Please sign in again.",
"Terms and Conditions": "Terms and Conditions",