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
|
||||
|
||||
Generated
+5
-4
@@ -15,7 +15,7 @@
|
||||
"@jambonz/mw-registrar": "^0.2.7",
|
||||
"@jambonz/realtimedb-helpers": "^0.8.21",
|
||||
"@jambonz/stats-collector": "^0.1.10",
|
||||
"@jambonz/time-series": "^0.2.8",
|
||||
"@jambonz/time-series": "^0.5.4",
|
||||
"debug": "^4.4.3",
|
||||
"drachtio-mw-registration-parser": "^0.1.2",
|
||||
"drachtio-mw-response-time": "^1.0.2",
|
||||
@@ -596,9 +596,10 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@jambonz/time-series": {
|
||||
"version": "0.2.13",
|
||||
"resolved": "https://registry.npmjs.org/@jambonz/time-series/-/time-series-0.2.13.tgz",
|
||||
"integrity": "sha512-Kj+l+YUnI27zZA4qoPRzjN7L82W7GuMXYq9ttDjXQ0ZBIdOLAzJjB6R3jJ3b+mvoNEQ6qG5MUtfoc6CpTFH5lw==",
|
||||
"version": "0.5.4",
|
||||
"resolved": "https://registry.npmjs.org/@jambonz/time-series/-/time-series-0.5.4.tgz",
|
||||
"integrity": "sha512-XNGSsNdYSD9cdBoaZ4xOWbNBNMLMpd6lfJ/b6ws3D4rEQ3UYg/vDtnakW8XMjMTAHq8lGJNrLN7gMgF6JLoCZw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"debug": "^4.3.1",
|
||||
"influx": "^5.9.3"
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@
|
||||
"@jambonz/mw-registrar": "^0.2.7",
|
||||
"@jambonz/realtimedb-helpers": "^0.8.21",
|
||||
"@jambonz/stats-collector": "^0.1.10",
|
||||
"@jambonz/time-series": "^0.2.8",
|
||||
"@jambonz/time-series": "^0.5.4",
|
||||
"debug": "^4.4.3",
|
||||
"drachtio-mw-registration-parser": "^0.1.2",
|
||||
"drachtio-mw-response-time": "^1.0.2",
|
||||
|
||||
Reference in New Issue
Block a user