// src/services/voiceDiag/checks/wan/wanLoss.js // // Per-path WAN packet loss (LQM %, 0-100). Voice codec loss // tolerance: // - <= 1% : good (PLC hides it) // - 1-3% : warn (audible artifacts on longer calls) // - > 3% : error (words dropping, users repeating themselves) // // Both thresholds are env-configurable via WAN_STANDARD_LOSS_*. import { maybeSkippedByKillSwitch, getLinks, getLossWarnPct, getLossErrorPct, evaluatePerLinkMetric, } from './_helpers.js'; export const WAN_LOSS_STANDARDS = Object.freeze({ maxWarnPct: 1, maxErrorPct: 3, unit: '%', reference: 'G.711 PLC tolerance envelope', }); export const wanLossCheck = { id: 'wanLoss', label: 'SD-WAN Packet Loss (per path)', requires: ['sdwanSite'], scope: null, standards: WAN_LOSS_STANDARDS, async run(ctx) { const skip = maybeSkippedByKillSwitch(wanLossCheck); if (skip) return skip; const warnThresh = getLossWarnPct(); const errorThresh = getLossErrorPct(); return evaluatePerLinkMetric({ links: getLinks(ctx), metricKey: 'lossPct', label: 'packet loss', unit: '%', warnThresh, errorThresh, lowIsBad: false, standardLabel: `warn > ${warnThresh}%, error > ${errorThresh}%`, }); }, };