feat(AddPeopleDialog): invite rooms (#2001)
* feat(AddPeopleDialog): invite rooms Distinguish between 'user' and 'videosipgw' search result items and invite them with using different method. * squash: fix typo in AddPeopleDialog.web.js
This commit is contained in:
parent
a0a4fbf566
commit
e553e61f04
|
@ -10,7 +10,7 @@ import { translate } from '../../base/i18n';
|
||||||
import MultiSelectAutocomplete
|
import MultiSelectAutocomplete
|
||||||
from '../../base/react/components/web/MultiSelectAutocomplete';
|
from '../../base/react/components/web/MultiSelectAutocomplete';
|
||||||
|
|
||||||
import { invitePeople, searchPeople } from '../functions';
|
import { invitePeople, inviteRooms, searchPeople } from '../functions';
|
||||||
|
|
||||||
declare var interfaceConfig: Object;
|
declare var interfaceConfig: Object;
|
||||||
|
|
||||||
|
@ -26,6 +26,12 @@ class AddPeopleDialog extends Component {
|
||||||
* @static
|
* @static
|
||||||
*/
|
*/
|
||||||
static propTypes = {
|
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.
|
* The URL pointing to the service allowing for people invite.
|
||||||
*/
|
*/
|
||||||
|
@ -229,11 +235,17 @@ class AddPeopleDialog extends Component {
|
||||||
addToCallInProgress: true
|
addToCallInProgress: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.props._conference
|
||||||
|
&& inviteRooms(
|
||||||
|
this.props._conference,
|
||||||
|
this.state.inviteItems.filter(
|
||||||
|
i => i.type === 'videosipgw'));
|
||||||
|
|
||||||
invitePeople(
|
invitePeople(
|
||||||
this.props._inviteServiceUrl,
|
this.props._inviteServiceUrl,
|
||||||
this.props._inviteUrl,
|
this.props._inviteUrl,
|
||||||
this.props._jwt,
|
this.props._jwt,
|
||||||
this.state.inviteItems)
|
this.state.inviteItems.filter(i => i.type === 'user'))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.setState({
|
this.setState({
|
||||||
addToCallInProgress: false
|
addToCallInProgress: false
|
||||||
|
@ -318,6 +330,7 @@ class AddPeopleDialog extends Component {
|
||||||
* }}
|
* }}
|
||||||
*/
|
*/
|
||||||
function _mapStateToProps(state) {
|
function _mapStateToProps(state) {
|
||||||
|
const { conference } = state['features/base/conference'];
|
||||||
const {
|
const {
|
||||||
inviteServiceUrl,
|
inviteServiceUrl,
|
||||||
peopleSearchQueryTypes,
|
peopleSearchQueryTypes,
|
||||||
|
@ -325,6 +338,7 @@ function _mapStateToProps(state) {
|
||||||
} = state['features/base/config'];
|
} = state['features/base/config'];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
_conference: conference,
|
||||||
_jwt: state['features/jwt'].jwt,
|
_jwt: state['features/jwt'].jwt,
|
||||||
_inviteUrl: getInviteURL(state),
|
_inviteUrl: getInviteURL(state),
|
||||||
_inviteServiceUrl: inviteServiceUrl,
|
_inviteServiceUrl: inviteServiceUrl,
|
||||||
|
|
|
@ -35,14 +35,14 @@ export function searchPeople(// eslint-disable-line max-params
|
||||||
* invitation.
|
* invitation.
|
||||||
* @param {string} inviteUrl - The url to the conference.
|
* @param {string} inviteUrl - The url to the conference.
|
||||||
* @param {string} jwt - The jwt token to pass to the search service.
|
* @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.
|
* @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) => {
|
return new Promise((resolve, reject) => {
|
||||||
$.post(`${inviteServiceUrl}?token=${jwt}`,
|
$.post(`${inviteServiceUrl}?token=${jwt}`,
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
'invited': inviteItems,
|
'invited': people,
|
||||||
'url': inviteUrl }),
|
'url': inviteUrl }),
|
||||||
response => resolve(response),
|
response => resolve(response),
|
||||||
'json')
|
'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)}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue