imsd: logind's block inhibitor for sleep while a call is in the calls table
Nothing of imsd runs while the phone is suspended: a suspend under a call stops the daemon and the call's media leg for as long as the phone sleeps. On the dev phone (Plasma Mobile, the sleep targets unmasked for the test, a call placed on the bus) logind listed one block inhibitor for sleep under a call, imsd's, and PowerDevil's policy agent none of its own. While the calls table holds a call the main thread holds logind's block inhibitor for sleep (Inhibit with "sleep", "imsd", "a call", "block"): from the call's addition to the table, which is an incoming call's announcement and for a Dial follows the recovery's try on a dead flow and the refresh of the P-Access-Network-Info, to its removal. Under it logind refused a plain "systemctl suspend" on the dev phone (below); a request can tell logind to ignore inhibitors (systemctl suspend -i). The engine starts before the bus connection is there: a lock wanted by then is asked for when the connection comes. On the dev phone (systemd 262.2) logind answered Inhibit for this lock OperationInProgress in a sleep hook before a suspend, in one after it, and to imsd 0.1 to 0.3 s after the resume, and gave it once it had logged the operation's "finished". So a lock that was not given and is still wanted is asked for again when logind sends PrepareForSleep with false. Where logind gives none at all (the session bus of --session has no logind) calls go on without one, and the journal says so once until a call's lock is next given. Tested: the suites (none reaches the change, which is the main thread's). On the workstation the daemon of this commit and 1.2.4's ran with a stand-in logind that prints every Inhibit and every lock's release and refuses every Inhibit, with logind's OperationInProgress error, while a file says a sleep's operation runs (the fp6 journal's 2026-11-25-through-sleep capture, bench/bench-sleep.sh): one lock per call, taken within 1.5 s of the Dial and released within 1.5 s after the call's end, for a call answered and hung up, a call the network refused and two calls in a row; a call placed while the stand-in refused had its lock within 0.5 s of the stand-in's PrepareForSleep(false); with no logind on the bus the call ran as with one; 1.2.4 asked for no lock. On the dev phone (KPN, the daemon of this commit, the sleep targets unmasked for the test; the capture's phone/), under a call to the carrier's voicemail: the lock in systemd-inhibit's list, "systemctl suspend" answered "Operation denied due to active block inhibitor" and no suspend counted, the lock gone after the hang-up; and for a call placed from a sleep hook at a resume, with logind's operation still running: the refusal's line, and the lock when logind had said the sleep was over. Not run: a suspend under a call without the lock; an incoming call that wakes a sleeping phone; a call announced before the bus connection is there; a request at a second row's addition or removal (a Dial refused under a call that has no lock); a second refusal before a lock is given, which prints no line; an answer of logind's without a descriptor; a PrepareForSleep whose argument is not one boolean; the lock wanted where it is held, which asks nothing (a suspend told to ignore inhibitors under it; a Dial refused under a call that has it); a desktop's own request for a suspend under the lock.
This commit is contained in:
parent
83a9eb539d
commit
52d4b4f217
2 changed files with 154 additions and 2 deletions
80
AGENTS.md
80
AGENTS.md
|
|
@ -166,7 +166,11 @@ before any response to its INVITE (1.2.4, §7.6) has its decisions in
|
|||
and when the call ends instead. The shell's part (`MaybeResendInvite`: the dead flow closed
|
||||
without a FIN's exchange, the one connect, the policy's word on whether the
|
||||
old registration may be reconnected over) ran against a stand-in network on
|
||||
the workstation and on the dev phone (§5). SMS over IP (1.2.0, §7.9) keeps in the
|
||||
the workstation and on the dev phone (§5). The sleep inhibitor for a call
|
||||
(1.2.5, §7.6) is all in the shell (`HoldSleepOff` and its callers);
|
||||
what of it ran against a stand-in logind on the workstation and what on
|
||||
the dev phone is in §5. SMS over IP
|
||||
(1.2.0, §7.9) keeps in the
|
||||
shell, among others, the service centre's source (`SMSC=` over EF_SMSP, `LoadSmsParameters`),
|
||||
the three counters (TP-MR, RP-MR, the concatenation reference), their
|
||||
seeding and the TP-MR file, the routing of an inbound MESSAGE
|
||||
|
|
@ -1115,6 +1119,37 @@ Rules:
|
|||
network makes of a number that skips one, as a REGISTER that was sent
|
||||
and never arrived leaves it (the stand-in took one; no phone run tells
|
||||
whether its network saw one).
|
||||
- The call's sleep inhibitor (§7.6) is the main thread's code, and no suite
|
||||
reaches it. On the workstation the daemon ran with a stand-in logind
|
||||
on the bench's bus, which prints every `Inhibit` and every lock's
|
||||
release and refuses every `Inhibit`, with logind's
|
||||
`OperationInProgress` error, while a file says a sleep's
|
||||
operation runs (the fp6 journal's `2026-11-25-through-sleep` capture,
|
||||
`bench/bench-sleep.sh`): one lock per call, taken within 1.5 s of the
|
||||
`Dial` and released within 1.5 s after the call's end, for a call
|
||||
answered and hung up, a call the network refused and two calls in a
|
||||
row; a call placed while the stand-in refused had its lock within
|
||||
0.5 s of the stand-in's `PrepareForSleep(false)`; with no logind on
|
||||
the bus the call ran as with one; 1.2.4 asked for no lock. On the dev
|
||||
phone (KPN, systemd 262.2, Plasma Mobile, the sleep targets unmasked
|
||||
for the test; `phone/` there), under a
|
||||
call to the carrier's voicemail placed on the bus: imsd's lock the
|
||||
only block inhibitor for sleep in `systemd-inhibit --list`, none in
|
||||
the list of PowerDevil's policy agent, `systemctl
|
||||
suspend` answered `Operation denied due to active block inhibitor` and
|
||||
no suspend counted, the lock gone after the hang-up; and for a call
|
||||
placed from a sleep hook at a resume, with logind's operation still
|
||||
running: the refusal's line, and the lock when logind had said the
|
||||
sleep was over. Not run: a suspend under a call without the lock; an
|
||||
incoming call that wakes a sleeping phone; a call announced before
|
||||
the bus connection is there; a request at a second row's addition or
|
||||
removal (a Dial refused under a call that has no lock); a second
|
||||
refusal before a lock is given, which prints no line; an answer of
|
||||
logind's without a descriptor; a `PrepareForSleep` whose argument is
|
||||
not one boolean; the lock wanted where it is held, which asks nothing
|
||||
(a suspend told to ignore inhibitors under it; a Dial refused under
|
||||
a call that has it); a desktop's own
|
||||
request for a suspend under the lock.
|
||||
- `imsd-pcscf` ran on the dev phone (KPN) on 2026-10-11 against the live ims
|
||||
bearer: the `--mux 1 --profile 2 -v` sequence, a plain run, and `OutOfCall`
|
||||
on an unbound mux (the fp6 journal's `2026-10-11-pcscf-pco-probe` capture,
|
||||
|
|
@ -1194,7 +1229,9 @@ the status snapshot live (main thread only). The Messaging interface's
|
|||
`Subscribe` keeps its subscriber set on the main thread as well, and
|
||||
`List` and `Delete` read and unlink the received-message store there while
|
||||
the engine thread writes it — safe through the `.tmp` + `link(2)` publish
|
||||
(§7.9).
|
||||
(§7.9). On the same bus imsd is a client of logind's
|
||||
(`org.freedesktop.login1`): the main thread takes its sleep inhibitor
|
||||
there and listens for its `PrepareForSleep` (§7.6).
|
||||
|
||||
Per answered call imsd forks `imsd-media` (`IMSD_MEDIA`, default next to the
|
||||
`imsd` binary, else `/usr/libexec/imsd-media`) with the addresses, ports and
|
||||
|
|
@ -1832,6 +1869,27 @@ sent, emit this D-Bus state change, arm this deadline). States and reasons are t
|
|||
30 s outside a call, without the ping the flow can have been silent,
|
||||
or dropped without a close, long before the call came. Shown on the
|
||||
workstation for a call the daemon placed (§5); not met on a network.
|
||||
- Sleep: nothing of imsd runs while the phone is suspended, so a
|
||||
suspend under a call stops the daemon and the call's media leg for as
|
||||
long as the phone sleeps; on the dev phone (Plasma Mobile, the sleep
|
||||
targets unmasked for the test, a call placed on the bus) logind
|
||||
listed one block inhibitor for sleep under a call, imsd's, and
|
||||
PowerDevil's policy agent none of its own (§5). While the
|
||||
calls table holds a call imsd holds logind's block inhibitor for
|
||||
sleep (`Inhibit` with `sleep`, `imsd`, `a call`, `block`;
|
||||
`systemd-inhibit --list` shows it): from the call's addition to the
|
||||
table, which is an incoming call's announcement and for a `Dial`
|
||||
follows the recovery's try on a dead flow (§7.4) and the refresh of
|
||||
the `P-Access-Network-Info`, to its removal. Under it logind refused
|
||||
a plain `systemctl suspend` on the dev phone (§5); a request can tell
|
||||
logind to ignore inhibitors (`systemctl suspend -i`). Where it was
|
||||
asked for during a suspend's operation logind refused this lock
|
||||
(§13): a lock that was not given and is still wanted is asked for
|
||||
again when logind
|
||||
sends `PrepareForSleep` with false, and one
|
||||
wanted before the bus connection was there when the connection
|
||||
comes. Where logind gives none at all (`--session`: the session bus
|
||||
has no logind) calls go on without one.
|
||||
- Emergency: a number `IsEmergency` classifies (112, 911, plus
|
||||
`EMERGENCY_NUMBERS`; SIM `EF_ECC` is not read yet) is tried as
|
||||
`urn:service:sos` first, with one fallback to a plain INVITE of the digits;
|
||||
|
|
@ -2030,6 +2088,12 @@ Lines the operator (and the scripts) look for, all prefixed `imsd: `:
|
|||
- `call X: the client flow died before any response to the INVITE; reopening it` and, when the connect
|
||||
succeeded, `call X: the INVITE again over the reopened flow` (§7.6); `call X ended: error — the client flow
|
||||
died before any response to the INVITE` where the call ends instead.
|
||||
- `sleep is held off while the call lasts (logind's inhibitor)` when the
|
||||
calls table's first call has its lock and `sleep is no longer held off
|
||||
(no call)` when that lock is released, the table's last call gone
|
||||
(§7.6): where no lock was held, no such line; `no sleep inhibitor from
|
||||
logind (…): asked again when it says a sleep is over` where logind gave
|
||||
none, once until a call's lock is next given.
|
||||
- `media <codec> pt=N octet=true|false -> [X]:P, telephone-event pt N|none` at a
|
||||
call's media start (`… pt N (theirs M)` when `DTMF_RX_PT` differs from
|
||||
the one we send with); `call X: DTMF '…' -> media leg (telephone-event pt
|
||||
|
|
@ -3094,6 +3158,18 @@ the related code.
|
|||
between). Where a network's P-CSCF closes or forgets a flow it hears
|
||||
nothing on, `CRLF_KEEPALIVE` is that network's setting (§7.2 step 5
|
||||
has what imsd does without it).
|
||||
- **logind refused a block inhibitor for sleep where it was asked for
|
||||
during a suspend's operation**
|
||||
(systemd 262.2, the dev phone, 2026-11-25 and 2026-11-28): `Inhibit`
|
||||
for `sleep` in `block` mode was answered
|
||||
`org.freedesktop.login1.OperationInProgress` (`The operation
|
||||
inhibition has been requested for is already running`) in a sleep hook
|
||||
before the suspend, in one after it, and to imsd 0.1 to 0.3 s after
|
||||
systemd-sleep's `System returned from sleep operation`;
|
||||
logind's `Operation 'suspend' finished` came 0.03 s after that line
|
||||
where the run's sleep hook did nothing after the resume, 0.1 s after
|
||||
it where the hook made three bus calls then, and 2.1 s after it where
|
||||
it also waited two seconds; a lock asked for after it was given.
|
||||
- **pmOS's default nftables** drops inbound on `qmapmux*`; without the
|
||||
protected-port rule every network-initiated request (NOTIFY, MT
|
||||
INVITE) dies after ESP decapsulation and MT calls fall back to CS. The
|
||||
|
|
|
|||
Loading…
Reference in a new issue