collabSupport/services/voiceDiag/checks/wan/wanJitter.js
jmcqueen b802383441 Add Prisma SD-WAN voice-quality enrichment for /phonestatus + /voicediag
Introduces a full Palo Alto Prisma SD-WAN integration (dual-mode SASE
OAuth 2.0 / legacy CloudGenix auth, pagination, 429 backoff, session
priming) that surfaces per-path latency/jitter/loss/MOS, site
healthscore, link state, and alarm data for a store. Wired into the
/phonestatus WAN follow-up and eight new /voicediag WAN checks graded
against ITU-T G.114 / RFC 3550 defaults (env-overridable via
WAN_STANDARD_*).

Also adds a shape-aware detail renderer for /voicediag (per-link
tables with verdict icons instead of a stringified JSON dump) and a
--window flag (15m / 1h / 6h / 24h / 1d, env default via
WAN_STANDARD_WINDOW_MINUTES) so operators can widen the look-back
without redeploying. scripts/prismaProbe.js is bundled as a CLI for
schema iteration against a live tenant.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-09 09:45:29 -04:00

51 lines
1.3 KiB
JavaScript

// src/services/voiceDiag/checks/wan/wanJitter.js
//
// Per-path WAN jitter (LQM inter-packet arrival variation, ms) vs
// voice-quality references:
// - <= 30ms : good (jitter buffer handles it cleanly)
// - 30-50ms : warn (audible choppiness on longer calls)
// - > 50ms : error (jitter buffer starts dropping packets;
// garbled audio)
//
// Both thresholds are env-configurable via WAN_STANDARD_JITTER_*.
import {
maybeSkippedByKillSwitch,
getLinks,
getJitterWarnMs,
getJitterErrorMs,
evaluatePerLinkMetric,
} from './_helpers.js';
export const WAN_JITTER_STANDARDS = Object.freeze({
maxWarnMs: 30,
maxErrorMs: 50,
unit: 'ms',
reference: 'RFC 3550 jitter buffer sizing',
});
export const wanJitterCheck = {
id: 'wanJitter',
label: 'SD-WAN Jitter (per path)',
requires: ['sdwanSite'],
scope: null,
standards: WAN_JITTER_STANDARDS,
async run(ctx) {
const skip = maybeSkippedByKillSwitch(wanJitterCheck);
if (skip) return skip;
const warnThresh = getJitterWarnMs();
const errorThresh = getJitterErrorMs();
return evaluatePerLinkMetric({
links: getLinks(ctx),
metricKey: 'jitterMs',
label: 'jitter',
unit: 'ms',
warnThresh,
errorThresh,
lowIsBad: false,
standardLabel: `warn > ${warnThresh}ms, error > ${errorThresh}ms`,
});
},
};