Conversation
codingjoe
commented
Jun 18, 2026
- WIP
- Drop callback for task
- Add UDP support
- Fix msg headers
- Fix IPv6 support
- Add no audio warning
- Fix stereo opus support
- Enable opus sending
- Fix voice input on Opus
There was a problem hiding this comment.
⚠️ Not ready to approve
There are critical SIP correctness issues (ACK routing and Via branch extraction) and a runtime bug in UDP setup (getaddrinfo with ipaddress hosts) that must be fixed before it can be safely approved.
Pull request overview
This PR is a WIP refactor that aims to simplify call/session wiring while extending the SIP stack to support UDP transport, improving NAT/public-address handling for RTP, and fixing several SIP header and Opus audio edge cases.
Changes:
- Add UDP transport support to
SessionInitiationProtocol, including reconnection support via a newserve()helper. - Refactor RTP public-address discovery to be async/awaitable and update SIP/RTP integration points accordingly.
- Rework Opus encode/decode behavior to produce valid single-frame RTP payloads and introduce a stateful Opus decoder; adjust CLI/docs and tests to match the new APIs.
File summaries
| File | Description |
|---|---|
voip/stun.py |
Adjust STUN server default and improve IPv6 tuple handling; add parse debug log. |
voip/sip/transactions.py |
Update RTP public address usage and session registration; adjust digest default and headers. |
voip/sip/protocol.py |
Add UDP support and a reconnecting serve() loop; update keepalive behavior by transport. |
voip/sip/messages.py |
Update Via/header copying logic for responses and adjust Via parsing behavior. |
voip/rtp.py |
Make RTP public address awaitable and add an async create() constructor. |
voip/mcp.py |
Remove the “ready callback” parameter from MCP run path. |
voip/codecs/opus.py |
Add Opus packetization for RTP, introduce a stateful decoder, and adjust Ogg header parameters. |
voip/audio.py |
Use negotiated payload type for outbound packets; add warnings for payload-type mismatch/empty decode. |
voip/__main__.py |
Simplify CLI connection flow using run()/serve(); update STUN default; add outbound dialog close behavior. |
tests/test_mcp.py |
Update MCP tests for removed callback parameter. |
tests/sip/conftest.py |
Make RTP fixture async and adapt to new public_address Future behavior. |
tests/codecs/test_opus.py |
Add regression tests for Opus packetization and stateful decoding. |
tests/codecs/test_g722.py |
Update codec test setup (currently contains a format mismatch issue). |
docs/rfc_status.md |
Document SIP UDP support. |
docs/feature_roadmap.md |
Update roadmap text to include UDP transport. |
Copilot's findings
- Files reviewed: 15/15 changed files
- Comments generated: 7
Note
Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.
| "<8sBBHIhB", | ||
| b"OpusHead", | ||
| 1, # version | ||
| 1, # channel count (mono) | ||
| 3840, # pre-skip: 80 ms at 48 kHz (RFC 7587) | ||
| cls.channels, # channel count | ||
| 0, # pre-skip: each RTP payload is decoded as a standalone stream |
There was a problem hiding this comment.
Fixed in the latest commit — channels is now 1, consistent with the mono layout used in packetize, encode, and OpusDecoder. Added a test_channels assertion to TestOpusConstants to lock this in.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
codingjoe
left a comment
There was a problem hiding this comment.
@copilot I believe we should make the new UDP support the default for SIP (not sips) as it is more commonly supported by servers and will make it easer out of the box. Please udpate the docs and readme too.
Double check if there are tests failing.
| ### SIP Signalling | ||
|
|
||
| SIP User Agent Client (UAC) over TLS/TCP ([RFC 3261]). Handles incoming | ||
| SIP User Agent Client (UAC) over TLS/TCP/UDP ([RFC 3261]). Handles incoming |
There was a problem hiding this comment.
The MPC isn't mentioned here yet.
This reverts commit b030942.
for more information, see https://pre-commit.ci
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #92 +/- ##
==========================================
+ Coverage 67.91% 68.89% +0.97%
==========================================
Files 28 28
Lines 2344 2382 +38
==========================================
+ Hits 1592 1641 +49
+ Misses 752 741 -11 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|