feat: register and unregister as commands - #106
Merged
Conversation
`: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.
Open
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.
:register/:unregister, and the same overringo control. No key bindings —signing off is not something to hit by accident.
Two fixes fall out of it:
AppEvent::UnregisteredsetRegStatus::Failed, so a deliberate sign-offshowed a red ✗. There is a
RegStatus::Unregisterednow (○ Unregistered).plain 200 OK and baresip reports any 2xx to a REGISTER as
REGISTER_OK, sosigning off arrived as "registered" right after
UNREGISTERING. libre clearsits flag before the handler runs, so
ua_isregisteredtells the two apart.A test now holds
dispatchandCOMMANDStogether so a new command cannot shipwithout completion.