Skip to content

NAT, Docker, wildcard dialplan, μ-law perf, RTP playback pipeline - #44

Merged
thorsager merged 4 commits into
mainfrom
43-exteranal-and-local-ip
Jul 17, 2026
Merged

NAT, Docker, wildcard dialplan, μ-law perf, RTP playback pipeline#44
thorsager merged 4 commits into
mainfrom
43-exteranal-and-local-ip

Conversation

@thorsager

@thorsager thorsager commented Jul 17, 2026

Copy link
Copy Markdown
Owner
  • NAT/Docker: --nat-address flag replaces loopback in SDP for Docker, resolveClientAddr uses net.ResolveUDPAddr at all 6 call sites, Docker Compose with front/back trecsd instances
  • Wildcard dialplan: support "number": "*" match-all routes
  • μ-law perf: ITU-T G.711 µ-law via 64KB LUT (~1.8ns/lookup), reference value tests, symmetry/clamp/quantization tests
  • RTP playback: pre-marshal all packets + single time.Ticker (fixed double-pacing bug), then producer-consumer pipeline for memory-bounded O(window) playback
  • Jitter test: tightened tolerances to <2ms per-packet, <10ms total drift

closes #43

Add external-ip and nat-address flags for NAT traversal, Dockerfile and
compose for containerized deployment, and wildcard ("*") dialplan
entries for catch-all routing. Trunks now support per-trunk local_ip
override for multi-interface setups.
Replace per-sample encoding with a pre-computed [65536]byte
lookup table for O(1) μ-law conversion. Also adds Docker
Compose targets and skips NAT tests when not in Docker.
Use a producer-consumer pattern to marshal RTP packets ahead of the sender
and send them on a ticker, reducing jitter and drift. The first packet is sent
immediately, and subsequent packets are paced by a ticker for more accurate
timing.

Add TestRunFilePlayback_Timing to verify that per-packet jitter and total
drift remain within acceptable bounds.
Per-packet jitter: <30ms (industry standard, VoIP <30ms per Cisco/IBM/ITU-T)
Total drift: <50ms (allows for CI scheduler noise, still catches real
regressions like the double-pacing bug)
@github-actions

Copy link
Copy Markdown

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/thorsager/trecs/cmd/trecsd 0.00% (ø)
github.com/thorsager/trecs/integrationtest 0.00% (ø)
github.com/thorsager/trecs/integrationtest/dialplan 0.00% (ø)
github.com/thorsager/trecs/internal/b2bua 3.59% (+0.48%) 👍
github.com/thorsager/trecs/internal/dialplan 100.00% (ø)
github.com/thorsager/trecs/internal/media 78.04% (+18.98%) 🎉
github.com/thorsager/trecs/internal/trunk 40.00% (+0.55%) 👍

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/thorsager/trecs/cmd/trecsd/main.go 0.00% (ø) 109 (+8) 0 109 (+8)
github.com/thorsager/trecs/integrationtest/testserver.go 0.00% (ø) 0 0 0
github.com/thorsager/trecs/internal/b2bua/handler.go 2.80% (+0.52%) 1001 (+35) 28 (+6) 973 (+29) 👍
github.com/thorsager/trecs/internal/dialplan/jsondp.go 100.00% (ø) 19 (+2) 19 (+2) 0
github.com/thorsager/trecs/internal/dialplan/static.go 100.00% (ø) 8 (+2) 8 (+2) 0
github.com/thorsager/trecs/internal/media/playback.go 67.92% (+67.92%) 106 (+17) 72 (+72) 34 (-55) 🌟
github.com/thorsager/trecs/internal/trunk/config.go 89.47% (+0.43%) 76 (+3) 68 (+3) 8 👍
github.com/thorsager/trecs/internal/trunk/manager.go 20.92% (+0.19%) 196 (+3) 41 (+1) 155 (+2) 👍

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/thorsager/trecs/integrationtest/dialplan/dialplan_test.go
  • github.com/thorsager/trecs/internal/b2bua/handler_test.go
  • github.com/thorsager/trecs/internal/dialplan/jsondp_test.go
  • github.com/thorsager/trecs/internal/dialplan/static_test.go
  • github.com/thorsager/trecs/internal/media/playback_test.go
  • github.com/thorsager/trecs/internal/trunk/config_test.go
  • github.com/thorsager/trecs/internal/trunk/manager_test.go

@thorsager
thorsager merged commit 8bab954 into main Jul 17, 2026
9 checks passed
@thorsager
thorsager deleted the 43-exteranal-and-local-ip branch July 17, 2026 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add --external-ip CLI flag and per-trunk local_ip config for multi-address deployments

1 participant