Pārlūkot izejas kodu

Merge pull request #8962 from jitsi/tavram/sip-invite-auth

fix(sip-invite) fix sip invite jwt not being sent correctly
j8
Avram Tudor 4 gadus atpakaļ
vecāks
revīzija
5599454ea9
Revīzijas autora e-pasta adrese nav piesaistīta nevienam kontam

+ 2
- 0
react/features/invite/actions.any.js Parādīt failu

@@ -104,6 +104,7 @@ export function invite(
104 104
         } = state['features/base/config'];
105 105
         const inviteUrl = getInviteURL(state);
106 106
         const { sipInviteUrl } = state['features/base/config'];
107
+        const { locationURL } = state['features/base/connection'];
107 108
         const { jwt } = state['features/base/jwt'];
108 109
         const { name: displayName } = getLocalParticipant(state);
109 110
 
@@ -172,6 +173,7 @@ export function invite(
172 173
 
173 174
         conference && inviteSipEndpoints(
174 175
             sipEndpoints,
176
+            locationURL,
175 177
             sipInviteUrl,
176 178
             jwt,
177 179
             conference.options.name,

+ 7
- 2
react/features/invite/functions.js Parādīt failu

@@ -808,6 +808,7 @@ export function isSharingEnabled(sharingFeature: string) {
808 808
  * Sends a post request to an invite service.
809 809
  *
810 810
  * @param {Array} inviteItems - The list of the "sip" type items to invite.
811
+ * @param {URL} locationURL - The URL of the location.
811 812
  * @param {string} sipInviteUrl - The invite service that generates the invitation.
812 813
  * @param {string} jwt - The jwt token.
813 814
  * @param {string} roomName - The name to the conference.
@@ -816,6 +817,7 @@ export function isSharingEnabled(sharingFeature: string) {
816 817
  */
817 818
 export function inviteSipEndpoints( // eslint-disable-line max-params
818 819
         inviteItems: Array<Object>,
820
+        locationURL: URL,
819 821
         sipInviteUrl: string,
820 822
         jwt: string,
821 823
         roomName: string,
@@ -825,13 +827,15 @@ export function inviteSipEndpoints( // eslint-disable-line max-params
825 827
         return Promise.resolve();
826 828
     }
827 829
 
830
+    const baseUrl = locationURL.href.toLowerCase().replace(`/${roomName}`, '');
831
+
828 832
     return fetch(
829
-       `${sipInviteUrl}?token=${jwt}`,
833
+       sipInviteUrl,
830 834
        {
831 835
            body: JSON.stringify({
832 836
                callParams: {
833 837
                    callUrlInfo: {
834
-                       baseUrl: window.location.origin,
838
+                       baseUrl,
835 839
                        callName: roomName
836 840
                    }
837 841
                },
@@ -842,6 +846,7 @@ export function inviteSipEndpoints( // eslint-disable-line max-params
842 846
            }),
843 847
            method: 'POST',
844 848
            headers: {
849
+               'Authorization': `Bearer ${jwt}`,
845 850
                'Content-Type': 'application/json'
846 851
            }
847 852
        }

Notiek ielāde…
Atcelt
Saglabāt