浏览代码

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 年前
父节点
当前提交
5599454ea9
没有帐户链接到提交者的电子邮件
共有 2 个文件被更改,包括 9 次插入2 次删除
  1. 2
    0
      react/features/invite/actions.any.js
  2. 7
    2
      react/features/invite/functions.js

+ 2
- 0
react/features/invite/actions.any.js 查看文件

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

+ 7
- 2
react/features/invite/functions.js 查看文件

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

正在加载...
取消
保存