RFC 3261: distinguish outbound proxy from registrar + AOR-based CLI#23
RFC 3261: distinguish outbound proxy from registrar + AOR-based CLI#23codingjoe merged 4 commits intotranscribe-callfrom
Conversation
…ance RFC 3261 §8.1.2 distinguishes between the outbound proxy (the server a UA sends all requests to) and the registrar (whose domain is derived from the AOR per §10). The two can differ — e.g. proxy.carrier.com vs carrier.com. - Rename `server_address` → `outbound_proxy` (optional, default None) - Update class docstring with RFC 3261 UAC topology overview - Update `register()` docstring/logging to log proxy vs registrar - Update CLI --server/--aor help text to use RFC 3261 terminology - Update all test references accordingly Co-authored-by: codingjoe <[email protected]>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
codingjoe
left a comment
There was a problem hiding this comment.
@copilot let's change the CLI and protocol. We provide the aor by as a position argument to the CLI, like sip:[email protected]:port and by default parse all information (except for the PW from it). However, username, the proxy domain, the realm, protocol (sip/sips) can be separately overwritten.
We default to port 5061/tls. If port 5060 is given we we establish TCP transport w/o ssl. Over the transport type can still be overriden via the cli.
- Add `_parse_aor()` to extract (scheme, user, host, port) from a SIP URI - Replace `--server` + `--aor` + `--username` options with positional AOR argument (e.g. sips:[email protected] or sip:[email protected]:5060) - Auto-detect transport from port: 5060 → plain TCP, anything else → TLS (--no-tls still overrides) - Add `--username` option to override user part from AOR - Add `--proxy HOST[:PORT]` option to override outbound proxy address when it differs from the registrar domain in the AOR - Extract SIP_TCP_PORT=5060 / SIP_TLS_PORT=5061 named constants - Update README CLI example and Python API example - Rewrite tests in test_main.py to cover new positional AOR interface Co-authored-by: codingjoe <[email protected]>
Done in commit Behaviour:
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
pre-commit.ci run |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## transcribe-call #23 +/- ##
===================================================
- Coverage 94.74% 94.62% -0.13%
===================================================
Files 16 16
Lines 1276 1303 +27
===================================================
+ Hits 1209 1233 +24
- Misses 67 70 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR implements RFC 3261 §8.1.2 by distinguishing the outbound proxy from the registrar in the SIP protocol layer, and reworks the CLI to accept the AOR (Address of Record) as a positional argument from which connection parameters are derived automatically.
Changes:
- Renamed
server_address→outbound_proxy(now optional, defaults toNone) inSessionInitiationProtocol, with updated docstrings explaining the RFC 3261 outbound proxy / registrar distinction. - Reworked the
transcribeCLI command to take the AOR as a positional argument, with_parse_aor()helper for URI parsing and scheme-based transport auto-detection (sip:→ TCP/5060,sips:→ TLS/5061). - Updated all tests and README documentation to reflect the new API surface.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
voip/sip/protocol.py |
Renamed server_address → outbound_proxy (optional), added RFC 3261 topology docstring, improved register() logging to distinguish proxy from registrar. |
voip/__main__.py |
AOR positional argument, _parse_aor() helper, _parse_hostport() rename, scheme-based transport auto-detection, named port constants. |
tests/test_main.py |
Comprehensive new tests for _parse_aor, _parse_hostport, and all CLI transport/proxy/AOR behaviors. |
tests/sip/test_protocol.py |
Mechanical rename of server_address= → outbound_proxy= across all test instantiations. |
README.md |
Updated CLI example and Python API example to use the new interface. |
You can also share your feedback on Copilot code review. Take the survey.
| """ | ||
| scheme, _, rest = value.partition(":") | ||
| if not scheme or not rest: | ||
| raise click.BadParameter(f"Invalid SIP URI: {value!r}. Expected sip[s]:user@host[:port].") |
| host, _, port_str = hostport.partition(":") | ||
| if not host: | ||
| raise click.BadParameter(f"Invalid SIP URI: {value!r}. Missing host.") | ||
| port: int | None = int(port_str) if port_str else None |
| if proxy is not None: | ||
| proxy_addr = _parse_hostport(ctx, None, proxy) | ||
| else: | ||
| # Default port: SIP_TCP_PORT for sip scheme, SIP_TLS_PORT for sips. | ||
| default_port = SIP_TCP_PORT if scheme == "sip" else SIP_TLS_PORT |
RFC 3261 §8.1.2 separates the outbound proxy (the server a UA physically connects to) from the registrar (§10, whose URI is derived from the AOR domain). These can differ — e.g.
proxy.carrier.comas the TLS endpoint whilecarrier.comis the registrar domain.Changes
Protocol (
voip/sip/protocol.py)SessionInitiationProtocol: renamedserver_address→outbound_proxy(tuple[str, int] | None, defaultNone); optional because the UA may connect directly to the registrar with no explicit proxy configuredregister(): docstring and debug logging now explicitly distinguish proxy from registrar ("Sending REGISTER via outbound proxy … to registrar …")CLI (
voip/__main__.py)The
transcribecommand now takes the AOR as a positional argument. All connection parameters are derived from it by default; individual pieces can be overridden:_parse_aor(): new helper that extracts(scheme, user, host, port)from a SIP URI--no-tlsstill overrides explicitly.sip:scheme defaults to port 5060 (plain TCP);sips:defaults to port 5061 (TLS).--username: optional override for the user part from the AOR--proxy HOST[:PORT]: optional override for the outbound proxy address when it differs from the registrar domain in the AORSIP_TCP_PORT = 5060/SIP_TLS_PORT = 5061: named constants replacing magic numbers📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.