From 5559a1c7693242465c1f8e368aeb121b3acabdd8 Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Wed, 17 Jan 2024 12:56:23 -0500 Subject: [PATCH] lookupAllVoipCarriers should not return carriers associated with inactive accounts --- lib/lookup-all-voip-carriers.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/lookup-all-voip-carriers.js b/lib/lookup-all-voip-carriers.js index 9ee0b3e..43915ba 100644 --- a/lib/lookup-all-voip-carriers.js +++ b/lib/lookup-all-voip-carriers.js @@ -1,6 +1,9 @@ const debug = require('debug')('jambonz:db-helpers'); -const sql = 'SELECT * FROM voip_carriers'; +// eslint-disable-next-line max-len +const sql = `SELECT * FROM voip_carriers +WHERE account_sid IS NULL +OR account_sid IN (SELECT account_sid FROM accounts WHERE is_active = 1)`; /** * Lookup all voip_carriers