diff options
Diffstat (limited to 'src/api/util/handlers/Voice.ts')
-rw-r--r-- | src/api/util/handlers/Voice.ts | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/api/util/handlers/Voice.ts b/src/api/util/handlers/Voice.ts index 4d60eb91..88e266a1 100644 --- a/src/api/util/handlers/Voice.ts +++ b/src/api/util/handlers/Voice.ts @@ -3,7 +3,9 @@ import { distanceBetweenLocations, IPAnalysis } from "../utility/ipAddress"; export async function getVoiceRegions(ipAddress: string, vip: boolean) { const regions = Config.get().regions; - const availableRegions = regions.available.filter((ar) => (vip ? true : !ar.vip)); + const availableRegions = regions.available.filter((ar) => + vip ? true : !ar.vip, + ); let optimalId = regions.default; if (!regions.useDefaultAsOptimal) { @@ -13,7 +15,10 @@ export async function getVoiceRegions(ipAddress: string, vip: boolean) { for (let ar of availableRegions) { //TODO the endpoint location should be saved in the database if not already present to prevent IPAnalysis call - const dist = distanceBetweenLocations(clientIpAnalysis, ar.location || (await IPAnalysis(ar.endpoint))); + const dist = distanceBetweenLocations( + clientIpAnalysis, + ar.location || (await IPAnalysis(ar.endpoint)), + ); if (dist < min) { min = dist; @@ -27,6 +32,6 @@ export async function getVoiceRegions(ipAddress: string, vip: boolean) { name: ar.name, custom: ar.custom, deprecated: ar.deprecated, - optimal: ar.id === optimalId + optimal: ar.id === optimalId, })); } |