A received message went to a bus signal and nowhere else but DUMP_SIP's opt-in raw dump of the last MESSAGE outside a call's dialog, so with no app listening it was gone. It is now written to <state dir>/sms/<id>.msg — mode 0600 in a 0700 directory, whole to a .tmp, linked to its name and the directory fsynced; the engine's FormatStoredSms/ParseStoredSms record codec, pinned by tests/Engine — before the signal, and stays until Delete. List hands over the records it can read, by arrival second, then within a run by sequence number. The record is named by the message's id and published with link(2), which refuses a name the store already holds, so the next number is tried and nothing is replaced. link(2) refuses only a name the store still holds: a client that deleted the daemon's copy after importing it freed the name, and the run's token in the id is what keeps a later run from giving it to another text, unless that run draws the same token and meets the same second and number. The two methods sit behind the Messaging polkit action with Send, and the policy text says so; GetStatus, the open read, does not count the store, since the count would tell any local account when a text arrived, and the unit makes the state directory 0700 (StateDirectoryMode) for the same reason. For a message the store cannot write the delivery report stays an RP-ACK: the signal is its only delivery, and the journal says so. The protocol's refusal — RP-ERROR "memory capacity exceeded", TS 24.011 cause 22 — is half of a mechanism: the other half, the UE's memory-available notification (RP-SMMA, TS 24.341 5.3.2.5), imsd does not send; a refused last segment would also lose its set. The refusal was built and benched on KPN — the store made unwritable, the text refused; it came again five minutes later, the store writable by then, and a later text came at once — and taken out again; no other core is measured. It returns with the notification and a probe of the store. The record's directory is fsynced after the link, its result unchecked like the directory open's; a concatenated text's earlier segments are held in memory, not in the store, until the set is whole (§7.9). Tested on the dev phone (KPN): a text from the phone to its own number on 2026-10-18 23:30, under this publish (a build of this range ahead of this history, 735dfda, whose StoreReceivedSms has this commit's code), stored as ims-sms-in-1792359045-1, an id of that build's shape; the store directory listed on 2026-10-19 holds that record and no temporary (the fp6 journal's 2026-10-17-sms-over-ip-bench capture: r20-tip-smoke-2026-10-18-2329, r22-store-backup-and-delete-proof). The Exists path has no bench: a run's own ids never repeat. The refusal's bench (store-refused-2026-10-18-0136): the store directory made immutable at 01:37, a text to the phone's own number not stored (EPERM on its .tmp), the RP-ERROR answered 202, the text delivered again at 01:42:56 under its first SC time stamp, stored and acknowledged, a later text not held. Not on the phone: List's skip of a file that is no record and four of Delete's answers ran on the workstation, in dev mode on a private session bus, on this commit's host build (2026-11-19; its sha256 begins 8fdd9192866645d5): the skip, with its journal line; InvalidArgs for a string that is no id; IOError, the record still listed, for a record in a store directory made unwritable; the removal once it was writable; FileNotFound for an id with no record. The engine's start sweeps the .tmp names a crash left — one it cannot unlink stays, unreported — so a deleted text's second name goes at the next engine start that can remove it (Delete leaves .tmp names alone). A Delete whose removal fails answers IOError with the system's reason, and a record that is there is kept; FileNotFound is left for a removal that found no file. List's order breaks a tie between two texts of one run in one second by the sequence number (pinned), not by the id as text.
48 lines
2.2 KiB
Desktop File
48 lines
2.2 KiB
Desktop File
# SPDX-License-Identifier: GPL-3.0-only
|
|
# SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
|
|
[Unit]
|
|
Description=Userspace IMS/VoLTE daemon (SIP register + calls over the ims PDN)
|
|
# needs the ims PDN (multiplexed netdev + global v6) — ims-pdn-up.sh
|
|
# creates/connects the bearer through ModemManager and configures the netdev
|
|
After=ModemManager.service network.target
|
|
Wants=ModemManager.service
|
|
|
|
[Service]
|
|
Type=simple
|
|
# bring up the ims PDN first; waits for modem + network registration,
|
|
# idempotent. worst case ~14 min (2 min modem wait + 5 min registration
|
|
# gate + connect retries), hence TimeoutStartSec
|
|
ExecStartPre=/usr/libexec/ims-pdn-up.sh
|
|
# a daemon older than 0.3.10 that an upgrade restarted inside its bring-up
|
|
# throttle wait: the wait — on another address only the verdict that its
|
|
# registration is gone — is handed over from its journal now that it has
|
|
# stopped (imsd.post-upgrade recorded the invocation in /run/imsd.handover)
|
|
ExecStartPre=-/usr/libexec/imsd-handover.sh
|
|
TimeoutStartSec=900
|
|
# /run/imsd.env: written by ims-pdn-up.sh (DEV= the connected ims netdev,
|
|
# LOCAL= the PDN address ModemManager assigned to it, PCSCF_DISCOVERED= the
|
|
# P-CSCF list the network put in the PDN's PCO, read from the modem,
|
|
# PCSCF_DISCOVERY= how that list came to be: found, none, failed, skipped;
|
|
# or IMSD_IDLE=<reason> alone when the bring-up found nothing to do).
|
|
# /etc/imsd.env: admin configuration, none required where discovery finds a
|
|
# P-CSCF (AGENTS.md §10, the README); it wins over the runtime-derived values
|
|
# — PCSCF= overrides discovery.
|
|
EnvironmentFile=-/run/imsd.env
|
|
EnvironmentFile=-/etc/imsd.env
|
|
# registration state (imsreg.state) + media stats live here
|
|
StateDirectory=imsd
|
|
# 0700: the store of received texts lives under it, and even the store's mtime would
|
|
# tell any local account when a text arrived
|
|
StateDirectoryMode=0700
|
|
ExecStart=/usr/bin/imsd
|
|
# registration: resume an existing SA when possible (avoids fresh-SA
|
|
# throttles); a failed bring-up exits nonzero and systemd retries, as does
|
|
# a registered imsd whose PDN address left the netdev
|
|
Restart=on-failure
|
|
RestartSec=120
|
|
# SIGTERM: engine keeps the SA + registration state for the next resume
|
|
KillMode=mixed
|
|
TimeoutStopSec=10
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|