diff --git a/appinfo/routes.php b/appinfo/routes.php index 229a7c7e2..a1c75b8f3 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -62,7 +62,7 @@ return [ 'url' => '/api/{apiVersion}/signaling/settings', 'verb' => 'GET', 'requirements' => [ - 'apiVersion' => 'v(1|2|3)', + 'apiVersion' => 'v(3)', ], ], [ @@ -70,7 +70,7 @@ return [ 'url' => '/api/{apiVersion}/signaling/welcome/{serverId}', 'verb' => 'GET', 'requirements' => [ - 'apiVersion' => 'v(1|2)', + 'apiVersion' => 'v(3)', 'serverId' => '^\d+$', ], ], @@ -79,7 +79,7 @@ return [ 'url' => '/api/{apiVersion}/signaling/backend', 'verb' => 'POST', 'requirements' => [ - 'apiVersion' => 'v(1|2)', + 'apiVersion' => 'v(3)', ], ], [ @@ -87,7 +87,7 @@ return [ 'url' => '/api/{apiVersion}/signaling/{token}', 'verb' => 'POST', 'requirements' => [ - 'apiVersion' => 'v(1|2)', + 'apiVersion' => 'v(3)', 'token' => '^[a-z0-9]{4,30}$', ], ], @@ -96,7 +96,7 @@ return [ 'url' => '/api/{apiVersion}/signaling/{token}', 'verb' => 'GET', 'requirements' => [ - 'apiVersion' => 'v(1|2)', + 'apiVersion' => 'v(3)', 'token' => '^[a-z0-9]{4,30}$', ], ], diff --git a/docs/internal-signaling.md b/docs/internal-signaling.md index e113498a0..8fd1c47c2 100644 --- a/docs/internal-signaling.md +++ b/docs/internal-signaling.md @@ -1,7 +1,7 @@ # Signaling API -* Base endpoint for API v1 is: `/ocs/v2.php/apps/spreed/api/v1` -* Base endpoint for API v2 is: `/ocs/v2.php/apps/spreed/api/v2` +* Base endpoint for API v1 is: 🏁 Removed with API v3 +* Base endpoint for API v2 is: 🏁 Removed with API v3 * Base endpoint for API v3 is: `/ocs/v2.php/apps/spreed/api/v3` ## Get signaling settings @@ -23,33 +23,18 @@ `hideWarning` | string | v1 | Don't show a performance warning although internal signaling is used `server` | string | v1 | URL of the external signaling server `ticket` | string | v1 | Ticket for the external signaling server - `stunservers` | array | v1 | STUN servers - `turnservers` | array | v1 | TURN servers + `stunservers` | array | v3 | STUN servers + `turnservers` | array | v3 | TURN servers `sipDialinInfo` | string | v2 | Generic SIP dial-in information for this conversation (admin free text containing the phone number etc) - - STUN server (v1|v2) + - STUN server - field | type | Description - ---|---|--- - `url` | string | STUN server URL - - - TURN server (v1|v2) - - field | type | Description - ---|---|--- - `url` | array | One element array with TURN server URL - `urls` | array | One element array with TURN server URL - `username` | string | User name for the TURN server - `credential` | string | User password for the TURN server - - - STUN server (v3) - field | type | Description ------|------|------------ `urls` | array | Each element is a STUN server URL as a string - - TURN server (v3) - + - TURN server + field | type | Description ------|------|------------ `urls` | array | Each element is a TURN server URL as a string diff --git a/lib/Controller/SignalingController.php b/lib/Controller/SignalingController.php index 72d586bb9..166e010f3 100644 --- a/lib/Controller/SignalingController.php +++ b/lib/Controller/SignalingController.php @@ -118,13 +118,10 @@ class SignalingController extends OCSController { /** * @PublicPage * - * @param string $apiVersion * @param string $token * @return DataResponse */ - public function getSettings(string $apiVersion, string $token = ''): DataResponse { - $apiV = (int) substr($apiVersion, 1); - + public function getSettings(string $token = ''): DataResponse { try { if ($token !== '') { $room = $this->manager->getRoomForUserByToken($token, $this->userId); @@ -137,21 +134,16 @@ class SignalingController extends OCSController { } $stun = []; - $stunV3 = []; $stunUrls = []; $stunServers = $this->talkConfig->getStunServers(); foreach ($stunServers as $stunServer) { - $stun[] = [ - 'url' => 'stun:' . $stunServer, - ]; $stunUrls[] = 'stun:' . $stunServer; } - $stunV3[] = [ + $stun[] = [ 'urls' => $stunUrls ]; $turn = []; - $turnV3 = []; $turnSettings = $this->talkConfig->getTurnSettings(); foreach ($turnSettings as $turnServer) { $turnUrls = []; @@ -159,17 +151,11 @@ class SignalingController extends OCSController { $protocols = explode(',', $turnServer['protocols']); foreach ($schemes as $scheme) { foreach ($protocols as $proto) { - $turn[] = [ - 'url' => [$scheme . ':' . $turnServer['server'] . '?transport=' . $proto], - 'urls' => [$scheme . ':' . $turnServer['server'] . '?transport=' . $proto], - 'username' => $turnServer['username'], - 'credential' => $turnServer['password'], - ]; $turnUrls[] = $scheme . ':' . $turnServer['server'] . '?transport=' . $proto; } } - $turnV3[] = [ + $turn[] = [ 'urls' => $turnUrls, 'username' => $turnServer['username'], 'credential' => $turnServer['password'], @@ -187,17 +173,9 @@ class SignalingController extends OCSController { 'ticket' => $this->talkConfig->getSignalingTicket($this->userId), 'stunservers' => $stun, 'turnservers' => $turn, + 'sipDialinInfo' => $this->talkConfig->isSIPConfigured() ? $this->talkConfig->getDialInInfo() : '', ]; - if ($apiV >= 2) { - $data['sipDialinInfo'] = $this->talkConfig->isSIPConfigured() ? $this->talkConfig->getDialInInfo() : ''; - } - - if ($apiV >= 3) { - $data['stunservers'] = $stunV3; - $data['turnservers'] = $turnV3; - } - return new DataResponse($data); } diff --git a/src/services/signalingService.js b/src/services/signalingService.js index 02406cc2b..bf0c6dd01 100644 --- a/src/services/signalingService.js +++ b/src/services/signalingService.js @@ -35,11 +35,11 @@ const fetchSignalingSettings = async({ token }, options) => { } const pullSignalingMessages = async(token, options) => { - return axios.get(generateOcsUrl('apps/spreed/api/v2/signaling/{token}', { token }), options) + return axios.get(generateOcsUrl('apps/spreed/api/v3/signaling/{token}', { token }), options) } const getWelcomeMessage = async(serverId) => { - return axios.get(generateOcsUrl('apps/spreed/api/v2/signaling/welcome/{serverId}', { serverId })) + return axios.get(generateOcsUrl('apps/spreed/api/v3/signaling/welcome/{serverId}', { serverId })) } export { diff --git a/src/utils/signaling.js b/src/utils/signaling.js index 1c2a8e62e..8c19031b5 100644 --- a/src/utils/signaling.js +++ b/src/utils/signaling.js @@ -362,7 +362,7 @@ Signaling.Internal.prototype._sendMessageWithCallback = function(ev) { } Signaling.Internal.prototype._sendMessages = function(messages) { - return axios.post(generateOcsUrl('apps/spreed/api/v1/signaling/{token}', { token: this.currentRoomToken }), { + return axios.post(generateOcsUrl('apps/spreed/api/v3/signaling/{token}', { token: this.currentRoomToken }), { messages: JSON.stringify(messages), }) } @@ -818,7 +818,7 @@ Signaling.Standalone.prototype.sendHello = function() { } else { // Already reconnected with a new session. this._forceReconnect = false - const url = generateOcsUrl('apps/spreed/api/v1/signaling/backend') + const url = generateOcsUrl('apps/spreed/api/v3/signaling/backend') msg = { 'type': 'hello', 'hello': {