Remove previous versions for signaling endpoints

The mobile apps will need to adjust to the new version (note that only
the signaling settings endpoint actually changed), but they will not be
compatible with Talk < 12 anyway due to the changes in the conversation
endpoints.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2021-05-18 19:04:39 +02:00
Родитель 2cb9d9625d
Коммит 45c4226819
5 изменённых файлов: 20 добавлений и 57 удалений

Просмотреть файл

@ -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}$',
],
],

Просмотреть файл

@ -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

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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 {

Просмотреть файл

@ -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': {