Repository navigation
Conversation
call.leg_add accepts an optional offer instead of a target. The session creates the leg's media peer from the offer (ICE + DTLS selects the same rustrtc WebRTC transport WebRTC SIP callers use), answers it, and the command completes with data.answer. The leg is connected at once and joins media only through call.bridge, so a controller can attach a browser or WebRTC agent to any call without a SIP registration. The answer prefers the caller's negotiated codec when offered, so the bridge passes audio through, and otherwise follows the codec policy.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
call.leg_adddials a SIP target today, so a browser or WebRTC agent can join a call only by registering as a SIP user. This adds an optionaloffertocall.leg_add: the session builds the leg's media peer from the offer through the existing rustrtc WebRTC path (ICE + DTLS, as for WebRTC SIP callers), answers it, and the command completes with the answer.{"action":"call.leg_add","action_id":"join-1","params":{"call_id":"session-1","leg_id":"0192f0c4a8e47b3c9d2e5f6a7b8c9d0e","offer":"v=0\r\n..."}} {"type":"command_completed","action_id":"join-1","action":"call.leg_add","call_id":"session-1","status":"success","data":{"leg_id":"0192f0c4a8e47b3c9d2e5f6a7b8c9d0e","answer":"v=0\r\n..."}}targetandofferare exclusive; a request with both fails.call_answeredwith nocall_ringing.external_ip,webrtc_port_start/webrtc_port_endandice_serverssettings.call.bridge,call.leg_removeand call teardown work as for dialed legs, and leg events are unchanged.Changes:
RwiCommandPayload::LegAddgainsoffer: Option<String>, andCommandResult::LegAddedgainsanswer.CallCommand::LegAddOffercarries a oneshot reply, andSipSessionHandle::add_offer_legwaits for it.SipSession::handle_add_offer_legreusesbuild_leg_config,create_leg,prepare_answerandcommit_local_answer. It rejects a duplicate live leg ID and stops the peer on any failure.docs/rwi.mdanddocs/rwi_zh.mddocument the request, the response and the leg ID rule below.call.bridgepre-validation incommand_dispatch.rsaccepts onlycaller,callee,consult*or IDs of at least 32 hex characters. This already applies to dialed legs named like theattempt-bexample indocs/rwi.md. The docs ask for such an ID rather than changing validation in this PR. Accepting any live leg there is a separate fix.Tests:
rwi_leg_add_offer_answers_webrtc_and_bridges_to_callerchecks the exclusivity error and the queued command. It checks the WebRTC answer for ICE credentials, a fingerprint,UDP/TLS/RTP/SAVPFand PCMU first for a PCMU caller. It then checks the connected state, the leg-scopedcall_answered, duplicate refusal, the bridge and removal.cargo test --lib -- rwi leg_add: 141 passed onmainatb4f6b192with this commit.7224fcc9, the fullcargo test --librun passed 2444 tests.console::handlers::mfa::tests::mfa_disable_requires_matching_passwordfailed becauseconfig/trunks/trunks.generated.tomlwas missing. That failure is environmental and unrelated.scripts/check_test_sleeps.shandregression/scripts/check_assertion_quality.pypass.cargo clippy --libreports nothing on the changed lines.dtmfevents.Merge likelihood
Medium-high, about 65–75 percent, if it is rebased onto
mainthe day it is opened and stays one focused commit.The evidence comes from GitHub PR history, read on 2026-11-18:
docs/rwi.mdlists SDP renegotiation as TODO, and 网页端(WebRTC)视频呼叫多款 SIP 软电话,视频协商失败 #303, an open WebRTC issue, shows demand.feat(rwi): ..., updatedocs/rwi.mdanddocs/rwi_zh.mdtogether and add no demo code. RWI has no separate schema file; the protocol lives insrc/rwi/session.rs,processor.rsandhandler.rs.src/rwichanges almost daily, with 114 commits by one maintainer since August, and feat(routing): structured HTTP route targets with explicit trunk routing #294 was closed and rewritten after its branch went stale. A two-day-old rebase may already conflict inprocessor.rs.