Merge pull request #8962 from jitsi/tavram/sip-invite-auth
fix(sip-invite) fix sip invite jwt not being sent correctly
This commit is contained in:
commit
5599454ea9
|
@ -104,6 +104,7 @@ export function invite(
|
||||||
} = state['features/base/config'];
|
} = state['features/base/config'];
|
||||||
const inviteUrl = getInviteURL(state);
|
const inviteUrl = getInviteURL(state);
|
||||||
const { sipInviteUrl } = state['features/base/config'];
|
const { sipInviteUrl } = state['features/base/config'];
|
||||||
|
const { locationURL } = state['features/base/connection'];
|
||||||
const { jwt } = state['features/base/jwt'];
|
const { jwt } = state['features/base/jwt'];
|
||||||
const { name: displayName } = getLocalParticipant(state);
|
const { name: displayName } = getLocalParticipant(state);
|
||||||
|
|
||||||
|
@ -172,6 +173,7 @@ export function invite(
|
||||||
|
|
||||||
conference && inviteSipEndpoints(
|
conference && inviteSipEndpoints(
|
||||||
sipEndpoints,
|
sipEndpoints,
|
||||||
|
locationURL,
|
||||||
sipInviteUrl,
|
sipInviteUrl,
|
||||||
jwt,
|
jwt,
|
||||||
conference.options.name,
|
conference.options.name,
|
||||||
|
|
|
@ -808,6 +808,7 @@ export function isSharingEnabled(sharingFeature: string) {
|
||||||
* Sends a post request to an invite service.
|
* Sends a post request to an invite service.
|
||||||
*
|
*
|
||||||
* @param {Array} inviteItems - The list of the "sip" type items to invite.
|
* @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} sipInviteUrl - The invite service that generates the invitation.
|
||||||
* @param {string} jwt - The jwt token.
|
* @param {string} jwt - The jwt token.
|
||||||
* @param {string} roomName - The name to the conference.
|
* @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
|
export function inviteSipEndpoints( // eslint-disable-line max-params
|
||||||
inviteItems: Array<Object>,
|
inviteItems: Array<Object>,
|
||||||
|
locationURL: URL,
|
||||||
sipInviteUrl: string,
|
sipInviteUrl: string,
|
||||||
jwt: string,
|
jwt: string,
|
||||||
roomName: string,
|
roomName: string,
|
||||||
|
@ -825,13 +827,15 @@ export function inviteSipEndpoints( // eslint-disable-line max-params
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const baseUrl = locationURL.href.toLowerCase().replace(`/${roomName}`, '');
|
||||||
|
|
||||||
return fetch(
|
return fetch(
|
||||||
`${sipInviteUrl}?token=${jwt}`,
|
sipInviteUrl,
|
||||||
{
|
{
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
callParams: {
|
callParams: {
|
||||||
callUrlInfo: {
|
callUrlInfo: {
|
||||||
baseUrl: window.location.origin,
|
baseUrl,
|
||||||
callName: roomName
|
callName: roomName
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -842,6 +846,7 @@ export function inviteSipEndpoints( // eslint-disable-line max-params
|
||||||
}),
|
}),
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
|
'Authorization': `Bearer ${jwt}`,
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue