|
@@ -20,17 +20,6 @@ export function checkDialNumber(
|
20
|
20
|
dialNumber: string,
|
21
|
21
|
dialOutAuthUrl: string
|
22
|
22
|
): Promise<Object> {
|
23
|
|
-
|
24
|
|
- if (!dialOutAuthUrl) {
|
25
|
|
- // no auth url, let's say it is valid
|
26
|
|
- const response = {
|
27
|
|
- allow: true,
|
28
|
|
- phone: `+${dialNumber}`
|
29
|
|
- };
|
30
|
|
-
|
31
|
|
- return Promise.resolve(response);
|
32
|
|
- }
|
33
|
|
-
|
34
|
23
|
const fullUrl = `${dialOutAuthUrl}?phone=${dialNumber}`;
|
35
|
24
|
|
36
|
25
|
return new Promise((resolve, reject) => {
|
|
@@ -159,10 +148,18 @@ export function getInviteResultsForQuery(
|
159
|
148
|
}
|
160
|
149
|
|
161
|
150
|
|
162
|
|
- const hasCountryCode = text.startsWith('+');
|
|
151
|
+ let hasCountryCode = text.startsWith('+');
|
163
|
152
|
let phoneNumberPromise;
|
164
|
153
|
|
165
|
|
- if (dialOutEnabled && isMaybeAPhoneNumber(text)) {
|
|
154
|
+ // Phone numbers are handled a specially to enable both cases of restricting
|
|
155
|
+ // numbers to telephone number-y numbers and accepting any arbitrary string,
|
|
156
|
+ // which may be valid for SIP (jigasi) calls. If the dialOutAuthUrl is
|
|
157
|
+ // defined, then it is assumed the call is to a telephone number and
|
|
158
|
+ // some validation of the number is completed, with the + sign used as a way
|
|
159
|
+ // for the UI to detect and enforce the usage of a country code. If the
|
|
160
|
+ // dialOutAuthUrl is not defined, accept anything because this is assumed
|
|
161
|
+ // to be the SIP (jigasi) case.
|
|
162
|
+ if (dialOutEnabled && dialOutAuthUrl && isMaybeAPhoneNumber(text)) {
|
166
|
163
|
let numberToVerify = text;
|
167
|
164
|
|
168
|
165
|
// When the number to verify does not start with a +, we assume no
|
|
@@ -178,6 +175,16 @@ export function getInviteResultsForQuery(
|
178
|
175
|
numberToVerify = getDigitsOnly(numberToVerify);
|
179
|
176
|
|
180
|
177
|
phoneNumberPromise = checkDialNumber(numberToVerify, dialOutAuthUrl);
|
|
178
|
+ } else if (dialOutEnabled && !dialOutAuthUrl) {
|
|
179
|
+ // fake having a country code to hide the country code reminder
|
|
180
|
+ hasCountryCode = true;
|
|
181
|
+
|
|
182
|
+ // With no auth url, let's say the text is a valid number
|
|
183
|
+ phoneNumberPromise = Promise.resolve({
|
|
184
|
+ allow: true,
|
|
185
|
+ country: '',
|
|
186
|
+ phone: text
|
|
187
|
+ });
|
181
|
188
|
} else {
|
182
|
189
|
phoneNumberPromise = Promise.resolve({});
|
183
|
190
|
}
|