Commit Graph
13 Commits
Author SHA1 Message Date
Dave HortonandClaude Opus 5.5 f5c675952a feat: per-SBC registration Call-ID, and hand off the regbot role on AWS scale-in (#156)
The Call-ID of outbound registrations was the sip_gateway_sid, the same on
every SBC. When the regbot role moved to the other SBC, the registrar saw a
refresh of an existing binding from a different source address and Contact.
Some registrars 200 such a refresh without updating their routing, so inbound
calls to the registered trunk fail with 404 until the binding is recreated.
The Call-ID is now sip_gateway_sid@<sending SBC public IP>: stable across
refreshes and restarts of one SBC, new when the role moves, so a move looks
like a new registration. register_status also records the sending SBC as
sbcAddress.

With AWS_LIFECYCLE_DRAIN enabled the sidecar polls IMDS
autoscaling/target-lifecycle-state (the signal inbound drains on; detection
only, inbound completes the lifecycle hook). When the instance is being scaled
in, the regbot holder releases the lease while still running instead of after
the instance is gone; until now the draining SBC kept the registrations, so
carriers kept sending registration-trunk calls to an SBC that answers new
INVITEs with 503. It never claims the role back. Once another SBC has claimed
it, the draining SBC un-REGISTERs (Expires: 0) the bindings whose Contact
carries its own IP. Bindings with an AoR or realm Contact are left alone: the
new SBC sends the same Contact, and its REGISTER has already replaced ours.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 13:33:36 -04:00
Dave HortonandClaude Fable 5.1 b51362ac04 fix: shared-roster expiry and sbc_addresses keepalive (two-SBC cutover bugs) (#153)
* fix: expire FS/RTP roster members on shared last-seen, not one SBC's local view

The active-fs, fs-service-url and active-rtp redis sets are shared by every
SBC in the cluster, but the expiry sweep in lib/options.js removed members
based solely on when THIS sidecar last received an OPTIONS ping from them.
An SBC that was taken out of active-sip (so FS/RTP servers stopped pinging
it) therefore deleted every feature server and rtpengine from the shared
rosters 60s later, rejecting all inbound calls until the other SBC re-added
them on its next ping cycle.

Each SBC now records the last ping it received per member in a shared redis
hash (<setName>:lastseen, member -> epoch ms) and the sweep removes a member
only when that shared timestamp is older than EXPIRES_INTERVAL. Members with
no shared timestamp are never expired by the sweep, so a parked or
mixed-version SBC cannot remove members the others are still hearing from.

Adds a unit test that reproduces the failure against the old code.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* fix: make sbc_addresses keepalive recurring instead of a single setTimeout

addSbcAddress() refreshes the row's last_updated and cleanSbcAddresses()
deletes rows older than DEAD_SBC_IN_SECOND (default 3600s), but app.js only
re-called addSbcAddress once, 15 minutes after connecting. The row then
went stale, and the next sidecar to start anywhere in the cluster deleted
the healthy SBC's row, so new sip realms were provisioned with one SBC IP
instead of two.

Run one recurring timer (SBC_PUBLIC_ADDRESS_KEEP_ALIVE_IN_MILISECOND, default
15 min) that refreshes this SBC's rows and only then reaps stale ones, so the
cleaner never runs ahead of this process's own keepalive. The timer is
unref'd and replaced (not stacked) on drachtio reconnect.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-21 10:58:05 -04:00
Sam Machin ce05d91e6d restart regbots on drachtio reconnect (#151)
* restart regbots on drachtio reconnect

* PR feedback

* add check for multiple regbot instances
2026-09-09 15:02:23 +01:00
Ed RobbinsandClaude Opus 4.6 2f2f522133 fix: prevent concurrent regbot rebuilds, raise min expires (#147)
* fix: add mutex to prevent concurrent regbot rebuilds (#2719)

updateCarrierRegbots was called via .then() (not awaited) from checkStatus,
allowing concurrent invocations to race on the shared regbots array. The
last writer wins, and concurrent cleanup can stop() regbots still in use,
permanently breaking their timer chain.

Add a boolean mutex (rebuildInProgress) with try/finally to skip concurrent
invocations. Promote rebuild completion log from debug to info for production
visibility. Add standalone test demonstrating both the bug and the fix.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* raise default minimum registration expires from 30s to 90s

Prevents overly aggressive re-registration cycles when the registrar
returns a short Expires value, reducing regbot churn.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-08-19 08:28:08 -04:00
Hoan Luu Huu 55ace7820f Feat/cli remove fs (#116)
* support draining feature server manually

* support draining feature server manually

* support CLI to add or remove feature server

* wip

* wip

* wip

* add redis key for feature server and integration test

* wip
2025-10-28 19:26:24 -04:00
Dave Horton e94ae431d8 add support for registration trunks which result in a set of ephemera… (#112)
* add support for registration trunks which result in a set of ephemeral sip gateways to be stored in redis

* wip

* refactor createEphemeralGateways into realtime dbhelpers

* minor

* update eslint
2025-10-21 07:32:06 -04:00
Hoan Luu Huu e687d772d8 fix regbot issue with invalid sip_realm (#79)
* fix regbot issue with invalid sip_realm

* wip

* wip

* wip
2025-02-04 23:57:33 -05:00
Markus FrindtandMarkus Frindt b190d8a312 improvement of ipv4 regex and test cases (#73)
* improvement of ipv4 regex and test cases

* require utils test

* change example

---------

Co-authored-by: Markus Frindt <m.frindt@cognigy.com>
2024-08-21 11:47:06 -04:00
Quan HL 07bcea7116 fix: failing testcase 2023-06-23 17:45:10 +07:00
Quan HL 6eebe379a6 feat:update fs server url to redis 2023-06-23 17:35:43 +07:00
Dave Horton c5ac53ce37 revamp algorithm to determine whether to become the active regbot in a cluster 2022-10-20 23:02:53 -04:00
Quan Luu da57ab4212 feat: merge sip-registra and sip-options-handler 2022-09-09 16:26:14 +07:00
Quan Luu 933059f262 first version 2022-09-01 07:36:35 +07:00