Browse Source

Send Nextcloud session id too when a participant joins a call

When the internal signaling server is used the Nextcloud session id and
the signaling session id are the same. However, if the external
signaling server is used they are different.

Signaling messages for participants in calls (like joining the call,
muting and so on) are identified only by their signaling session id, so
when the external signaling server is used it was not possible to
associate participants in calls with the participant information
provided by the Nextcloud server.

However, when a participant joins a call her client notifies the
Nextcloud server (either directly or, in the case of SIP clients,
through the signaling server). The Nextcloud server then notifies the
signaling server which, in turn, notifies all the clients. When
Nextcloud notifies the signaling server the participant is identified
with the Nextcloud session id, and the signaling server then replaces
that with the signaling session id before relaying the message to the
clients.

Due to this when a participant joins (or leaves) a call now the
Nextcloud session id is sent too in an extra property. This property is
not adjusted by the external signaling server, so the clients receive
both the signaling session id and the Nextcloud session id and thus are
able to map them.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
pull/4952/head
Daniel Calviño Sánchez 5 years ago
parent
commit
deb2494193
  1. 4
      docs/standalone-signaling-api-v1.md
  2. 1
      lib/Signaling/BackendNotifier.php
  3. 5
      src/utils/webrtc/models/CallParticipantModel.js
  4. 7
      src/utils/webrtc/webrtc.js
  5. 7
      tests/php/Signaling/BackendNotifierTest.php

4
docs/standalone-signaling-api-v1.md

@ -549,7 +549,9 @@ Message format (Server -> Client, participants change):
If a participant has the `inCall` flag set, he has joined the call of the room
and a WebRTC peerconnection should be established if the local client is also
in the call.
in the call. In that case the participant information will contain properties
for both the signaling session id (`sessionId`) and the Nextcloud session id
(`nextcloudSessionId`).
## Room messages

1
lib/Signaling/BackendNotifier.php

@ -334,6 +334,7 @@ class BackendNotifier {
$data['inCall'] = $session->getInCall();
$data['lastPing'] = $session->getLastPing();
$data['sessionId'] = $session->getSessionId();
$data['nextcloudSessionId'] = $session->getSessionId();
if ($session->getInCall() !== Participant::FLAG_DISCONNECTED) {
$users[] = $data;

5
src/utils/webrtc/models/CallParticipantModel.js

@ -37,6 +37,7 @@ export default function CallParticipantModel(options) {
this.attributes = {
peerId: null,
nextcloudSessionId: null,
peer: null,
screenPeer: null,
// "undefined" is used for values not known yet; "null" or "false"
@ -348,4 +349,8 @@ CallParticipantModel.prototype = {
this.set('userId', userId)
},
setNextcloudSessionId: function(nextcloudSessionId) {
this.set('nextcloudSessionId', nextcloudSessionId)
},
}

7
src/utils/webrtc/webrtc.js

@ -229,6 +229,12 @@ function usersChanged(signaling, newUsers, disconnectedSessionIds) {
// TODO(fancycode): Adjust property name of internal PHP backend to be all lowercase.
const userId = user.userId || user.userid || null
// When the external signaling server is used the Nextcloud session id
// will be provided in its own property. When the internal signaling
// server is used the Nextcloud session id and the signaling session id
// are the same and thus set from the signaling session id.
const nextcloudSessionId = user.nextcloudSessionId || user.nextcloudsessionid || sessionId
let callParticipantModel = callParticipantCollection.get(sessionId)
if (!callParticipantModel) {
callParticipantModel = callParticipantCollection.add({
@ -237,6 +243,7 @@ function usersChanged(signaling, newUsers, disconnectedSessionIds) {
})
}
callParticipantModel.setUserId(userId)
callParticipantModel.setNextcloudSessionId(nextcloudSessionId)
if (user.internal) {
callParticipantModel.set('internal', true)
}

7
tests/php/Signaling/BackendNotifierTest.php

@ -513,6 +513,7 @@ class BackendNotifierTest extends \Test\TestCase {
'inCall' => 7,
'lastPing' => 0,
'sessionId' => $userSession,
'nextcloudSessionId' => $userSession,
'participantType' => Participant::USER,
'userId' => $this->userId,
],
@ -522,6 +523,7 @@ class BackendNotifierTest extends \Test\TestCase {
'inCall' => 7,
'lastPing' => 0,
'sessionId' => $userSession,
'nextcloudSessionId' => $userSession,
'participantType' => Participant::USER,
'userId' => $this->userId,
],
@ -545,6 +547,7 @@ class BackendNotifierTest extends \Test\TestCase {
'inCall' => 1,
'lastPing' => 0,
'sessionId' => $guestSession,
'nextcloudSessionId' => $guestSession,
'participantType' => Participant::GUEST,
],
],
@ -553,6 +556,7 @@ class BackendNotifierTest extends \Test\TestCase {
'inCall' => 7,
'lastPing' => 0,
'sessionId' => $userSession,
'nextcloudSessionId' => $userSession,
'participantType' => Participant::USER,
'userId' => $this->userId,
],
@ -560,6 +564,7 @@ class BackendNotifierTest extends \Test\TestCase {
'inCall' => 1,
'lastPing' => 0,
'sessionId' => $guestSession,
'nextcloudSessionId' => $guestSession,
'participantType' => Participant::GUEST,
],
],
@ -578,6 +583,7 @@ class BackendNotifierTest extends \Test\TestCase {
'inCall' => 0,
'lastPing' => 0,
'sessionId' => $userSession,
'nextcloudSessionId' => $userSession,
'participantType' => Participant::USER,
'userId' => $this->userId,
],
@ -587,6 +593,7 @@ class BackendNotifierTest extends \Test\TestCase {
'inCall' => 1,
'lastPing' => 0,
'sessionId' => $guestSession,
'nextcloudSessionId' => $guestSession,
'participantType' => Participant::GUEST,
],
],

Loading…
Cancel
Save