Skip to content

simplify - #92

Merged
codingjoe merged 19 commits into
mainfrom
simplify
Jun 18, 2026
Merged

simplify#92
codingjoe merged 19 commits into
mainfrom
simplify

Conversation

@codingjoe

Copy link
Copy Markdown
Owner
  • 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

Copilot AI review requested due to automatic review settings June 18, 2026 13:16
@codingjoe codingjoe self-assigned this Jun 18, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ 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 new serve() 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.

Comment thread voip/sip/protocol.py
Comment thread voip/sip/messages.py
Comment thread voip/sip/protocol.py Outdated
Comment thread voip/sip/protocol.py Outdated
Comment thread voip/rtp.py
Comment thread tests/codecs/test_g722.py
Comment thread voip/codecs/opus.py
Comment on lines 128 to +132
"<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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

codingjoe and others added 4 commits June 18, 2026 16:31
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 codingjoe left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

Comment thread docs/feature_roadmap.md
### 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

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The MPC isn't mentioned here yet.

@codecov

codecov Bot commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 42.76316% with 87 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.89%. Comparing base (bbd91df) to head (f0f99e7).

Files with missing lines Patch % Lines
voip/sip/protocol.py 13.79% 50 Missing ⚠️
voip/__main__.py 0.00% 20 Missing ⚠️
voip/audio.py 12.50% 7 Missing ⚠️
voip/sip/transactions.py 0.00% 5 Missing ⚠️
voip/rtp.py 69.23% 4 Missing ⚠️
voip/sip/messages.py 87.50% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codingjoe
codingjoe merged commit 9ac47b9 into main Jun 18, 2026
16 of 17 checks passed
@codingjoe
codingjoe deleted the simplify branch June 18, 2026 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants