Compare commits

...
47 Commits
Author SHA1 Message Date
DeFiDude 19ac89ec7a ci: pin rsReticulum f6d0d69 2026-11-20 12:57:55 -07:00
DeFiDude 92baad3898 ci: pin rsReticulum 54c8525 2026-11-19 20:53:05 -07:00
DeFiDude 09a47976fb ci: pin rsReticulum 5e35c9f 2026-11-19 09:33:11 -07:00
DeFiDude 4370a4153a build: lock rsReticulum 1.5.1 in the API fixtures 2026-11-19 09:32:57 -07:00
DeFiDude e9e053a038 ci: pin rsReticulum 0ce5a12 2026-11-19 08:55:25 -07:00
DeFiDude fe3128964b api: record the rsReticulum ~1.5.1 requirement 2026-11-19 08:49:37 -07:00
DeFiDude f323457be5 ci: pin rsReticulum 3d53958 (1.5.1) and Python Reticulum 1.6.1 2026-11-19 07:54:35 -07:00
DeFiDude f52c805d7b ci: the live telephone tests follow Python Reticulum 1.6.1 2026-11-18 20:07:41 -07:00
DeFiDude 0a5c434fc8 tests: Rust telephones announce unstamped unless a test sets the stamp policy 2026-11-18 20:07:41 -07:00
DeFiDude d41528031f tests: the Python Telephone helper stamps announces only when a test asks, as before Reticulum 1.6.1 2026-11-18 20:07:28 -07:00
DeFiDude b39e23cbec ci: pin rsReticulum 184bbfe 2026-11-15 10:08:18 -07:00
DeFiDude 2b04b62e79 ci: pin rsReticulum 81e6188 2026-11-15 08:51:57 -07:00
DeFiDude 7511e99bf1 ci: pin rsReticulum 0680941 2026-11-15 07:21:03 -07:00
DeFiDude c140942a13 tests: Python call pairs compare media in any arrival order 2026-11-15 06:56:25 -07:00
DeFiDude ff602499fa tests: media waits for the caller's audio and takes Python's frames in any order 2026-11-15 06:46:02 -07:00
DeFiDude 7e6e962746 tests: the late-connection announce observer does not announce itself 2026-11-15 05:21:46 -07:00
DeFiDude e8a3a67132 ci: pin rsReticulum cce85ec 2026-11-15 00:26:59 -07:00
DeFiDude 2a7357e0d1 ci: pin rsReticulum 1.5.0 2026-11-14 19:39:17 -07:00
DeFiDude ed9dfdd74b docs: README and changelog for 0.4.0 2026-11-14 00:02:11 -07:00
DeFiDude e01e28693d build: version 0.4.0 on rsReticulum 1.5, with the API baselines and migration guide 2026-11-13 23:06:53 -07:00
DeFiDude 131b592355 build: lock file gains the SQLite dependencies 2026-11-13 11:25:03 -07:00
DeFiDude 958c7f7932 tests: follow the transport's non-exhaustive RPC entries 2026-11-13 11:25:03 -07:00
DeFiDude 15a749ed48 tests: build live test interface entries through the constructor 2026-11-13 10:12:42 -07:00
DeFiDude 73947604ba tests: cover calls across a relay of the other implementation 2026-11-12 16:34:50 -07:00
DeFiDude 0b2a55aadd opus: the Medium profile stays wideband, set explicitly 2026-11-12 16:33:43 -07:00
DeFiDude edc6187472 opus: update opus-rs to 0.1.42 and encode the Medium profile narrowband 2026-11-12 11:06:08 -07:00
DeFiDude 4613264079 opus: reject a packet that panics the decoder and reset the decoder 2026-11-12 10:46:01 -07:00
DeFiDude db48665199 tests: cite upstream files without line numbers in comments 2026-11-12 06:58:08 -07:00
DeFiDude 74b0fb8fd8 api: move the compatibility floor past the async outgoing link calls 2026-11-12 05:27:11 -07:00
DeFiDude aeb400006b api: update the baselines and draft the next release's migration guide 2026-11-12 05:27:02 -07:00
DeFiDude a2f19db8ea telephony: the live interop test registers its server interface 2026-11-12 00:14:50 -07:00
DeFiDude 9f84f6e466 tests: read the reference checkouts from the upstream directory 2026-11-11 21:15:57 -07:00
DeFiDude 6394464f11 telephony: the test transport answers the next-hop MTU query 2026-11-11 21:15:57 -07:00
DeFiDude 9c70a9d67e ci: check against LXST 0.6.0 and Reticulum 1.6.0 2026-11-11 04:19:13 -07:00
DeFiDude 57171563b0 telephony: stamp the link requests that open calls 2026-11-10 13:37:20 -07:00
DeFiDude 56da627f6b build: update the lockfile for the runtime's tempfile dependency 2026-11-10 09:56:26 -07:00
DeFiDude 585405cb3b telephony: announce through the stamped announce builder 2026-11-10 08:41:20 -07:00
DeFiDude 54f8711730 telephony: establish the caller sooner; embedded call times can be set 2026-11-10 05:18:02 -07:00
DeFiDude f4d6daab25 tests: follow the transport path entry and drop-path reply types 2026-11-10 02:16:22 -07:00
DeFiDude cd66bad49a api: move the compatibility floor past the removed answer-retry items 2026-11-10 01:52:31 -07:00
DeFiDude 1c037655b2 telephony: match LXST 0.6.0 signalling, profiles, and call modes 2026-11-10 01:51:43 -07:00
DeFiDude cb857c69d0 Release 0.3.1 2026-11-08 11:55:13 -07:00
DeFiDude dff93e73af telephony: wake for the next announce instead of waiting on the idle tick 2026-11-08 06:29:14 -07:00
DeFiDude b6d7d921f5 Replace invalid AGPL license with the LXST license
This repository is a port of LXST, whose reference implementation is published
under CC BY-NC-ND 4.0. The AGPL-3.0-or-later grant previously in LICENSE was
never effective, because there was no right to place the derived code under
AGPL terms. LICENSE now states the terms under which Mark Qvist licenses this
port for Ratspeak, and those terms govern every revision in this repository's
history.
2026-11-07 19:26:04 -07:00
DeFiDude 65c21b6e94 telephony: keep the idle poll interval private 2026-11-05 09:35:25 -07:00
DeFiDude c95af2b0ae telephony: wake on link events and poll once a second when idle 2026-11-05 02:43:54 -07:00
DeFiDude 2c680d8028 docs: refresh guides and reference help 2026-11-02 11:13:51 -07:00
60 changed files with 5145 additions and 1899 deletions

No files matched your search

