This commit is contained in:
Dave Horton
2024-04-19 18:16:02 -04:00
parent 5750b9bd2b
commit 0c1caa04c7

View File

@@ -39,8 +39,8 @@ class OptionsBot {
writeAlerts({
account_sid: carrier.account_sid,
service_provider_sid: carrier.service_provider_sid,
message: `Options ping ${this.ipv4}${this.port ? `:${this.port}` : ''};transport=${this.protocol}
unsuccessfully, received: ${res.status}`
// eslint-disable-next-line max-len
message: `Options ping ${this.ipv4}${this.port ? `:${this.port}` : ''};transport=${this.protocol} unsuccessfully, received: ${res.status}`
});
}
}
@@ -53,8 +53,8 @@ class OptionsBot {
writeAlerts({
account_sid: carrier.account_sid,
service_provider_sid: carrier.service_provider_sid,
message: `Options ping ${this.ipv4}${this.port ? `:${this.port}` : ''};transport=${this.protocol}
unsuccessfully, error: ${err}`
// eslint-disable-next-line max-len
message: `Options ping ${this.ipv4}${this.port ? `:${this.port}` : ''};transport=${this.protocol} unsuccessfully, error: ${err}`
});
}
}
@@ -68,15 +68,17 @@ module.exports = async(logger, srf) => {
const { lookupSipGatewaysByFilters } = srf.locals.dbHelpers;
const gws = await lookupSipGatewaysByFilters({send_options_ping: true, outbound: true, is_active: true});
logger.info(`updateSipGatewayOptsBot: start sending Options to ${gws.length} destinations`);
send_options_gateways.length = 0;
send_options_gateways.push(...gws);
for (const g of send_options_gateways) {
const optsBot = new OptionsBot(logger, g);
send_options_bots.push(optsBot);
optsBot.options(srf);
if (gws.length > 0) {
logger.debug(`updateSipGatewayOptsBot: sending OPTIONS ping to ${gws.length} gateways`);
send_options_gateways.length = 0;
send_options_gateways.push(...gws);
for (const g of send_options_gateways) {
const optsBot = new OptionsBot(logger, g);
send_options_bots.push(optsBot);
optsBot.options(srf);
}
logger.debug(`updateSipGatewayOptsBot: we have started ${send_options_bots.length} optionsBots`);
}
logger.debug(`updateSipGatewayOptsBot: we have started ${send_options_bots.length} optionsBots`);
} catch (err) {
logger.error({ err }, 'updateSipGatewayOptsBot Error');
}