adds conference to lookup of dial in numbers (#3859)

This commit is contained in:
Aaron van Meerten 2019-02-01 21:10:34 -06:00 committed by virtuacoplenny
parent c998dbb47e
commit b9a14acd3c
3 changed files with 28 additions and 6 deletions

View File

@ -174,7 +174,7 @@ export function updateDialInNumbers() {
const { room } = state['features/base/conference'];
Promise.all([
getDialInNumbers(dialInNumbersUrl),
getDialInNumbers(dialInNumbersUrl, room, mucURL),
getDialInConferenceID(dialInConfCodeUrl, room, mucURL)
])
.then(([ dialInNumbers, { conference, id, message } ]) => {

View File

@ -190,13 +190,25 @@ class DialInSummary extends Component<Props, State> {
* @returns {Promise}
*/
_getNumbers() {
const { dialInNumbersUrl } = config;
const { room } = this.props;
const { dialInNumbersUrl, hosts } = config;
const mucURL = hosts && hosts.muc;
let URLSuffix = '';
if (!dialInNumbersUrl) {
return Promise.reject(this.props.t('info.dialInNotSupported'));
}
return fetch(dialInNumbersUrl)
// when room and mucURL are available
// provide conference when looking up dial in numbers
if (room && mucURL) {
URLSuffix = `?conference=${room}@${mucURL}`;
}
const conferenceIDURL
= `${dialInNumbersUrl}${URLSuffix}`;
return fetch(conferenceIDURL)
.then(response => response.json())
.catch(() => Promise.reject(this.props.t('info.genericError')));
}

View File

@ -56,12 +56,22 @@ export function getDialInConferenceID(
* Sends a GET request for phone numbers used to dial into a conference.
*
* @param {string} url - The service that returns confernce dial-in numbers.
* @param {string} roomName - The conference name to find the associated
* conference ID.
* @param {string} mucURL - In which MUC the conference exists.
* @returns {Promise} - The promise created by the request. The returned numbers
* may be an array of numbers or an object with countries as keys and arrays of
* phone number strings.
*/
export function getDialInNumbers(url: string): Promise<*> {
return doGetJSON(url);
export function getDialInNumbers(
url: string,
roomName: string,
mucURL: string
): Promise<*> {
const fullUrl = `${url}?conference=${roomName}@${mucURL}`;
return doGetJSON(fullUrl);
}
/**
@ -442,7 +452,7 @@ export function getShareInfoText(
}
numbersPromise = Promise.all([
getDialInNumbers(dialInNumbersUrl),
getDialInNumbers(dialInNumbersUrl, room, mucURL),
getDialInConferenceID(dialInConfCodeUrl, room, mucURL)
]).then(([ { defaultCountry, numbers }, {
conference, id, message } ]) => {