Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

feat(AddPeopleDialog): invite rooms (#2001)

Paweł Domase553e61f04f0
diff --git a/react/features/invite/components/AddPeopleDialog.web.js b/react/features/invite/components/AddPeopleDialog.web.js
index 001b42f951..d954ae7406 100644
--- a/react/features/invite/components/AddPeopleDialog.web.js
+++ b/react/features/invite/components/AddPeopleDialog.web.js
@@ -10,7 +10,7 @@ import { translate } from '../../base/i18n';
import MultiSelectAutocomplete
from '../../base/react/components/web/MultiSelectAutocomplete';
-import { invitePeople, searchPeople } from '../functions';
+import { invitePeople, inviteRooms, searchPeople } from '../functions';
declare var interfaceConfig: Object;
@@ -26,6 +26,12 @@ class AddPeopleDialog extends Component {
* @static
*/
static propTypes = {
+ /**
+ * The {@link JitsiMeetConference} which will be used to invite "room"
+ * participants through the SIP Jibri (Video SIP gateway).
+ */
+ _conference: PropTypes.object,
+
/**
* The URL pointing to the service allowing for people invite.
*/
@@ -229,11 +235,17 @@ class AddPeopleDialog extends Component {
addToCallInProgress: true
});
+ this.props._conference
+ && inviteRooms(
+ this.props._conference,
+ this.state.inviteItems.filter(
+ i => i.type === 'videosipgw'));
+
invitePeople(
this.props._inviteServiceUrl,
this.props._inviteUrl,
this.props._jwt,
- this.state.inviteItems)
+ this.state.inviteItems.filter(i => i.type === 'user'))
.then(() => {
this.setState({
addToCallInProgress: false
@@ -318,6 +330,7 @@ class AddPeopleDialog extends Component {
* }}
*/
function _mapStateToProps(state) {
+ const { conference } = state['features/base/conference'];
const {
inviteServiceUrl,
peopleSearchQueryTypes,
@@ -325,6 +338,7 @@ function _mapStateToProps(state) {
} = state['features/base/config'];
return {
+ _conference: conference,
_jwt: state['features/jwt'].jwt,
_inviteUrl: getInviteURL(state),
_inviteServiceUrl: inviteServiceUrl,
diff --git a/react/features/invite/functions.js b/react/features/invite/functions.js
index 96c30e7b3f..80ae96fc93 100644
--- a/react/features/invite/functions.js
+++ b/react/features/invite/functions.js
@@ -35,14 +35,14 @@ export function searchPeople(// eslint-disable-line max-params
* invitation.
* @param {string} inviteUrl - The url to the conference.
* @param {string} jwt - The jwt token to pass to the search service.
- * @param {Immutable.List} inviteItems - The list of items to invite.
+ * @param {Immutable.List} people - The list of the "user" type items to invite.
* @returns {Promise} - The promise created by the request.
*/
-export function invitePeople(inviteServiceUrl, inviteUrl, jwt, inviteItems) { // eslint-disable-line max-params, max-len
+export function invitePeople(inviteServiceUrl, inviteUrl, jwt, people) { // eslint-disable-line max-params, max-len
return new Promise((resolve, reject) => {
$.post(`${inviteServiceUrl}?token=${jwt}`,
JSON.stringify({
- 'invited': inviteItems,
+ 'invited': people,
'url': inviteUrl }),
response => resolve(response),
'json')
@@ -51,3 +51,29 @@ export function invitePeople(inviteServiceUrl, inviteUrl, jwt, inviteItems) { //
);
});
}
+
+/**
+ * Invites room participants to the conference through the SIP Jibri service.
+ *
+ * @param {JitsiMeetConference} conference - The conference to which the rooms
+ * will be invited to.
+ * @param {Immutable.List} rooms - The list of the "videosipgw" type items to
+ * invite.
+ * @returns {void}
+ */
+export function inviteRooms(conference, rooms) {
+ for (const room of rooms) {
+ const sipAddress = room.id;
+ const displayName = room.name;
+
+ if (sipAddress && displayName) {
+ const newSession
+ = conference.createVideoSIPGWSession(sipAddress, displayName);
+
+ newSession.start();
+ } else {
+ console.error(
+ `No display name or sip number for ${JSON.stringify(room)}`);
+ }
+ }
+}