From 32ecd6310c3fe8782a4c93da610c02a517a8cfe5 Mon Sep 17 00:00:00 2001 From: Tudor-Ovidiu Avram Date: Wed, 7 Apr 2021 15:37:17 +0300 Subject: [PATCH 1/2] fix(sip-invite) fix sip invite jwt not being sent correctly --- react/features/invite/functions.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/react/features/invite/functions.js b/react/features/invite/functions.js index 83dd3c38a..f020a60f5 100644 --- a/react/features/invite/functions.js +++ b/react/features/invite/functions.js @@ -825,13 +825,15 @@ export function inviteSipEndpoints( // eslint-disable-line max-params return Promise.resolve(); } + const baseUrl = window.location.href.toLowerCase().replace(`/${roomName}`, ''); + return fetch( - `${sipInviteUrl}?token=${jwt}`, + sipInviteUrl, { body: JSON.stringify({ callParams: { callUrlInfo: { - baseUrl: window.location.origin, + baseUrl, callName: roomName } }, @@ -842,6 +844,7 @@ export function inviteSipEndpoints( // eslint-disable-line max-params }), method: 'POST', headers: { + 'Authorization': `Bearer ${jwt}`, 'Content-Type': 'application/json' } } From 86dd35b9275241c228730c4b66cec3c07e4cadab Mon Sep 17 00:00:00 2001 From: Tudor-Ovidiu Avram Date: Wed, 7 Apr 2021 15:46:01 +0300 Subject: [PATCH 2/2] code review changes --- react/features/invite/actions.any.js | 2 ++ react/features/invite/functions.js | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/react/features/invite/actions.any.js b/react/features/invite/actions.any.js index 5ef3f0c2b..20b3e3c5b 100644 --- a/react/features/invite/actions.any.js +++ b/react/features/invite/actions.any.js @@ -104,6 +104,7 @@ export function invite( } = state['features/base/config']; const inviteUrl = getInviteURL(state); const { sipInviteUrl } = state['features/base/config']; + const { locationURL } = state['features/base/connection']; const { jwt } = state['features/base/jwt']; const { name: displayName } = getLocalParticipant(state); @@ -172,6 +173,7 @@ export function invite( conference && inviteSipEndpoints( sipEndpoints, + locationURL, sipInviteUrl, jwt, conference.options.name, diff --git a/react/features/invite/functions.js b/react/features/invite/functions.js index f020a60f5..382a8088d 100644 --- a/react/features/invite/functions.js +++ b/react/features/invite/functions.js @@ -808,6 +808,7 @@ export function isSharingEnabled(sharingFeature: string) { * Sends a post request to an invite service. * * @param {Array} inviteItems - The list of the "sip" type items to invite. + * @param {URL} locationURL - The URL of the location. * @param {string} sipInviteUrl - The invite service that generates the invitation. * @param {string} jwt - The jwt token. * @param {string} roomName - The name to the conference. @@ -816,6 +817,7 @@ export function isSharingEnabled(sharingFeature: string) { */ export function inviteSipEndpoints( // eslint-disable-line max-params inviteItems: Array, + locationURL: URL, sipInviteUrl: string, jwt: string, roomName: string, @@ -825,7 +827,7 @@ export function inviteSipEndpoints( // eslint-disable-line max-params return Promise.resolve(); } - const baseUrl = window.location.href.toLowerCase().replace(`/${roomName}`, ''); + const baseUrl = locationURL.href.toLowerCase().replace(`/${roomName}`, ''); return fetch( sipInviteUrl,