feat(alias): add LOCAL_ALIASES to re-home short local TGs under an owned prefix
Re-home a short local talk group (e.g. 8) under the reflector's own owned prefix as a globally-unique number (e.g. 2620008) via a single [GLOBAL] LOCAL_ALIASES entry, so it routes across the trunk mesh like any owned TG while local users keep dialing the short number. - Config: LOCAL_ALIASES=localTG:aliasTG[/dir] (dir in|out, omitted = two-way); aliasTG must be owned by a LOCAL_PREFIX. Rejects unowned alias, an owned short side, duplicate short keys, and numeric overflow. - Boundary rewrite: prefix routing / owner-relay / peer-interest run on the long owned number; local delivery and talker arbitration run on the short number, bridged in the four inbound trunk handlers. - Rewrite-on-select folds a client that dials the long number onto the short number (select + monitor), so the two are one conversation locally and on the mesh. - Twin: external-talker notify uses the short number to match the audio mirror; disconnect cleanup folds to short so an aliased TG cannot wedge. - /status exposes local_aliases; satellite nodes warn that the setting is ignored (a local alias belongs on the mesh parent that owns the prefix). - Docs (PEER_PROTOCOL, CONCEPTS, conf template) and integration tests (tests/test_alias.py): two-way / in / out, rewrite-on-select, status, validation, disconnect-wedge, and duplicate-key coverage.
This commit is contained in:
1 parent
7e625dd514
commit
5da075f150
12 files changed
+1187
-64
No files matched your search
@@ -185,6 +185,47 @@ A listener on each is monitoring TG `25` (owned by **B**).
|
||||
|
||||
---
|
||||
|
||||
## 9. Local aliases: giving a short TG a global number
|
||||
|
||||
Section 2 established the rule: a number is only reachable mesh-wide if its
|
||||
prefix is owned by a reflector. That leaves a common problem — a club or
|
||||
region wants a short, easy-to-remember local TG (e.g. `8`) that its own users
|
||||
already dial, but also wants it reachable from anywhere in the mesh by a
|
||||
proper globally-unique number under the reflector's own prefix (e.g.
|
||||
`2620008` under `LOCAL_PREFIX=262`). Renumbering the local TG isn't
|
||||
attractive, and neither is asking every peer to special-case it.
|
||||
|
||||
`LOCAL_ALIASES` re-homes the short TG under the long, owned number: the
|
||||
reflector treats `8` and `2620008` as the same conversation, uses the long
|
||||
number for everything that crosses the mesh (routing, owner-relay), and the
|
||||
short number for everything local clients see (selection, talker
|
||||
arbitration). Local users keep dialing `8`; anyone elsewhere in the mesh
|
||||
reaches the same traffic by dialing `2620008`.
|
||||
|
||||
This sits alongside two other tools that shape TG reachability, and it's easy
|
||||
to reach for the wrong one:
|
||||
|
||||
- **`CLUSTER_TGS`** (section 5) is for TGs that **every** participating
|
||||
reflector already agrees to broadcast everywhere, regardless of ownership —
|
||||
a nationwide or mesh-wide talk group both sides opted into.
|
||||
- **`TG_MAP`** (per `[TRUNK_x]` section) is a **per-link** curated remap: it
|
||||
translates one TG number to another on a single trunk, so it must be
|
||||
repeated identically on every link that needs it, and it is invisible to
|
||||
hops beyond that one link.
|
||||
- **Local alias** re-homes a curated subset of your own local TGs under a
|
||||
number you already own, once, in `[GLOBAL]`. Because the long number is a
|
||||
real, longest-prefix-matched, owned number, it routes across every hop in
|
||||
the mesh exactly like any other owned TG — no per-link repetition, and no
|
||||
cooperation required from peers or intermediate gateways.
|
||||
|
||||
The underlying rule doesn't change: anything meant to be reachable
|
||||
internationally must have one unique number that falls under a country (MCC)
|
||||
prefix. A local alias doesn't create an exception to that — it's a way to let
|
||||
a short, locally-convenient number satisfy it without forcing local users to
|
||||
dial the long form.
|
||||
|
||||
---
|
||||
|
||||
## Where to go next
|
||||
|
||||
- [`PEER_PROTOCOL.md`](PEER_PROTOCOL.md) — the exact messages, handshake, and
|
||||
|
||||
@@ -726,6 +726,9 @@ The `/status` JSON endpoint includes a `trunks` object alongside `nodes`:
|
||||
"200": "LA8PV"
|
||||
}
|
||||
}
|
||||
},
|
||||
"local_aliases": {
|
||||
"8": { "alias": 2620008, "direction": "two-way" }
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -733,6 +736,14 @@ The `/status` JSON endpoint includes a `trunks` object alongside `nodes`:
|
||||
`active_talkers` contains only TGs with an active remote talker at the moment
|
||||
of the request. It is empty when no trunk conversations are in progress.
|
||||
|
||||
`local_aliases` is keyed by the short local TG and lists every configured
|
||||
`LOCAL_ALIASES` entry: `alias` is the long, mesh-routable number it is
|
||||
re-homed under, and `direction` is `"two-way"`, `"in"`, or `"out"` (see
|
||||
"Local aliases" below). Note that this is the *local* view — `active_talkers`
|
||||
above (and MQTT/Redis mirrors of it) report the long mesh number for aliased
|
||||
traffic, since that is the identity used for routing, while local clients
|
||||
experience the short number.
|
||||
|
||||
---
|
||||
|
||||
## Configuration
|
||||
@@ -807,6 +818,61 @@ SECRET=secret_bc
|
||||
REMOTE_PREFIX=2
|
||||
```
|
||||
|
||||
### Local aliases
|
||||
|
||||
`LOCAL_ALIASES` (in `[GLOBAL]`) re-homes a short local TG under one of this
|
||||
reflector's own `LOCAL_PREFIX` values, so it gets a globally-unique number
|
||||
reachable from anywhere in the mesh while local users keep dialing the short
|
||||
number:
|
||||
|
||||
```ini
|
||||
[GLOBAL]
|
||||
LOCAL_PREFIX=262
|
||||
LOCAL_ALIASES=8:2620008,9:2620009/out,4001:2620400/in
|
||||
```
|
||||
|
||||
**Syntax.** Comma-separated entries of the form `localTG:aliasTG[/dir]`.
|
||||
`dir` is `in` or `out`; when omitted the alias is two-way.
|
||||
|
||||
**Ownership rule.** `aliasTG` must fall under one of this reflector's
|
||||
`LOCAL_PREFIX` values (checked with the same longest-prefix match used for
|
||||
TG ownership everywhere else). An entry whose `aliasTG` is not owned is
|
||||
rejected at config load — logged as an error and skipped — so a typo can
|
||||
never claim a number the reflector doesn't own; the reflector still starts
|
||||
and the remaining valid entries take effect.
|
||||
|
||||
**Direction semantics.**
|
||||
- **two-way** (no suffix): talk on the short local TG is exported to the
|
||||
mesh under the long number, and traffic arriving from the mesh on the
|
||||
long number is delivered to local clients on the short number.
|
||||
- **`/out`**: local talk is exported to the mesh under the long number, but
|
||||
inbound mesh traffic on the long number is *not* folded back to the short
|
||||
number — the alias is publish-only.
|
||||
- **`/in`**: mesh traffic on the long number is delivered locally on the
|
||||
short number, but the short number is *not* exported to the mesh — the
|
||||
alias is listen-only.
|
||||
|
||||
**Rewrite-on-select.** A client — local or remote — that dials the long
|
||||
alias number directly is folded onto the short number as soon as it
|
||||
selects or monitors that TG, so `8` and `2620008` are always the same
|
||||
conversation locally; there is no way to end up split across both numbers
|
||||
on this reflector.
|
||||
|
||||
**Routing on long, delivery on short.** The alias is a translation applied
|
||||
at the local-client / trunk-mesh boundary, not a rename. All prefix
|
||||
routing, owner-relay fan-out, and peer-interest bookkeeping run on the
|
||||
*long* number, because that is the identity the rest of the mesh sees and
|
||||
uses for longest-prefix-match. All local delivery and talker arbitration
|
||||
(which client currently holds the TG, PTT interruption, monitor filters,
|
||||
mute) run on the *short* number, because that is what local clients
|
||||
select and expect to see. One documented consequence: `/status.local_aliases`
|
||||
(above) is the local, short-keyed view of the mapping, but
|
||||
`/status.active_talkers` in a trunk's status block — and the equivalent
|
||||
MQTT/Redis mirrors — report the *long* mesh number while local clients are
|
||||
simultaneously experiencing the *short* number for the same transmission.
|
||||
This is intentional: it reflects the two identities (mesh-routing vs.
|
||||
local-delivery) the alias deliberately keeps separate.
|
||||
|
||||
---
|
||||
|
||||
## Files Changed vs Upstream SvxLink
|
||||
|
||||
Reference in new issue
Block a user