This commit is contained in:
Quan HL
2025-06-23 08:50:26 +07:00
parent 9ad56af553
commit a36dd8d92e
+12 -11
View File
@@ -210,17 +210,8 @@ const updateCarrierRegbots = async(logger, srf) => {
}
if (JSON.stringify(gws) !== JSON.stringify(gateways)) hasChanged = true;
// find account_sip_realm for each gateway if it associated with an account
for (const gw of gws) {
if (gw.carrier.account_sid) {
const account = await lookupAccountBySid(gw.carrier.account_sid);
if (account && account.sip_realm) {
gw.account_sip_realm = account.sip_realm;
}
}
}
if (hasChanged) {
debug('updateCarrierRegbots: got new or changed carriers');
logger.info('updateCarrierRegbots: got new or changed carriers');
carriers.length = 0;
@@ -235,7 +226,17 @@ const updateCarrierRegbots = async(logger, srf) => {
// start new regbots
let batch_count = 0;
for (const gw of getUniqueGateways(gateways, logger)) {
const uniqueGateways = getUniqueGateways(gateways, logger);
// find account_sip_realm for each gateway if it associated with an account
for (const gw of uniqueGateways) {
if (gw.carrier.account_sid) {
const account = await lookupAccountBySid(gw.carrier.account_sid);
if (account && account.sip_realm) {
gw.account_sip_realm = account.sip_realm;
}
}
}
for (const gw of uniqueGateways) {
try {
const rb = new Regbot(logger, {
voip_carrier_sid: gw.carrier.voip_carrier_sid,