Skip to content

feat: register and unregister as commands - #106

Merged
davidborzek merged 1 commit into
mainfrom
feat/register-unregister
Aug 24, 2026
Merged

feat: register and unregister as commands#106
davidborzek merged 1 commit into
mainfrom
feat/register-unregister

Conversation

@davidborzek

Copy link
Copy Markdown
Owner

:register / :unregister, and the same over ringo control. No key bindings —
signing off is not something to hit by accident.

Two fixes fall out of it:

  • AppEvent::Unregistered set RegStatus::Failed, so a deliberate sign-off
    showed a red ✗. There is a RegStatus::Unregistered now (○ Unregistered).
  • The status did not survive anyway: a de-registration is acknowledged with a
    plain 200 OK and baresip reports any 2xx to a REGISTER as REGISTER_OK, so
    signing off arrived as "registered" right after UNREGISTERING. libre clears
    its flag before the handler runs, so ua_isregistered tells the two apart.

A test now holds dispatch and COMMANDS together so a new command cannot ship
without completion.

`:register` / `:unregister`, and the same two over `ringo control`. No key
bindings: signing off is not something to hit by accident, and the hint
bar has just been trimmed to what belongs in a call.

Unregistering signs the account off, so the provider has nowhere to
deliver calls to and usually takes them itself — voicemail, or whatever
the account is set up to do.

Signing off no longer looks like a failure. `AppEvent::Unregistered` set
`RegStatus::Failed("Unregistered")`, which was defensible while it only
ever happened by accident; with a command for it, the header would show a
red ✗ for exactly what the user asked for. There is a `RegStatus::
Unregistered` now, shown as `○ Unregistered` in the attention colour —
nothing went wrong, but calls will not arrive and that has to stay
visible.

It also has to survive, which it did not: a de-registration is
acknowledged with a plain 200 OK, and baresip reports any 2xx to a
REGISTER as BEVENT_REGISTER_OK. So signing off arrived as "registered"
immediately after UNREGISTERING said otherwise — the account really was
off, the header claimed otherwise. libre clears its registered flag before
running the handler (`reg->registered = reg->wait > 0` with expires 0), so
asking `ua_isregistered` at that point tells the two 200s apart.

The status is deliberately not set optimistically on unregister: baresip's
event decides, which keeps one source of truth for what the registration
is doing.

Completion covers both, and a test now holds `dispatch` and `COMMANDS`
together — two lists that must agree, where the entries added last are
the ones forgotten in the second.
@davidborzek
davidborzek merged commit 982ad48 into main Aug 24, 2026
13 checks passed
@davidborzek
davidborzek deleted the feat/register-unregister branch August 24, 2026 21:18
@github-actions github-actions Bot mentioned this pull request Aug 24, 2026
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.

1 participant