mirror of
https://github.com/jambonz/sbc-sip-sidecar.git
synced 2026-10-04 02:04:20 +00:00
fix: set alert_type on OPTIONS-ping and registration alerts (#154)
* fix: set alert_type on OPTIONS-ping and registration alerts The three writeAlerts() calls in sip-trunk-options-ping.js and the two in regbot.js omitted alert_type, so the alerts were stored as 'undefined'. Use AlertType.SIP_GATEWAY_OPTIONS_FAILURE / SIP_GATEWAY_REGISTRATION_FAILURE. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: bump @jambonz/time-series to ^0.5.4 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
b51362ac04
commit
c58a1fc925
+3
-1
@@ -176,7 +176,7 @@ class Regbot {
|
||||
async register(srf) {
|
||||
const { createEphemeralGateway } = srf.locals.realtimeDbHelpers;
|
||||
const { updateVoipCarriersRegisterStatus } = srf.locals.dbHelpers;
|
||||
const { writeAlerts, localSIPDomain } = srf.locals;
|
||||
const { writeAlerts, AlertType, localSIPDomain } = srf.locals;
|
||||
// stamp this attempt so a late/stale response (e.g. after a watchdog-driven retry) is ignored
|
||||
const epoch = ++this.epoch;
|
||||
try {
|
||||
@@ -283,6 +283,7 @@ class Regbot {
|
||||
// eslint-disable-next-line max-len
|
||||
this.logger.info(`Disabling Outbound Registration for carrier ${carrier.name} (sid:${carrier.voip_carrier_sid})`);
|
||||
writeAlerts({
|
||||
alert_type: AlertType.SIP_GATEWAY_REGISTRATION_FAILURE,
|
||||
account_sid: carrier.account_sid,
|
||||
service_provider_sid: carrier.service_provider_sid,
|
||||
// eslint-disable-next-line max-len
|
||||
@@ -293,6 +294,7 @@ class Regbot {
|
||||
// eslint-disable-next-line max-len
|
||||
this.logger.info(`Deactivating carrier ${carrier.name} (sid:${carrier.voip_carrier_sid}) due to registration errors`);
|
||||
writeAlerts({
|
||||
alert_type: AlertType.SIP_GATEWAY_REGISTRATION_FAILURE,
|
||||
account_sid: carrier.account_sid,
|
||||
service_provider_sid: carrier.service_provider_sid,
|
||||
// eslint-disable-next-line max-len
|
||||
|
||||
@@ -25,7 +25,7 @@ class OptionsBot {
|
||||
|
||||
async options(srf) {
|
||||
const { lookupCarrierBySid } = srf.locals.dbHelpers;
|
||||
const { writeAlerts, logger, realtimeDbHelpers } = srf.locals;
|
||||
const { writeAlerts, AlertType, logger, realtimeDbHelpers } = srf.locals;
|
||||
try {
|
||||
const req = await srf.request({
|
||||
uri: this.uri,
|
||||
@@ -43,6 +43,7 @@ class OptionsBot {
|
||||
const carrier = await lookupCarrierBySid(this.voip_carrier_sid);
|
||||
if (carrier) {
|
||||
writeAlerts({
|
||||
alert_type: AlertType.SIP_GATEWAY_OPTIONS_FAILURE,
|
||||
account_sid: carrier.account_sid,
|
||||
service_provider_sid: carrier.service_provider_sid,
|
||||
// eslint-disable-next-line max-len
|
||||
@@ -58,6 +59,7 @@ class OptionsBot {
|
||||
// eslint-disable-next-line max-len
|
||||
this.logger.info(`Disabling Options ping for ${this.ipv4} in carrier ${carrier.name}:${carrier.voip_carrier_sid} due to ${res.status}`);
|
||||
writeAlerts({
|
||||
alert_type: AlertType.SIP_GATEWAY_OPTIONS_FAILURE,
|
||||
account_sid: carrier.account_sid,
|
||||
service_provider_sid: carrier.service_provider_sid,
|
||||
// eslint-disable-next-line max-len
|
||||
@@ -80,6 +82,7 @@ class OptionsBot {
|
||||
const carrier = await lookupCarrierBySid(this.voip_carrier_sid);
|
||||
if (carrier) {
|
||||
writeAlerts({
|
||||
alert_type: AlertType.SIP_GATEWAY_OPTIONS_FAILURE,
|
||||
account_sid: carrier.account_sid,
|
||||
service_provider_sid: carrier.service_provider_sid,
|
||||
// eslint-disable-next-line max-len
|
||||
|
||||
Reference in New Issue
Block a user