+7 -4
View File
@@ -10,10 +10,10 @@ permissions:
contents: read
env:
RSLXST_RSRETICULUM_VERSION: 1.4.0
RSLXST_RSRETICULUM_COMMIT: bf7d16fc36045b6d33ca0d4c85d2b35b1b20751f
RSLXST_PYTHON_LXST_COMMIT: 1194c9011fe6402edc7aebe7ffe9650ea3b1afee
RSLXST_PYTHON_RNS_COMMIT: b48b96e61676504e0a4e527b33b9a0b4495c6872
RSLXST_RSRETICULUM_VERSION: 1.5.1
RSLXST_RSRETICULUM_COMMIT: f6d0d698dd7e6edc180f9c3697ab1c873571f372
RSLXST_PYTHON_LXST_COMMIT: 6a329bf6d956ca8b15077d4c470afe4cb7c669cc
RSLXST_PYTHON_RNS_COMMIT: cff4d03fdbd6bfb63b765280cd944756ac5cce8d
jobs:
api-compat:
@@ -147,6 +147,9 @@ jobs:
run: brew install opus libogg
- name: Install Python interop deps
run: python -m pip install --upgrade pip && python -m pip install numpy cryptography pyserial cffi "audioop-lts; python_version >= '3.13'"
# The voice relay interop tests run an rnsd-rs transport node.
- run: cargo build -p rns-tools --bin rnsd-rs --locked
working-directory: rsReticulum
- run: cargo test --workspace --locked
working-directory: rsLXST
+31 -1
View File
@@ -2,6 +2,36 @@
## Unreleased
## 0.4.0 - 2026-11-13
### Added
- **Call modes**: calls can be full or half duplex, as in LXST 0.6.0, and switch during a call. `TelephonyControl::Call` takes a `mode`; `None` is full duplex.
- **Stamped calls**: call announces and link requests carry stamps when Reticulum's `[stamps]` settings ask for them, and call links use Link MTU discovery.
### Fixed and improved
- Calls connect as in LXST 0.6.0: the callee is established as soon as it answers, and a lost setup packet no longer ends a call. Check `audio_started` to know when audio is running.
- An outgoing call ends if the callee doesn't ring within `connect_timeout` (5 seconds by default), and the line is busy while a call looks for its path.
- `lxst-embedded` sessions use LXST 0.6.0's ring, wait, and connect times; change them with `SessionConfig::times`.
- The first announce goes out 5 seconds after start, with no startup burst by default.
- `opus-rs` 0.1.42 fixes a decoder crash on a crafted packet, and a damaged frame is now skipped instead of dropping its whole packet.
### Build and compatibility
- rsLXST now uses rsReticulum `~1.5.0`, whose default storage builds a bundled SQLite and needs a C compiler.
- API changes, including the removed answer retry, call modes, and async outgoing link calls, are listed in the [migration guide](api/migrations/next.md).
## 0.3.1 - 2026-11-08
- Telephony wakes on Link events instead of polling, polls once a second when
idle, and sends announces on their own deadline instead of the idle tick.
- Replaced the AGPL license text with the LXST license.
- Uses the rsReticulum `~1.4.0` dependency line; the `v0.3.0` release used
`~1.3.0`.
- Retire outgoing calls when Link-request dispatch or handshake queue admission
fails, and keep established traffic bound to the original interface owner.
## 0.3.0 - 2026-10-12
### Added
@@ -33,7 +63,7 @@
buffers and an application-supplied native backend. Reject malformed lengths,
unexpected modes and insufficient capacity before codec processing; stop
further processing after a backend failure. Preserve native 700C frame padding.
Codec backend selection and live Codec2 telephony remain separate work.
Native Codec2 telephony streams use this adapter boundary.
### Build and compatibility
Generated
+124 -40
View File
@@ -14,6 +14,18 @@ dependencies = [
"zeroize",
]
[[package]]
name = "ahash"
version = "0.8.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75"
dependencies = [
"cfg-if",
"once_cell",
"version_check",
"zerocopy",
]
[[package]]
name = "anyhow"
version = "1.0.102"
@@ -71,15 +83,6 @@ dependencies = [
"generic-array",
]
[[package]]
name = "block2"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f"
dependencies = [
"objc2",
]
[[package]]
name = "bytes"
version = "1.11.1"
@@ -104,6 +107,16 @@ dependencies = [
"cipher",
]
[[package]]
name = "cc"
version = "1.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33ef9e3e8154a45c7a95cff4c1299702106ad94062d7bb85fdc5d3a5afd91d45"
dependencies = [
"find-msvc-tools",
"shlex",
]
[[package]]
name = "cesu8"
version = "1.1.0"
@@ -263,6 +276,18 @@ dependencies = [
"windows-sys 0.61.2",
]
[[package]]
name = "fallible-iterator"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649"
[[package]]
name = "fallible-streaming-iterator"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a"
[[package]]
name = "fastrand"
version = "2.4.1"
@@ -275,6 +300,12 @@ version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d"
[[package]]
name = "find-msvc-tools"
version = "0.1.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48"
[[package]]
name = "fnv"
version = "1.0.7"
@@ -379,6 +410,15 @@ dependencies = [
"zerocopy",
]
[[package]]
name = "hashbrown"
version = "0.14.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
dependencies = [
"ahash",
]
[[package]]
name = "hashbrown"
version = "0.15.5"
@@ -394,6 +434,15 @@ version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f467dd6dccf739c208452f8014c75c18bb8301b050ad1cfb27153803edb0f51"
[[package]]
name = "hashlink"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af"
dependencies = [
"hashbrown 0.14.5",
]
[[package]]
name = "heck"
version = "0.5.0"
@@ -534,6 +583,17 @@ version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"
[[package]]
name = "libsqlite3-sys"
version = "0.30.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149"
dependencies = [
"cc",
"pkg-config",
"vcpkg",
]
[[package]]
name = "linux-raw-sys"
version = "0.12.1"
@@ -557,14 +617,14 @@ checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897"
[[package]]
name = "lxst-codec2"
version = "0.3.0"
version = "0.4.0"
dependencies = [
"libm",
]
[[package]]
name = "lxst-core"
version = "0.3.0"
version = "0.4.0"
dependencies = [
"half",
"hex",
@@ -577,7 +637,7 @@ dependencies = [
[[package]]
name = "lxst-embedded"
version = "0.3.0"
version = "0.4.0"
dependencies = [
"lxst-codec2",
"lxst-core",
@@ -586,7 +646,7 @@ dependencies = [
[[package]]
name = "lxst-rns"
version = "0.3.0"
version = "0.4.0"
dependencies = [
"bytes",
"lxst-core",
@@ -600,7 +660,7 @@ dependencies = [
[[package]]
name = "lxst-telephony"
version = "0.3.0"
version = "0.4.0"
dependencies = [
"bytes",
"hex",
@@ -668,29 +728,21 @@ dependencies = [
"autocfg",
]
[[package]]
name = "objc-sys"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310"
[[package]]
name = "objc2"
version = "0.5.2"
version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46a785d4eeff09c14c487497c162e92766fbb3e4059a71840cecc03d9a50b804"
checksum = "08849bbd4767dfae9457696856ae1c84fe4e0281bbe4a7abff2d0e06fb7981f8"
dependencies = [
"objc-sys",
"objc2-encode",
]
[[package]]
name = "objc2-core-bluetooth"
version = "0.2.2"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a644b62ffb826a5277f536cf0f701493de420b13d40e700c452c36567771111"
checksum = "79b30b9eacc37434a61377866f68b27acef9fa5496f25cc9ca8b2549032e0394"
dependencies = [
"bitflags",
"objc2",
"objc2-foundation",
]
@@ -703,13 +755,11 @@ checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33"
[[package]]
name = "objc2-foundation"
version = "0.2.2"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8"
checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272"
dependencies = [
"bitflags",
"block2",
"libc",
"objc2",
]
@@ -721,9 +771,9 @@ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
[[package]]
name = "opus-rs"
version = "0.1.29"
version = "0.1.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eadaf84d53a021172447a8771d74f805ac3719a61041dafa95720ef86b8e271d"
checksum = "bafbcaf2ed381cdf68ced4ed8d16517de90ffd7424e36f0b9e45d67fbe30b1f9"
[[package]]
name = "parking_lot"
@@ -764,6 +814,12 @@ dependencies = [
"spki",
]
[[package]]
name = "pkg-config"
version = "0.3.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548"
[[package]]
name = "ppv-lite86"
version = "0.2.21"
@@ -953,7 +1009,7 @@ dependencies = [
[[package]]
name = "rns-crypto"
version = "1.4.0"
version = "1.5.1"
dependencies = [
"aes",
"cbc",
@@ -971,7 +1027,7 @@ dependencies = [
[[package]]
name = "rns-identity"
version = "1.4.0"
version = "1.5.1"
dependencies = [
"hex",
"libc",
@@ -991,7 +1047,7 @@ dependencies = [
[[package]]
name = "rns-interface"
version = "1.4.0"
version = "1.5.1"
dependencies = [
"bytes",
"hex",
@@ -1019,7 +1075,7 @@ dependencies = [
[[package]]
name = "rns-link"
version = "1.4.0"
version = "1.5.1"
dependencies = [
"hex",
"libc",
@@ -1036,7 +1092,7 @@ dependencies = [
[[package]]
name = "rns-protocol"
version = "1.4.0"
version = "1.5.1"
dependencies = [
"bzip2",
"hex",
@@ -1053,7 +1109,7 @@ dependencies = [
[[package]]
name = "rns-runtime"
version = "1.4.0"
version = "1.5.1"
dependencies = [
"bytes",
"hex",
@@ -1072,6 +1128,7 @@ dependencies = [
"serde",
"sha2",
"subtle",
"tempfile",
"thiserror 2.0.18",
"tokio",
"tracing",
@@ -1080,7 +1137,7 @@ dependencies = [
[[package]]
name = "rns-transport"
version = "1.4.0"
version = "1.5.1"
dependencies = [
"bytes",
"hex",
@@ -1090,6 +1147,7 @@ dependencies = [
"rns-crypto",
"rns-identity",
"rns-wire",
"rusqlite",
"serde",
"subtle",
"thiserror 2.0.18",
@@ -1099,13 +1157,27 @@ dependencies = [
[[package]]
name = "rns-wire"
version = "1.4.0"
version = "1.5.1"
dependencies = [
"rns-crypto",
"sha2",
"thiserror 2.0.18",
]
[[package]]
name = "rusqlite"
version = "0.32.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7753b721174eb8ff87a9a0e799e2d7bc3749323e773db92e0984debb00019d6e"
dependencies = [
"bitflags",
"fallible-iterator",
"fallible-streaming-iterator",
"hashlink",
"libsqlite3-sys",
"smallvec",
]
[[package]]
name = "rustc_version"
version = "0.4.1"
@@ -1266,6 +1338,12 @@ dependencies = [
"digest",
]
[[package]]
name = "shlex"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
[[package]]
name = "signal-hook-registry"
version = "1.4.8"
@@ -1480,6 +1558,12 @@ version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
[[package]]
name = "vcpkg"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]]
name = "version_check"
version = "0.9.5"
+12 -12
View File
@@ -9,9 +9,9 @@ members = [
]
[workspace.package]
version = "0.3.0"
version = "0.4.0"
edition = "2024"
license = "AGPL-3.0-or-later"
license-file = "LICENSE"
rust-version = "1.89"
publish = false
@@ -24,16 +24,16 @@ bytes = "1"
tokio = { version = "1", features = ["sync", "time", "rt", "macros"] }
half = "2"
proptest = "1"
opus-rs = { version = "=0.1.29", default-features = false, features = ["heap"] }
opus-rs = { version = "=0.1.42", default-features = false, features = ["heap"] }
serial_test = "3"
rns-crypto = { path = "../rsReticulum/crates/rns-crypto", version = "~1.4.0" }
rns-identity = { path = "../rsReticulum/crates/rns-identity", version = "~1.4.0" }
rns-interface = { path = "../rsReticulum/crates/rns-interface", version = "~1.4.0" }
rns-link = { path = "../rsReticulum/crates/rns-link", version = "~1.4.0" }
rns-runtime = { path = "../rsReticulum/crates/rns-runtime", version = "~1.4.0" }
rns-transport = { path = "../rsReticulum/crates/rns-transport", version = "~1.4.0" }
rns-wire = { path = "../rsReticulum/crates/rns-wire", version = "~1.4.0" }
rns-crypto = { path = "../rsReticulum/crates/rns-crypto", version = "~1.5.1" }
rns-identity = { path = "../rsReticulum/crates/rns-identity", version = "~1.5.1" }
rns-interface = { path = "../rsReticulum/crates/rns-interface", version = "~1.5.1" }
rns-link = { path = "../rsReticulum/crates/rns-link", version = "~1.5.1" }
rns-runtime = { path = "../rsReticulum/crates/rns-runtime", version = "~1.5.1" }
rns-transport = { path = "../rsReticulum/crates/rns-transport", version = "~1.5.1" }
rns-wire = { path = "../rsReticulum/crates/rns-wire", version = "~1.5.1" }
lxst-core = { path = "crates/lxst-core", version = "0.3.0" }
lxst-rns = { path = "crates/lxst-rns", version = "0.3.0" }
lxst-core = { path = "crates/lxst-core", version = "0.4.0" }
lxst-rns = { path = "crates/lxst-rns", version = "0.4.0" }
+5 -659
View File
@@ -1,661 +1,7 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
LXST Copyright 2026 Mark Qvist.
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This implementation of LXST is derived from the LXST reference implementation,
and used under license for Ratspeak, for non-commercial use only.
No derivatives or use outside Ratspeak is permitted.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<https://www.gnu.org/licenses/>.
For commercial licensing inquiries, contact license@unsigned.io
+57 -75
View File
@@ -4,10 +4,10 @@
**Rust LXST telephony and media streaming for Reticulum.**
[![License: AGPL-3.0-or-later](https://img.shields.io/badge/license-AGPL--3.0--or--later-blue.svg)](LICENSE)
[![License: LXST license](https://img.shields.io/badge/license-LXST%20license-blue.svg)](LICENSE)
[![Rust 1.89+](https://img.shields.io/badge/rust-1.89%2B-orange.svg)](https://www.rust-lang.org)
[![LXST 0.4.5](https://img.shields.io/badge/target-LXST%200.4.5-success.svg)](https://github.com/markqvist/LXST)
[![Status](https://img.shields.io/badge/status-library-yellow.svg)](#feature-status)
[![LXST 0.6.0](https://img.shields.io/badge/target-LXST%200.6.0-success.svg)](https://github.com/markqvist/LXST)
[![Status](https://img.shields.io/badge/status-experimental-yellow.svg)](#release-scope)
[rsLXMF](https://github.com/ratspeak/rsLXMF) |
[Ratspeak](https://github.com/ratspeak/Ratspeak) |
@@ -18,19 +18,15 @@
---
rsLXST is a Rust implementation of [LXST](https://github.com/markqvist/LXST), the Lightweight Extensible Signal
Transport used for real-time voice calls and other media streams over Reticulum. This is not a
fork of LXST; it is LXST written in a different language with interoperability
as the primary focus. Python LXST remains the source-of-truth
implementation, do not treat this repository as one.
rsLXST is a Rust port of [LXST](https://github.com/markqvist/LXST), Mark Qvist's
Lightweight Extensible Signal Transport for real-time voice calls and other
media streams over Reticulum. It was written from the reference source with
interoperability as the primary focus.
The current rsLXST is experimental and incomplete. It provides LXST wire codecs,
Reticulum link media packet boundaries, a telephony runtime, and Opus stream
integration for applications (such as Ratspeak).
The first public target is interoperable Opus
telephony, not complete feature parity with
the reference implementation LXST.
rsLXST is Ratspeak's voice component. The LXST author licenses this port for
use in Ratspeak only, for non-commercial use, with no derivatives or use outside
Ratspeak; see [License](#license). The build, test, and API notes below document
the code for Ratspeak development.
## Contents
@@ -40,28 +36,16 @@ the reference implementation LXST.
- [Crate Layout](#crate-layout)
- [Using Telephony](#using-telephony)
- [Rust API](api/README.md)
- [Contributing](#contributing)
- [License](#license)
- [Third-party licenses](#third-party-licenses)
## Release Scope
The experimental release is to cover basic voice calls, with several features still unsupported:
- `rnphone` parity and `rnphone-rs` usage.
- Full Codec2 support.
- Deeper audio support: microphone/source backends, filters, AGC, etc.
- Broadcast, stream, and non-telephony LXST primitives.
Those are expected future work. They should not be implied by the first public
Opus telephony release.
`lxst-core::Codec2PacketCodec` provides bounded, fixed-profile Codec2 packet
processing over an application-supplied `Codec2Backend`. It uses caller-owned
PCM16/output buffers, validates complete packets before calling the backend,
and requires replacement after a backend error. This is a codec integration
boundary; device qualification and telephony stream integration
are still required. Its mode header belongs to LXST, not LXMF audio fields.
The implemented application path covers telephony signalling, full- and
half-duplex call modes, and negotiated Opus or native Codec2 media over
Reticulum Links. It does not provide a
`rnphone-rs` client, a general platform microphone/speaker backend, or LXST's
non-telephony features.
## Build It
@@ -81,9 +65,13 @@ mkdir ratspeak-src
cd ratspeak-src
git clone https://github.com/ratspeak/rsReticulum
git clone https://github.com/ratspeak/rsLXST
git -C rsReticulum checkout --detach v1.5.0
git -C rsLXST checkout --detach v0.4.0
cd rsLXST
```
The commands below run from that `rsLXST` directory.
### macOS
Install Rust with `rustup`, then install Apple's command-line build tools:
@@ -95,7 +83,6 @@ xcode-select --install
Build the workspace:
```bash
cd rsLXST
cargo build --release --locked
```
@@ -125,7 +112,6 @@ sudo pacman -S --needed base-devel pkgconf
Build the workspace:
```bash
cd rsLXST
cargo build --release --locked
```
@@ -137,7 +123,6 @@ Build Tools, install the "Desktop development with C++" workload.
Build from PowerShell:
```powershell
cd rsLXST
cargo build --release --locked
```
@@ -157,42 +142,46 @@ cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
cargo test --workspace --locked
```
The test gate covers wire codecs, telephony state, profile metadata, Opus
stream boundaries, malformed-input handling, the local service runtime, Python
LXST wire parity, and Reticulum destination parity. Live headless Telephone
interop is intentionally excluded from ordinary `cargo test` runs because it
starts Python processes and TCP interfaces. Run that suite explicitly with:
The live call tests against Python LXST are not part of ordinary runs. Run
them explicitly with:
```bash
cargo test -p lxst-telephony --test python_telephone_live_interop -- --ignored
```
The Python parity and live tests expect upstream LXST at `../upstream/LXST` or
Python/reference tests additionally need the reference source checkouts. They
expect upstream LXST at `../upstream/LXST` or
`LXST_UPSTREAM_DIR`, and upstream Reticulum at `../upstream/Reticulum`,
`RETICULUM_UPSTREAM_DIR`, or sibling `../rsReticulum`.
For full Python Opus media interop, install a native Opus runtime as well as
the Python reference dependencies:
For full Python Opus media interop, install a native Opus runtime and activate
a Python virtual environment. Then install the reference dependencies; Python
3.13 and newer also need the `audioop` compatibility package:
```bash
python -m pip install numpy cryptography pyserial cffi
python -m pip install numpy cryptography pyserial cffi "audioop-lts; python_version >= '3.13'"
```
## Crate Layout
| Crate | Purpose |
| --- | --- |
| `lxst-codec2` | Allocation-free native Codec2 700C/1600/3200 processing. |
| `lxst-embedded` | Bounded `no_std` framing, session/PTT policy and Codec2 integration for Ratspeak's constrained devices. |
| `lxst-core` | LXST constants, telephony profiles, signalling values, codec IDs, MessagePack packets, Raw audio frames, Opus encode/decode state, stream packetization, synthetic sources, and jitter buffers. This crate has no Reticulum runtime dependency. |
| `lxst-rns` | The Reticulum link-packet boundary for no-receipt LXST signalling and media over active links. It packs outbound LXST packets and decodes inbound link plaintext into typed LXST packet/frame events. |
| `lxst-telephony` | The telephony runtime and service layer. It owns call state, caller policy, Reticulum destination registration, announce discovery, outgoing link establishment, typed control/event channels, Opus transmit/receive stream boundaries, timeout handling, and shutdown teardown. |
## Using Telephony
Applications normally use `lxst-telephony` through `TelephonyService`, not by
Ratspeak uses `lxst-telephony` through `TelephonyService`, not by
manually translating Reticulum events. The service registers the local
`lxst.telephony` destination, emits startup/periodic announces, owns the call
runtime, and exposes typed control and event channels.
This fragment assumes an initialized Reticulum transport, local identity and
remote identity inside an async application:
```rust
use lxst_core::Profile;
use lxst_telephony::{TelephonyControl, TelephonyService};
@@ -208,6 +197,7 @@ control_tx
.send(TelephonyControl::Call {
remote_identity,
profile: Some(Profile::QualityMedium),
mode: None,
discovery_timeout: Duration::from_secs(8),
})
.await?;
@@ -221,30 +211,16 @@ traffic. Outgoing announce/path discovery runs asynchronously inside the
service, so an unreachable or non-LXST peer does not block hangup, announce,
media, or shutdown controls while discovery times out.
The compiled `lxst-telephony` `service` example is the conformance example for
this embedding boundary. The lower-level endpoint and runtime types remain
The compiled [`service` example](crates/lxst-telephony/examples/service.rs)
checks construction and types. It does not run a transport or place a call. The lower-level endpoint and runtime types remain
available for compatible specialist use, but are experimental SPI.
An initial Reticulum `LINKREQUEST` still follows normal destination routing.
After proof validation, rsLXST binds the call to the exact interface that
established the Link. Signalling, identification, keepalives, media, and close
traffic never reroute through a newly learned path, and packets arriving on a
different interface are rejected before decryption or call accounting.
Interface loss terminates that exact call.
Control and teardown traffic use an ordered, bounded Link endpoint queue. The
final close packet drains in order before transport removes the endpoint and
temporary Link destination. Realtime media uses exact-interface best-effort
delivery instead: it never enters the lossless control queue, reports drops
under backpressure, and intentionally does not request Reticulum delivery
receipts.
For Opus calls, applications supply and receive `RawAudioFrame` values through
For Opus calls, the host app supplies and receives `RawAudioFrame` values through
`StartOpusStream` and `StartOpusReceiveStream`. rsLXST enforces the negotiated
LXST profile and reports profile changes, source/sink closure, frame drops, and
call-end stream shutdown explicitly.
Applications still own platform integration:
The host app still owns platform integration:
- contact or peer lookup
- UI and call controls
@@ -274,17 +250,22 @@ VLBW and LBW profiles. Device timing, stack and audio qualification remain
required before use on hardware. This backend does not implement Opus voice
memo containers.
## Contributing
If the issue or contribution belongs upstream as well, start there. Python LXST
and Reticulum remain the reference implementations.
PRs are closed for now until I have time to catch up on everything.
## License
Licensed under the GNU Affero General
Public License v3.0 or later. See [LICENSE](LICENSE).
rsLXST is used under the license in [LICENSE](LICENSE), reproduced here:
```
LXST Copyright 2026 Mark Qvist.
This implementation of LXST is derived from the LXST reference implementation,
and used under license for Ratspeak, for non-commercial use only.
No derivatives or use outside Ratspeak is permitted.
For commercial licensing inquiries, contact license@unsigned.io
```
The adapted `lxst-codec2` crate retains its own [NOTICE](crates/lxst-codec2/NOTICE)
and upstream license files.
## Third-party licenses
@@ -293,6 +274,7 @@ dependency inventory, including the exact upstream BSD-3-Clause Opus package,
checksum, source commit, and preserved notice, is documented in
[THIRD_PARTY_LICENSES.md](THIRD_PARTY_LICENSES.md).
The host workspace requires Rust 1.89 or later. The standalone `lxst-codec2`
and `lxst-embedded` libraries retain Rust 1.87 compatibility for MCU consumers;
CI checks that independent minimum without the host-only development tests.
The host workspace requires Rust 1.89 or later. The `lxst-codec2` and
`lxst-embedded` crates retain Rust 1.87 compatibility for Ratspeak's constrained
targets; CI checks that independent minimum without the host-only development
tests.
+296 -23
View File
@@ -1,7 +1,7 @@
{
"schemaVersion": 1,
"scope": "Adapted Codec2 and all registry third-party normal/build dependencies reachable from rsLXST workspace members across declared targets; dev-only and first-party path packages are excluded.",
"cargoLockSha256": "0822e940150b09e9d90b9d50731388c0ba4290721334f2727b39bca5c2ed3208",
"cargoLockSha256": "ce5a11b52a7c3d39e944b8dfc48831c6793e42e8e0f04c1d35c9efafbcf6e15d",
"packages": [
{
"name": "aes",
@@ -10,6 +10,20 @@
"repository": "https://github.com/RustCrypto/block-ciphers",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "ahash",
"version": "0.8.12",
"license": "MIT OR Apache-2.0",
"repository": "https://github.com/tkaitchuck/ahash",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "anyhow",
"version": "1.0.102",
"license": "MIT OR Apache-2.0",
"repository": "https://github.com/dtolnay/anyhow",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "autocfg",
"version": "1.5.0",
@@ -45,13 +59,6 @@
"repository": "https://github.com/RustCrypto/utils",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "block2",
"version": "0.5.1",
"license": "MIT",
"repository": "https://github.com/madsmtm/objc2",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "bytes",
"version": "1.11.1",
@@ -73,6 +80,13 @@
"repository": "https://github.com/RustCrypto/block-modes",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "cc",
"version": "1.11.2",
"license": "MIT OR Apache-2.0",
"repository": "https://github.com/rust-lang/cc-rs",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "cesu8",
"version": "1.1.0",
@@ -227,6 +241,13 @@
"repository": "https://github.com/dalek-cryptography/curve25519-dalek/tree/main/ed25519-dalek",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "equivalent",
"version": "1.0.2",
"license": "Apache-2.0 OR MIT",
"repository": "https://github.com/indexmap-rs/equivalent",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "errno",
"version": "0.3.14",
@@ -234,6 +255,27 @@
"repository": "https://github.com/lambda-fairy/rust-errno",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "fallible-iterator",
"version": "0.3.0",
"license": "MIT/Apache-2.0",
"repository": "https://github.com/sfackler/rust-fallible-iterator",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "fallible-streaming-iterator",
"version": "0.1.9",
"license": "MIT/Apache-2.0",
"repository": "https://github.com/sfackler/fallible-streaming-iterator",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "fastrand",
"version": "2.4.1",
"license": "Apache-2.0 OR MIT",
"repository": "https://github.com/smol-rs/fastrand",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "fiat-crypto",
"version": "0.2.9",
@@ -241,6 +283,20 @@
"repository": "https://github.com/mit-plv/fiat-crypto",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "find-msvc-tools",
"version": "0.1.15",
"license": "MIT OR Apache-2.0",
"repository": "https://github.com/rust-lang/cc-rs",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "foldhash",
"version": "0.1.5",
"license": "Zlib",
"repository": "https://github.com/orlp/foldhash",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "generic-array",
"version": "0.14.7",
@@ -255,6 +311,13 @@
"repository": "https://github.com/rust-random/getrandom",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "getrandom",
"version": "0.4.2",
"license": "MIT OR Apache-2.0",
"repository": "https://github.com/rust-random/getrandom",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "half",
"version": "2.7.1",
@@ -262,6 +325,41 @@
"repository": "https://github.com/VoidStarKat/half-rs",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "hashbrown",
"version": "0.14.5",
"license": "MIT OR Apache-2.0",
"repository": "https://github.com/rust-lang/hashbrown",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "hashbrown",
"version": "0.15.5",
"license": "MIT OR Apache-2.0",
"repository": "https://github.com/rust-lang/hashbrown",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "hashbrown",
"version": "0.17.0",
"license": "MIT OR Apache-2.0",
"repository": "https://github.com/rust-lang/hashbrown",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "hashlink",
"version": "0.9.1",
"license": "MIT OR Apache-2.0",
"repository": "https://github.com/kyren/hashlink",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "heck",
"version": "0.5.0",
"license": "MIT OR Apache-2.0",
"repository": "https://github.com/withoutboats/heck",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "hex",
"version": "0.4.3",
@@ -283,6 +381,13 @@
"repository": "https://github.com/RustCrypto/MACs",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "id-arena",
"version": "2.3.0",
"license": "MIT/Apache-2.0",
"repository": "https://github.com/fitzgen/id-arena",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "if-addrs",
"version": "0.13.4",
@@ -290,6 +395,13 @@
"repository": "https://github.com/messense/if-addrs",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "indexmap",
"version": "2.14.0",
"license": "Apache-2.0 OR MIT",
"repository": "https://github.com/indexmap-rs/indexmap",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "inout",
"version": "0.1.4",
@@ -332,6 +444,13 @@
"repository": "https://github.com/jni-rs/jni-sys",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "leb128fmt",
"version": "0.1.0",
"license": "MIT OR Apache-2.0",
"repository": "https://github.com/bluk/leb128fmt",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "libbz2-rs-sys",
"version": "0.2.5",
@@ -353,6 +472,20 @@
"repository": "https://github.com/rust-lang/compiler-builtins",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "libsqlite3-sys",
"version": "0.30.1",
"license": "MIT",
"repository": "https://github.com/rusqlite/rusqlite",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "linux-raw-sys",
"version": "0.12.1",
"license": "Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT",
"repository": "https://github.com/sunfishcode/linux-raw-sys",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "lock_api",
"version": "0.4.14",
@@ -402,24 +535,17 @@
"repository": "https://github.com/rust-num/num-traits",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "objc-sys",
"version": "0.3.5",
"license": "MIT",
"repository": "https://github.com/madsmtm/objc2",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "objc2",
"version": "0.5.2",
"version": "0.6.5",
"license": "MIT",
"repository": "https://github.com/madsmtm/objc2",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "objc2-core-bluetooth",
"version": "0.2.2",
"license": "MIT",
"version": "0.3.2",
"license": "Zlib OR Apache-2.0 OR MIT",
"repository": "https://github.com/madsmtm/objc2",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
@@ -432,7 +558,7 @@
},
{
"name": "objc2-foundation",
"version": "0.2.2",
"version": "0.3.2",
"license": "MIT",
"repository": "https://github.com/madsmtm/objc2",
"source": "registry+https://github.com/rust-lang/crates.io-index"
@@ -446,13 +572,13 @@
},
{
"name": "opus-rs",
"version": "0.1.29",
"version": "0.1.42",
"license": "BSD-3-Clause",
"repository": "https://github.com/restsend/opus-rs",
"source": "registry+https://github.com/rust-lang/crates.io-index",
"crateChecksum": "eadaf84d53a021172447a8771d74f805ac3719a61041dafa95720ef86b8e271d",
"upstreamCommit": "95f8b76430beb8c1bed067354d519c918ceade21",
"licenseText": "third_party/opus-rs-0.1.29-COPYING"
"crateChecksum": "bafbcaf2ed381cdf68ced4ed8d16517de90ffd7424e36f0b9e45d67fbe30b1f9",
"upstreamCommit": "5d8230f362b2618b9e730e6201c0d8f98961dfe1",
"licenseText": "third_party/opus-rs-0.1.42-COPYING"
},
{
"name": "parking_lot",
@@ -482,6 +608,13 @@
"repository": "https://github.com/RustCrypto/formats/tree/master/pkcs8",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "pkg-config",
"version": "0.3.34",
"license": "MIT OR Apache-2.0",
"repository": "https://github.com/rust-lang/pkg-config-rs",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "ppv-lite86",
"version": "0.2.21",
@@ -489,6 +622,13 @@
"repository": "https://github.com/cryptocorrosion/cryptocorrosion",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "prettyplease",
"version": "0.2.37",
"license": "MIT OR Apache-2.0",
"repository": "https://github.com/dtolnay/prettyplease",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "proc-macro2",
"version": "1.0.106",
@@ -503,6 +643,13 @@
"repository": "https://github.com/dtolnay/quote",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "r-efi",
"version": "6.0.0",
"license": "MIT OR Apache-2.0 OR LGPL-2.1-or-later",
"repository": "https://github.com/r-efi/r-efi",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "rand",
"version": "0.8.6",
@@ -552,6 +699,13 @@
"repository": "https://github.com/3Hren/msgpack-rust",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "rusqlite",
"version": "0.32.1",
"license": "MIT",
"repository": "https://github.com/rusqlite/rusqlite",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "rustc_version",
"version": "0.4.1",
@@ -559,6 +713,13 @@
"repository": "https://github.com/djc/rustc-version-rs",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "rustix",
"version": "1.1.4",
"license": "Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT",
"repository": "https://github.com/bytecodealliance/rustix",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "same-file",
"version": "1.0.6",
@@ -622,6 +783,13 @@
"repository": "https://github.com/RustCrypto/hashes",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "shlex",
"version": "2.0.1",
"license": "MIT OR Apache-2.0",
"repository": "https://github.com/comex/rust-shlex",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "signal-hook-registry",
"version": "1.4.8",
@@ -678,6 +846,13 @@
"repository": "https://github.com/dtolnay/syn",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "tempfile",
"version": "3.27.0",
"license": "MIT OR Apache-2.0",
"repository": "https://github.com/Stebalien/tempfile",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "thiserror",
"version": "1.0.69",
@@ -755,6 +930,20 @@
"repository": "https://github.com/dtolnay/unicode-ident",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "unicode-xid",
"version": "0.2.6",
"license": "MIT OR Apache-2.0",
"repository": "https://github.com/unicode-rs/unicode-xid",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "vcpkg",
"version": "0.2.15",
"license": "MIT/Apache-2.0",
"repository": "https://github.com/mcgoo/vcpkg-rs",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "version_check",
"version": "0.9.5",
@@ -776,6 +965,41 @@
"repository": "https://github.com/bytecodealliance/wasi",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "wasip2",
"version": "1.0.3+wasi-0.2.9",
"license": "Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT",
"repository": "https://github.com/bytecodealliance/wasi-rs",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "wasip3",
"version": "0.4.0+wasi-0.3.0-rc-2026-01-06",
"license": "Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT",
"repository": "https://github.com/bytecodealliance/wasi-rs",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "wasm-encoder",
"version": "0.244.0",
"license": "Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT",
"repository": "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wasm-encoder",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "wasm-metadata",
"version": "0.244.0",
"license": "Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT",
"repository": "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wasm-metadata",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "wasmparser",
"version": "0.244.0",
"license": "Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT",
"repository": "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wasmparser",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "winapi-util",
"version": "0.1.11",
@@ -916,6 +1140,55 @@
"repository": "https://github.com/microsoft/windows-rs",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "wit-bindgen",
"version": "0.51.0",
"license": "Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT",
"repository": "https://github.com/bytecodealliance/wit-bindgen",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "wit-bindgen",
"version": "0.57.1",
"license": "Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT",
"repository": "https://github.com/bytecodealliance/wit-bindgen",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "wit-bindgen-core",
"version": "0.51.0",
"license": "Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT",
"repository": "https://github.com/bytecodealliance/wit-bindgen",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "wit-bindgen-rust",
"version": "0.51.0",
"license": "Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT",
"repository": "https://github.com/bytecodealliance/wit-bindgen",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "wit-bindgen-rust-macro",
"version": "0.51.0",
"license": "Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT",
"repository": "https://github.com/bytecodealliance/wit-bindgen",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "wit-component",
"version": "0.244.0",
"license": "Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT",
"repository": "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wit-component",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "wit-parser",
"version": "0.244.0",
"license": "Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT",
"repository": "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wit-parser",
"source": "registry+https://github.com/rust-lang/crates.io-index"
},
{
"name": "x25519-dalek",
"version": "2.0.1",
+17 -5
View File
@@ -1,6 +1,18 @@
# Third-party licenses
rsLXST is licensed under AGPL-3.0-or-later as described in [LICENSE](LICENSE).
rsLXST is used under the license in [LICENSE](LICENSE), reproduced here:
```
LXST Copyright 2026 Mark Qvist.
This implementation of LXST is derived from the LXST reference implementation,
and used under license for Ratspeak, for non-commercial use only.
No derivatives or use outside Ratspeak is permitted.
For commercial licensing inquiries, contact license@unsigned.io
```
The adapted `lxst-codec2` crate retains the separate terms described below.
Third-party components retain their own licenses; the rsLXST license does not
replace those terms or notices.
@@ -20,13 +32,13 @@ repository, or source changes.
## Upstream Opus implementation
rsLXST consumes the exact crates.io package `opus-rs` 0.1.29 from
rsLXST consumes the exact crates.io package `opus-rs` 0.1.42 from
[`restsend/opus-rs`](https://github.com/restsend/opus-rs), associated with
upstream commit `95f8b76430beb8c1bed067354d519c918ceade21` and locked crate
checksum `eadaf84d53a021172447a8771d74f805ac3719a61041dafa95720ef86b8e271d`.
upstream commit `5d8230f362b2618b9e730e6201c0d8f98961dfe1` and locked crate
checksum `bafbcaf2ed381cdf68ced4ed8d16517de90ffd7424e36f0b9e45d67fbe30b1f9`.
It is BSD-3-Clause, is not locally modified, and is configured with explicit
heap-backed codec state. The preserved license and Opus patent notice are in
[`third_party/opus-rs-0.1.29-COPYING`](third_party/opus-rs-0.1.29-COPYING).
[`third_party/opus-rs-0.1.42-COPYING`](third_party/opus-rs-0.1.42-COPYING).
This inventory records source and license evidence; it is not legal advice and
does not by itself replace any third-party notice required for a distributed
+7 -4
View File
@@ -1,6 +1,6 @@
# Rust API
rsLXST is experimental and remains below 1.0. Its current application boundary
rsLXST is experimental and remains below 1.0. The service boundary Ratspeak uses
for telephony is the existing `lxst_telephony::TelephonyService` service seam:
- construct it with `TelephonyService::registered` or
@@ -10,16 +10,19 @@ for telephony is the existing `lxst_telephony::TelephonyService` service seam:
- use `TelephonyControl`, `request_answer`, and `TelephonyServiceEvent` without
translating raw Reticulum events in the application.
The compiled `lxst-telephony` `service` example exercises this path.
The compiled `lxst-telephony` `service` example checks construction and handle
types. It does not run the service or demonstrate an end-to-end call.
## Stability
All workspace packages are experimental:
- `lxst-core` contains codec, profile, stream, signalling, and wire concepts;
- `lxst-rns` binds media packets to Reticulum Links; and
- `lxst-rns` binds media packets to Reticulum Links;
- `lxst-telephony` contains the service boundary plus extensive runtime and
state-machine machinery.
state-machine machinery;
- `lxst-codec2` provides bounded native Codec2 processing; and
- `lxst-embedded` provides the bounded `no_std` framing and session boundary.
Selecting `TelephonyService` does not stabilize the whole package or change
channel capacities, backpressure, event ordering, cancellation, timeouts,
+180 -41
View File
@@ -14,6 +14,18 @@ dependencies = [
"zeroize",
]
[[package]]
name = "ahash"
version = "0.8.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75"
dependencies = [
"cfg-if",
"once_cell",
"version_check",
"zerocopy",
]
[[package]]
name = "autocfg"
version = "1.5.1"
@@ -50,15 +62,6 @@ dependencies = [
"generic-array",
]
[[package]]
name = "block2"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f"
dependencies = [
"objc2",
]
[[package]]
name = "bytes"
version = "1.12.1"
@@ -83,6 +86,16 @@ dependencies = [
"cipher",
]
[[package]]
name = "cc"
version = "1.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33ef9e3e8154a45c7a95cff4c1299702106ad94062d7bb85fdc5d3a5afd91d45"
dependencies = [
"find-msvc-tools",
"shlex",
]
[[package]]
name = "cesu8"
version = "1.1.0"
@@ -236,12 +249,36 @@ dependencies = [
"windows-sys 0.61.2",
]
[[package]]
name = "fallible-iterator"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649"
[[package]]
name = "fallible-streaming-iterator"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a"
[[package]]
name = "fastrand"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223"
[[package]]
name = "fiat-crypto"
version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d"
[[package]]
name = "find-msvc-tools"
version = "0.1.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48"
[[package]]
name = "generic-array"
version = "0.14.7"
@@ -263,6 +300,17 @@ dependencies = [
"wasi",
]
[[package]]
name = "getrandom"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099"
dependencies = [
"cfg-if",
"libc",
"r-efi",
]
[[package]]
name = "half"
version = "2.7.1"
@@ -274,6 +322,24 @@ dependencies = [
"zerocopy",
]
[[package]]
name = "hashbrown"
version = "0.14.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
dependencies = [
"ahash",
]
[[package]]
name = "hashlink"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af"
dependencies = [
"hashbrown",
]
[[package]]
name = "hex"
version = "0.4.3"
@@ -384,6 +450,23 @@ version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"
[[package]]
name = "libsqlite3-sys"
version = "0.30.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149"
dependencies = [
"cc",
"pkg-config",
"vcpkg",
]
[[package]]
name = "linux-raw-sys"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"
[[package]]
name = "lock_api"
version = "0.4.14"
@@ -401,14 +484,14 @@ checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad"
[[package]]
name = "lxst-codec2"
version = "0.3.0"
version = "0.4.0"
dependencies = [
"libm",
]
[[package]]
name = "lxst-core"
version = "0.3.0"
version = "0.4.0"
dependencies = [
"half",
"opus-rs",
@@ -418,7 +501,7 @@ dependencies = [
[[package]]
name = "lxst-embedded"
version = "0.3.0"
version = "0.4.0"
dependencies = [
"lxst-codec2",
"thiserror 2.0.20",
@@ -426,7 +509,7 @@ dependencies = [
[[package]]
name = "lxst-rns"
version = "0.3.0"
version = "0.4.0"
dependencies = [
"bytes",
"lxst-core",
@@ -439,7 +522,7 @@ dependencies = [
[[package]]
name = "lxst-telephony"
version = "0.3.0"
version = "0.4.0"
dependencies = [
"bytes",
"lxst-codec2",
@@ -516,29 +599,21 @@ dependencies = [
"autocfg",
]
[[package]]
name = "objc-sys"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310"
[[package]]
name = "objc2"
version = "0.5.2"
version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46a785d4eeff09c14c487497c162e92766fbb3e4059a71840cecc03d9a50b804"
checksum = "08849bbd4767dfae9457696856ae1c84fe4e0281bbe4a7abff2d0e06fb7981f8"
dependencies = [
"objc-sys",
"objc2-encode",
]
[[package]]
name = "objc2-core-bluetooth"
version = "0.2.2"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a644b62ffb826a5277f536cf0f701493de420b13d40e700c452c36567771111"
checksum = "79b30b9eacc37434a61377866f68b27acef9fa5496f25cc9ca8b2549032e0394"
dependencies = [
"bitflags",
"objc2",
"objc2-foundation",
]
@@ -551,13 +626,11 @@ checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33"
[[package]]
name = "objc2-foundation"
version = "0.2.2"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8"
checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272"
dependencies = [
"bitflags",
"block2",
"libc",
"objc2",
]
@@ -569,9 +642,9 @@ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
[[package]]
name = "opus-rs"
version = "0.1.29"
version = "0.1.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eadaf84d53a021172447a8771d74f805ac3719a61041dafa95720ef86b8e271d"
checksum = "bafbcaf2ed381cdf68ced4ed8d16517de90ffd7424e36f0b9e45d67fbe30b1f9"
[[package]]
name = "parking_lot"
@@ -612,6 +685,12 @@ dependencies = [
"spki",
]
[[package]]
name = "pkg-config"
version = "0.3.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548"
[[package]]
name = "ppv-lite86"
version = "0.2.21"
@@ -639,6 +718,12 @@ dependencies = [
"proc-macro2",
]
[[package]]
name = "r-efi"
version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
[[package]]
name = "rand"
version = "0.8.7"
@@ -666,7 +751,7 @@ version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
dependencies = [
"getrandom",
"getrandom 0.2.17",
]
[[package]]
@@ -710,7 +795,7 @@ dependencies = [
[[package]]
name = "rns-crypto"
version = "1.4.0"
version = "1.5.1"
dependencies = [
"aes",
"cbc",
@@ -728,7 +813,7 @@ dependencies = [
[[package]]
name = "rns-identity"
version = "1.4.0"
version = "1.5.1"
dependencies = [
"hex",
"libc",
@@ -748,7 +833,7 @@ dependencies = [
[[package]]
name = "rns-interface"
version = "1.4.0"
version = "1.5.1"
dependencies = [
"bytes",
"hex",
@@ -776,7 +861,7 @@ dependencies = [
[[package]]
name = "rns-link"
version = "1.4.0"
version = "1.5.1"
dependencies = [
"hex",
"libc",
@@ -793,7 +878,7 @@ dependencies = [
[[package]]
name = "rns-protocol"
version = "1.4.0"
version = "1.5.1"
dependencies = [
"bzip2",
"hex",
@@ -810,7 +895,7 @@ dependencies = [
[[package]]
name = "rns-runtime"
version = "1.4.0"
version = "1.5.1"
dependencies = [
"bytes",
"hex",
@@ -829,6 +914,7 @@ dependencies = [
"serde",
"sha2",
"subtle",
"tempfile",
"thiserror 2.0.20",
"tokio",
"tracing",
@@ -837,7 +923,7 @@ dependencies = [
[[package]]
name = "rns-transport"
version = "1.4.0"
version = "1.5.1"
dependencies = [
"bytes",
"hex",
@@ -847,6 +933,7 @@ dependencies = [
"rns-crypto",
"rns-identity",
"rns-wire",
"rusqlite",
"serde",
"subtle",
"thiserror 2.0.20",
@@ -856,13 +943,27 @@ dependencies = [
[[package]]
name = "rns-wire"
version = "1.4.0"
version = "1.5.1"
dependencies = [
"rns-crypto",
"sha2",
"thiserror 2.0.20",
]
[[package]]
name = "rusqlite"
version = "0.32.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7753b721174eb8ff87a9a0e799e2d7bc3749323e773db92e0984debb00019d6e"
dependencies = [
"bitflags",
"fallible-iterator",
"fallible-streaming-iterator",
"hashlink",
"libsqlite3-sys",
"smallvec",
]
[[package]]
name = "rustc_version"
version = "0.4.1"
@@ -872,6 +973,19 @@ dependencies = [
"semver",
]
[[package]]
name = "rustix"
version = "1.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5e76742e5294153d4dde1207dbec5bdd81eef6fabdc0d2118babadabfd858aa"
dependencies = [
"bitflags",
"errno",
"libc",
"linux-raw-sys",
"windows-sys 0.61.2",
]
[[package]]
name = "same-file"
version = "1.0.6"
@@ -957,6 +1071,12 @@ dependencies = [
"digest",
]
[[package]]
name = "shlex"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
[[package]]
name = "signal-hook-registry"
version = "1.4.8"
@@ -1040,6 +1160,19 @@ dependencies = [
"unicode-ident",
]
[[package]]
name = "tempfile"
version = "3.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"
dependencies = [
"fastrand",
"getrandom 0.4.3",
"once_cell",
"rustix",
"windows-sys 0.61.2",
]
[[package]]
name = "thiserror"
version = "1.0.69"
@@ -1151,6 +1284,12 @@ version = "1.0.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
[[package]]
name = "vcpkg"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]]
name = "version_check"
version = "0.9.5"
+123
View File
@@ -0,0 +1,123 @@
# Migrating to rsLXST 0.4 (draft)
This draft covers source and behaviour changes since rsLXST 0.3.1. Telephony
now follows LXST 0.6.0 signalling, and rsLXST 0.4 runs on rsReticulum 1.5,
which follows Reticulum 1.6.0.
Move rsReticulum dependencies to `~1.5.0` together with rsLXST 0.4; types from
two rsReticulum lines do not mix. rsReticulum types that appear in rsLXST
signatures (`TransportMessage`, `Link`, `LinkManager`, and `Identity`) change
in 1.5; rsReticulum's own migration guide covers them.
## Telephony: answering
LXST 0.6.0 establishes the callee as soon as it answers: CONNECTING and
ESTABLISHED are sent once, with no retry and no wait for the caller's echo.
| Old | New |
| --- | --- |
| `lxst_core::TelephonyCall::retry_answer()` | removed; `answer()` returns the whole answer and ends with `StartAudioPipelines` |
| `lxst_embedded::CallState::retry_answer()` | removed; as above |
| `TelephonyServiceConfig::answer_retry_interval` | removed; delete the field |
| `TelephonyServiceConfig::answer_timeout` | removed; delete the field |
| (none) | `TelephonyServiceConfig::connect_timeout`; a literal without `..TelephonyServiceConfig::default()` must set it |
`request_answer` and `TelephonyControl::Answer` now reply with an ESTABLISHED
snapshot where they replied with CONNECTING.
A caller is ESTABLISHED once it has handled CONNECTING, so a lost ESTABLISHED
no longer ends the call. Its audio still starts only on the callee's
ESTABLISHED, so `status()` no longer shows that audio is running: check
`audio_started()` (`TelephonyCall`, `CallState`) or wait for
`StartAudioPipelines`.
## Telephony: call modes
Full and half duplex are signalled with the profile when the callee rings.
```rust
// old
TelephonyControl::Call { remote_identity, profile, discovery_timeout }
// new; `None` is full duplex
TelephonyControl::Call { remote_identity, profile, mode: None, discovery_timeout }
```
These types gain variants or fields, so exhaustive matches need new arms and
struct literals need the new fields:
| Type | Added |
| --- | --- |
| `Signal` (`lxst-core`, `lxst-embedded`) | `PreferredMode(u8)`; wire values `0xF0` to `0xFE` decode to it, not to `Raw` |
| `TelephonyAction` (`lxst-core`, `lxst-embedded`) | `SendSignalPair`, `SelectMode`, `SwitchMode` |
| `TelephonyCommand` | `SendSignalPair`, `SelectMode`, `SwitchMode` |
| `TelephonyControl` | `SwitchMode`, `SquelchTransmit`, `DisableRemoteModeFollow` |
| `ActiveCallSnapshot` | `mode`, `transmit_squelched` |
A caller that sees RINGING now emits one `SendSignalPair(profile, mode)` where
it emitted `SendSignal(profile)`. Both signals travel in one packet:
`TelephonyCommand::signal()` returns `None` for the pair, so build the packet
with `TelephonyCommand::to_lxst_packet()`.
## Telephony: outgoing call links
LXST 0.6.0 opens the call with a plain `RNS.Link(call_destination, ...)`
(`LXST/Primitives/Telephony.py:840-842`). On Reticulum 1.6.0 that link request
carries a stamp at the link cost the destination announced
(`RNS/Link.py:363`). Generating that stamp is CPU work, so building the link
request is now async:
| Old | New |
| --- | --- |
| `fn TelephonyRnsEndpoint::begin_outgoing_link_with_remote_pubkey(..) -> Result<LinkId, Error>` | `async fn`; add `.await` |
| (none) | `async fn TelephonyRnsEndpoint::begin_outgoing_link_with_mode(..)`, the same call with an `Option<CallMode>` |
```rust
// old
let link_id = endpoint.begin_outgoing_link_with_remote_pubkey(&mut core, identity, pubkey, profile, hops)?;
// new
let link_id = endpoint.begin_outgoing_link_with_remote_pubkey(&mut core, identity, pubkey, profile, hops).await?;
```
`begin_outgoing_link_with_remote_pubkey` no longer sends a path request, and
the new calls send none. When no path is known, call
`request_path_to_identity` first, or use `begin_outgoing_link`, which discovers
the peer and its path.
To stamp off the caller's task, call
`prepare_outgoing_link_request(&transport_tx, identity, hops).await?` and pass
its `OutgoingLinkRequest` to the synchronous
`TelephonyRnsEndpoint::begin_prepared_outgoing_link`.
`Error` gains `LinkStamp(rns_link::stamp::LinkStampError)`, so exhaustive
matches on `lxst_telephony::Error` need a new arm.
## Embedded sessions
`SessionConfig` gains `times: CallTimes`; add `times: CallTimes::DEFAULT` to
struct literals. The defaults are LXST 0.6.0's: an incoming call rings for
60 seconds (was 90), and an outgoing call ends unless the callee rings within
5 seconds and the call is established within 70 seconds of the session start.
The 10 second answer deadline and its three retries are gone.
## Behaviour an operator sees
- Outgoing calls end unless the callee rings within `connect_timeout`
(5 seconds by default) of the call request. The 70 second
`outgoing_call_timeout` also runs from the call request, path discovery
included.
- The line is busy while an outgoing call discovers its path.
- The first announce follows 5 seconds after the service starts, and
`startup_announce_retries` defaults to 0.
- The telephony destination announces through the stamped announce builder.
Calls stamp and check link requests according to the Reticulum `[stamps]`
settings, as upstream does.
- Call links signal the next hop's MTU when Reticulum's `link_mtu_discovery`
is on (`RNS/Link.py:392-397`).
- Received audio is decoded by the codec of each frame. A frame that fails to
decode is reported and skipped; the rest of its packet still plays.
- Raw frames at `RawBitDepth::Float128` carry IEEE binary128 samples, as
numpy's `float128` does on Linux aarch64. rsLXST 0.3.1 wrote an `f64`
padded to 16 bytes.
- The Medium voice profile still encodes wideband SILK at its 8 kbps ceiling.
- `opus-rs` is pinned at 0.1.42 (was 0.1.29). A peer packet that panics the
Opus decoder is rejected, and the decoder is reset.
+34 -1
View File
@@ -6,6 +6,18 @@ impl lxst_core::AudioCodec
pub const fn lxst_core::AudioCodec::channels(self) -> u8
pub const fn lxst_core::AudioCodec::codec_kind(self) -> lxst_core::CodecKind
pub const fn lxst_core::AudioCodec::sample_rate_hz(self) -> u32
#[repr(u8)] pub enum lxst_core::CallMode
pub lxst_core::CallMode::FullDuplex = 1
pub lxst_core::CallMode::HalfDuplex = 2
impl lxst_core::CallMode
pub const lxst_core::CallMode::AVAILABLE: [Self; 2]
pub const lxst_core::CallMode::DEFAULT: Self
pub const fn lxst_core::CallMode::abbreviation(self) -> &'static str
pub const fn lxst_core::CallMode::from_wire(u8) -> core::option::Option<Self>
pub const fn lxst_core::CallMode::name(self) -> &'static str
pub const fn lxst_core::CallMode::wire_value(self) -> u8
impl core::convert::From<lxst_core::CallMode> for lxst_core::Signal
pub fn lxst_core::Signal::from(lxst_core::CallMode) -> Self
pub enum lxst_core::CallRole
pub lxst_core::CallRole::Incoming
pub lxst_core::CallRole::Outgoing
@@ -147,6 +159,7 @@ pub const lxst_core::Profile::DEFAULT: Self
pub const lxst_core::Profile::ORDER: [Self; 8]
pub const fn lxst_core::Profile::abbreviation(self) -> &'static str
pub const fn lxst_core::Profile::audio_codec(self) -> lxst_core::AudioCodec
pub const fn lxst_core::Profile::buffer_frames(self) -> u8
pub const fn lxst_core::Profile::channels(self) -> u8
pub const fn lxst_core::Profile::frame_time_ms(self) -> u16
pub const fn lxst_core::Profile::from_wire(u32) -> core::option::Option<Self>
@@ -169,12 +182,15 @@ pub const fn lxst_core::RawBitDepth::bytes_per_sample(self) -> usize
pub const fn lxst_core::RawBitDepth::from_header_bits(u8) -> core::result::Result<Self, lxst_core::Error>
pub const fn lxst_core::RawBitDepth::numpy_dtype(self) -> &'static str
pub enum lxst_core::Signal
pub lxst_core::Signal::PreferredMode(u8)
pub lxst_core::Signal::PreferredProfile(lxst_core::Profile)
pub lxst_core::Signal::Raw(u32)
pub lxst_core::Signal::Status(lxst_core::SignallingStatus)
impl lxst_core::Signal
pub const fn lxst_core::Signal::from_wire(u32) -> Self
pub const fn lxst_core::Signal::wire_value(self) -> u32
impl core::convert::From<lxst_core::CallMode> for lxst_core::Signal
pub fn lxst_core::Signal::from(lxst_core::CallMode) -> Self
impl core::convert::From<lxst_core::Profile> for lxst_core::Signal
pub fn lxst_core::Signal::from(lxst_core::Profile) -> Self
impl core::convert::From<lxst_core::SignallingStatus> for lxst_core::Signal
@@ -217,10 +233,13 @@ pub lxst_core::TelephonyAction::OpenAudioPipelines
pub lxst_core::TelephonyAction::PrepareDialingPipelines
pub lxst_core::TelephonyAction::ResetDialingPipelines
pub lxst_core::TelephonyAction::RingIncomingCall
pub lxst_core::TelephonyAction::SelectMode(lxst_core::CallMode)
pub lxst_core::TelephonyAction::SelectProfile(lxst_core::Profile)
pub lxst_core::TelephonyAction::SendSignal(lxst_core::Signal)
pub lxst_core::TelephonyAction::SendSignalPair(lxst_core::Signal, lxst_core::Signal)
pub lxst_core::TelephonyAction::StartAudioPipelines
pub lxst_core::TelephonyAction::StartDialTone
pub lxst_core::TelephonyAction::SwitchMode(lxst_core::CallMode)
pub lxst_core::TelephonyAction::SwitchProfile(lxst_core::Profile)
pub lxst_core::TelephonyAction::TeardownLink
pub lxst_core::TelephonyAction::Terminate(core::option::Option<lxst_core::SignallingStatus>)
@@ -301,6 +320,12 @@ pub const fn lxst_core::OpusMonoDecoder::channels(&self) -> u8
pub fn lxst_core::OpusMonoDecoder::decode_packet(&mut self, &[u8]) -> core::result::Result<lxst_core::RawAudioFrame, lxst_core::OpusCodecError>
pub fn lxst_core::OpusMonoDecoder::new() -> core::result::Result<Self, lxst_core::OpusCodecError>
pub const fn lxst_core::OpusMonoDecoder::sample_rate_hz(&self) -> u32
pub struct lxst_core::OpusPacketDecoder
impl lxst_core::OpusPacketDecoder
pub const fn lxst_core::OpusPacketDecoder::channels(&self) -> u8
pub fn lxst_core::OpusPacketDecoder::decode_packet(&mut self, &[u8]) -> core::result::Result<lxst_core::RawAudioFrame, lxst_core::OpusCodecError>
pub fn lxst_core::OpusPacketDecoder::new(u32, u8) -> core::result::Result<Self, lxst_core::OpusCodecError>
pub const fn lxst_core::OpusPacketDecoder::sample_rate_hz(&self) -> u32
pub struct lxst_core::RawAudioFrame
pub lxst_core::RawAudioFrame::channels: u8
pub lxst_core::RawAudioFrame::samples: alloc::vec::Vec<f32>
@@ -308,9 +333,11 @@ impl lxst_core::RawAudioFrame
pub fn lxst_core::RawAudioFrame::from_frame(&lxst_core::Frame) -> core::result::Result<Self, lxst_core::Error>
pub fn lxst_core::RawAudioFrame::from_payload(&[u8]) -> core::result::Result<Self, lxst_core::Error>
pub fn lxst_core::RawAudioFrame::new(u8, impl core::convert::Into<alloc::vec::Vec<f32>>) -> core::result::Result<Self, lxst_core::Error>
pub fn lxst_core::RawAudioFrame::resampled(&self, u32, u32) -> Self
pub fn lxst_core::RawAudioFrame::sample_frames(&self) -> usize
pub fn lxst_core::RawAudioFrame::to_frame(&self, lxst_core::RawBitDepth) -> core::result::Result<lxst_core::Frame, lxst_core::Error>
pub fn lxst_core::RawAudioFrame::to_payload(&self, lxst_core::RawBitDepth) -> core::result::Result<alloc::vec::Vec<u8>, lxst_core::Error>
pub fn lxst_core::RawAudioFrame::with_channels(self, u8) -> core::result::Result<Self, lxst_core::Error>
pub struct lxst_core::RawFrameCollector
impl lxst_core::RawFrameCollector
pub fn lxst_core::RawFrameCollector::frames(&self) -> &[lxst_core::RawAudioFrame]
@@ -337,17 +364,23 @@ pub struct lxst_core::TelephonyCall
impl lxst_core::TelephonyCall
pub fn lxst_core::TelephonyCall::answer(&mut self) -> alloc::vec::Vec<lxst_core::TelephonyAction>
pub const fn lxst_core::TelephonyCall::answered(&self) -> bool
pub const fn lxst_core::TelephonyCall::audio_started(&self) -> bool
pub fn lxst_core::TelephonyCall::caller_identified(&mut self, bool, bool) -> alloc::vec::Vec<lxst_core::TelephonyAction>
pub fn lxst_core::TelephonyCall::disable_remote_mode_follow(&mut self)
pub fn lxst_core::TelephonyCall::hangup(&mut self, bool) -> alloc::vec::Vec<lxst_core::TelephonyAction>
pub fn lxst_core::TelephonyCall::incoming() -> Self
pub fn lxst_core::TelephonyCall::incoming_link_established(bool) -> alloc::vec::Vec<lxst_core::TelephonyAction>
pub const fn lxst_core::TelephonyCall::mode(&self) -> core::option::Option<lxst_core::CallMode>
pub fn lxst_core::TelephonyCall::outgoing(core::option::Option<lxst_core::Profile>) -> Self
pub fn lxst_core::TelephonyCall::outgoing_with_mode(core::option::Option<lxst_core::Profile>, core::option::Option<lxst_core::CallMode>) -> Self
pub const fn lxst_core::TelephonyCall::profile(&self) -> core::option::Option<lxst_core::Profile>
pub fn lxst_core::TelephonyCall::receive_signal(&mut self, lxst_core::Signal) -> alloc::vec::Vec<lxst_core::TelephonyAction>
pub fn lxst_core::TelephonyCall::retry_answer(&self) -> alloc::vec::Vec<lxst_core::TelephonyAction>
pub const fn lxst_core::TelephonyCall::role(&self) -> lxst_core::CallRole
pub fn lxst_core::TelephonyCall::set_transmit_squelched(&mut self, bool)
pub const fn lxst_core::TelephonyCall::status(&self) -> lxst_core::SignallingStatus
pub fn lxst_core::TelephonyCall::switch_mode(&mut self, lxst_core::CallMode) -> alloc::vec::Vec<lxst_core::TelephonyAction>
pub fn lxst_core::TelephonyCall::switch_profile(&mut self, lxst_core::Profile) -> alloc::vec::Vec<lxst_core::TelephonyAction>
pub const fn lxst_core::TelephonyCall::transmit_squelched(&self) -> bool
pub const lxst_core::APP_NAME: &str
pub const lxst_core::FIELD_FRAMES: u8
pub const lxst_core::FIELD_SIGNALLING: u8
+39 -1
View File
@@ -33,12 +33,15 @@ pub lxst_embedded::wire::Error::Truncated
pub lxst_embedded::wire::Error::UnknownCodec(u8)
pub lxst_embedded::wire::Error::UnknownCodec2Mode(u8)
pub enum lxst_embedded::wire::Signal
pub lxst_embedded::wire::Signal::PreferredMode(u8)
pub lxst_embedded::wire::Signal::PreferredProfile(lxst_embedded::Profile)
pub lxst_embedded::wire::Signal::Raw(u32)
pub lxst_embedded::wire::Signal::Status(lxst_embedded::SignallingStatus)
impl lxst_embedded::wire::Signal
pub const fn lxst_embedded::wire::Signal::from_wire(u32) -> Self
pub const fn lxst_embedded::wire::Signal::wire_value(self) -> u32
impl core::convert::From<lxst_embedded::CallMode> for lxst_embedded::wire::Signal
pub fn lxst_embedded::wire::Signal::from(lxst_embedded::CallMode) -> Self
impl core::convert::From<lxst_embedded::Profile> for lxst_embedded::wire::Signal
pub fn lxst_embedded::wire::Signal::from(lxst_embedded::Profile) -> Self
impl core::convert::From<lxst_embedded::SignallingStatus> for lxst_embedded::wire::Signal
@@ -63,6 +66,18 @@ impl lxst_embedded::AudioCodec
pub const fn lxst_embedded::AudioCodec::channels(self) -> u8
pub const fn lxst_embedded::AudioCodec::codec_kind(self) -> lxst_embedded::wire::CodecKind
pub const fn lxst_embedded::AudioCodec::sample_rate_hz(self) -> u32
#[repr(u8)] pub enum lxst_embedded::CallMode
pub lxst_embedded::CallMode::FullDuplex = 1
pub lxst_embedded::CallMode::HalfDuplex = 2
impl lxst_embedded::CallMode
pub const lxst_embedded::CallMode::AVAILABLE: [Self; 2]
pub const lxst_embedded::CallMode::DEFAULT: Self
pub const fn lxst_embedded::CallMode::abbreviation(self) -> &'static str
pub const fn lxst_embedded::CallMode::from_wire(u8) -> core::option::Option<Self>
pub const fn lxst_embedded::CallMode::name(self) -> &'static str
pub const fn lxst_embedded::CallMode::wire_value(self) -> u8
impl core::convert::From<lxst_embedded::CallMode> for lxst_embedded::wire::Signal
pub fn lxst_embedded::wire::Signal::from(lxst_embedded::CallMode) -> Self
pub enum lxst_embedded::CallRole
pub lxst_embedded::CallRole::Incoming
pub lxst_embedded::CallRole::Outgoing
@@ -159,6 +174,7 @@ pub const lxst_embedded::Profile::DEFAULT: Self
pub const lxst_embedded::Profile::ORDER: [Self; 8]
pub const fn lxst_embedded::Profile::abbreviation(self) -> &'static str
pub const fn lxst_embedded::Profile::audio_codec(self) -> lxst_embedded::AudioCodec
pub const fn lxst_embedded::Profile::buffer_frames(self) -> u8
pub const fn lxst_embedded::Profile::channels(self) -> u8
pub const fn lxst_embedded::Profile::frame_time_ms(self) -> u16
pub const fn lxst_embedded::Profile::from_wire(u32) -> core::option::Option<Self>
@@ -176,12 +192,15 @@ pub lxst_embedded::QueueError::Expired
pub lxst_embedded::QueueError::OutputCapacity
pub lxst_embedded::QueueError::PayloadTooLarge
pub enum lxst_embedded::Signal
pub lxst_embedded::Signal::PreferredMode(u8)
pub lxst_embedded::Signal::PreferredProfile(lxst_embedded::Profile)
pub lxst_embedded::Signal::Raw(u32)
pub lxst_embedded::Signal::Status(lxst_embedded::SignallingStatus)
impl lxst_embedded::wire::Signal
pub const fn lxst_embedded::wire::Signal::from_wire(u32) -> Self
pub const fn lxst_embedded::wire::Signal::wire_value(self) -> u32
impl core::convert::From<lxst_embedded::CallMode> for lxst_embedded::wire::Signal
pub fn lxst_embedded::wire::Signal::from(lxst_embedded::CallMode) -> Self
impl core::convert::From<lxst_embedded::Profile> for lxst_embedded::wire::Signal
pub fn lxst_embedded::wire::Signal::from(lxst_embedded::Profile) -> Self
impl core::convert::From<lxst_embedded::SignallingStatus> for lxst_embedded::wire::Signal
@@ -208,10 +227,13 @@ pub lxst_embedded::TelephonyAction::OpenAudioPipelines
pub lxst_embedded::TelephonyAction::PrepareDialingPipelines
pub lxst_embedded::TelephonyAction::ResetDialingPipelines
pub lxst_embedded::TelephonyAction::RingIncomingCall
pub lxst_embedded::TelephonyAction::SelectMode(lxst_embedded::CallMode)
pub lxst_embedded::TelephonyAction::SelectProfile(lxst_embedded::Profile)
pub lxst_embedded::TelephonyAction::SendSignal(lxst_embedded::wire::Signal)
pub lxst_embedded::TelephonyAction::SendSignalPair(lxst_embedded::wire::Signal, lxst_embedded::wire::Signal)
pub lxst_embedded::TelephonyAction::StartAudioPipelines
pub lxst_embedded::TelephonyAction::StartDialTone
pub lxst_embedded::TelephonyAction::SwitchMode(lxst_embedded::CallMode)
pub lxst_embedded::TelephonyAction::SwitchProfile(lxst_embedded::Profile)
pub lxst_embedded::TelephonyAction::TeardownLink
pub lxst_embedded::TelephonyAction::Terminate(core::option::Option<lxst_embedded::SignallingStatus>)
@@ -222,17 +244,31 @@ pub struct lxst_embedded::CallState
impl lxst_embedded::CallState
pub fn lxst_embedded::CallState::answer(&mut self) -> lxst_embedded::Actions
pub const fn lxst_embedded::CallState::answered(&self) -> bool
pub const fn lxst_embedded::CallState::audio_started(&self) -> bool
pub fn lxst_embedded::CallState::caller_identified(&mut self, bool, bool) -> lxst_embedded::Actions
pub fn lxst_embedded::CallState::disable_remote_mode_follow(&mut self)
pub fn lxst_embedded::CallState::hangup(&mut self, bool) -> lxst_embedded::Actions
pub fn lxst_embedded::CallState::incoming() -> Self
pub fn lxst_embedded::CallState::incoming_link_established(bool) -> lxst_embedded::Actions
pub const fn lxst_embedded::CallState::mode(&self) -> core::option::Option<lxst_embedded::CallMode>
pub fn lxst_embedded::CallState::outgoing(core::option::Option<lxst_embedded::Profile>) -> Self
pub fn lxst_embedded::CallState::outgoing_with_mode(core::option::Option<lxst_embedded::Profile>, core::option::Option<lxst_embedded::CallMode>) -> Self
pub const fn lxst_embedded::CallState::profile(&self) -> core::option::Option<lxst_embedded::Profile>
pub fn lxst_embedded::CallState::receive_signal(&mut self, lxst_embedded::wire::Signal) -> lxst_embedded::Actions
pub fn lxst_embedded::CallState::retry_answer(&self) -> lxst_embedded::Actions
pub const fn lxst_embedded::CallState::role(&self) -> lxst_embedded::CallRole
pub fn lxst_embedded::CallState::set_transmit_squelched(&mut self, bool)
pub const fn lxst_embedded::CallState::status(&self) -> lxst_embedded::SignallingStatus
pub fn lxst_embedded::CallState::switch_mode(&mut self, lxst_embedded::CallMode) -> lxst_embedded::Actions
pub fn lxst_embedded::CallState::switch_profile(&mut self, lxst_embedded::Profile) -> lxst_embedded::Actions
pub const fn lxst_embedded::CallState::transmit_squelched(&self) -> bool
pub struct lxst_embedded::CallTimes
pub lxst_embedded::CallTimes::connect_ms: u64
pub lxst_embedded::CallTimes::ring_ms: u64
pub lxst_embedded::CallTimes::wait_ms: u64
impl lxst_embedded::CallTimes
pub const lxst_embedded::CallTimes::DEFAULT: Self
impl core::default::Default for lxst_embedded::CallTimes
pub fn lxst_embedded::CallTimes::default() -> Self
pub struct lxst_embedded::Codec2PacketCodec<B>
impl<B: lxst_embedded::Codec2Backend> lxst_embedded::Codec2PacketCodec<B>
pub fn lxst_embedded::Codec2PacketCodec<B>::decode_into(&mut self, &[u8], &mut [i16]) -> core::result::Result<usize, lxst_embedded::Codec2PacketError<<B as lxst_embedded::Codec2Backend>::Error>>
@@ -272,6 +308,7 @@ pub fn lxst_embedded::Session::end(&mut self, lxst_embedded::EndReason) -> lxst_
pub const fn lxst_embedded::Session::ended(&self) -> core::option::Option<lxst_embedded::EndReason>
pub fn lxst_embedded::Session::link_established(&mut self) -> lxst_embedded::Events
pub fn lxst_embedded::Session::media_ready(&self) -> bool
pub const fn lxst_embedded::Session::mode(&self) -> core::option::Option<lxst_embedded::CallMode>
pub fn lxst_embedded::Session::new(lxst_embedded::CallRole, lxst_embedded::SessionConfig, u64) -> core::result::Result<Self, lxst_embedded::ConfigError>
pub fn lxst_embedded::Session::peer_verified(&mut self, u64) -> lxst_embedded::Events
pub fn lxst_embedded::Session::playback_allowed(&self) -> bool
@@ -287,6 +324,7 @@ pub lxst_embedded::SessionConfig::allowed: lxst_embedded::ProfileSet
pub lxst_embedded::SessionConfig::capture: bool
pub lxst_embedded::SessionConfig::playback: bool
pub lxst_embedded::SessionConfig::preferred: lxst_embedded::Profile
pub lxst_embedded::SessionConfig::times: lxst_embedded::CallTimes
pub trait lxst_embedded::Codec2Backend
pub type lxst_embedded::Codec2Backend::Error
pub fn lxst_embedded::Codec2Backend::decode_native(&mut self, &[u8], &mut [i16]) -> core::result::Result<(), Self::Error>
+34 -3
View File
@@ -12,6 +12,7 @@ pub lxst_telephony::Error::LineBusy
pub lxst_telephony::Error::LinkDestinationClosed
pub lxst_telephony::Error::LinkOperation(alloc::string::String)
pub lxst_telephony::Error::LinkProofInvalid(alloc::string::String)
pub lxst_telephony::Error::LinkStamp(rns_link::stamp::LinkStampError)
pub lxst_telephony::Error::MediaProfileMismatch
pub lxst_telephony::Error::MediaProfileMismatch::active: lxst_core::profile::Profile
pub lxst_telephony::Error::MediaProfileMismatch::requested: lxst_core::profile::Profile
@@ -66,18 +67,27 @@ pub lxst_telephony::TelephonyCommand::ResetDialingPipelines::link_id: lxst_telep
pub lxst_telephony::TelephonyCommand::RingIncomingCall
pub lxst_telephony::TelephonyCommand::RingIncomingCall::link_id: lxst_telephony::LinkId
pub lxst_telephony::TelephonyCommand::RingIncomingCall::remote_identity: lxst_telephony::IdentityHash
pub lxst_telephony::TelephonyCommand::SelectMode
pub lxst_telephony::TelephonyCommand::SelectMode::link_id: lxst_telephony::LinkId
pub lxst_telephony::TelephonyCommand::SelectMode::mode: lxst_core::profile::CallMode
pub lxst_telephony::TelephonyCommand::SelectProfile
pub lxst_telephony::TelephonyCommand::SelectProfile::link_id: lxst_telephony::LinkId
pub lxst_telephony::TelephonyCommand::SelectProfile::profile: lxst_core::profile::Profile
pub lxst_telephony::TelephonyCommand::SendSignal
pub lxst_telephony::TelephonyCommand::SendSignal::link_id: lxst_telephony::LinkId
pub lxst_telephony::TelephonyCommand::SendSignal::signal: lxst_core::wire::Signal
pub lxst_telephony::TelephonyCommand::SendSignalPair
pub lxst_telephony::TelephonyCommand::SendSignalPair::link_id: lxst_telephony::LinkId
pub lxst_telephony::TelephonyCommand::SendSignalPair::signals: [lxst_core::wire::Signal; 2]
pub lxst_telephony::TelephonyCommand::StartAudioPipelines
pub lxst_telephony::TelephonyCommand::StartAudioPipelines::link_id: lxst_telephony::LinkId
pub lxst_telephony::TelephonyCommand::StartDialTone
pub lxst_telephony::TelephonyCommand::StartDialTone::link_id: lxst_telephony::LinkId
pub lxst_telephony::TelephonyCommand::StopAudioPipelines
pub lxst_telephony::TelephonyCommand::StopAudioPipelines::link_id: lxst_telephony::LinkId
pub lxst_telephony::TelephonyCommand::SwitchMode
pub lxst_telephony::TelephonyCommand::SwitchMode::link_id: lxst_telephony::LinkId
pub lxst_telephony::TelephonyCommand::SwitchMode::mode: lxst_core::profile::CallMode
pub lxst_telephony::TelephonyCommand::SwitchProfile
pub lxst_telephony::TelephonyCommand::SwitchProfile::link_id: lxst_telephony::LinkId
pub lxst_telephony::TelephonyCommand::SwitchProfile::profile: lxst_core::profile::Profile
@@ -99,8 +109,10 @@ pub lxst_telephony::TelephonyControl::Answer::expected_link_id: lxst_telephony::
pub lxst_telephony::TelephonyControl::Answer::reply: tokio::sync::oneshot::Sender<core::result::Result<lxst_telephony::ActiveCallSnapshot, lxst_telephony::Error>>
pub lxst_telephony::TelephonyControl::Call
pub lxst_telephony::TelephonyControl::Call::discovery_timeout: core::time::Duration
pub lxst_telephony::TelephonyControl::Call::mode: core::option::Option<lxst_core::profile::CallMode>
pub lxst_telephony::TelephonyControl::Call::profile: core::option::Option<lxst_core::profile::Profile>
pub lxst_telephony::TelephonyControl::Call::remote_identity: lxst_telephony::IdentityHash
pub lxst_telephony::TelephonyControl::DisableRemoteModeFollow
pub lxst_telephony::TelephonyControl::Hangup
pub lxst_telephony::TelephonyControl::Hangup::ring_timeout: bool
pub lxst_telephony::TelephonyControl::SendAudioFrames
@@ -115,6 +127,7 @@ pub lxst_telephony::TelephonyControl::SendRawFrames::frames: alloc::vec::Vec<lxs
pub lxst_telephony::TelephonyControl::SetAccessPolicy(lxst_telephony::CallerAccessPolicy)
pub lxst_telephony::TelephonyControl::SetExternalBusy(bool)
pub lxst_telephony::TelephonyControl::Shutdown
pub lxst_telephony::TelephonyControl::SquelchTransmit(bool)
pub lxst_telephony::TelephonyControl::StartAudioReceiveStream
pub lxst_telephony::TelephonyControl::StartAudioReceiveStream::frames: tokio::sync::mpsc::bounded::Sender<lxst_core::raw::RawAudioFrame>
pub lxst_telephony::TelephonyControl::StartAudioStream
@@ -131,6 +144,8 @@ pub lxst_telephony::TelephonyControl::StopAudioReceiveStream
pub lxst_telephony::TelephonyControl::StopAudioStream
pub lxst_telephony::TelephonyControl::StopOpusReceiveStream
pub lxst_telephony::TelephonyControl::StopOpusStream
pub lxst_telephony::TelephonyControl::SwitchMode
pub lxst_telephony::TelephonyControl::SwitchMode::mode: lxst_core::profile::CallMode
pub lxst_telephony::TelephonyControl::SwitchProfile
pub lxst_telephony::TelephonyControl::SwitchProfile::profile: lxst_core::profile::Profile
pub enum lxst_telephony::TelephonyLinkEvent
@@ -228,10 +243,12 @@ pub lxst_telephony::ActiveCall::remote_identity: lxst_telephony::IdentityHash
pub struct lxst_telephony::ActiveCallSnapshot
pub lxst_telephony::ActiveCallSnapshot::answered: bool
pub lxst_telephony::ActiveCallSnapshot::link_id: lxst_telephony::LinkId
pub lxst_telephony::ActiveCallSnapshot::mode: core::option::Option<lxst_core::profile::CallMode>
pub lxst_telephony::ActiveCallSnapshot::profile: core::option::Option<lxst_core::profile::Profile>
pub lxst_telephony::ActiveCallSnapshot::remote_identity: lxst_telephony::IdentityHash
pub lxst_telephony::ActiveCallSnapshot::role: lxst_core::telephony::CallRole
pub lxst_telephony::ActiveCallSnapshot::status: lxst_core::profile::SignallingStatus
pub lxst_telephony::ActiveCallSnapshot::transmit_squelched: bool
pub struct lxst_telephony::AudioTransmitGate
impl lxst_telephony::AudioTransmitGate
pub fn lxst_telephony::AudioTransmitGate::allows(&self) -> bool
@@ -246,6 +263,9 @@ impl lxst_telephony::CallerAccessPolicy
pub fn lxst_telephony::CallerAccessPolicy::is_allowed(&self, &lxst_telephony::IdentityHash) -> bool
impl core::default::Default for lxst_telephony::CallerAccessPolicy
pub fn lxst_telephony::CallerAccessPolicy::default() -> Self
pub struct lxst_telephony::OutgoingLinkRequest
impl core::fmt::Debug for lxst_telephony::OutgoingLinkRequest
pub fn lxst_telephony::OutgoingLinkRequest::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
pub struct lxst_telephony::RemoteTelephonyPeer
pub lxst_telephony::RemoteTelephonyPeer::destination_hash: [u8; 16]
pub lxst_telephony::RemoteTelephonyPeer::hops: u8
@@ -265,7 +285,9 @@ impl lxst_telephony::TelephonyRnsEndpoint
pub fn lxst_telephony::TelephonyRnsEndpoint::announce(&self) -> core::result::Result<(), lxst_telephony::Error>
pub fn lxst_telephony::TelephonyRnsEndpoint::await_path_to_identity(&self, lxst_telephony::IdentityHash, core::time::Duration) -> impl core::future::future::Future<Output = core::result::Result<(), lxst_telephony::Error>> + core::marker::Send + 'static
pub async fn lxst_telephony::TelephonyRnsEndpoint::begin_outgoing_link(&mut self, &mut lxst_telephony::TelephonyRuntimeCore, lxst_telephony::IdentityHash, core::option::Option<lxst_core::profile::Profile>, core::time::Duration) -> core::result::Result<lxst_telephony::LinkId, lxst_telephony::Error>
pub fn lxst_telephony::TelephonyRnsEndpoint::begin_outgoing_link_with_remote_pubkey(&mut self, &mut lxst_telephony::TelephonyRuntimeCore, lxst_telephony::IdentityHash, [u8; 64], core::option::Option<lxst_core::profile::Profile>, u8) -> core::result::Result<lxst_telephony::LinkId, lxst_telephony::Error>
pub async fn lxst_telephony::TelephonyRnsEndpoint::begin_outgoing_link_with_mode(&mut self, &mut lxst_telephony::TelephonyRuntimeCore, lxst_telephony::IdentityHash, [u8; 64], core::option::Option<lxst_core::profile::Profile>, core::option::Option<lxst_core::profile::CallMode>, u8) -> core::result::Result<lxst_telephony::LinkId, lxst_telephony::Error>
pub async fn lxst_telephony::TelephonyRnsEndpoint::begin_outgoing_link_with_remote_pubkey(&mut self, &mut lxst_telephony::TelephonyRuntimeCore, lxst_telephony::IdentityHash, [u8; 64], core::option::Option<lxst_core::profile::Profile>, u8) -> core::result::Result<lxst_telephony::LinkId, lxst_telephony::Error>
pub fn lxst_telephony::TelephonyRnsEndpoint::begin_prepared_outgoing_link(&mut self, &mut lxst_telephony::TelephonyRuntimeCore, [u8; 64], core::option::Option<lxst_core::profile::Profile>, core::option::Option<lxst_core::profile::CallMode>, lxst_telephony::OutgoingLinkRequest) -> core::result::Result<lxst_telephony::LinkId, lxst_telephony::Error>
pub fn lxst_telephony::TelephonyRnsEndpoint::deregister_destination(&self) -> core::result::Result<(), lxst_telephony::Error>
pub fn lxst_telephony::TelephonyRnsEndpoint::deregister_link_destination(&self, lxst_telephony::LinkId) -> core::result::Result<(), lxst_telephony::Error>
pub fn lxst_telephony::TelephonyRnsEndpoint::discover_remote_telephony_peer(&self, lxst_telephony::IdentityHash, core::time::Duration) -> impl core::future::future::Future<Output = core::result::Result<lxst_telephony::RemoteTelephonyPeer, lxst_telephony::Error>> + core::marker::Send + 'static
@@ -293,6 +315,8 @@ pub const fn lxst_telephony::TelephonyRuntimeCore::access_policy(&self) -> &lxst
pub fn lxst_telephony::TelephonyRuntimeCore::active_call(&self) -> core::option::Option<&lxst_telephony::ActiveCall>
pub fn lxst_telephony::TelephonyRuntimeCore::answer_active(&mut self, lxst_telephony::LinkId) -> core::result::Result<alloc::vec::Vec<lxst_telephony::TelephonyCommand>, lxst_telephony::Error>
pub fn lxst_telephony::TelephonyRuntimeCore::caller_identified(&mut self, lxst_telephony::LinkId, lxst_telephony::IdentityHash) -> core::result::Result<alloc::vec::Vec<lxst_telephony::TelephonyCommand>, lxst_telephony::Error>
pub const fn lxst_telephony::TelephonyRuntimeCore::dialling(&self) -> bool
pub fn lxst_telephony::TelephonyRuntimeCore::disable_remote_mode_follow(&mut self) -> core::result::Result<(), lxst_telephony::Error>
pub const fn lxst_telephony::TelephonyRuntimeCore::external_busy(&self) -> bool
pub fn lxst_telephony::TelephonyRuntimeCore::hangup_active(&mut self, bool) -> core::result::Result<alloc::vec::Vec<lxst_telephony::TelephonyCommand>, lxst_telephony::Error>
pub fn lxst_telephony::TelephonyRuntimeCore::incoming_link_established(&mut self, lxst_telephony::LinkId) -> alloc::vec::Vec<lxst_telephony::TelephonyCommand>
@@ -303,10 +327,13 @@ pub fn lxst_telephony::TelephonyRuntimeCore::outgoing_link_established(&mut self
pub fn lxst_telephony::TelephonyRuntimeCore::pending_link_count(&self) -> usize
pub fn lxst_telephony::TelephonyRuntimeCore::receive_signal(&mut self, lxst_telephony::LinkId, lxst_core::wire::Signal) -> core::result::Result<alloc::vec::Vec<lxst_telephony::TelephonyCommand>, lxst_telephony::Error>
pub fn lxst_telephony::TelephonyRuntimeCore::set_access_policy(&mut self, lxst_telephony::CallerAccessPolicy)
pub fn lxst_telephony::TelephonyRuntimeCore::set_active_transmit_squelched(&mut self, bool) -> core::result::Result<(), lxst_telephony::Error>
pub fn lxst_telephony::TelephonyRuntimeCore::set_external_busy(&mut self, bool)
pub fn lxst_telephony::TelephonyRuntimeCore::shutdown(&mut self) -> alloc::vec::Vec<lxst_telephony::TelephonyCommand>
pub fn lxst_telephony::TelephonyRuntimeCore::snapshot(&self) -> lxst_telephony::TelephonyRuntimeSnapshot
pub fn lxst_telephony::TelephonyRuntimeCore::start_outgoing_call(&mut self, lxst_telephony::LinkId, lxst_telephony::IdentityHash, core::option::Option<lxst_core::profile::Profile>) -> core::result::Result<(), lxst_telephony::Error>
pub fn lxst_telephony::TelephonyRuntimeCore::start_outgoing_call_with_mode(&mut self, lxst_telephony::LinkId, lxst_telephony::IdentityHash, core::option::Option<lxst_core::profile::Profile>, core::option::Option<lxst_core::profile::CallMode>) -> core::result::Result<(), lxst_telephony::Error>
pub fn lxst_telephony::TelephonyRuntimeCore::switch_active_mode(&mut self, lxst_core::profile::CallMode) -> core::result::Result<alloc::vec::Vec<lxst_telephony::TelephonyCommand>, lxst_telephony::Error>
pub fn lxst_telephony::TelephonyRuntimeCore::switch_active_profile(&mut self, lxst_core::profile::Profile) -> core::result::Result<alloc::vec::Vec<lxst_telephony::TelephonyCommand>, lxst_telephony::Error>
pub fn lxst_telephony::TelephonyRuntimeCore::with_access_policy(lxst_telephony::CallerAccessPolicy) -> Self
pub struct lxst_telephony::TelephonyRuntimeSnapshot
@@ -328,8 +355,7 @@ pub fn lxst_telephony::TelephonyServiceChannelConfig::default() -> Self
pub struct lxst_telephony::TelephonyServiceConfig
pub lxst_telephony::TelephonyServiceConfig::announce_interval: core::option::Option<core::time::Duration>
pub lxst_telephony::TelephonyServiceConfig::announce_on_start: bool
pub lxst_telephony::TelephonyServiceConfig::answer_retry_interval: core::option::Option<core::time::Duration>
pub lxst_telephony::TelephonyServiceConfig::answer_timeout: core::option::Option<core::time::Duration>
pub lxst_telephony::TelephonyServiceConfig::connect_timeout: core::option::Option<core::time::Duration>
pub lxst_telephony::TelephonyServiceConfig::incoming_ring_timeout: core::option::Option<core::time::Duration>
pub lxst_telephony::TelephonyServiceConfig::media_frames_per_tick: usize
pub lxst_telephony::TelephonyServiceConfig::outgoing_call_timeout: core::option::Option<core::time::Duration>
@@ -348,9 +374,14 @@ pub lxst_telephony::TelephonyStep::inbound: core::option::Option<lxst_rns::Inbou
impl lxst_telephony::TelephonyStep
pub fn lxst_telephony::TelephonyStep::commands(alloc::vec::Vec<lxst_telephony::TelephonyCommand>) -> Self
pub const lxst_telephony::TELEPHONY_ANNOUNCE_INTERVAL: core::time::Duration
pub const lxst_telephony::TELEPHONY_CONNECT_TIME: core::time::Duration
pub const lxst_telephony::TELEPHONY_JOB_INTERVAL: core::time::Duration
pub const lxst_telephony::TELEPHONY_RING_TIME: core::time::Duration
pub const lxst_telephony::TELEPHONY_STARTUP_ANNOUNCE_RETRIES: u8
pub const lxst_telephony::TELEPHONY_STARTUP_ANNOUNCE_RETRY_INTERVAL: core::time::Duration
pub const lxst_telephony::TELEPHONY_WAIT_TIME: core::time::Duration
pub fn lxst_telephony::execute_command_with_link(&tokio::sync::mpsc::bounded::Sender<rns_transport::messages::TransportMessage>, &[u8; 64], &rns_identity::identity::Identity, &mut rns_link::link::Link, &lxst_telephony::TelephonyCommand) -> core::result::Result<lxst_telephony::TelephonyCommandEffect, lxst_telephony::Error>
pub async fn lxst_telephony::prepare_outgoing_link_request(&tokio::sync::mpsc::bounded::Sender<rns_transport::messages::TransportMessage>, lxst_telephony::IdentityHash, u8) -> core::result::Result<lxst_telephony::OutgoingLinkRequest, lxst_telephony::Error>
pub async fn lxst_telephony::request_answer(&tokio::sync::mpsc::bounded::Sender<lxst_telephony::TelephonyControl>, lxst_telephony::LinkId) -> core::result::Result<lxst_telephony::ActiveCallSnapshot, lxst_telephony::Error>
pub fn lxst_telephony::signalling_packet(lxst_core::wire::Signal) -> lxst_core::wire::LxstPacket
pub fn lxst_telephony::signalling_packets_from_commands(&[lxst_telephony::TelephonyCommand]) -> alloc::vec::Vec<(lxst_telephony::LinkId, lxst_core::wire::LxstPacket)>
+20 -20
View File
@@ -4,7 +4,7 @@
"packages": [
{
"name": "lxst-codec2",
"version": "0.3.0",
"version": "0.4.0",
"rustVersion": "1.87",
"edition": "2024",
"features": {},
@@ -36,7 +36,7 @@
},
{
"name": "lxst-core",
"version": "0.3.0",
"version": "0.4.0",
"rustVersion": "1.89",
"edition": "2024",
"features": {},
@@ -69,7 +69,7 @@
"rename": null,
"kind": null,
"target": null,
"requirement": "=0.1.29",
"requirement": "=0.1.42",
"optional": false,
"defaultFeatures": false,
"features": [
@@ -103,7 +103,7 @@
},
{
"name": "lxst-embedded",
"version": "0.3.0",
"version": "0.4.0",
"rustVersion": "1.87",
"edition": "2024",
"features": {},
@@ -125,7 +125,7 @@
"rename": null,
"kind": null,
"target": null,
"requirement": "^0.3.0",
"requirement": "^0.4.0",
"optional": false,
"defaultFeatures": true,
"features": [],
@@ -146,7 +146,7 @@
},
{
"name": "lxst-rns",
"version": "0.3.0",
"version": "0.4.0",
"rustVersion": "1.89",
"edition": "2024",
"features": {},
@@ -179,7 +179,7 @@
"rename": null,
"kind": null,
"target": null,
"requirement": "^0.3.0",
"requirement": "^0.4.0",
"optional": false,
"defaultFeatures": true,
"features": [],
@@ -190,7 +190,7 @@
"rename": null,
"kind": null,
"target": null,
"requirement": "~1.4.0",
"requirement": "~1.5.1",
"optional": false,
"defaultFeatures": true,
"features": [],
@@ -201,7 +201,7 @@
"rename": null,
"kind": null,
"target": null,
"requirement": "~1.4.0",
"requirement": "~1.5.1",
"optional": false,
"defaultFeatures": true,
"features": [],
@@ -212,7 +212,7 @@
"rename": null,
"kind": null,
"target": null,
"requirement": "~1.4.0",
"requirement": "~1.5.1",
"optional": false,
"defaultFeatures": true,
"features": [],
@@ -249,7 +249,7 @@
},
{
"name": "lxst-telephony",
"version": "0.3.0",
"version": "0.4.0",
"rustVersion": "1.89",
"edition": "2024",
"features": {},
@@ -282,7 +282,7 @@
"rename": null,
"kind": null,
"target": null,
"requirement": "^0.3.0",
"requirement": "^0.4.0",
"optional": false,
"defaultFeatures": true,
"features": [],
@@ -293,7 +293,7 @@
"rename": null,
"kind": null,
"target": null,
"requirement": "^0.3.0",
"requirement": "^0.4.0",
"optional": false,
"defaultFeatures": true,
"features": [],
@@ -304,7 +304,7 @@
"rename": null,
"kind": null,
"target": null,
"requirement": "^0.3.0",
"requirement": "^0.4.0",
"optional": false,
"defaultFeatures": true,
"features": [],
@@ -315,7 +315,7 @@
"rename": null,
"kind": null,
"target": null,
"requirement": "~1.4.0",
"requirement": "~1.5.1",
"optional": false,
"defaultFeatures": true,
"features": [],
@@ -326,7 +326,7 @@
"rename": null,
"kind": null,
"target": null,
"requirement": "~1.4.0",
"requirement": "~1.5.1",
"optional": false,
"defaultFeatures": true,
"features": [],
@@ -337,7 +337,7 @@
"rename": null,
"kind": null,
"target": null,
"requirement": "~1.4.0",
"requirement": "~1.5.1",
"optional": false,
"defaultFeatures": true,
"features": [],
@@ -348,7 +348,7 @@
"rename": null,
"kind": null,
"target": null,
"requirement": "~1.4.0",
"requirement": "~1.5.1",
"optional": false,
"defaultFeatures": true,
"features": [],
@@ -359,7 +359,7 @@
"rename": null,
"kind": null,
"target": null,
"requirement": "~1.4.0",
"requirement": "~1.5.1",
"optional": false,
"defaultFeatures": true,
"features": [],
@@ -370,7 +370,7 @@
"rename": null,
"kind": null,
"target": null,
"requirement": "~1.4.0",
"requirement": "~1.5.1",
"optional": false,
"defaultFeatures": true,
"features": [],
+9 -12
View File
@@ -14,8 +14,8 @@
"commit": "af89a03094605dbdf7264d06fdc546526ec6980b"
},
"compatibilityFloor": {
"evidenceCommit": "21a54b778472343b70fd71d34ae96c61c44187c3",
"sourceCommit": "af89a03094605dbdf7264d06fdc546526ec6980b"
"evidenceCommit": "aeb400006bdd550f42e494bfc823f66acce0669e",
"sourceCommit": "aeb400006bdd550f42e494bfc823f66acce0669e"
},
"packages": [
{
@@ -33,8 +33,8 @@
"tier": "experimental",
"compatibility": "reviewed-snapshot",
"snapshot": "api/snapshots/lxst-embedded.txt",
"itemCount": 299,
"sha256": "7cfa734581040e35c4b817422376e4e99c9f7d447181d9e3a9e1dac0912b9295"
"itemCount": 337,
"sha256": "e4a86f580d90b6b5589fa0e91ac6d426b7df5d7f10e753683061d7184f64d425"
},
{
"name": "lxst-core",
@@ -42,8 +42,8 @@
"tier": "experimental",
"compatibility": "reviewed-snapshot",
"snapshot": "api/snapshots/lxst-core.txt",
"itemCount": 364,
"sha256": "2c272021cc340af7f779d944bebb336ae1804938239a8ead3cbf11a8074022e4"
"itemCount": 397,
"sha256": "7edc5748c8b212d551756681cbc0815da6102accb5a59126b43d3b23233096cd"
},
{
"name": "lxst-rns",
@@ -60,12 +60,9 @@
"tier": "experimental",
"compatibility": "reviewed-snapshot",
"snapshot": "api/snapshots/lxst-telephony.txt",
"itemCount": 360,
"sha256": "c9b9784a9b09bb41a9beffb29b62085b21f2b22cb8b7d18ef53ea9f673d77698"
"itemCount": 391,
"sha256": "f36724579b879506b8cd4fd3e4378f9b594bf97f169764f1461dd64401679b7a"
}
],
"newPackages": [
"lxst-codec2",
"lxst-embedded"
]
"newPackages": []
}
+9 -3
View File
@@ -38,9 +38,15 @@ FFT coefficient tables are shared read-only data, generated using the pinned
`libm` and the original native initialisation formulas. Per-stream state keeps
only integer selectors; encoder/decoder histories and mutable FFT scratch remain
independent. A bit-for-bit table test covers every supported size and direction.
Regenerate the checked-in coefficients with:
Generate coefficients into a temporary file and compare them with the checked-in table:
```sh
cargo run -p lxst-codec2 --example generate_fft_tables --locked --offline > crates/lxst-codec2/src/native/fft_coefficients.rs
cargo fmt -p lxst-codec2
coefficients=$(mktemp)
cargo run -p lxst-codec2 --example generate_fft_tables --locked --offline > "$coefficients"
diff -u crates/lxst-codec2/src/native/fft_coefficients.rs "$coefficients"
```
These comparison commands are for a POSIX shell. Inspect the generated file and
diff before replacing checked-in coefficients; redirecting straight to the
source would truncate it before Cargo has compiled the generator. `--offline`
requires the pinned dependencies to be available in the Cargo cache.
+1 -1
View File
@@ -2,7 +2,7 @@
name = "lxst-core"
version.workspace = true
edition.workspace = true
license.workspace = true
license-file.workspace = true
rust-version.workspace = true
publish.workspace = true
+5 -5
View File
@@ -1,8 +1,8 @@
//! Core LXST wire types.
//!
//! This crate owns the byte-level contract with Python LXST. It deliberately
//! avoids audio and Reticulum runtime dependencies so packet/profile parity can
//! be tested in isolation.
//! This crate provides LXST packet/profile types, call transitions and audio
//! codec helpers. It has no Reticulum runtime dependency and does not open
//! audio devices; callers supply and consume PCM frames.
#[path = "shared/actions.rs"]
mod actions;
@@ -21,10 +21,10 @@ mod wire;
pub use codec2::{Codec2Backend, Codec2PacketCodec, Codec2PacketError};
pub use opus::{
OPUS_ENCODED_FRAME_MAX_BYTES, OPUS_ENCODED_PACKET_MAX_BYTES, OPUS_MONO_DECODE_SAMPLE_RATE_HZ,
OpusCodecError, OpusDecoderState, OpusEncoderState, OpusMonoDecoder,
OpusCodecError, OpusDecoderState, OpusEncoderState, OpusMonoDecoder, OpusPacketDecoder,
opus_packet_duration_samples_48k,
};
pub use profile::{AudioCodec, OpusApplication, OpusProfile, Profile, SignallingStatus};
pub use profile::{AudioCodec, CallMode, OpusApplication, OpusProfile, Profile, SignallingStatus};
pub use raw::RawAudioFrame;
pub use stream::{
DropPolicy, FramePacketizer, FrameStreamEvent, FrameStreamState, JitterBuffer, JitterPush,
+205 -100
View File
@@ -1,4 +1,6 @@
use opus_rs::{Application, OpusDecoder, OpusEncoder};
use std::panic::{AssertUnwindSafe, catch_unwind};
use opus_rs::{Application, Bandwidth, OpusDecoder, OpusEncoder};
use thiserror::Error;
use crate::{AudioCodec, CodecKind, Frame, OpusApplication, OpusProfile, Profile, RawAudioFrame};
@@ -11,8 +13,10 @@ pub const OPUS_ENCODED_FRAME_MAX_BYTES: usize = 1_275;
/// The maximum encoded Opus packet accepted by the interoperable decoder.
///
/// RFC 7845 bounds one Opus packet at 61,440 encoded bytes. This is distinct from the 1,275-byte
/// limit for each frame inside the packet and from the bounded decoded PCM allocation.
/// This implementation uses the 61,440-byte processing limit recommended by
/// [RFC 7845, section 6](https://www.rfc-editor.org/rfc/rfc7845.html#section-6).
/// Valid padded Opus packets can be larger. This is separate from the
/// 1,275-byte per-frame limit and the decoded PCM allocation.
pub const OPUS_ENCODED_PACKET_MAX_BYTES: usize = 61_440;
#[derive(Debug, Error, PartialEq, Eq)]
@@ -64,8 +68,6 @@ pub struct OpusEncoderState {
sample_frames: usize,
subframe_count: usize,
subframe_sample_frames: usize,
encode_sample_frames: usize,
encode_subframe_sample_frames: usize,
max_payload_bytes: usize,
encoder: OpusEncoder,
}
@@ -78,35 +80,28 @@ impl OpusEncoderState {
};
let channels = opus_profile.channels();
let sample_rate = opus_profile.sample_rate();
let encode_sample_rate = encode_sample_rate(opus_profile);
let sample_frames = profile.sample_frames_per_packet();
let encode_sample_frames =
scale_sample_frames(sample_frames, sample_rate, encode_sample_rate)?;
let packet_layout = PacketLayout::new(encode_sample_rate, encode_sample_frames)?;
let subframe_sample_frames = sample_frames
.checked_div(packet_layout.subframe_count)
.filter(|frames| frames * packet_layout.subframe_count == sample_frames)
.ok_or(OpusCodecError::UnsupportedFrameDuration {
sample_rate_hz: sample_rate,
sample_frames,
})?;
let packet_layout = PacketLayout::new(sample_rate, sample_frames)?;
let mut encoder = OpusEncoder::new(
encode_sample_rate as i32,
sample_rate as i32,
usize::from(channels),
opus_application(opus_profile.application()),
)
.map_err(|err| OpusCodecError::Codec(err.to_string()))?;
encoder.bitrate_bps = opus_profile.bitrate_ceiling() as i32;
encoder.use_cbr = false;
if matches!(opus_profile, OpusProfile::VoiceMedium) {
// At 8 kbps libopus builds disagree (1.5 wideband, 1.6 narrowband); wideband is
// what this profile has always sent.
encoder.set_bandwidth(Bandwidth::Wideband);
}
Ok(Self {
profile,
channels,
sample_frames,
subframe_count: packet_layout.subframe_count,
subframe_sample_frames,
encode_sample_frames,
encode_subframe_sample_frames: packet_layout.subframe_sample_frames,
subframe_sample_frames: packet_layout.subframe_sample_frames,
max_payload_bytes: opus_profile.max_bytes_per_frame_ms(profile.frame_time_ms()),
encoder,
})
@@ -142,22 +137,10 @@ impl OpusEncoderState {
return self.encode_multi_subframe_packet(frame);
}
let resampled;
let input = if self.encode_sample_frames == self.sample_frames {
&frame.samples
} else {
resampled = resample_interleaved_linear(
&frame.samples,
self.sample_frames,
self.encode_sample_frames,
usize::from(self.channels),
);
&resampled
};
let mut encoded = vec![0u8; self.max_payload_bytes];
let written = self
.encoder
.encode(input, self.encode_sample_frames, &mut encoded)
.encode(&frame.samples, self.sample_frames, &mut encoded)
.map_err(|err| OpusCodecError::Codec(err.to_string()))?;
encoded.truncate(written);
Ok(Frame::new(CodecKind::Opus, encoded))
@@ -174,22 +157,14 @@ impl OpusEncoderState {
for (subframe_index, payload_budget) in budgets.into_iter().enumerate() {
let start = subframe_index * self.subframe_sample_frames * channels;
let end = start + self.subframe_sample_frames * channels;
let resampled;
let input = if self.encode_subframe_sample_frames == self.subframe_sample_frames {
&frame.samples[start..end]
} else {
resampled = resample_interleaved_linear(
&frame.samples[start..end],
self.subframe_sample_frames,
self.encode_subframe_sample_frames,
channels,
);
&resampled
};
let mut encoded = vec![0u8; payload_budget + 1];
let written = self
.encoder
.encode(input, self.encode_subframe_sample_frames, &mut encoded)
.encode(
&frame.samples[start..end],
self.subframe_sample_frames,
&mut encoded,
)
.map_err(|err| OpusCodecError::Codec(err.to_string()))?;
encoded.truncate(written);
if encoded.first().is_none_or(|toc| toc & 0x03 != 0) {
@@ -245,6 +220,7 @@ impl OpusEncoderState {
pub struct OpusDecoderState {
profile: Profile,
sample_rate_hz: u32,
channels: u8,
sample_frames: usize,
subframe_count: usize,
@@ -267,6 +243,7 @@ impl OpusDecoderState {
Ok(Self {
profile,
sample_rate_hz: sample_rate,
channels,
sample_frames,
subframe_count: packet_layout.subframe_count,
@@ -300,10 +277,14 @@ impl OpusDecoderState {
fn decode_direct_packet(&mut self, frame: &Frame) -> Result<RawAudioFrame, OpusCodecError> {
let mut samples = vec![0.0f32; self.sample_frames * usize::from(self.channels)];
let decoded = self
.decoder
.decode(&frame.payload, self.sample_frames, &mut samples)
.map_err(|err| OpusCodecError::Codec(err.to_string()))?;
let decoded = decode_guarded(
&mut self.decoder,
self.sample_rate_hz,
usize::from(self.channels),
&frame.payload,
self.sample_frames,
&mut samples,
)?;
samples.truncate(decoded * usize::from(self.channels));
Ok(RawAudioFrame::new(self.channels, samples)?)
}
@@ -323,13 +304,14 @@ impl OpusDecoderState {
let mut subpacket = Vec::with_capacity(subpayload.len() + 1);
subpacket.push(toc);
subpacket.extend_from_slice(subpayload);
self.decoder
.decode(
&subpacket,
self.subframe_sample_frames,
&mut samples[start..end],
)
.map_err(|err| OpusCodecError::Codec(err.to_string()))?;
decode_guarded(
&mut self.decoder,
self.sample_rate_hz,
channels,
&subpacket,
self.subframe_sample_frames,
&mut samples[start..end],
)?;
}
Ok(RawAudioFrame::new(self.channels, samples)?)
@@ -360,7 +342,9 @@ impl OpusMonoDecoder {
1
}
/// Decodes one complete Opus packet to mono PCM at 48 kHz.
/// Decode one complete mono Opus packet to PCM at 48 kHz.
/// Stereo packets are rejected, as are packets exceeding
/// [`OPUS_ENCODED_PACKET_MAX_BYTES`] or the per-frame size/duration limits.
pub fn decode_packet(&mut self, packet: &[u8]) -> Result<RawAudioFrame, OpusCodecError> {
let inspected = inspect_opus_packet(packet)?;
if inspected.channels != 1 {
@@ -379,14 +363,14 @@ impl OpusMonoDecoder {
let output_start = samples.len();
samples.resize(output_start + inspected.samples_per_frame_48k, 0.0);
let decoded = self
.decoder
.decode(
&direct_packet,
inspected.samples_per_frame_48k,
&mut samples[output_start..],
)
.map_err(|err| OpusCodecError::Codec(err.to_string()))?;
let decoded = decode_guarded(
&mut self.decoder,
OPUS_MONO_DECODE_SAMPLE_RATE_HZ,
1,
&direct_packet,
inspected.samples_per_frame_48k,
&mut samples[output_start..],
)?;
if decoded != inspected.samples_per_frame_48k {
return Err(OpusCodecError::DecodedPacketDurationMismatch {
expected: inspected.samples_per_frame_48k,
@@ -400,6 +384,113 @@ impl OpusMonoDecoder {
}
}
/// Decodes any legal Opus packet (2.5 to 120 ms, mono or stereo) to a fixed sample rate
/// and channel count, as Python's libopus decoder does whatever the local profile is.
pub struct OpusPacketDecoder {
sample_rate_hz: u32,
channels: u8,
decoders: [Option<OpusDecoder>; 2],
}
impl OpusPacketDecoder {
pub fn new(sample_rate_hz: u32, channels: u8) -> Result<Self, OpusCodecError> {
if !matches!(sample_rate_hz, 8_000 | 12_000 | 16_000 | 24_000 | 48_000) {
return Err(OpusCodecError::UnsupportedFrameDuration {
sample_rate_hz,
sample_frames: 0,
});
}
if !matches!(channels, 1 | 2) {
return Err(OpusCodecError::ChannelMismatch {
expected: 2,
actual: channels,
});
}
Ok(Self {
sample_rate_hz,
channels,
decoders: [None, None],
})
}
pub const fn sample_rate_hz(&self) -> u32 {
self.sample_rate_hz
}
pub const fn channels(&self) -> u8 {
self.channels
}
pub fn decode_packet(&mut self, packet: &[u8]) -> Result<RawAudioFrame, OpusCodecError> {
let inspected = inspect_opus_packet(packet)?;
let packet_channels = usize::from(inspected.channels);
let samples_per_frame =
inspected.samples_per_frame_48k * self.sample_rate_hz as usize / 48_000;
let slot = &mut self.decoders[packet_channels - 1];
if slot.is_none() {
*slot = Some(
OpusDecoder::new(self.sample_rate_hz as i32, packet_channels)
.map_err(|err| OpusCodecError::Codec(err.to_string()))?,
);
}
let decoder = slot.as_mut().expect("decoder exists after creation");
let mut samples =
Vec::with_capacity(samples_per_frame * inspected.frames.len() * packet_channels);
let direct_toc = inspected.toc & !0x03;
for payload in inspected.frames {
let mut direct_packet = Vec::with_capacity(payload.len() + 1);
direct_packet.push(direct_toc);
direct_packet.extend_from_slice(payload);
let output_start = samples.len();
samples.resize(output_start + samples_per_frame * packet_channels, 0.0);
let decoded = decode_guarded(
decoder,
self.sample_rate_hz,
packet_channels,
&direct_packet,
samples_per_frame,
&mut samples[output_start..],
)?;
if decoded != samples_per_frame {
return Err(OpusCodecError::DecodedPacketDurationMismatch {
expected: samples_per_frame,
actual: decoded,
});
}
}
let frame = RawAudioFrame::new(inspected.channels, samples)?;
Ok(frame.with_channels(self.channels)?)
}
}
/// Peer packets reach opus-rs, which has panicked on hostile input (0.1.29: negative SILK LTP
/// start index, fixed in 0.1.42). A panicked decoder's state is undefined, so it is replaced
/// and the packet rejected. Remove once the pinned opus-rs passes a decoder fuzz campaign.
fn decode_guarded(
decoder: &mut OpusDecoder,
sample_rate_hz: u32,
channels: usize,
packet: &[u8],
frame_size: usize,
output: &mut [f32],
) -> Result<usize, OpusCodecError> {
match catch_unwind(AssertUnwindSafe(|| {
decoder.decode(packet, frame_size, output)
})) {
Ok(result) => result.map_err(|err| OpusCodecError::Codec(err.to_string())),
Err(_) => {
*decoder = OpusDecoder::new(sample_rate_hz as i32, channels)
.map_err(|err| OpusCodecError::Codec(err.to_string()))?;
Err(OpusCodecError::MalformedPacket(
"Opus decoder rejected the packet",
))
}
}
}
/// Returns a supported packet's total duration in samples at the Opus 48 kHz clock.
///
/// The packet is structurally inspected using the framing rules from RFC 6716. Every legal
@@ -642,44 +733,11 @@ fn opus_application(application: OpusApplication) -> Application {
}
}
fn encode_sample_rate(profile: OpusProfile) -> u32 {
match profile {
// Python LXST uses libopus with an output byte ceiling but no fixed
// bitrate or bandwidth CTLs. At Medium's 8 kbps ceiling, libopus is
// free to pick lower voice bandwidth; opus-rs otherwise forces
// superwideband/hybrid from the 24 kHz API rate, which is poor for
// speech at this budget.
OpusProfile::VoiceMedium => 16_000,
_ => profile.sample_rate(),
}
}
fn scale_sample_frames(
sample_frames: usize,
source_sample_rate: u32,
encode_sample_rate: u32,
) -> Result<usize, OpusCodecError> {
let numerator = sample_frames
.checked_mul(encode_sample_rate as usize)
.ok_or(OpusCodecError::UnsupportedFrameDuration {
sample_rate_hz: encode_sample_rate,
sample_frames,
})?;
let denominator = source_sample_rate as usize;
if !numerator.is_multiple_of(denominator) {
return Err(OpusCodecError::UnsupportedFrameDuration {
sample_rate_hz: encode_sample_rate,
sample_frames,
});
}
Ok(numerator / denominator)
}
fn supports_direct_frame(sample_rate_hz: u32, sample_frames: usize) -> bool {
sample_frames != 0 && (sample_rate_hz as usize).is_multiple_of(sample_frames)
}
fn resample_interleaved_linear(
pub(crate) fn resample_interleaved_linear(
input: &[f32],
input_frames: usize,
output_frames: usize,
@@ -1277,4 +1335,51 @@ mod tests {
));
}
}
// Fuzz-found sequence: the last packet drove opus-rs 0.1.29 `silk_decode_core` to a
// negative LTP start index and a panic. 0.1.42 decodes or refuses it.
fn silk_panic_window() -> Vec<Vec<u8>> {
include_str!("../tests/data/opus_silk_negative_ltp_start.hex")
.lines()
.map(|line| hex::decode(line).unwrap())
.collect()
}
#[test]
fn mono_decoder_survives_fuzz_found_silk_frame() {
let window = silk_panic_window();
let (last, prefix) = window.split_last().unwrap();
let mut decoder = OpusMonoDecoder::new().unwrap();
for packet in prefix {
let _ = decoder.decode_packet(packet);
}
let _ = decoder.decode_packet(last);
let good = encoded_mono_packet(960, 32_000);
let after = decoder.decode_packet(&good).unwrap();
let fresh = OpusMonoDecoder::new()
.unwrap()
.decode_packet(&good)
.unwrap();
assert_eq!(after.samples.len(), fresh.samples.len());
}
#[test]
fn packet_decoder_survives_fuzz_found_silk_frame() {
let window = silk_panic_window();
let (last, prefix) = window.split_last().unwrap();
let mut decoder = OpusPacketDecoder::new(OPUS_MONO_DECODE_SAMPLE_RATE_HZ, 1).unwrap();
for packet in prefix {
let _ = decoder.decode_packet(packet);
}
let _ = decoder.decode_packet(last);
let good = encoded_mono_packet(960, 32_000);
let after = decoder.decode_packet(&good).unwrap();
let fresh = OpusPacketDecoder::new(OPUS_MONO_DECODE_SAMPLE_RATE_HZ, 1)
.unwrap()
.decode_packet(&good)
.unwrap();
assert_eq!(after.samples.len(), fresh.samples.len());
}
}
+80 -14
View File
@@ -46,6 +46,46 @@ impl RawAudioFrame {
})
}
/// Convert to `channels`: mono is duplicated, extra channels are averaged to mono,
/// otherwise the leading channels are kept and the last one repeated.
pub fn with_channels(self, channels: u8) -> Result<Self, Error> {
if channels == self.channels {
return Ok(self);
}
let source = usize::from(self.channels);
let target = usize::from(channels);
let mut samples = Vec::with_capacity(self.sample_frames() * target);
for frame in self.samples.chunks_exact(source) {
if target == 1 {
samples.push(frame.iter().sum::<f32>() / source as f32);
} else {
for channel in 0..target {
samples.push(frame[channel.min(source - 1)]);
}
}
}
Self::new(channels, samples)
}
/// Linearly resample from `input_rate_hz` to `output_rate_hz`.
pub fn resampled(&self, input_rate_hz: u32, output_rate_hz: u32) -> Self {
if input_rate_hz == output_rate_hz || input_rate_hz == 0 {
return self.clone();
}
let input_frames = self.sample_frames();
let output_frames =
(input_frames as u64 * u64::from(output_rate_hz) / u64::from(input_rate_hz)) as usize;
Self {
channels: self.channels,
samples: crate::opus::resample_interleaved_linear(
&self.samples,
input_frames,
output_frames,
usize::from(self.channels),
),
}
}
pub fn to_payload(&self, bit_depth: RawBitDepth) -> Result<Vec<u8>, Error> {
validate_sample_count(self.channels, self.samples.len())?;
let header = RawFrameHeader::new(self.channels, bit_depth)?;
@@ -92,7 +132,7 @@ fn decode_samples(bytes: &[u8], bit_depth: RawBitDepth) -> Result<Vec<f32>, Erro
}
RawBitDepth::Float128 => {
for chunk in bytes.as_chunks::<16>().0 {
samples.push(decode_float128_lossy(chunk));
samples.push(decode_float128(chunk));
}
}
}
@@ -125,24 +165,50 @@ fn encode_samples(samples: &[f32], bit_depth: RawBitDepth, out: &mut Vec<u8>) {
}
}
fn decode_float128_lossy(bytes: &[u8]) -> f32 {
// Python/Numpy names this dtype "float128", but on common little-endian
// platforms it may be backed by an 80-bit extended value padded to 16 bytes.
// We preserve finite zero exactly and otherwise use the leading f64 lane as
// a conservative lossy fallback until a platform-specific long-double codec
// is introduced.
if bytes.iter().all(|byte| *byte == 0) {
// numpy float128 is IEEE binary128 on Linux aarch64; x86_64 pads an 80-bit value instead.
const BINARY128_EXPONENT_BIAS: i32 = 16_383;
const BINARY128_MANTISSA_BITS: u32 = 112;
fn decode_float128(bytes: &[u8]) -> f32 {
let mut le = [0u8; 16];
le.copy_from_slice(bytes);
let bits = u128::from_le_bytes(le);
let negative = bits >> 127 != 0;
let exponent = ((bits >> BINARY128_MANTISSA_BITS) & 0x7FFF) as i32;
let mantissa = bits & ((1u128 << BINARY128_MANTISSA_BITS) - 1);
let magnitude = if exponent == 0x7FFF {
if mantissa == 0 {
f64::INFINITY
} else {
f64::NAN
}
} else if exponent == 0 {
// Subnormal binary128 values are far below the f32 range.
0.0
} else {
f64::from_le_bytes([
bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5], bytes[6], bytes[7],
]) as f32
}
let fraction = (mantissa >> (BINARY128_MANTISSA_BITS - 52)) as f64 / (1u64 << 52) as f64;
(1.0 + fraction) * 2f64.powi(exponent - BINARY128_EXPONENT_BIAS)
};
(if negative { -magnitude } else { magnitude }) as f32
}
fn encode_float128_from_f32(sample: f32, out: &mut Vec<u8>) {
out.extend_from_slice(&f64::from(sample).to_le_bytes());
out.extend_from_slice(&[0u8; 8]);
let value = f64::from(sample);
let f64_bits = value.to_bits();
let sign = u128::from(f64_bits >> 63) << 127;
let exponent = ((f64_bits >> 52) & 0x7FF) as i32;
let mantissa = u128::from(f64_bits & ((1u64 << 52) - 1));
let bits = if value == 0.0 {
sign
} else if exponent == 0x7FF {
let nan_mantissa = if mantissa == 0 { 0 } else { 1u128 << 111 };
sign | (0x7FFFu128 << BINARY128_MANTISSA_BITS) | nan_mantissa
} else {
// Every f32 widens to a normal f64.
let exponent = (exponent - 1023 + BINARY128_EXPONENT_BIAS) as u128;
sign | (exponent << BINARY128_MANTISSA_BITS) | (mantissa << (BINARY128_MANTISSA_BITS - 52))
};
out.extend_from_slice(&bits.to_le_bytes());
}
#[cfg(test)]
+3 -3
View File
@@ -1,16 +1,16 @@
use crate::Signal;
use crate::TelephonyAction;
/// Every current transition emits at most four ordered actions.
/// Every current transition emits at most six ordered actions.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Actions {
items: [TelephonyAction; 4],
items: [TelephonyAction; 6],
length: usize,
}
impl Actions {
pub(crate) fn new() -> Self {
Self {
items: [const { TelephonyAction::IgnoreSignal(Signal::Raw(0)) }; 4],
items: [const { TelephonyAction::IgnoreSignal(Signal::Raw(0)) }; 6],
length: 0,
}
}
+5 -1
View File
@@ -1,4 +1,4 @@
use crate::{Profile, Signal, SignallingStatus};
use crate::{CallMode, Profile, Signal, SignallingStatus};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum CallRole {
@@ -9,6 +9,8 @@ pub enum CallRole {
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum TelephonyAction {
SendSignal(Signal),
/// Send both signals in one packet, as Python sends profile and mode on RINGING.
SendSignalPair(Signal, Signal),
IdentifyLocalIdentity,
SelectProfile(Profile),
PrepareDialingPipelines,
@@ -20,5 +22,7 @@ pub enum TelephonyAction {
TeardownLink,
RingIncomingCall,
SwitchProfile(Profile),
SelectMode(CallMode),
SwitchMode(CallMode),
IgnoreSignal(Signal),
}
+6 -5
View File
@@ -122,9 +122,9 @@ impl<B: Codec2Backend> Codec2PacketCodec<B> {
/// Encode exactly one profile packet. PCM is mono 8 kHz, signed 16-bit.
///
/// Capacity/shape errors leave backend and output unchanged. A backend error
/// invalidates this stream and the partially written output; replace it before
/// reuse. Bytes beyond the returned length remain untouched.
/// Capacity/shape errors leave output unchanged and do not call the native
/// encoder. A backend error invalidates this stream and its partial output;
/// replace it before reuse. Bytes beyond the returned length stay untouched.
pub fn encode_into(
&mut self,
pcm: &[i16],
@@ -159,8 +159,9 @@ impl<B: Codec2Backend> Codec2PacketCodec<B> {
/// Decode exactly one negotiated-profile payload, including its mode header.
///
/// A peer cannot trigger mode changes, unbounded frame counts or allocations
/// through this wrapper. The backend is never called on malformed payloads.
/// The wrapper fixes the mode and frame count and allocates no memory.
/// It checks mode header, payload length and output capacity before calling
/// the native decoder; codec-content validation belongs to the backend.
/// On backend failure discard the partial PCM and replace this stream.
pub fn decode_into(
&mut self,
+53
View File
@@ -159,6 +159,21 @@ impl Profile {
}
}
/// Python `Profiles.get_buffer_frames`: its sink holds one frame more than this and
/// starts playback at `max(1, buffer_frames() - 2)` frames.
pub const fn buffer_frames(self) -> u8 {
match self {
Self::BandwidthUltraLow => 2,
Self::BandwidthVeryLow => 2,
Self::BandwidthLow => 2,
Self::QualityMedium => 5,
Self::QualityHigh => 5,
Self::QualityMax => 5,
Self::LatencyLow => 3,
Self::LatencyUltraLow => 2,
}
}
pub fn next(self) -> Self {
let index = Self::ORDER
.iter()
@@ -168,6 +183,44 @@ impl Profile {
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[repr(u8)]
pub enum CallMode {
FullDuplex = 0x01,
HalfDuplex = 0x02,
}
impl CallMode {
pub const DEFAULT: Self = Self::FullDuplex;
pub const AVAILABLE: [Self; 2] = [Self::FullDuplex, Self::HalfDuplex];
pub const fn wire_value(self) -> u8 {
self as u8
}
pub const fn from_wire(value: u8) -> Option<Self> {
match value {
0x01 => Some(Self::FullDuplex),
0x02 => Some(Self::HalfDuplex),
_ => None,
}
}
pub const fn name(self) -> &'static str {
match self {
Self::FullDuplex => "Full Duplex",
Self::HalfDuplex => "Half Duplex",
}
}
pub const fn abbreviation(self) -> &'static str {
match self {
Self::FullDuplex => "FDX",
Self::HalfDuplex => "HDX",
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum AudioCodec {
Opus(OpusProfile),
+123 -40
View File
@@ -1,5 +1,5 @@
use crate::actions::Actions;
use crate::{CallRole, Profile, Signal, SignallingStatus, TelephonyAction};
use crate::{CallMode, CallRole, Profile, Signal, SignallingStatus, TelephonyAction};
macro_rules! actions {
($($value:expr),* $(,)?) => { Actions::from_array([$($value),*]) };
@@ -10,16 +10,29 @@ pub struct CallState {
role: CallRole,
status: SignallingStatus,
profile: Option<Profile>,
/// Raw mode value; Python stores unknown modes without acting on them.
mode: Option<u8>,
answered: bool,
pipelines_started: bool,
transmit_squelched: bool,
remote_mode_follow_disabled: bool,
}
impl CallState {
pub fn outgoing(profile: Option<Profile>) -> Self {
Self::outgoing_with_mode(profile, None)
}
pub fn outgoing_with_mode(profile: Option<Profile>, mode: Option<CallMode>) -> Self {
Self {
role: CallRole::Outgoing,
status: SignallingStatus::Calling,
profile,
mode: mode.map(|mode| mode.wire_value()),
answered: false,
pipelines_started: false,
transmit_squelched: false,
remote_mode_follow_disabled: false,
}
}
@@ -28,7 +41,11 @@ impl CallState {
role: CallRole::Incoming,
status: SignallingStatus::Available,
profile: None,
mode: None,
answered: false,
pipelines_started: false,
transmit_squelched: false,
remote_mode_follow_disabled: false,
}
}
@@ -48,6 +65,34 @@ impl CallState {
self.answered
}
/// Whether audio pipelines were started; a caller only starts them on the callee's ESTABLISHED.
pub const fn audio_started(&self) -> bool {
self.pipelines_started
}
/// Selected call mode, or `None` before selection or for an unknown remote mode.
pub const fn mode(&self) -> Option<CallMode> {
match self.mode {
Some(value) => CallMode::from_wire(value),
None => None,
}
}
/// Whether outbound media frames are dropped, as Python's squelched Packetizer.
pub const fn transmit_squelched(&self) -> bool {
self.transmit_squelched
}
/// Squelch or unsquelch transmit locally without signalling, as Python `squelch_transmit`.
pub fn set_transmit_squelched(&mut self, squelched: bool) {
self.transmit_squelched = squelched;
}
/// Ignore later remote mode switches, as Python `disable_remote_mode_follow`.
pub fn disable_remote_mode_follow(&mut self) {
self.remote_mode_follow_disabled = true;
}
pub fn incoming_link_established(line_busy: bool) -> Actions {
if line_busy {
actions![
@@ -84,36 +129,16 @@ impl CallState {
let mut actions = Actions::new();
self.answered = true;
self.ensure_profile(&mut actions);
self.ensure_mode(&mut actions);
self.squelch_for_opened_pipelines();
self.push_status_signal(SignallingStatus::Connecting, &mut actions);
actions.push(TelephonyAction::OpenAudioPipelines);
// Python LXST sends ESTABLISHED as the final half of the answer offer,
// then the outgoing peer echoes ESTABLISHED while opening its own
// pipelines. Keep the incoming call in CONNECTING until that remote
// echo is observed: local queue admission alone is not proof that the
// caller received the answer.
actions.push(TelephonyAction::SendSignal(Signal::from(
SignallingStatus::Established,
)));
self.push_status_signal(SignallingStatus::Established, &mut actions);
actions.push(TelephonyAction::StartAudioPipelines);
self.pipelines_started = true;
actions
}
/// Re-send the wire-compatible answer offer without reopening pipelines
/// or changing local state. The service bounds these retries and stops as
/// soon as the outgoing peer's ESTABLISHED echo is observed.
pub fn retry_answer(&self) -> Actions {
if self.role != CallRole::Incoming
|| !self.answered
|| self.status != SignallingStatus::Connecting
{
return Actions::new();
}
actions![
TelephonyAction::SendSignal(Signal::from(SignallingStatus::Connecting)),
TelephonyAction::SendSignal(Signal::from(SignallingStatus::Established)),
]
}
pub fn receive_signal(&mut self, signal: Signal) -> Actions {
if self.role == CallRole::Incoming && !self.answered && matches!(signal, Signal::Status(_))
{
@@ -143,11 +168,13 @@ impl CallState {
}
let mut actions = Actions::new();
self.status = SignallingStatus::Ringing;
self.ensure_profile(&mut actions);
let profile = self.ensure_profile(&mut actions);
let mode = self.ensure_mode(&mut actions);
actions.push(TelephonyAction::PrepareDialingPipelines);
if let Some(profile) = self.profile {
actions.push(TelephonyAction::SendSignal(Signal::from(profile)));
}
actions.push(TelephonyAction::SendSignalPair(
Signal::from(profile),
Signal::PreferredMode(mode),
));
actions.push(TelephonyAction::StartDialTone);
actions
}
@@ -155,9 +182,8 @@ impl CallState {
if self.role == CallRole::Outgoing
&& self.status.wire_value() >= SignallingStatus::Connecting.wire_value()
{
// A delayed/retried CONNECTING must not regress an already
// established call. Re-echo ESTABLISHED so an incoming
// peer can recover if its first acknowledgement was lost.
// Python answers every CONNECTING with ESTABLISHED, and callees
// from rsLXST 0.3.1 and earlier resend CONNECTING until they see it.
return actions![TelephonyAction::SendSignal(Signal::from(
SignallingStatus::Established,
))];
@@ -166,24 +192,24 @@ impl CallState {
return actions![TelephonyAction::IgnoreSignal(signal)];
}
self.status = SignallingStatus::Connecting;
self.squelch_for_opened_pipelines();
let mut actions = actions![
TelephonyAction::ResetDialingPipelines,
TelephonyAction::OpenAudioPipelines,
];
if self.role == CallRole::Outgoing {
// This mirrors Python Telephone.__open_pipelines(): the
// caller echoes ESTABLISHED after observing CONNECTING.
actions.push(TelephonyAction::SendSignal(Signal::from(
SignallingStatus::Established,
)));
// Python's caller signals ESTABLISHED once its pipelines are open,
// which makes its own call status ESTABLISHED.
self.push_status_signal(SignallingStatus::Established, &mut actions);
}
actions
}
Signal::Status(SignallingStatus::Established) => {
if self.status == SignallingStatus::Established {
if self.role != CallRole::Outgoing || self.pipelines_started {
return actions![TelephonyAction::IgnoreSignal(signal)];
}
self.status = SignallingStatus::Established;
self.pipelines_started = true;
actions![TelephonyAction::StartAudioPipelines]
}
Signal::PreferredProfile(profile) => {
@@ -198,10 +224,45 @@ impl CallState {
actions![TelephonyAction::SelectProfile(profile)]
}
}
Signal::PreferredMode(mode) => {
if self.status == SignallingStatus::Established {
if self.remote_mode_follow_disabled || self.mode == Some(mode) {
return Actions::new();
}
let Some(known) = CallMode::from_wire(mode) else {
return Actions::new();
};
self.mode = Some(mode);
self.apply_mode_squelch(known);
actions![TelephonyAction::SwitchMode(known)]
} else {
self.mode = Some(mode);
match CallMode::from_wire(mode) {
Some(known) => {
self.apply_mode_squelch(known);
actions![TelephonyAction::SelectMode(known)]
}
None => Actions::new(),
}
}
}
Signal::Raw(_) => actions![TelephonyAction::IgnoreSignal(signal)],
}
}
/// Switch the mode of an established call and signal it, as Python `switch_mode`.
pub fn switch_mode(&mut self, mode: CallMode) -> Actions {
if self.status != SignallingStatus::Established || self.mode == Some(mode.wire_value()) {
return Actions::new();
}
self.mode = Some(mode.wire_value());
self.apply_mode_squelch(mode);
actions![
TelephonyAction::SendSignal(Signal::from(mode)),
TelephonyAction::SwitchMode(mode),
]
}
pub fn switch_profile(&mut self, profile: Profile) -> Actions {
if self.profile == Some(profile) {
return Actions::new();
@@ -233,13 +294,35 @@ impl CallState {
actions.push(TelephonyAction::TeardownLink);
self.status = SignallingStatus::Available;
self.answered = false;
self.pipelines_started = false;
actions
}
fn ensure_profile(&mut self, actions: &mut Actions) {
fn ensure_profile(&mut self, actions: &mut Actions) -> Profile {
let profile = self.profile.unwrap_or(Profile::DEFAULT);
self.profile = Some(profile);
actions.push(TelephonyAction::SelectProfile(profile));
profile
}
/// Python `__select_call_mode`: an unset mode becomes the default, an unknown one is kept.
fn ensure_mode(&mut self, actions: &mut Actions) -> u8 {
let mode = self.mode.unwrap_or(CallMode::DEFAULT.wire_value());
self.mode = Some(mode);
if let Some(known) = CallMode::from_wire(mode) {
self.apply_mode_squelch(known);
actions.push(TelephonyAction::SelectMode(known));
}
mode
}
fn apply_mode_squelch(&mut self, mode: CallMode) {
self.transmit_squelched = mode == CallMode::HalfDuplex;
}
/// Python builds a new Packetizer when pipelines open and squelches it only for half duplex.
fn squelch_for_opened_pipelines(&mut self) {
self.transmit_squelched = self.mode == Some(CallMode::HalfDuplex.wire_value());
}
fn push_status_signal(&mut self, status: SignallingStatus, actions: &mut Actions) {
+13 -1
View File
@@ -1,6 +1,7 @@
// Shared directly with lxst-embedded. The enclosing wire module supplies its
// own error type; wire identifiers and conversions have one implementation.
use crate::profile::{Profile, SignallingStatus};
use crate::profile::{CallMode, Profile, SignallingStatus};
const PREFERRED_MODE_BASE: u32 = 0xF0;
const PREFERRED_PROFILE_BASE: u32 = 0xFF;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
@@ -36,6 +37,8 @@ impl CodecKind {
pub enum Signal {
Status(SignallingStatus),
PreferredProfile(Profile),
/// Raw mode byte after `0xF0`; unknown modes are carried, not rejected.
PreferredMode(u8),
Raw(u32),
}
@@ -44,6 +47,7 @@ impl Signal {
match self {
Self::Status(status) => status.wire_value(),
Self::PreferredProfile(profile) => PREFERRED_PROFILE_BASE + profile.wire_value(),
Self::PreferredMode(mode) => PREFERRED_MODE_BASE + mode as u32,
Self::Raw(value) => value,
}
}
@@ -58,6 +62,8 @@ impl Signal {
} else {
Self::Raw(value)
}
} else if value >= PREFERRED_MODE_BASE {
Self::PreferredMode((value - PREFERRED_MODE_BASE) as u8)
} else {
Self::Raw(value)
}
@@ -70,6 +76,12 @@ impl From<SignallingStatus> for Signal {
}
}
impl From<CallMode> for Signal {
fn from(value: CallMode) -> Self {
Self::PreferredMode(value.wire_value())
}
}
impl From<Profile> for Signal {
fn from(value: Profile) -> Self {
Self::PreferredProfile(value)
+229 -20
View File
@@ -12,6 +12,11 @@ impl TelephonyCall {
state: CallState::outgoing(profile),
}
}
pub fn outgoing_with_mode(profile: Option<Profile>, mode: Option<CallMode>) -> Self {
Self {
state: CallState::outgoing_with_mode(profile, mode),
}
}
pub fn incoming() -> Self {
Self {
state: CallState::incoming(),
@@ -29,6 +34,24 @@ impl TelephonyCall {
pub const fn answered(&self) -> bool {
self.state.answered()
}
pub const fn audio_started(&self) -> bool {
self.state.audio_started()
}
pub const fn mode(&self) -> Option<CallMode> {
self.state.mode()
}
pub const fn transmit_squelched(&self) -> bool {
self.state.transmit_squelched()
}
pub fn set_transmit_squelched(&mut self, squelched: bool) {
self.state.set_transmit_squelched(squelched);
}
pub fn disable_remote_mode_follow(&mut self) {
self.state.disable_remote_mode_follow();
}
pub fn switch_mode(&mut self, mode: CallMode) -> Vec<TelephonyAction> {
self.state.switch_mode(mode).as_slice().to_vec()
}
pub fn incoming_link_established(line_busy: bool) -> Vec<TelephonyAction> {
CallState::incoming_link_established(line_busy)
.as_slice()
@@ -43,9 +66,6 @@ impl TelephonyCall {
pub fn answer(&mut self) -> Vec<TelephonyAction> {
self.state.answer().as_slice().to_vec()
}
pub fn retry_answer(&self) -> Vec<TelephonyAction> {
self.state.retry_answer().as_slice().to_vec()
}
pub fn receive_signal(&mut self, signal: Signal) -> Vec<TelephonyAction> {
self.state.receive_signal(signal).as_slice().to_vec()
}
@@ -93,22 +113,27 @@ mod tests {
);
let answer = call.answer();
assert_eq!(call.status(), SignallingStatus::Connecting);
assert_eq!(call.status(), SignallingStatus::Established);
assert!(call.answered());
assert_eq!(call.profile(), Some(Profile::DEFAULT));
assert_eq!(call.mode(), Some(CallMode::FullDuplex));
assert_eq!(
answer,
vec![
TelephonyAction::SelectProfile(Profile::DEFAULT),
TelephonyAction::SelectMode(CallMode::FullDuplex),
TelephonyAction::SendSignal(Signal::from(SignallingStatus::Connecting)),
TelephonyAction::OpenAudioPipelines,
TelephonyAction::SendSignal(Signal::from(SignallingStatus::Established)),
TelephonyAction::StartAudioPipelines,
]
);
assert_eq!(
call.receive_signal(Signal::from(SignallingStatus::Established)),
vec![TelephonyAction::StartAudioPipelines]
vec![TelephonyAction::IgnoreSignal(Signal::from(
SignallingStatus::Established
))]
);
assert_eq!(call.status(), SignallingStatus::Established);
}
@@ -128,8 +153,12 @@ mod tests {
ringing,
vec![
TelephonyAction::SelectProfile(Profile::DEFAULT),
TelephonyAction::SelectMode(CallMode::FullDuplex),
TelephonyAction::PrepareDialingPipelines,
TelephonyAction::SendSignal(Signal::from(Profile::DEFAULT)),
TelephonyAction::SendSignalPair(
Signal::from(Profile::DEFAULT),
Signal::from(CallMode::FullDuplex),
),
TelephonyAction::StartDialTone,
]
);
@@ -150,29 +179,18 @@ mod tests {
}
#[test]
fn answer_retry_and_established_echo_are_bounded_idempotent_transitions() {
fn callee_is_established_on_answer_and_ignores_the_caller_echo() {
let mut incoming = TelephonyCall::incoming();
incoming.caller_identified(false, true);
incoming.answer();
assert_eq!(
incoming.retry_answer(),
vec![
TelephonyAction::SendSignal(Signal::from(SignallingStatus::Connecting)),
TelephonyAction::SendSignal(Signal::from(SignallingStatus::Established)),
]
);
assert_eq!(
incoming.receive_signal(Signal::from(SignallingStatus::Established)),
vec![TelephonyAction::StartAudioPipelines]
);
assert!(incoming.retry_answer().is_empty());
assert_eq!(incoming.status(), SignallingStatus::Established);
assert_eq!(
incoming.receive_signal(Signal::from(SignallingStatus::Established)),
vec![TelephonyAction::IgnoreSignal(Signal::from(
SignallingStatus::Established
))]
);
assert!(incoming.answer().is_empty());
let mut outgoing = TelephonyCall::outgoing(Some(Profile::DEFAULT));
outgoing.receive_signal(Signal::from(SignallingStatus::Available));
@@ -188,6 +206,197 @@ mod tests {
assert_eq!(outgoing.status(), SignallingStatus::Established);
}
#[test]
fn caller_is_established_after_connecting_and_starts_audio_on_callee_established() {
let mut call = TelephonyCall::outgoing(None);
call.receive_signal(Signal::from(SignallingStatus::Available));
call.receive_signal(Signal::from(SignallingStatus::Ringing));
call.receive_signal(Signal::from(SignallingStatus::Connecting));
assert_eq!(call.status(), SignallingStatus::Established);
assert_eq!(
call.receive_signal(Signal::from(SignallingStatus::Established)),
vec![TelephonyAction::StartAudioPipelines]
);
assert_eq!(
call.receive_signal(Signal::from(SignallingStatus::Established)),
vec![TelephonyAction::IgnoreSignal(Signal::from(
SignallingStatus::Established
))]
);
}
fn signals(packet: &str) -> Vec<Signal> {
crate::LxstPacket::decode(&hex::decode(packet).unwrap())
.unwrap()
.signals
}
fn sent(actions: &[TelephonyAction]) -> Vec<Vec<u8>> {
actions
.iter()
.filter_map(|action| match action {
TelephonyAction::SendSignal(signal) => Some(vec![*signal]),
TelephonyAction::SendSignalPair(first, second) => Some(vec![*first, *second]),
_ => None,
})
.map(|signals| crate::LxstPacket::signalling(signals).encode().unwrap())
.collect()
}
// Packets recorded from the rsLXST 0.3.1 call state machine; it decodes the mode
// byte of a profile-and-mode packet as an ignored raw signal.
#[test]
fn caller_completes_a_call_with_a_0_3_1_callee() {
let mut call = TelephonyCall::outgoing(None);
let mut out = Vec::new();
for packet in ["81009103", "81009104", "81009105", "81009106", "81009105"] {
for signal in signals(packet) {
out.extend(sent(&call.receive_signal(signal)));
}
}
assert_eq!(
out.iter().map(hex::encode).collect::<Vec<_>>(),
["810092cd013fccf1", "81009106", "81009106"]
);
assert_eq!(call.status(), SignallingStatus::Established);
assert!(call.audio_started());
}
#[test]
fn callee_completes_a_call_with_a_0_3_1_caller() {
let mut call = TelephonyCall::incoming();
call.caller_identified(false, true);
for signal in signals("810091cd013f") {
call.receive_signal(signal);
}
assert_eq!(
sent(&call.answer())
.iter()
.map(hex::encode)
.collect::<Vec<_>>(),
["81009105", "81009106"]
);
for signal in signals("81009106") {
assert!(matches!(
call.receive_signal(signal).as_slice(),
[TelephonyAction::IgnoreSignal(_)]
));
}
assert_eq!(call.status(), SignallingStatus::Established);
assert_eq!(call.profile(), Some(Profile::QualityMedium));
assert_eq!(call.mode(), Some(CallMode::FullDuplex));
}
#[test]
fn ringing_sends_profile_and_requested_mode_in_one_packet() {
let mut call = TelephonyCall::outgoing_with_mode(
Some(Profile::BandwidthLow),
Some(CallMode::HalfDuplex),
);
call.receive_signal(Signal::from(SignallingStatus::Available));
let ringing = call.receive_signal(Signal::from(SignallingStatus::Ringing));
assert!(ringing.contains(&TelephonyAction::SendSignalPair(
Signal::from(Profile::BandwidthLow),
Signal::from(CallMode::HalfDuplex),
)));
assert!(call.transmit_squelched());
assert_eq!(Signal::from(CallMode::HalfDuplex).wire_value(), 0xF2);
}
#[test]
fn mode_signal_before_answer_is_selected_but_status_is_ignored() {
let mut call = TelephonyCall::incoming();
call.caller_identified(false, true);
assert_eq!(
call.receive_signal(Signal::from_wire(0xF2)),
vec![TelephonyAction::SelectMode(CallMode::HalfDuplex)]
);
assert!(call.transmit_squelched());
assert_eq!(
call.receive_signal(Signal::from(SignallingStatus::Connecting)),
vec![TelephonyAction::IgnoreSignal(Signal::from(
SignallingStatus::Connecting
))]
);
let answer = call.answer();
assert!(answer.contains(&TelephonyAction::SelectMode(CallMode::HalfDuplex)));
assert!(call.transmit_squelched());
}
#[test]
fn unknown_mode_is_stored_without_squelch_change_or_error() {
let mut call = TelephonyCall::incoming();
call.caller_identified(false, true);
assert!(call.receive_signal(Signal::from_wire(0xF3)).is_empty());
assert_eq!(call.mode(), None);
assert!(!call.transmit_squelched());
call.answer();
assert!(!call.transmit_squelched());
assert!(call.receive_signal(Signal::from_wire(0xF0)).is_empty());
}
#[test]
fn opening_pipelines_squelches_only_for_half_duplex() {
let mut callee = TelephonyCall::incoming();
callee.caller_identified(false, true);
callee.receive_signal(Signal::from(CallMode::HalfDuplex));
assert!(callee.receive_signal(Signal::from_wire(0xF5)).is_empty());
assert!(callee.transmit_squelched());
callee.answer();
assert!(!callee.transmit_squelched());
let mut caller = TelephonyCall::outgoing(None);
caller.receive_signal(Signal::from(SignallingStatus::Available));
caller.receive_signal(Signal::from(SignallingStatus::Ringing));
caller.set_transmit_squelched(true);
caller.receive_signal(Signal::from(SignallingStatus::Connecting));
assert!(!caller.transmit_squelched());
let mut half_duplex = TelephonyCall::outgoing_with_mode(None, Some(CallMode::HalfDuplex));
half_duplex.receive_signal(Signal::from(SignallingStatus::Available));
half_duplex.receive_signal(Signal::from(SignallingStatus::Ringing));
half_duplex.receive_signal(Signal::from(SignallingStatus::Connecting));
assert!(half_duplex.transmit_squelched());
}
#[test]
fn established_mode_switch_follows_remote_unless_disabled() {
let mut call = TelephonyCall::incoming();
call.caller_identified(false, true);
call.answer();
assert_eq!(
call.receive_signal(Signal::from(CallMode::HalfDuplex)),
vec![TelephonyAction::SwitchMode(CallMode::HalfDuplex)]
);
assert!(call.transmit_squelched());
assert!(
call.receive_signal(Signal::from(CallMode::HalfDuplex))
.is_empty()
);
call.disable_remote_mode_follow();
assert!(
call.receive_signal(Signal::from(CallMode::FullDuplex))
.is_empty()
);
assert!(call.transmit_squelched());
assert_eq!(
call.switch_mode(CallMode::FullDuplex),
vec![
TelephonyAction::SendSignal(Signal::from(CallMode::FullDuplex)),
TelephonyAction::SwitchMode(CallMode::FullDuplex),
]
);
assert!(!call.transmit_squelched());
assert!(call.switch_mode(CallMode::FullDuplex).is_empty());
}
#[test]
fn local_mode_switch_requires_established_call() {
let mut call = TelephonyCall::outgoing(None);
assert!(call.switch_mode(CallMode::HalfDuplex).is_empty());
assert_eq!(call.mode(), None);
}
#[test]
fn profile_signals_select_or_switch_profile_by_call_status() {
let mut call = TelephonyCall::outgoing(None);
+4
View File
@@ -142,6 +142,10 @@ impl LxstPacket {
Ok(out)
}
/// Decode the first MessagePack value as an LXST packet. Trailing bytes are
/// ignored, and repeated signalling/frame fields are concatenated.
/// This allocating parser has no packet-size limit; bound input before use.
/// Codec headers are checked, but encoded audio content is not decoded here.
pub fn decode(bytes: &[u8]) -> Result<Self, Error> {
let value = read_value(&mut &bytes[..]).map_err(|e| Error::Decode(e.to_string()))?;
Self::from_value(value)
@@ -0,0 +1,16 @@
28afe918bca8941139ab60f9598427e7ae4741723a388b9907d9eb8c4c7d301b337931e7ee
98b066163f47095412beadde8cb2f6a7c5df75e88d045d1e36272773afcb27b26be0d70dee
98afe91a1c2d353ffebd6f412832c22d1cbd6c385de5967c27342e8cb160865b694472efee
98b04dcf34ff809b86a63aae0319326095c1ab2eb02d7203ace62921c6b25a99e5e135ee
98aca7b59d0483411f3e7a1882d257dfb0b842f92f88fa1cb0b3c920ea9ce7a1282031ee
98afe918bca8941139ab60f9598427e7ae4741723a388b9907d9eb8c4c7d301b337931e7ee
98b066f13f47095412beadde8cb2f6a7c5df75e88d045d1e36272773afcb27b26be0ee0d98
e9afd71a1c2d353ffebd6f412832c22d1cbd6c385de5967c27342e8cb160865b694472efee
98b04dcf34ff809b86a63aae0319326095c1ab2e002d7203ace62921c6b25a99e5e136ee
98aca7b59d0483411f3e7a1882d257dfb0b842f92f88fa1cb0b3c920ea9ce7a1282031ee
98afe918bca8941139ab60f9598427e7ae4741723a388b9907d9eb8c4c7d301b337931e7ee
98b066f13f47095412beadde8cb2f6a7c5df75e88d045d1e36272773afcb27b26be0d70dee
98afe91a1c2d353ffebd6f412832c22d1cbd6c385de5967c27342e8cb160865b694472efee
98b04dcf34ff809b86a63aae0319326095c1ab2eb02d7203ace62921c6b25a99e5e135ee
98aca7b59d0483411f3e7a1882d257dfb0b842f92f88fa1cb0b3c920ea9ce7a12820323d
00000018bca8941139ab60f9598427e7ae4741723a388b9907d9eb8c4c7d302d337931e7ee
+3 -3
View File
@@ -2,14 +2,14 @@
name = "lxst-embedded"
version.workspace = true
edition.workspace = true
license.workspace = true
license-file.workspace = true
rust-version = "1.87"
publish.workspace = true
description = "Bounded no_std LXST framing and authenticated PTT session policy"
[dependencies]
thiserror = { version = "2", default-features = false }
lxst-codec2 = { path = "../lxst-codec2", version = "0.3.0" }
lxst-codec2 = { path = "../lxst-codec2", version = "0.4.0" }
[dev-dependencies]
lxst-core = { path = "../lxst-core", version = "0.3.0" }
lxst-core = { path = "../lxst-core", version = "0.4.0" }
+3 -2
View File
@@ -11,8 +11,9 @@ the same fixed action list. Preserve this shared source layout in source bundles
these unpublished workspace crates are built from the complete repository.
`wire::Packet` borrows validated input with fixed ceilings (512 packet bytes,
eight signals, four frames, 256 bytes per codec frame). It rejects duplicates,
trailing data, excessive nesting and oversized declared containers. Unknown
eight signals, four frames, 256 bytes per encoded frame including its codec
identifier). It rejects duplicate signal/media fields, trailing data, excessive
nesting and oversized declared containers. Unknown
metadata is skipped within those limits. `wire::encode` matches the full Rust
encoder's canonical MessagePack forms and validates before writing output.
The negotiated Reticulum Link MDU can be smaller than the parser ceiling; the
+4 -2
View File
@@ -17,14 +17,16 @@ pub use call_state::CallState;
#[path = "../../lxst-core/src/shared/call_types.rs"]
mod call_types;
pub use call_types::{CallRole, TelephonyAction};
pub use profile::{AudioCodec, OpusApplication, OpusProfile, Profile, SignallingStatus};
pub use profile::{AudioCodec, CallMode, OpusApplication, OpusProfile, Profile, SignallingStatus};
pub use wire::{Codec2Mode, CodecKind, Signal};
#[path = "../../lxst-core/src/shared/codec2.rs"]
mod codec2;
pub use codec2::{Codec2Backend, Codec2PacketCodec, Codec2PacketError};
mod session;
pub use session::{ConfigError, EndReason, Event, Events, ProfileSet, Session, SessionConfig};
pub use session::{
CallTimes, ConfigError, EndReason, Event, Events, ProfileSet, Session, SessionConfig,
};
impl Codec2Backend for &mut lxst_codec2::Codec {
type Error = lxst_codec2::Error;
+56 -31
View File
@@ -1,10 +1,11 @@
//! Local admission and microphone policy around the trusted call transitions.
//! No extra wire extension, turn token or directional capability is invented.
use crate::{Actions, CallRole, CallState, Profile, Signal, SignallingStatus, TelephonyAction};
use crate::{
Actions, CallMode, CallRole, CallState, Profile, Signal, SignallingStatus, TelephonyAction,
};
/// Local limit for an incoming link to identify its caller; Python has no counterpart.
const SETUP_MS: u64 = 30_000;
const RING_MS: u64 = 90_000;
const ANSWER_MS: u64 = 10_000;
const PROFILE_MS: u64 = 5_000;
pub const TALK_LIMIT_MS: u64 = 30_000;
@@ -24,6 +25,29 @@ impl ProfileSet {
}
}
/// Call setup limits in milliseconds; the defaults are Python `Telephone`'s.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct CallTimes {
/// Python `CONNECT_TIME` (`set_connect_timeout`): the callee must ring within this time of the call start.
pub connect_ms: u64,
/// Python `wait_time`, measured from the start of the outgoing call.
pub wait_ms: u64,
/// Python `ring_time`.
pub ring_ms: u64,
}
impl CallTimes {
pub const DEFAULT: Self = Self {
connect_ms: 5_000,
wait_ms: 70_000,
ring_ms: 60_000,
};
}
impl Default for CallTimes {
fn default() -> Self {
Self::DEFAULT
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct SessionConfig {
/// The embedder must qualify each selected codec and route before admission.
@@ -31,6 +55,7 @@ pub struct SessionConfig {
pub preferred: Profile,
pub capture: bool,
pub playback: bool,
pub times: CallTimes,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ConfigError {
@@ -94,11 +119,10 @@ pub struct Session {
audio_generation: u32,
ended: Option<EndReason>,
deadline: u64,
connect_deadline: Option<u64>,
talk_started: u64,
suggested: bool,
profile_deadline: Option<u64>,
answer_retry: u64,
retries: u8,
}
impl Session {
pub fn new(role: CallRole, config: SessionConfig, now_ms: u64) -> Result<Self, ConfigError> {
@@ -123,12 +147,17 @@ impl Session {
input_down: false,
audio_generation: 1,
ended: None,
deadline: now_ms.saturating_add(SETUP_MS),
deadline: now_ms.saturating_add(match role {
CallRole::Incoming => SETUP_MS,
CallRole::Outgoing => config.times.wait_ms,
}),
connect_deadline: match role {
CallRole::Incoming => None,
CallRole::Outgoing => Some(now_ms.saturating_add(config.times.connect_ms)),
},
talk_started: 0,
suggested: false,
profile_deadline: None,
answer_retry: 0,
retries: 0,
})
}
pub const fn status(&self) -> SignallingStatus {
@@ -137,6 +166,9 @@ impl Session {
pub const fn profile(&self) -> Option<Profile> {
self.call.profile()
}
pub const fn mode(&self) -> Option<CallMode> {
self.call.mode()
}
pub const fn ended(&self) -> Option<EndReason> {
self.ended
}
@@ -153,6 +185,7 @@ impl Session {
&& self.ready
&& self.profile_deadline.is_none()
&& self.call.status() == SignallingStatus::Established
&& self.call.audio_started()
}
pub fn playback_allowed(&self) -> bool {
self.media_ready() && self.config.playback && !self.transmitting
@@ -178,7 +211,7 @@ impl Session {
}
self.verified = true;
if self.call.role() == CallRole::Incoming {
self.deadline = now_ms.saturating_add(RING_MS);
self.deadline = now_ms.saturating_add(self.config.times.ring_ms);
events.transitions(self.call.caller_identified(false, true));
events.push(Event::Transition(TelephonyAction::SendSignal(
self.config.preferred.into(),
@@ -186,7 +219,7 @@ impl Session {
}
events
}
pub fn answer(&mut self, now_ms: u64) -> Events {
pub fn answer(&mut self, _now_ms: u64) -> Events {
let mut events = Events::new();
if self.ended.is_some()
|| !self.verified
@@ -195,8 +228,6 @@ impl Session {
{
return events;
}
self.deadline = now_ms.saturating_add(ANSWER_MS);
self.answer_retry = now_ms.saturating_add(1000);
events.transitions(self.call.answer());
events
}
@@ -220,6 +251,7 @@ impl Session {
return events;
}
self.profile_deadline = None;
self.suggested = false;
if self.call.profile() != Some(profile) {
self.stop_capture(&mut events);
self.ready = false;
@@ -273,20 +305,17 @@ impl Session {
if !allowed {
return events;
}
if status == SignallingStatus::Ringing && current != status {
self.deadline = now_ms.saturating_add(RING_MS);
}
if status == SignallingStatus::Connecting && current == SignallingStatus::Ringing {
self.deadline = now_ms.saturating_add(ANSWER_MS);
if status == SignallingStatus::Ringing {
self.connect_deadline = None;
}
}
events.transitions(self.call.receive_signal(signal));
events
}
/// Matching authenticated media confirms adoption of a suggested profile.
/// Some standard peers change codec without echoing PreferredProfile. The
/// embedder must validate codec, mode and complete native packet size first.
/// This does not open audio, answer a call, or start the microphone.
/// Confirm adoption of the current suggested profile using authenticated media.
/// The embedder must first validate codec, mode and complete native packet size.
/// This clears a pending profile deadline only; it does not change the
/// selected profile, open audio, answer a call or start the microphone.
pub fn receive_profile_media(&mut self, profile: Profile, now_ms: u64) -> Events {
if self.ended.is_none()
&& self.linked
@@ -352,20 +381,16 @@ impl Session {
if self.status() != SignallingStatus::Established && now_ms >= self.deadline {
return self.end(EndReason::Timeout);
}
if self
.connect_deadline
.is_some_and(|deadline| now_ms >= deadline)
{
return self.end(EndReason::Timeout);
}
if self.transmitting && now_ms.saturating_sub(self.talk_started) >= TALK_LIMIT_MS {
self.stop_capture(&mut events);
events.push(Event::FlushMedia);
}
if self.call.role() == CallRole::Incoming
&& self.call.answered()
&& self.status() == SignallingStatus::Connecting
&& now_ms >= self.answer_retry
&& self.retries < 3
{
self.retries += 1;
self.answer_retry = now_ms.saturating_add(1000);
events.transitions(self.call.retry_answer());
}
events
}
pub fn end(&mut self, reason: EndReason) -> Events {
+4
View File
@@ -43,6 +43,10 @@ impl<'a> Packet<'a> {
&self.frames[..self.frame_count]
}
/// Borrow one complete packet within the fixed size and item-count limits.
/// Trailing bytes and duplicate signalling/frame fields are rejected.
/// Unknown fields are skipped within bounded depth; their duplicates are
/// not tracked. Codec payload contents require validation by the embedder.
pub fn decode(bytes: &'a [u8]) -> Result<Self, Error> {
if bytes.len() > MAX_PACKET_BYTES {
return Err(Error::Limit);
+130 -18
View File
@@ -1,6 +1,6 @@
use lxst_embedded::{
CallRole, CallState, EndReason, Event, Profile, ProfileSet, Session, SessionConfig, Signal,
SignallingStatus as Status, TelephonyAction as Action,
CallMode, CallRole, CallState, CallTimes, EndReason, Event, Profile, ProfileSet, Session,
SessionConfig, Signal, SignallingStatus as Status, TelephonyAction as Action,
};
#[test]
@@ -24,14 +24,22 @@ fn crossed_profile_offers_converge_before_media_without_an_echo_loop() {
for event in receiver.peer_verified(1).as_slice() {
if let Event::Transition(Action::SendSignal(signal)) = event {
for action in caller.receive_signal(*signal).as_slice() {
if let Action::SendSignal(signal) = action {
in_flight.push(*signal);
match action {
Action::SendSignal(signal) => in_flight.push(*signal),
Action::SendSignalPair(first, second) => {
in_flight.push(*first);
in_flight.push(*second);
}
_ => {}
}
}
}
}
assert_eq!(caller.profile(), Some(preferred));
assert_eq!(in_flight, vec![Signal::from(offered)]);
assert_eq!(
in_flight,
vec![Signal::from(offered), Signal::from(CallMode::FullDuplex)]
);
for signal in in_flight {
for event in receiver.receive_signal(signal, 2).as_slice() {
if let Event::Transition(Action::SendSignal(signal)) = event {
@@ -72,6 +80,7 @@ fn config() -> SessionConfig {
preferred: Profile::BandwidthVeryLow,
capture: true,
playback: true,
times: CallTimes::default(),
}
}
fn connect(role: CallRole) -> Session {
@@ -200,26 +209,35 @@ fn unsupported_profile_has_one_bounded_offer_then_closes() {
session.receive_signal(Profile::QualityHigh.into(), 20);
session.receive_signal(Profile::BandwidthVeryLow.into(), 21);
assert!(session.media_ready());
session.receive_signal(Profile::QualityHigh.into(), 22);
let events = session.receive_signal(Profile::QualityHigh.into(), 22);
assert_eq!(session.ended(), None);
assert!(
events
.as_slice()
.contains(&Event::Transition(Action::SendSignal(
Profile::BandwidthVeryLow.into()
)))
);
session.receive_signal(Profile::QualityMax.into(), 23);
assert_eq!(session.ended(), Some(EndReason::ProfileUnsupported));
}
#[test]
fn retries_are_bounded_and_one_direction_devices_work() {
fn answer_establishes_without_retries_and_one_direction_devices_work() {
let mut session = Session::new(CallRole::Incoming, config(), 0).unwrap();
session.link_established();
session.peer_verified(1);
session.answer(2);
for n in 1..=3 {
let events = session.tick(2 + n * 1000);
assert_eq!(events.as_slice().len(), 2);
assert_eq!(
events.as_slice()[1],
Event::Transition(Action::SendSignal(Status::Established.into()))
);
let answer = session.answer(2);
let sent = answer
.as_slice()
.iter()
.filter(|event| matches!(event, Event::Transition(Action::SendSignal(_))))
.count();
assert_eq!(sent, 2);
assert_eq!(session.status(), Status::Established);
for n in 1..=20 {
assert!(session.tick(2 + n * 1000).as_slice().is_empty());
}
assert!(session.tick(4002).as_slice().is_empty());
session.tick(10002);
assert_eq!(session.ended(), Some(EndReason::Timeout));
assert_eq!(session.ended(), None);
for (capture, playback) in [(true, false), (false, true)] {
let mut cfg = config();
cfg.capture = capture;
@@ -304,3 +322,97 @@ fn authenticated_matching_media_confirms_standard_profile_fallback_without_echo(
ringing.tick(5100);
assert_eq!(ringing.ended(), Some(EndReason::ProfileUnsupported));
}
#[test]
fn incoming_ring_times_out_after_python_ring_time() {
let mut session = Session::new(CallRole::Incoming, config(), 0).unwrap();
session.link_established();
session.peer_verified(0);
session.tick(59_999);
assert_eq!(session.ended(), None);
session.tick(60_000);
assert_eq!(session.ended(), Some(EndReason::Timeout));
}
#[test]
fn outgoing_call_ends_when_callee_does_not_ring_within_connect_time() {
let mut session = Session::new(CallRole::Outgoing, config(), 0).unwrap();
session.link_established();
session.peer_verified(1);
session.receive_signal(Status::Available.into(), 100);
session.tick(4_999);
assert_eq!(session.ended(), None);
session.tick(5_000);
assert_eq!(session.ended(), Some(EndReason::Timeout));
}
#[test]
fn outgoing_wait_time_runs_from_call_start_once_ringing() {
let mut session = Session::new(CallRole::Outgoing, config(), 0).unwrap();
session.link_established();
session.peer_verified(1);
session.receive_signal(Status::Available.into(), 100);
session.receive_signal(Status::Ringing.into(), 4_000);
session.tick(69_999);
assert_eq!(session.ended(), None);
session.tick(70_000);
assert_eq!(session.ended(), Some(EndReason::Timeout));
}
#[test]
fn preferred_mode_signal_is_recorded_by_the_session() {
let mut session = Session::new(CallRole::Incoming, config(), 0).unwrap();
session.link_established();
session.peer_verified(1);
session.receive_signal(Signal::from_wire(0xF2), 2);
assert_eq!(session.mode(), Some(CallMode::HalfDuplex));
assert_eq!(session.ended(), None);
}
#[test]
fn configured_call_times_replace_the_python_defaults() {
let slow = SessionConfig {
times: CallTimes {
connect_ms: 20_000,
wait_ms: 200_000,
ring_ms: 150_000,
},
..config()
};
let mut outgoing = Session::new(CallRole::Outgoing, slow, 0).unwrap();
outgoing.link_established();
outgoing.peer_verified(1);
outgoing.tick(19_999);
assert_eq!(outgoing.ended(), None);
outgoing.receive_signal(Status::Available.into(), 19_999);
outgoing.receive_signal(Status::Ringing.into(), 19_999);
outgoing.tick(199_999);
assert_eq!(outgoing.ended(), None);
outgoing.tick(200_000);
assert_eq!(outgoing.ended(), Some(EndReason::Timeout));
let mut incoming = Session::new(CallRole::Incoming, slow, 0).unwrap();
incoming.link_established();
incoming.peer_verified(0);
incoming.tick(149_999);
assert_eq!(incoming.ended(), None);
incoming.tick(150_000);
assert_eq!(incoming.ended(), Some(EndReason::Timeout));
}
#[test]
fn caller_keeps_call_past_wait_time_when_callee_established_is_lost() {
let mut session = Session::new(CallRole::Outgoing, config(), 0).unwrap();
session.link_established();
session.peer_verified(1);
for status in [Status::Available, Status::Ringing, Status::Connecting] {
session.receive_signal(status.into(), 100);
}
session.audio_ready(session.audio_generation(), true);
assert_eq!(session.status(), Status::Established);
assert!(!session.media_ready());
session.tick(70_001);
assert_eq!(session.ended(), None);
session.receive_signal(Status::Established.into(), 70_002);
assert!(session.media_ready());
}
+17 -3
View File
@@ -123,7 +123,22 @@ fn shared_transitions_retain_full_rust_actions() {
use lxst_embedded::{CallState, SignallingStatus};
let mut embedded = CallState::outgoing(Some(Profile::BandwidthVeryLow));
let mut host = lxst_core::TelephonyCall::outgoing(Some(lxst_core::Profile::BandwidthVeryLow));
for signal in [3, 4, 5, 6, 5, 6, 0x11f, 0x12f, 0, 1, u32::MAX] {
for signal in [
3,
4,
5,
6,
5,
6,
0x11f,
0x12f,
0xf1,
0xf2,
0xf3,
0,
1,
u32::MAX,
] {
let a = embedded.receive_signal(Signal::from_wire(signal));
let b = host.receive_signal(lxst_core::Signal::from_wire(signal));
assert_eq!(format!("{:?}", a.as_slice()), format!("{b:?}"));
@@ -132,13 +147,12 @@ fn shared_transitions_retain_full_rust_actions() {
// Explore combinations including adversarial order to prove the shared
// fixed action bound; session policy separately restricts allowed ordering.
for first in 0..512 {
for second in [0, 3, 4, 5, 6, 0x11f, 0x12f, 0x13f] {
for second in [0, 3, 4, 5, 6, 0x11f, 0x12f, 0x13f, 0xf1, 0xf2] {
let mut call = CallState::incoming();
call.caller_identified(false, true);
call.receive_signal(Signal::from_wire(first));
call.answer();
call.receive_signal(Signal::from_wire(second));
call.retry_answer();
call.hangup(false);
assert_eq!(call.status(), SignallingStatus::Available);
}
+1 -1
View File
@@ -2,7 +2,7 @@
name = "lxst-rns"
version.workspace = true
edition.workspace = true
license.workspace = true
license-file.workspace = true
rust-version.workspace = true
publish.workspace = true
+15 -10
View File
@@ -1,8 +1,8 @@
//! Reticulum transport boundary for LXST.
//!
//! This crate is intentionally small: it turns already-encoded LXST packets into
//! Reticulum link data packets and leaves call state, audio, and codec work to
//! higher layers.
//! Packet helpers encrypt LXST payloads for Reticulum Links; ingress/egress
//! adapters track frames, provide a jitter queue and convert raw or Opus audio.
//! Call policy and audio-device ownership stay with the embedding runtime.
use bytes::Bytes;
use lxst_core::{
@@ -67,6 +67,8 @@ impl LxstLinkIngress {
}
/// Decode decrypted plaintext from `LinkManager::set_link_packet_channel`.
/// The caller supplies the authenticated Link association; parsing does not
/// verify `link_id`. Input parsing follows [`LxstPacket::decode`].
pub fn accept_plaintext(
&mut self,
link_id: [u8; 16],
@@ -267,16 +269,18 @@ pub fn prepare_lxst_link_packet_send(
Ok(prepare_packed_link_endpoint_send(packet, role))
}
/// One packet plus the typed transport operation that owns its delivery
/// outcome. Callers must retain and inspect `result_rx`; deliberately
/// discarding the result would turn terminal endpoint failures into silent
/// media or signalling loss.
/// One packet, a transport command and its local admission result.
///
/// Enqueue `message` and inspect `result_rx`. `Sent` and `Queued` do not
/// acknowledge peer receipt; later failures need endpoint-lifecycle handling.
pub struct PreparedLinkEndpointSend {
pub packet: PackedLinkPacket,
pub message: TransportMessage,
pub result_rx: oneshot::Receiver<LinkEndpointSendResult>,
}
/// Prepare an ordered send for an already packed Link packet.
/// This only constructs the command; it does not enqueue or transmit it.
pub fn prepare_packed_link_endpoint_send(
packet: PackedLinkPacket,
role: LinkEndpointRole,
@@ -298,9 +302,10 @@ pub fn prepare_packed_link_endpoint_send(
}
}
/// Prepare the final ordered packet for an established Link. Transport keeps
/// the endpoint alive until this packet and all earlier control packets have
/// drained, then atomically unbinds it.
/// Prepare an ordered send followed by endpoint unbinding.
/// Once admitted, the transport drains earlier control packets and this packet
/// before unbinding; a terminal send/interface error may end the Link earlier.
/// The caller must enqueue the command and inspect its local result.
pub fn prepare_packed_link_endpoint_final_send(
packet: PackedLinkPacket,
role: LinkEndpointRole,
+3 -2
View File
@@ -2,14 +2,14 @@
name = "lxst-telephony"
version.workspace = true
edition.workspace = true
license.workspace = true
license-file.workspace = true
rust-version.workspace = true
publish.workspace = true
[dependencies]
bytes.workspace = true
lxst-core.workspace = true
lxst-codec2 = { path = "../lxst-codec2", version = "0.3.0" }
lxst-codec2 = { path = "../lxst-codec2", version = "0.4.0" }
lxst-rns.workspace = true
rns-crypto.workspace = true
rns-identity.workspace = true
@@ -21,6 +21,7 @@ thiserror.workspace = true
tokio.workspace = true
[dev-dependencies]
tokio = { workspace = true, features = ["test-util"] }
hex.workspace = true
rns-interface.workspace = true
serial_test.workspace = true
+6 -2
View File
@@ -1,8 +1,10 @@
use std::sync::Mutex;
use std::time::{Duration, Instant};
/// A release-aware local PTT lease. A stalled UI stops media within 750 ms;
/// a ten-second burst requires a new release/press. It adds no LXST wire fields.
/// A local PTT lease that expires after 750 ms without renewal or a ten-second
/// burst. The caller must check [`Self::allows`] before forwarding each frame;
/// this gate does not stop an audio device itself. Once expiry is observed,
/// a release is required before another press. It adds no LXST wire fields.
#[derive(Default, Debug)]
pub struct AudioTransmitGate {
state: Mutex<State>,
@@ -74,6 +76,8 @@ impl AudioTransmitGate {
state.blocked = true;
}
}
/// Check the current lease; contention, expiry or closure returns `false`.
/// This may mark an expired press blocked until a release arrives.
pub fn allows(&self) -> bool {
self.allows_at(Instant::now())
}
File diff suppressed because it is too large. Load diff
+77 -32
View File
@@ -3,8 +3,8 @@
use crate::Error;
use lxst_codec2::{Codec, Mode};
use lxst_core::{
AudioCodec, Codec2Backend, Codec2Mode, Codec2PacketCodec, CodecKind, Frame, OpusDecoderState,
OpusEncoderState, Profile, RawAudioFrame,
AudioCodec, Codec2Backend, Codec2Mode, Codec2PacketCodec, CodecKind, Frame, OpusEncoderState,
OpusPacketDecoder, Profile, RawAudioFrame,
};
struct Native(Box<Codec>);
@@ -74,33 +74,11 @@ impl Codec2Audio {
result?;
Ok(Frame::new(CodecKind::Codec2, payload))
}
fn decode(&mut self, frame: &Frame) -> Result<RawAudioFrame, Error> {
if frame.codec != CodecKind::Codec2 {
return Err(Error::Audio("unexpected media codec".into()));
}
self.codec
.decode_into(&frame.payload, &mut self.pcm)
.map_err(|e| Error::Audio(e.to_string()))?;
let samples = self
.pcm
.iter()
.map(|v| f32::from(*v) / 32768.0)
.collect::<Vec<_>>();
self.pcm.fill(0);
Ok(RawAudioFrame {
channels: 1,
samples,
})
}
}
pub(crate) enum AudioEncoder {
Opus(Box<OpusEncoderState>),
Codec2(Codec2Audio),
}
pub(crate) enum AudioDecoder {
Opus(Box<OpusDecoderState>),
Codec2(Codec2Audio),
}
impl AudioEncoder {
pub(crate) fn new(profile: Profile) -> Result<Self, Error> {
match profile.audio_codec() {
@@ -115,17 +93,84 @@ impl AudioEncoder {
}
}
}
impl AudioDecoder {
pub(crate) fn new(profile: Profile) -> Result<Self, Error> {
match profile.audio_codec() {
AudioCodec::Opus(_) => Ok(Self::Opus(Box::new(OpusDecoderState::new(profile)?))),
AudioCodec::Codec2(_) => Ok(Self::Codec2(Codec2Audio::new(profile)?)),
const CODEC2_SAMPLE_RATE_HZ: u32 = 8_000;
/// Follows the codec and Codec2 mode of each received frame, as Python `LinkSource`
/// does, and converts the output to the local profile's sample rate and channels.
pub(crate) struct ReceiveDecoder {
sample_rate_hz: u32,
channels: u8,
opus: Option<OpusPacketDecoder>,
codec2: Vec<(Codec2Mode, Box<Codec>)>,
}
impl ReceiveDecoder {
pub(crate) fn new(profile: Profile) -> Self {
Self {
sample_rate_hz: profile.sample_rate_hz(),
channels: profile.channels(),
opus: None,
codec2: Vec::new(),
}
}
pub(crate) fn decode_frame(&mut self, frame: &Frame) -> Result<RawAudioFrame, Error> {
match self {
Self::Opus(codec) => Ok(codec.decode_frame(frame)?),
Self::Codec2(codec) => codec.decode(frame),
match frame.codec {
CodecKind::Opus => {
if self.opus.is_none() {
self.opus = Some(OpusPacketDecoder::new(self.sample_rate_hz, self.channels)?);
}
let decoder = self
.opus
.as_mut()
.expect("Opus decoder exists after creation");
Ok(decoder.decode_packet(&frame.payload)?)
}
CodecKind::Codec2 => self.decode_codec2(&frame.payload),
other => Err(Error::Audio(format!("unexpected media codec {other:?}"))),
}
}
fn decode_codec2(&mut self, payload: &[u8]) -> Result<RawAudioFrame, Error> {
let (&header, bytes) = payload
.split_first()
.ok_or_else(|| Error::Audio("empty Codec2 frame".into()))?;
let wire_mode =
Codec2Mode::from_header(header).map_err(|error| Error::Audio(error.to_string()))?;
let mode = match wire_mode {
Codec2Mode::Mode700C => Mode::Rate700C,
Codec2Mode::Mode1600 => Mode::Rate1600,
Codec2Mode::Mode3200 => Mode::Rate3200,
other => {
return Err(Error::Audio(format!(
"unsupported native Codec2 mode {other:?}"
)));
}
};
let index = match self.codec2.iter().position(|(m, _)| *m == wire_mode) {
Some(index) => index,
None => {
let mut storage = Box::<Codec>::new_uninit();
Codec::initialise(&mut storage, mode);
// SAFETY: initialise completed in final storage above.
self.codec2
.push((wire_mode, unsafe { storage.assume_init() }));
self.codec2.len() - 1
}
};
let codec = &mut self.codec2[index].1;
// Python decodes every whole native frame in the payload.
let mut pcm = vec![0i16; mode.samples()];
let mut samples = Vec::with_capacity(bytes.len() / mode.bytes() * mode.samples());
for chunk in bytes.chunks_exact(mode.bytes()) {
codec
.decode(chunk, &mut pcm)
.map_err(|_| Error::Audio("invalid native frame".into()))?;
samples.extend(pcm.iter().map(|v| f32::from(*v) / 32768.0));
}
let mono = RawAudioFrame::new(1, samples).map_err(|e| Error::Audio(e.to_string()))?;
mono.resampled(CODEC2_SAMPLE_RATE_HZ, self.sample_rate_hz)
.with_channels(self.channels)
.map_err(|e| Error::Audio(e.to_string()))
}
}
File diff suppressed because it is too large. Load diff
+15
View File
@@ -0,0 +1,15 @@
{
"generator": "tools/fixtures/lxst_media_fixtures.py",
"lxst_version": "0.6.0",
"lxst_commit": "6a329bf6d956ca8b15077d4c470afe4cb7c669cc",
"rns_version": "1.6.0",
"rns_commit": "cb1260891d1b6da8f6e9b21542c4f0cc0725cac4",
"buffer_frames": {"16": 2, "32": 2, "48": 2, "64": 5, "80": 5, "96": 5, "112": 2, "128": 3},
"frame_time_ms": {"16": 400, "32": 320, "48": 200, "64": 60, "80": 60, "96": 60, "112": 10, "128": 20},
"raw128": {"machine": "aarch64", "longdouble_bits": 128, "longdouble_nmant": 112, "samples": [0.0, 0.5, -0.25, 1.0], "payload_hex": "c0000000000000000000000000000000000000000000000000000000000000fe3f0000000000000000000000000000fdbf0000000000000000000000000000ff3f", "decoded": [0.0, 0.5, -0.25, 1.0]},
"mixed_batch": [
{"name": "opus_60ms", "codec": 1, "wire_hex": "01db037b5af3c47e60df913de2a4bc5f21a2bd4eb9afea6c144d002a6a9a8c966f0ffd97d00daeb04dcf27e9a5f40332fd4ef0fcea52582fae", "decoded_sample_frames": 2880},
{"name": "codec2_3200_200ms", "codec": 2, "wire_hex": "0206c07d231bd4ace738c0002900d6bdeb5ac681000019f81dd0c5b962029b86d5ffc5884a0094bd6b5ac591840194adebdac5802900d6bdeb5ac581000019f81dd0c5b962029b86d5ffc5884a0094bd6b5a", "decoded_sample_frames": 9595},
{"name": "opus_20ms", "codec": 1, "wire_hex": "01d8b51a679c5c8787e2a9b61c6bc130233e9db6b2", "decoded_sample_frames": 960}
]
}
@@ -69,7 +69,8 @@ fn python_telephone_helper_loads_reference_and_creates_destination() {
.expect("READY event");
assert_eq!(ready["app_name"], "lxst");
assert_eq!(ready["primitive_name"], "telephony");
assert_eq!(ready["lxst_version"], "0.4.5");
assert_eq!(ready["lxst_version"], "0.6.0");
assert_eq!(ready["rns_version"], "1.6.1");
let lxst_root = PathBuf::from(ready["lxst_root"].as_str().expect("LXST root"));
if let Ok(configured) = std::env::var("LXST_UPSTREAM_DIR") {
let configured = PathBuf::from(configured)
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,152 @@
#!/usr/bin/env python3
"""The headless Telephone helper, plus path hop counts and per-frame codec headers.
Commands added to tools/interop/lxst_telephone_helper.py:
{"cmd": "hops", "destination_hash": hex, "timeout": s}
-> HOPS with RNS.Transport.hops_to
{"cmd": "send_call_frames", "count": n}
encodes n 48 kHz sine frames with a fresh copy of the Telephone's transmit
codec, paced at its target frame time -> CALL_FRAMES_DONE
{"cmd": "profile_codec", "profile": p}
-> PROFILE_CODEC, the codec header byte, channels and frame time Telephony.Profiles gives p
Events added:
FRAME_SENT {"codec", "stereo" (Opus TOC s bit), "digest"} of each frame Packetizer puts on the wire
FRAME_RECEIVED {"frames": [{"codec", "stereo", "digest"}]} of each packet LinkSource reads
"""
from __future__ import annotations
import hashlib
import math
import sys
import threading
import time
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parents[3] / "tools" / "interop"))
import lxst_telephone_helper as helper # noqa: E402
OPUS = 0x01
_setup_python_stack = helper.setup_python_stack
_handle_command = helper.handle_command
def frame_fields(frame: bytes) -> dict:
return {
"codec": int(frame[0]),
"stereo": bool(frame[1] & 0x04) if frame[0] == OPUS and len(frame) > 1 else None,
"digest": hashlib.sha256(bytes(frame)).hexdigest()[:16],
}
def setup_python_stack():
codec2_stubbed = _setup_python_stack()
import LXST.Network as Network
import RNS.vendor.umsgpack as mp
from LXST.Codecs import codec_header_byte
packetizer_handle_frame = Network.Packetizer.handle_frame
link_source_packet = Network.LinkSource._packet
def handle_frame(self, frame, source=None):
sendable = not (
type(self.destination) == helper._RNS.Link and not self.destination.status == helper._RNS.Link.ACTIVE
) and not self.squelched
result = packetizer_handle_frame(self, frame, source)
if sendable:
helper.emit({"event": "FRAME_SENT", **frame_fields(codec_header_byte(type(self.source.codec)) + frame)})
return result
def packet(self, data, packet):
try:
unpacked = mp.unpackb(data)
if type(unpacked) == dict and Network.FIELD_FRAMES in unpacked:
frames = unpacked[Network.FIELD_FRAMES]
if type(frames) != list:
frames = [frames]
helper.emit({"event": "FRAME_RECEIVED", "frames": [frame_fields(frame) for frame in frames]})
except Exception:
pass
return link_source_packet(self, data, packet)
Network.Packetizer.handle_frame = handle_frame
Network.LinkSource._packet = packet
return codec2_stubbed
def send_call_frames(command: dict) -> None:
np = helper._np
telephone = helper._telephone
profile = telephone.active_profile
codec = type(telephone.transmit_codec)(profile=telephone.transmit_codec.profile)
frame_ms = telephone.target_frame_time_ms
class Source:
samplerate = 48000
channels = 1
samples = 48000 * frame_ms // 1000
sent = 0
started = time.time()
for index in range(int(command["count"])):
t = (np.arange(samples) + index * samples) / 48000.0
frame = (0.25 * np.sin(2 * math.pi * 440.0 * t)).astype(np.float32).reshape((samples, 1))
# send_packetized_frame rebinds codec.source to the packetizer's source.
codec.source = Source()
sent += bool(helper.send_packetized_frame(codec, codec.encode(frame)))
time.sleep(max(0.0, started + (index + 1) * frame_ms / 1000.0 - time.time()))
helper.emit({"event": "CALL_FRAMES_DONE", "id": command.get("id"), "profile": profile, "frame_ms": frame_ms, "sent": sent})
def profile_codec(command: dict) -> None:
from LXST.Codecs import codec_header_byte
Profiles = helper._Telephony.Profiles
profile = int(command["profile"])
helper.emit(
{
"event": "PROFILE_CODEC",
"id": command.get("id"),
"profile": profile,
"codec": codec_header_byte(type(Profiles.get_codec(profile)))[0],
"channels": Profiles.get_codec(profile).channels,
"frame_ms": Profiles.get_frame_time(profile),
}
)
def handle_command(command: dict, args) -> bool:
if command.get("cmd") == "profile_codec":
profile_codec(command)
return True
if command.get("cmd") == "send_call_frames":
threading.Thread(target=send_call_frames, args=(command,), daemon=True).start()
return True
if command.get("cmd") != "hops":
return _handle_command(command, args)
RNS = helper._RNS
destination_hash = bytes.fromhex(command["destination_hash"])
deadline = time.time() + float(command.get("timeout", 10))
requested = 0.0
while not RNS.Transport.has_path(destination_hash) and time.time() < deadline:
if time.time() - requested > 1.0:
RNS.Transport.request_path(destination_hash)
requested = time.time()
time.sleep(0.1)
helper.emit(
{
"event": "HOPS",
"id": command.get("id"),
"has_path": bool(RNS.Transport.has_path(destination_hash)),
"hops": RNS.Transport.hops_to(destination_hash),
}
)
return True
helper.setup_python_stack = setup_python_stack
helper.handle_command = handle_command
if __name__ == "__main__":
raise SystemExit(helper.main())
File renamed without changes.
+8 -3
View File
@@ -275,10 +275,15 @@ def render_snapshot(
def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument("--metadata-only", action="store_true")
parser = argparse.ArgumentParser(
description="Compare current public APIs with the stored snapshots, or refresh them after review."
)
parser.add_argument(
"--metadata-only", action="store_true",
help="validate metadata, package inventory and stored snapshot hashes without generating API output; incompatible with --update",
)
parser.add_argument("--update", action="store_true",
help="refresh snapshots from the working tree to commit alongside source changes")
help="regenerate snapshots and update their counts/hashes in api/stability.json; review the diff before committing")
parser.add_argument("--snapshot-source-commit",
help="optional HEAD guard for --update; includes uncommitted source changes")
args = parser.parse_args()
+5 -3
View File
@@ -122,17 +122,19 @@ def render_contract() -> str:
def main() -> None:
parser = argparse.ArgumentParser()
parser = argparse.ArgumentParser(
description="Compare current library Cargo metadata with api/snapshots/manifest-contract.json."
)
parser.add_argument(
"--print",
action="store_true",
dest="print_contract",
help="print the current canonical contract for reviewed application",
help="print current Cargo contract JSON instead of comparing it with the saved snapshot",
)
parser.add_argument(
"--update",
action="store_true",
help="write the current reviewed manifest contract",
help="replace the saved manifest contract with current Cargo metadata; review the diff before committing",
)
args = parser.parse_args()
if args.print_contract and args.update:
+5 -5
View File
@@ -14,10 +14,10 @@ ROOT = Path(__file__).resolve().parents[1]
EXPECTED_PACKAGES = {"lxst-core", "lxst-codec2", "lxst-embedded", "lxst-rns", "lxst-telephony"}
EXPECTED_MSRV = "1.89"
EMBEDDED_MSRV = {"lxst-codec2": "1.87", "lxst-embedded": "1.87"}
EXPECTED_RETICULUM_VERSION = "1.4.0"
EXPECTED_RETICULUM_COMMIT = "bf7d16fc36045b6d33ca0d4c85d2b35b1b20751f"
EXPECTED_RETICULUM_VERSION = "1.5.1"
EXPECTED_RETICULUM_COMMIT = "f6d0d698dd7e6edc180f9c3697ab1c873571f372"
EXPECTED_OPUS_DEPENDENCY = (
'opus-rs = { version = "=0.1.29", default-features = false, '
'opus-rs = { version = "=0.1.42", default-features = false, '
'features = ["heap"] }'
)
SHA_PATTERN = re.compile(r"^[0-9a-f]{40}$")
@@ -79,7 +79,7 @@ if "## Unreleased" not in (ROOT / "CHANGELOG.md").read_text(encoding="utf-8"):
root_manifest = (ROOT / "Cargo.toml").read_text(encoding="utf-8")
if EXPECTED_OPUS_DEPENDENCY not in root_manifest:
fail("workspace must consume exact upstream opus-rs 0.1.29 with heap state")
fail("workspace must consume exact upstream opus-rs 0.1.42 with heap state")
if (ROOT / "vendor/opus-rs").exists():
fail("local opus-rs vendor/fork must not exist")
@@ -143,7 +143,7 @@ python_pins = {
"RSLXST_PYTHON_LXST_COMMIT",
json.loads((ROOT / "tools/reference/lxst_reference_lock.json").read_text())["commit"],
),
"Reticulum": ("RSLXST_PYTHON_RNS_COMMIT", "b48b96e61676504e0a4e527b33b9a0b4495c6872"),
"Reticulum": ("RSLXST_PYTHON_RNS_COMMIT", "cff4d03fdbd6bfb63b765280cd944756ac5cce8d"),
}
for name, (variable, revision) in python_pins.items():
pin = re.search(rf"^ {variable}: ([0-9a-f]{{40}})$", workflow, re.MULTILINE)
+9 -5
View File
@@ -13,15 +13,15 @@ import tomllib
ROOT = Path(__file__).resolve().parents[1]
INVENTORY = ROOT / "THIRD_PARTY_LICENSES.json"
UPSTREAM_OPUS_COMMIT = "95f8b76430beb8c1bed067354d519c918ceade21"
UPSTREAM_OPUS_VERSION = "0.1.29"
UPSTREAM_OPUS_COMMIT = "5d8230f362b2618b9e730e6201c0d8f98961dfe1"
UPSTREAM_OPUS_VERSION = "0.1.42"
UPSTREAM_OPUS_LICENSE = "BSD-3-Clause"
UPSTREAM_OPUS_REPOSITORY = "https://github.com/restsend/opus-rs"
UPSTREAM_OPUS_SOURCE = "registry+https://github.com/rust-lang/crates.io-index"
UPSTREAM_OPUS_CRATE_CHECKSUM = (
"eadaf84d53a021172447a8771d74f805ac3719a61041dafa95720ef86b8e271d"
"bafbcaf2ed381cdf68ced4ed8d16517de90ffd7424e36f0b9e45d67fbe30b1f9"
)
UPSTREAM_OPUS_COPYING = "third_party/opus-rs-0.1.29-COPYING"
UPSTREAM_OPUS_COPYING = "third_party/opus-rs-0.1.42-COPYING"
UPSTREAM_OPUS_COPYING_SHA256 = (
"67c6f0a4bac3019fb08948838d7203bf661a629416f69057081c6f39db5e96a5"
)
@@ -164,7 +164,11 @@ expected = json.dumps(build_inventory(), indent=2, sort_keys=False) + "\n"
if len(sys.argv) == 2 and sys.argv[1] == "--write":
INVENTORY.write_text(expected, encoding="utf-8")
elif len(sys.argv) != 1:
fail("usage: check-third-party-licenses.py [--write]")
fail(
"usage: check-third-party-licenses.py [--write]\n"
"Without --write, compare the locked dependency inventory with THIRD_PARTY_LICENSES.json.\n"
"With --write, replace that file after checking dependency provenance; review the diff before committing."
)
elif not INVENTORY.is_file():
fail("THIRD_PARTY_LICENSES.json is missing; run with --write")
elif INVENTORY.read_text(encoding="utf-8") != expected:
+6 -2
View File
@@ -23,8 +23,12 @@ def main_root() -> Path:
return repo_root().parent
def _upstream_checkout(name: str) -> Path:
return main_root() / "upstream" / name
def upstream_lxst_root() -> Path:
return Path(os.environ.get("LXST_UPSTREAM_DIR", main_root() / "upstream" / "LXST")).resolve()
return Path(os.environ.get("LXST_UPSTREAM_DIR", _upstream_checkout("LXST"))).resolve()
def upstream_reticulum_root() -> Path:
@@ -32,7 +36,7 @@ def upstream_reticulum_root() -> Path:
if configured:
return Path(configured).resolve()
upstream = main_root() / "upstream" / "Reticulum"
upstream = _upstream_checkout("Reticulum")
if upstream.exists():
return upstream.resolve()
+118
View File
@@ -0,0 +1,118 @@
#!/usr/bin/env python3
"""Generate LXST media-path vectors by calling upstream Python LXST.
usage: python tools/fixtures/lxst_media_fixtures.py crates/lxst-telephony/tests/fixtures/media_vectors.json
Upstream checkouts come from LXST_UPSTREAM_DIR / RETICULUM_UPSTREAM_DIR, or the
workspace upstream directory (see tools/common/lxst_reference.py). Real Opus and
Codec2 codecs are required: the generator refuses to run with the Codec2 stub.
Emits buffer_frames and frame_time_ms per profile, raw128 (Raw(bitdepth=128) bytes,
platform-specific) and mixed_batch (one packet switching codec mid-batch, with the
sample counts upstream's per-frame codec switching decodes, Network.py LinkSource).
"""
from __future__ import annotations
import json
import platform
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "common"))
from lxst_reference import git_output, prepare_python_path, upstream_lxst_root, upstream_reticulum_root # noqa: E402
try:
import pycodec2 # noqa: F401 loaded first so the locator never installs its Codec2 stub
except ImportError:
raise SystemExit("pycodec2 is not installed; Codec2 vectors need the real codec")
prepare_python_path()
import numpy as np # noqa: E402
import RNS # noqa: E402
from LXST._version import __version__ as LXST_VERSION # noqa: E402
from LXST.Codecs import Codec2, Opus, Raw, codec_header_byte, codec_type # noqa: E402
from LXST.Primitives.Telephony import Profiles # noqa: E402
assert LXST_VERSION == "0.6.0", LXST_VERSION
assert RNS.__version__ == "1.6.0", RNS.__version__
class Src: # encoders read only samplerate from their source
def __init__(self, rate):
self.samplerate = rate
class Sink: # decoders read samplerate and channels from their sink
def __init__(self, rate, channels):
self.samplerate = rate
self.channels = channels
def tone(rate, ms):
n = int(rate * ms / 1000)
t = np.arange(n) / rate
return (0.3 * np.sin(2 * np.pi * 440 * t)).reshape(n, 1).astype("float32")
def main() -> None:
out_path = Path(sys.argv[1])
lxst_root = upstream_lxst_root()
out = {
"generator": "tools/fixtures/lxst_media_fixtures.py",
"lxst_version": LXST_VERSION,
"lxst_commit": git_output(["rev-parse", "HEAD"], lxst_root),
"rns_version": RNS.__version__,
"rns_commit": git_output(["rev-parse", "HEAD"], upstream_reticulum_root()),
}
profiles = [Profiles.BANDWIDTH_ULTRA_LOW, Profiles.BANDWIDTH_VERY_LOW, Profiles.BANDWIDTH_LOW,
Profiles.QUALITY_MEDIUM, Profiles.QUALITY_HIGH, Profiles.QUALITY_MAX,
Profiles.LATENCY_ULTRA_LOW, Profiles.LATENCY_LOW]
out["buffer_frames"] = {str(p): Profiles.get_buffer_frames(p) for p in profiles}
out["frame_time_ms"] = {str(p): Profiles.get_frame_time(p) for p in profiles}
samples = np.array([[0.0], [0.5], [-0.25], [1.0]], dtype="float32")
encoded = Raw(channels=1, bitdepth=128).encode(samples)
decoded = Raw().decode(encoded)
out["raw128"] = {"machine": platform.machine(),
"longdouble_bits": int(np.finfo(np.longdouble).bits),
"longdouble_nmant": int(np.finfo(np.longdouble).nmant),
"samples": samples[:, 0].tolist(), "payload_hex": encoded.hex(),
"decoded": [float(x) for x in decoded[:, 0]]}
frames = []
opus = Opus(profile=Opus.PROFILE_VOICE_MEDIUM)
opus.source = Src(24000)
frames.append(("opus_60ms", codec_header_byte(Opus) + opus.encode(tone(24000, 60))))
codec2 = Codec2(mode=Codec2.CODEC2_3200)
codec2.source = Src(8000)
frames.append(("codec2_3200_200ms", codec_header_byte(Codec2) + codec2.encode(np.repeat(tone(8000, 200), 2, axis=1))))
frames.append(("opus_20ms", codec_header_byte(Opus) + opus.encode(tone(24000, 20))))
sink = Sink(48000, 1)
codec = Opus()
codec.sink = sink
batch = []
for name, wire in frames:
frame_codec = codec_type(wire[0])
if type(codec) != frame_codec:
codec = frame_codec()
codec.sink = sink
samples_out = codec.decode(wire[1:])
batch.append({"name": name, "codec": int(wire[0]), "wire_hex": wire.hex(),
"decoded_sample_frames": int(samples_out.shape[0])})
out["mixed_batch"] = batch
lines = []
for key, value in out.items():
if isinstance(value, list):
items = ",\n".join(" " + json.dumps(item) for item in value)
lines.append(f"{json.dumps(key)}: [\n{items}\n ]")
else:
lines.append(f"{json.dumps(key)}: {json.dumps(value)}")
out_path.write_text("{\n " + ",\n ".join(lines) + "\n}\n")
if __name__ == "__main__":
main()
+3 -2
View File
@@ -62,8 +62,9 @@ def generate_fixtures():
def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument("--decode-hex", default="")
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--decode-hex", default="",
help="decode a hex-encoded Raw codec payload to JSON; omit or pass an empty string to generate fixture cases")
args = parser.parse_args()
if args.decode_hex:
+3 -2
View File
@@ -90,8 +90,9 @@ def generate_fixtures():
def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument("--decode-hex", default="")
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--decode-hex", default="",
help="decode a hex-encoded LXST wire packet to JSON; omit or pass an empty string to generate fixture cases")
args = parser.parse_args()
if args.decode_hex:
+3 -3
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
"""Generate immutable Rust 700C codebooks from the pinned Codec2 source tree."""
"""Generate Rust 700C codebooks from Codec2 inputs with pinned source hashes."""
import argparse
import hashlib
import json
@@ -11,8 +11,8 @@ BACKEND = ROOT / "crates/lxst-codec2"
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("source", type=Path)
parser.add_argument("--check", action="store_true")
parser.add_argument("source", type=Path, help="Codec2 source-tree root containing the codebook files listed in UPSTREAM.json")
parser.add_argument("--check", action="store_true", help="compare with the generated Rust file without rewriting it")
args = parser.parse_args()
provenance = json.loads((BACKEND / "UPSTREAM.json").read_text())["codec2_700c"]
lines = [
+77 -12
View File
@@ -86,6 +86,12 @@ def patch_headless_audio(Telephony, LXST, np, opus_available: bool) -> None:
self.should_run = False
self.samplerate = 48000
self.channels = 1
self.buffer_max_height = 3
self.autostart_min = 1
self.streaming = False
def wait_for_frames(self):
return None
def start(self):
self.should_run = True
@@ -249,6 +255,8 @@ def patch_headless_audio(Telephony, LXST, np, opus_available: bool) -> None:
Telephony.Pipeline = HeadlessPipeline
Telephony.BandPass = NoopFilter
Telephony.AGC = NoopFilter
if hasattr(Telephony, "EchoSuppressor"):
Telephony.EchoSuppressor = NoopFilter
if not opus_available:
original_get_codec = Telephony.Profiles.get_codec
@@ -269,14 +277,49 @@ def patch_headless_audio(Telephony, LXST, np, opus_available: bool) -> None:
def patch_signalling_events(Telephony) -> None:
original = Telephony.Telephone.signalling_received
# LXST_HELPER_DROP_RECEIVED lists signal values this phone never sees, to model loss.
dropped = {int(value) for value in os.environ.get("LXST_HELPER_DROP_RECEIVED", "").split(",") if value.strip()}
def signalling_received(self, signals, source):
emit({"event": "SIGNALS", "signals": [int(signal) for signal in signals]})
signals = [signal for signal in signals if int(signal) not in dropped]
return original(self, signals, source)
Telephony.Telephone.signalling_received = signalling_received
def patch_dropped_signals() -> None:
# LXST_HELPER_DROP_SENT lists signal values this phone never puts on the wire, to model loss.
dropped = {int(value) for value in os.environ.get("LXST_HELPER_DROP_SENT", "").split(",") if value.strip()}
if not dropped:
return
import LXST.Network as Network
original = Network.SignallingReceiver.signal
def signal(self, signal, destination, immediate=True):
signals = signal if type(signal) == list else [signal]
kept = [value for value in signals if value not in dropped]
if kept:
return original(self, kept, destination, immediate)
Network.SignallingReceiver.signal = signal
def patch_open_pipelines_observer(Telephony) -> None:
# LXST_HELPER_OPEN_DELAY delays the caller's pipeline setup to model a slow or distant phone.
delay = float(os.environ.get("LXST_HELPER_OPEN_DELAY", "0") or 0)
original = Telephony.Telephone._Telephone__open_pipelines
def open_pipelines(self, identity):
emit({"event": "OPEN_PIPELINES"})
if delay and self.active_call is not None and getattr(self.active_call, "is_outgoing", False):
time.sleep(delay)
return original(self, identity)
Telephony.Telephone._Telephone__open_pipelines = open_pipelines
def setup_python_stack():
global _RNS, _LXST, _Telephony, _np, _opus_available
_RNS, _LXST, codec2_stubbed = import_rns_lxst()
@@ -286,6 +329,8 @@ def setup_python_stack():
_opus_available = python_opus_available(Telephony)
patch_headless_audio(Telephony, _LXST, np, _opus_available)
patch_signalling_events(Telephony)
patch_open_pipelines_observer(Telephony)
patch_dropped_signals()
_Telephony = Telephony
_np = np
return codec2_stubbed
@@ -299,8 +344,11 @@ def snapshot_event():
active = {
"identity_hash": bytes(remote.hash).hex() if remote else None,
"profile": getattr(telephone.active_call, "profile", None),
"call_mode": getattr(telephone.active_call, "call_mode", None),
"squelched": bool(getattr(getattr(telephone.active_call, "packetizer", None), "squelched", False)),
"status": telephone.call_status,
"answered": bool(getattr(telephone.active_call, "answered", False)),
"audio_started": bool(telephone.audio_input is not None and telephone.audio_input.should_run),
}
return {
@@ -322,6 +370,7 @@ def emit_ready(identity, telephone, codec2_stubbed):
"app_name": "lxst",
"primitive_name": "telephony",
"lxst_version": lxst_version,
"rns_version": _RNS.__version__,
"lxst_root": str(upstream_lxst_root()),
"codec2_stubbed": bool(codec2_stubbed),
"headless_audio": True,
@@ -368,9 +417,13 @@ def setup_reticulum(storage: Path, tcp_role: str, tcp_host: str, tcp_port: int,
config_dir = storage / "rns"
config_dir.mkdir(parents=True, exist_ok=True)
(config_dir / "config").write_text(
build_rns_config(tcp_role, tcp_host, tcp_port, enable_transport),
build_rns_config(tcp_role, tcp_host, tcp_port, enable_transport)
+ ("\n[stamps]\n" + os.environ["LXST_HELPER_STAMPS"].replace(";", "\n") + "\n" if os.environ.get("LXST_HELPER_STAMPS") else ""),
encoding="utf-8",
)
# Destination stamping opt-in, as before Reticulum 1.6.1 ([stamps] still turns it on):
# macOS stamps on one core, and a value-25 stamp takes about a minute there.
_RNS.Transport.STAMP_DESTINATIONS = False
loglevel = os.environ.get("LXST_PYTHON_LOGLEVEL")
if loglevel:
@@ -391,7 +444,7 @@ def create_telephone(args):
telephone = _Telephony.Telephone(
identity,
ring_time=args.ring_time,
wait_time=args.wait_time,
wait_time=float(os.environ.get("LXST_HELPER_WAIT_TIME", args.wait_time)),
)
configure_callbacks(telephone)
_telephone = telephone
@@ -491,7 +544,7 @@ def handle_command(command: dict, args) -> bool:
}
)
return True
_telephone.call(identity, profile=command.get("profile"))
_telephone.call(identity, profile=command.get("profile"), mode=command.get("mode"))
emit(
{
"event": "CALL_REQUESTED",
@@ -547,6 +600,16 @@ def handle_command(command: dict, args) -> bool:
emit({"event": "OPUS_FRAME_SENT", "id": command.get("id"), "sent": sent})
return True
if cmd == "switch_mode":
_telephone.switch_mode(int(command["mode"]))
emit({"event": "MODE_SWITCHED", "id": command.get("id"), "mode": _telephone.active_mode})
return True
if cmd == "unsquelch":
_telephone.unsquelch_transmit()
emit({"event": "UNSQUELCHED", "id": command.get("id")})
return True
if cmd == "switch_profile":
profile = int(command["profile"])
_telephone.switch_profile(profile)
@@ -577,15 +640,17 @@ def run_command_loop(args):
def main() -> int:
parser = argparse.ArgumentParser()
parser.add_argument("--mode", choices=["self-test", "host"], required=True)
parser.add_argument("--storage-dir", required=True)
parser.add_argument("--tcp-role", choices=["server", "client"], default="client")
parser.add_argument("--tcp-host", default="127.0.0.1")
parser.add_argument("--tcp-port", type=int, default=0)
parser.add_argument("--ring-time", type=float, default=20.0)
parser.add_argument("--wait-time", type=float, default=20.0)
parser.add_argument("--enable-transport", action="store_true")
parser = argparse.ArgumentParser(
description="Headless LXST interop harness: starts Reticulum and exchanges JSON events/commands without physical audio."
)
parser.add_argument("--mode", choices=["self-test", "host"], required=True, help="self-test starts the stack, emits a snapshot and stops; host reads JSON commands from stdin")
parser.add_argument("--storage-dir", required=True, help="scratch directory: existing contents are deleted and the directory is recreated on startup in both modes")
parser.add_argument("--tcp-role", choices=["server", "client"], default="client", help="TCP interface role when --tcp-port is positive (default: client)")
parser.add_argument("--tcp-host", default="127.0.0.1", help="client destination or server listen address (default: 127.0.0.1)")
parser.add_argument("--tcp-port", type=int, default=0, help="TCP port; zero or negative omits the TCP interface (default: 0)")
parser.add_argument("--ring-time", type=float, default=20.0, help="incoming-call ring timeout in seconds (default: 20)")
parser.add_argument("--wait-time", type=float, default=20.0, help="outgoing-call/path-recall timeout in seconds (default: 20)")
parser.add_argument("--enable-transport", action="store_true", help="enable transport mode in the generated Reticulum config (default: off)")
args = parser.parse_args()
try:
+15 -15
View File
@@ -1,38 +1,38 @@
{
"commit": "1194c9011fe6402edc7aebe7ffe9650ea3b1afee",
"commit": "6a329bf6d956ca8b15077d4c470afe4cb7c669cc",
"dirty": false,
"files": {
"LXST/Codecs/Codec2.py": {
"bytes": 4107,
"sha256": "e43a0be0b3b5b66665c47f468e8b102040632652a88e73598fc8cdbad8d4819a"
"bytes": 4221,
"sha256": "bb5727a4da4083ceddc0f692a12cf4aa17c8ad48c4394bcc71a61d4bdf5d572c"
},
"LXST/Codecs/Opus.py": {
"bytes": 7806,
"sha256": "0f0e6f9ffa48e899a80220b33485226fc411d70cd07dce3ff0b7582a208deb03"
"bytes": 8688,
"sha256": "bd3c7b0d777bddfbfc80acd51765b3d9bf623ba02bc0f1d1a6e128a2ab5bdd48"
},
"LXST/Codecs/Raw.py": {
"bytes": 2316,
"sha256": "8bda42cb8602797e7ef62dd71bac074d2ec547278ec2b0bc5bf8bcb7c100a026"
"bytes": 2451,
"sha256": "bce228630cf26a0c3a72b8d068eef3f9bbd099f077184b4ebf467259a42dbb0f"
},
"LXST/Codecs/__init__.py": {
"bytes": 704,
"sha256": "48c3f7adaf9c89326a81abf29f394f9857b11ea17315b3790214eaf7d45c03de"
"bytes": 739,
"sha256": "7977e713a3b8fa2167762db122024d1dcad8d09a1e8d98d25099271b22abfe1b"
},
"LXST/Network.py": {
"bytes": 6172,
"sha256": "3da8422a5c2c73f6e9c7d8e784b1e9cb307d079ebb5bf99183fc5daadfbd9701"
"bytes": 6458,
"sha256": "1f58806a43b2eadac536e1062857493fede551688ef92414b427aaffd6492923"
},
"LXST/Primitives/Telephony.py": {
"bytes": 37026,
"sha256": "35b2a4093368223145a548ac671504b43a4dcdac62368db754b082fe40138825"
"bytes": 46484,
"sha256": "da13879d66d2f4f83ea3b39c141a6566f29fc0ef7c96636a4c0b5dd619c0ab1c"
},
"LXST/_version.py": {
"bytes": 22,
"sha256": "12b90b908d930c15f5388aa2d8619adb408f7aee1972e9448be5df7d16cb53a3"
"sha256": "7080f58cb9c2fef8f8f0680c37a61bd4503726c43de73366087991604f131616"
}
},
"missing_files": [],
"package_version": "0.4.5",
"package_version": "0.6.0",
"remote": "https://github.com/markqvist/LXST.git",
"upstream": "../upstream/LXST"
}