diff --git a/AGENTS.md b/AGENTS.md index 1f99bc7..26508cc 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -15,20 +15,17 @@ bug — fix it in the same change. imsd is a userspace IMS/VoLTE client for mainline Linux phones. The modem firmware on such phones brings up the IMS PDN but cannot carry call audio, so -imsd does the whole IMS client itself: SIP registration — by default under -the identity the card's ISIM holds, else the one derived from the IMSI, with -AKA authentication in that ISIM, else in the USIM (§7.2) — over -kernel IPsec (ESP), call signalling for outgoing and +imsd does the whole IMS client itself: SIP registration with USIM AKA +authentication over kernel IPsec (ESP), call signalling for outgoing and incoming calls, and the RTP media plane (AMR-WB, AMR, G.711) wired into PipeWire, and since 1.2.0 short messages over IMS (TS 24.341: the SIP MESSAGE -carrying an RP-DATA, a store, the Messaging interface — +carrying an RP-DATA, a store for what arrives, the Messaging interface — §7.9). A stock mobile dialer — Plasma Dialer, or GNOME Calls under Phosh and GNOME Mobile — places and receives real VoLTE calls on a commercial network through it. It talks to the modem through ModemManager (`mmcli`) and `qmicli` over QRTR -(the AKA run and the read of an ISIM's identity files go through UIM logical -channels) and, for the P-CSCF list +(the USIM AKA run goes through a UIM logical channel) and, for the P-CSCF list the network put in the ims PDN's PCO, through its own QMI WDS client (`imsd-pcscf`, a raw QRTR socket bound to the bearer's mux data port — §13), installs its security @@ -43,14 +40,14 @@ PipeWire. The verified device/carrier combinations are in the README. |---|---| | `project.cpp` | The canonical build description, for [Crafter Build](https://forgejo.catcrafts.net/Catcrafts/Crafter.Build). Chooses the product by `--product=`. | | `interfaces/Imsd.cppm` | The primary module interface of `imsd-core`: `export import`s the nine partitions below. | -| `interfaces/Imsd-Util.cppm` | `imsd::util` — SIP tokens, IPv6 host/port formatting, the RFC 5952 §4 IPv6 text (`CanonicalIp6`/`CanonicalAddr`; an IPv4-mapped address spelled in hex stays hex, where §5 and `inet_ntop` write it dotted) and the comma-separated address-list parser (`ParseAddressList`), the count of seconds a setting names (`WholeSeconds`), hex/base64, MD5 (RFC 1321), the fixed protected ports `PortUc`/`PortUs` (45061/45062). | -| `interfaces/Imsd-Sip.cppm` | `imsd::sip` — SIP as a text layer plus TCP framing: header extraction (from the header section only: a read ends at the first empty line after the start line, empty lines before it skipped; a header is asked for by its long name and found under that or its compact form — RFC 3261 7.3.3: the RFC's ten, and `o` for Event and `x` for Session-Expires — with or without white space before the colon; `Unfolded`, by which the framers hand a message on with its folded header lines — 7.3.1 — joined; `HeaderUri`: the party a header names; `Body`, moved here out of `CallMachine`), status codes, the granted lifetime, `MinSe` (the interval a `Min-SE` names), `WithoutHeader` (a message less every line on which one header is found, under its long name or its compact form), `ResponseOf` transaction matching (the Call-ID, and the CSeq as its number and its method, whatever spaces or tabs part them and whatever zeros stand before the number), `CutShortRequest`: the header section of a request — any but an ACK or a CANCEL — whose datagram has fewer body bytes than the Content-Length read from it says, which its 400 is built from. Not a full RFC 3261 parser, deliberately. | +| `interfaces/Imsd-Util.cppm` | `imsd::util` — SIP tokens, IPv6 host/port formatting, the RFC 5952 §4 IPv6 text (`CanonicalIp6`/`CanonicalAddr`; an IPv4-mapped address spelled in hex stays hex, where §5 and `inet_ntop` write it dotted) and the comma-separated address-list parser (`ParseAddressList`), hex/base64, MD5 (RFC 1321), the fixed protected ports `PortUc`/`PortUs` (45061/45062). | +| `interfaces/Imsd-Sip.cppm` | `imsd::sip` — SIP as a text layer plus TCP framing: header extraction (from the header section only: a read ends at the first empty line after the start line, empty lines before it skipped; `HeaderUri`: the party a header names; `Body`, moved here out of `CallMachine`), status codes, the granted lifetime, `ResponseOf` transaction matching. Not a full RFC 3261 parser, deliberately. | | `interfaces/Imsd-Sdp.cppm` | `imsd::sdp` — SDP offer/answer: the AMR-WB + AMR + telephone-event offer (optional IR.92 preconditions; `OfferedTelephoneEventPt` names its telephone-event numbers), the parser the media plane needs (the codec, its payload type and mode, and the telephone-event payload type the m-line lists at that codec's clock), `BuildAnswer` for the terminating side, the `CODECS` override. | -| `interfaces/Imsd-Sms.cppm` | `imsd::sms` — the short message codecs SMS over IP rides on (TS 24.341 carries the bytes a 2G/3G phone puts in an RP-DATA, in a SIP MESSAGE body): the GSM 7-bit default alphabet with its extension table and the septet packing, UCS-2 (TS 23.038); the SM-TL PDUs (TS 23.040: SMS-SUBMIT built, one per segment with the concatenation header when the text needs more than one; SMS-DELIVER, SMS-STATUS-REPORT and SMS-SUBMIT-REPORT parsed; the SMS-DELIVER-REPORT that acknowledges a delivery; the user-data header — concatenation, application ports — and the `Reassembler` of a concatenated message); the SM-RL messages (TS 24.011: RP-DATA, RP-ACK, RP-ERROR in both directions, the cause values) and `RpCauseIsTemporary`, the causes of a submission after which imsd sends the segment again; EF_SMSP (TS 31.102 §4.2.27), where the (U)SIM names the service centre, and qmicli's hex dump of it. Byte-level only: no SIP, no clock, no I/O. | -| `interfaces/Imsd-Aka.cppm` | `imsd::aka` — the card's side of a registration: the AKAv1-MD5 digest (RFC 3310), IMPI/IMPU/realm from IMSI + MCC/MNC, parsers for `qmicli --uim-get-card-status` and `mmcli` output, the AUTHENTICATE APDU and its response; since 1.2.3 the ISIM: the application of the slot in use out of the card status (`ParseIsimApp`, in whatever state the modem lists it), the SELECT and the two READ commands its identity files are read with, a card's answer (`ApduAnswer`: `90 00`, `91 XX` and `92 XX` are its normal endings; `HoldsRead` takes a read's data under `62 82` as well) and the command it asks for next (`ApduFollowUp`, for an answer without data: GET RESPONSE for `61 XX`, a command without data again for `6C XX`), the value a file holds (`ParseIsimValue`: the data object with tag `80`, the `FF` bytes at the end of its length cut, no blank and no byte outside printable ASCII) and `IsimIdentity`, the check of the three values — an `@` between two parts, a domain of labels of letters, digits and inner hyphens, 63 characters a label and 253 in all at most, a `sip:` at the start and more after it, the two identities 255 characters at most, no blank, no byte outside printable ASCII and no `"`, `\`, `<` or `>` — before they replace the derived names. | -| `interfaces/Imsd-Ipsec.cppm` | `imsd::ipsec` — the two ESP SA pairs (TS 33.203) as `ip xfrm` argv lists, the ESP ciphers offered (`ParseEalgOffer`, `DefaultEalgOffer`), the Security-Server mechanism selection, and the reader that reconstructs SPIs/ports from `ip xfrm state`/`policy` text for a warm resume, and (1.0.0) `SaPeer`, the P-CSCF the kernel's pair is to, read from the `dir out` policies that carry imsd's fingerprint, `OwnXfrmDeleteCommands`, the deletes by exact key of what two rules select — the policies carrying imsd's fingerprint and the reqid-1/2 transport-mode ESP states in their direction or on the UE's ims-PDN address, whoever installed them (§12), and `FileNamesAnotherPair`, whether a state file's `spi_uc`/`spi_us` name the kernel's pair (unknown on either side decides nothing); `SaPaths` and `OnSaPath`, whether a packet runs on one of the two paths the outbound policies of an SA pair select. | -| `interfaces/Imsd-Messages.cppm` | `imsd::msg` — every SIP request and response imsd sends, built from an explicit `Context` (an empty one for `BuildBadRequest`'s 400) and per-request variables so the builders are pure functions (the shell takes one line, `P-Access-Network-Info`, out of an answer its server ports send on neither path of the SA pair on record: §12); `tests/Messages` is their suite. Also `IsEmergency`. Since 1.2.0 the SIP MESSAGE of SMS over IP (`BuildMessageSms`: an RP-DATA to the service centre's PSI, or an RP-ACK/RP-ERROR to the IP-SM-GW with In-Reply-To — TS 24.341 5.3.1.2 and 5.3.2.4), the `+g.3gpp.smsip` Contact tag behind `Context::smsOverIp`, `BuildResponse`, the final for an inbound MESSAGE outside a call's dialog (the 200, the 480, the 488): each Via row echoed in order and the To echoed with a tag added unless it already holds `tag=` (RFC 3261 8.2.6.2); since 1.2.1 `BuildBadRequest`, the 400 to a request cut short of the Content-Length read from it — any but an ACK or a CANCEL, in a call's dialog or not —, in that shape, a To tag it adds made from the request's header section and a secret of the run (RFC 3261 8.2.7); of requests that came whole, in-dialog requests, a MESSAGE among them, and the shell's answers to any other request outside a call — a NOTIFY, an OPTIONS, a method it does not handle; not an INVITE, whose 486 while a call exists is `BuildInviteResponse`'s — keep `BuildResponse200`'s hop-by-hop shape; and `ScPsi`, the service centre's PSI from its international number — never a dialled-number guess. | -| `interfaces/Imsd-Engine.cppm` | `imsd::engine` — the decisions as pure reducers: `CallMachine` (one call's dialog, returning `Action`s for the shell), `RegRecovery` (the registration recovery policy, §7.4) and, since 1.2.0, SMS over IP (§7.9): `SmsOutbound` (one short message of ours on its way to the service centre, segment by segment, since 1.2.1 a segment that gets no answer, or an RP-ERROR with cause 41, sent once more with TP-RD set — TS 23.040 9.2.3.6 —, returning `SmsAction`s) and `OnSmsMessage` (what an inbound MESSAGE outside a call's dialog leads to: its final, the message or status report it delivered, the delivery report to send), and `RecentTransactions` (an inbound request's retransmission — the same Call-ID, CSeq and Via branch within 32 s (`TimerJ`), the branch being the value of the first `branch=` of its first Via row and a request with none or an empty one never matched — answered with the same final and not handled again) and, since 1.2.1, `RecentSubmissions` (the Call-IDs of the MESSAGEs our submissions went out in, an hour each, by which a submit report for one that is no longer in flight is known for ours — TS 24.341 5.3.1.2); `SameRecipient` and `StatusReportBook`, a status report's match to the message that asked for one — TP-MR and recipient — and its word for the whole message, with `SmsWordOrder`, the order of a message's words: the submission's first, a report's held until then (§7.9); `RunToken`, `SentSmsId` and `ReceivedSmsId`, the ids (§8.4); `StoredSms` with `FormatStoredSms`/`ParseStoredSms`, the record codec of the received-message store, and `StoredSmsBefore`, `List`'s order. Since 1.2.5 also `WakeAt`: when the phone has to be awake for imsd (§7.10). | +| `interfaces/Imsd-Sms.cppm` | `imsd::sms` — the short message codecs SMS over IP rides on (TS 24.341 carries the bytes a 2G/3G phone puts in an RP-DATA, in a SIP MESSAGE body): the GSM 7-bit default alphabet with its extension table and the septet packing, UCS-2 (TS 23.038); the SM-TL PDUs (TS 23.040: SMS-SUBMIT built, one per segment with the concatenation header when the text needs more than one; SMS-DELIVER, SMS-STATUS-REPORT and SMS-SUBMIT-REPORT parsed; the SMS-DELIVER-REPORT that acknowledges a delivery; the user-data header — concatenation, application ports — and the `Reassembler` of a concatenated message); the SM-RL messages (TS 24.011: RP-DATA, RP-ACK, RP-ERROR in both directions, the cause values); EF_SMSP (TS 31.102 §4.2.27), where the (U)SIM names the service centre, and qmicli's hex dump of it. Byte-level only: no SIP, no clock, no I/O. | +| `interfaces/Imsd-Aka.cppm` | `imsd::aka` — USIM AKA glue: the AKAv1-MD5 digest (RFC 3310), IMPI/IMPU/realm from IMSI + MCC/MNC, parsers for `qmicli --uim-get-card-status` and `mmcli` output, the AUTHENTICATE APDU and its response. | +| `interfaces/Imsd-Ipsec.cppm` | `imsd::ipsec` — the two ESP SA pairs (TS 33.203) as `ip xfrm` argv lists, the Security-Server mechanism selection, and the reader that reconstructs SPIs/ports from `ip xfrm state`/`policy` text for a warm resume, and (1.0.0) `SaPeer`, the P-CSCF the kernel's pair is to, read from the `dir out` policies that carry imsd's fingerprint, `OwnXfrmDeleteCommands`, the deletes by exact key of what two rules select — the policies carrying imsd's fingerprint and the reqid-1/2 transport-mode ESP states in their direction or on the UE's ims-PDN address, whoever installed them (§12), and `FileNamesAnotherPair`, whether a state file's `spi_uc`/`spi_us` name the kernel's pair (unknown on either side decides nothing). | +| `interfaces/Imsd-Messages.cppm` | `imsd::msg` — every SIP request and response imsd sends, built from an explicit `Context` and per-request variables so the builders are pure functions; `tests/Messages` is their suite, which calls every builder but `BuildInviteResponse` (`tests/Engine` checks the responses `CallMachine` builds with it). Also `IsEmergency`. Since 1.2.0 the SIP MESSAGE of SMS over IP (`BuildMessageSms`: an RP-DATA to the service centre's PSI, or an RP-ACK/RP-ERROR to the IP-SM-GW with In-Reply-To — TS 24.341 5.3.1.2 and 5.3.2.4), the `+g.3gpp.smsip` Contact tag behind `Context::smsOverIp`, `BuildResponse`, the final for an inbound MESSAGE outside a call's dialog (the 200, the 480, the 488): each `Via:` line echoed in order (the text layer reads long header names only, not RFC 3261 7.3.3's compact forms) and the To echoed with a tag added unless it already holds `tag=` (RFC 3261 8.2.6.2); in-dialog requests, a MESSAGE among them, and the shell's answers to any other request outside a call — a NOTIFY, an OPTIONS, a method it does not handle; not an INVITE, whose 486 while a call exists is `BuildInviteResponse`'s — keep `BuildResponse200`'s hop-by-hop shape; and `ScPsi`, the service centre's PSI from its international number — never a dialled-number guess. | +| `interfaces/Imsd-Engine.cppm` | `imsd::engine` — the decisions as pure reducers: `CallMachine` (one call's dialog, returning `Action`s for the shell), `RegRecovery` (the registration recovery policy, §7.4) and, since 1.2.0, SMS over IP (§7.9): `SmsOutbound` (one short message of ours on its way to the service centre, segment by segment, returning `SmsAction`s) and `OnSmsMessage` (what an inbound MESSAGE outside a call's dialog leads to: its final, the message or status report it delivered, the delivery report to send), and `RecentTransactions` (an inbound request's retransmission — the same Call-ID, CSeq and Via branch within 32 s (`TimerJ`), the branch being the value of the first `branch=` of its first `Via:` line and a request with none or an empty one never matched — answered with the same final and not handled again); `SameRecipient` and `StatusReportBook`, a status report's match to the message that asked for one — TP-MR and recipient — and its word for the whole message, with `SmsWordOrder`, the order of a message's words: the submission's first, a report's held until then (§7.9); `RunToken`, `SentSmsId` and `ReceivedSmsId`, the ids (§8.4); `StoredSms` with `FormatStoredSms`/`ParseStoredSms`, the record codec of the received-message store, and `StoredSmsBefore`, `List`'s order. | | `interfaces/Imsd-Qmi.cppm` | `imsd::qmi` — the QMI WDS request bytes `imsd-pcscf` sends (Bind Mux Data Port, Set IP Family, Get Packet Service Status, Get Current Settings, Get Profile Settings), the message/TLV parser, the P-CSCF list readers (0x22 flag, 0x23 IPv4, 0x24 FQDN, 0x2E IPv6 — the last one libqmi does not model). | | `interfaces/ImsdBus.cppm` | `imsd::bus` — the polkit gate in front of call control and messaging (`Gated`'s `Action` parameter names the action), shared by imsd and imsd-ofonod. GLib, so outside `imsd-core`. | | `implementations/main.cpp` | The `imsd` daemon shell: GLib main loop, GDBus service, sockets, subprocesses, the registration sequence and the run loop that pumps the core. | @@ -101,9 +98,7 @@ meanwhile and the routing of our reg-event SUBSCRIBE's final read there, the 12 s wait restarted on a provisional); the reregistration's headers and its answer to a challenge (`Reregister`: the stored challenge answer, or the empty digest for a pre-0.3.11 state file, the new SPIs, `PortUcNext`; a 401 thrown -as a refusal carrying its status; and, since 1.2.5, the number it takes, -used and written to the state file once the REGISTER is sent, §7.2 -step 5 and §5); the state-file round trip +as a refusal carrying its status); the state-file round trip (`PersistState`/`LoadState`: the `security_server` key, written empty for a value with a quote, a backslash or a newline — the choice between that list and the entry rebuilt from the SA is `Imsd:Ipsec`'s, with a test); the @@ -121,14 +116,8 @@ the second refusal, the count travelling in the holds (`Reconnectable()` and `Fresh()`, decided once after both catch arms) — and taken out of the kernel, §7.2 step 1), the `OnLink` read that writes the old registration off when its address has left the netdev (`FreshRecover` after a failed move, -`AddressGone`), `PacketServiceUp`'s read of -ModemManager before a silent cycle is counted and, since 1.2.5, before -every reconnect cycle and every fresh registration of the recovery -(`NoService`; a bring-up's registrations and the connect for a call's -resend do not ask), and the shell's word that the network has answered, -which starts a coverage gap's counts over (`OnNetworkAnswered`: an -answered TCP connect of the resume or of a reconnect, a response to a -REGISTER); the no-target reads and +`AddressGone`), and `PacketServiceUp`'s read of +ModemManager before a silent cycle is counted; the no-target reads and reactions (1.0.0): the kernel text behind `SaPeer`, the holds' `old_gone` and the script's `PCSCF_DISCOVERY=` — whether a pair is resumable (`SaPeer` finds one and the holds' `old_gone` does not write it off: `!peer || @@ -150,49 +139,7 @@ both sides (1.0.0) is unbenched: no capture stages a holds file whose `pdn` is spelled unlike `LOCAL`). For the schedule, a reducer next to `RegRecovery`, with a Subscription-State parser in `Imsd:Sip` pinned by `tests/Sip`, is the follow-up that moves it; a pure format/parse pair in -`Imsd:Engine` is the holds file's. The card's side (1.2.3, §7.2 step 2) -keeps in the shell the choice of the identity (`BringUp`: `ISIM=0`, no ISIM -application in the USIM's slot, an ISIM that gave none, and `FreshRecover`'s -asking of such an ISIM again), the read itself -(`ReadIsimIdentity`: the three files and their order, record 1 of EF_IMPU, -a SELECT's `61 XX` taken for the file selected, what its `why` says), the -channel (`UimChannel`: the open, the exchanges, the two follow-ups at most, -the close), the application the challenge goes to with its -fall-back to the USIM and the journal's words for an answer that is no -result (`Authenticate`, `AkaIn`), and which identity a -registration carries: the card's at a fresh registration, the one it was -made under at a resume (`TryResume`: the state file's three names, the -derived ones for a file that has none; `FreshRegister`'s restore after a -failed attempt) — the commands, the -answers' reading, the follow-up, the value of a file and the check of the -identity are `Imsd:Aka`'s, with tests; the shell's part ran against -stand-ins on the workstation (§5). A call whose client flow is found dead -before any response to its INVITE (1.2.4, §7.6) has its decisions in -`CallMachine`, with tests: which INVITE is sent again, with which bytes, -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). 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. The registration through a -sleep (1.2.5, §7.10) is the shell's but for when the phone has to be -awake (`WakeAt`) and the policy's wake after a local wait -(`RegRecovery::WakeTime`), which are `Imsd:Engine`'s, with tests; §7.10 -has what the shell does for it, and §5 what of that ran against -stand-ins on the workstation and what on the dev phone. Where an answer -goes that the server ports send (§12: the connection found by its port -and its peer, an answer that is not sent, the socket a datagram leaves -from) is the shell's (`ServerPorts`); §5 has what of it ran against a -stand-in network on the workstation and what on the dev phone. What such -an answer keeps of `P-Access-Network-Info` (§12) is decided by -`imsd::ipsec::OnSaPath` and done by `imsd::sip::WithoutHeader`, both with -tests; the shell's part is the record of the SA pair (`saPaths_`: when a -pair goes on it and when it is emptied), the two ends it has an answer -judged by (`Leaving`'s callers) and the journal's line for a header taken -out (`Leaving`), and §5 has what of it ran against that network and what -on the dev phone. SMS over IP -(1.2.0, §7.9) keeps in the +`Imsd:Engine` is the holds file's. 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 @@ -204,20 +151,18 @@ status-report book's entries (made at a message's start, and only for one that asked for a report: `StartNextSms`), the routing of a MESSAGE final to the message in flight (`OnSmsResponse` — ahead of the reg-event subscription's handler in the run loop, after it inside `AwaitFinal`), the -judgement of the final's wait and of the report's after the server ports' drain and the read of what -the client flow already holds, the reassembler's +judgement of the final's wait and of the report's after the server ports' drain, the reassembler's 30-minute age-out in the run loop, the retransmission check around `OnSmsMessage`, the delivery reports' finals (`reportCallIds_`), a send failure attributed by Call-ID, and the forwarding of a status report's word to the bus — the transactions themselves are `SmsOutbound` and `OnSmsMessage` (a submit report's routing to the message in flight, by -In-Reply-To, else RP-MR, and past that to a MESSAGE of ours on record, is theirs), and the report's match to the message +In-Reply-To, else RP-MR, is theirs), and the report's match to the message that asked for one `SameRecipient` and `StatusReportBook`, all with tests. The received-message store (§7.9) keeps in the shell, among others, the `link(2)` publish and its retry with the next id, the sweep of `.tmp` files at the engine's start, `Delete`'s id check and its -answers by the removal's outcome, `List`'s skip of a file that is no record, its `IOError` -for a store it could not read, the count the `stored` line loses for one, and the delivery +answers by the removal's outcome, `List`'s skip of a file that is no record and the delivery report a store failure leaves unchanged; the record codec and `List`'s order are the core's, with tests. @@ -297,50 +242,19 @@ releases. This is the flow CI runs (§9.4). `crafter-build test` runs the nine suites. Each suite is a plain `main()` with a `Check(bool, message)` counter: failures print `FAIL: …`, success prints `: all tests passed`, and the exit status is -1 after any failure. `crafter-build test` ending in `9 passed`, on every +the failure count for six suites — non-zero short of a multiple of 256 — and +1 for `Engine`, `Sip` and `Sms`. `crafter-build test` ending in `9 passed`, on every commit of a range (§11), is the project's definition of green. What the suites pin: - `Util` — tokens, IPv6 detection and host/port formatting, the RFC 5952 §4 form (the RFC's §4.1–4.2.3 examples, idempotence on `inet_ntop`-shaped - text, what is refused), the address-list parser, the count of seconds - a setting names (`WholeSeconds`: digits and nothing else; a sign, a - unit, a fraction, a blank, `0x1e`, `1e2`, `nan`, `inf` and a number too - large are refused), hex/base64, MD5. + text, what is refused), the address-list parser, hex/base64, MD5. - `Aka` — the AKAv1-MD5 digest, identity derivation, the `qmicli`/`mmcli` - text parsers, the AUTHENTICATE APDU and its response parser, the class - byte of a command on a logical channel (the channel itself for 0 to 3, - `4X` for 4 to 19 — TS 102 221 10.1.1; AUTHENTICATE on channels 3 and - 4, GET RESPONSE on channel 7); the ISIM application of a slot (a card with a `ready` USIM and - a `detected` ISIM in one slot, in either order — the applications, states - and AIDs the fp6 journal's probe read off a reporter's card, 2026-11-23, - in the lines qmicli prints for an application —; another slot's ISIM not - taken, a twelve-byte AID, a CSIM, a missing state line) and the slot of - a line whose number does not parse, the SELECT and the READ - commands byte for byte on standard and extended channels, a card's answer - and its follow-up (`61 XX`, `6C XX` to a read and to a command with - data, an error, data with `61 XX`; `91 XX` and `92 XX` normal endings, - `90 01` and `93 00` none; a read's data - taken under `62 82`, not under `62 81` or `63 82`), `ParseIsimValue` (the - three length forms, the padding after the object and `FF` at the end of - its length, an unused record, another tag, a length past the data, a - blank, a line break, a NUL, an `FF` before the value's end, a byte above - ASCII) and `IsimIdentity` (names unlike the derived ones, the derived - ones themselves, and what is refused: a private identity without an `@` - between two parts, a domain that is not labels of letters, digits and - inner hyphens or that has a label of 64 characters or 254 characters in - all, a public identity that does not begin `sip:` or - is that alone, a private or a public identity of 256 characters, a - quote, a backslash, an angle bracket, a blank or a line break in one of - the three). -- `Ipsec` — the exact `ip xfrm` argv lists for the SA pairs, the `EALG` - setting, the Security-Server mechanism selection against one offered - cipher and against two (KPN's entry and Odido's, O2's six with the SPIs - on the null entry and on the aes-cbc one, a list whose every entry - carries them), the SA reader (the entry it - rebuilds names the pair's integrity algorithm and cipher, read from the - lines the kernel prints for them), the SA peer + text parsers, the AUTHENTICATE APDU and its response parser. +- `Ipsec` — the exact `ip xfrm` argv lists for the SA pairs, the + Security-Server mechanism selection, the SA reader, the SA peer (`SaPeer`: the one address a reqid-1 and a reqid-2 `dir out` transport policy both name with imsd's protected port as the selector's sport — the fingerprint —, the pair kept beside a VPN's policies; @@ -352,14 +266,7 @@ What the suites pin: untouched, another transport-mode user's pair on other ports and addresses untouched — its reqid-1 ESP state on the UE's address deleted, its AH state left —, a policy-less state on the UE's address deleted, one between - other addresses left), and `OnSaPath` (our client port to the P-CSCF's - server port and our server port to its client port are the pair's - paths; our client port to its client port, our server port to its - server port, another port or another host for the P-CSCF, another - address or another port of ours are not, nor is anything while no pair - is on record; an IPv6 address in another spelling, the packet's or the - record's, is the same address; over IPv4 a path of the pair, and not - another host on its port). + other addresses left). - `Qmi` — the request bytes `imsd-pcscf` sends (four of the five the probe's, byte for byte; Get Profile Settings is the helper's own, answered by the modem on the dev phone in the probe capture's `--profile 2 -v` run and on the dev phone's bring-up @@ -373,78 +280,16 @@ What the suites pin: TLVs) and the error names (OutOfCall, NoEffect, an unknown code as `?`). - `Messages` — the outgoing SIP messages: the initial and the protected REGISTER, the reg-event SUBSCRIBE and the INVITEs byte-for-byte, their - variants (a Security-Client for another offer among them; the two - REGISTERs of an identity an ISIM holds, byte for byte the pinned ones - with the card's names for the derived ones, and `RuriFor` at an - ISIM's home domain; the INVITE, its CANCEL and its two ACKs for a dialog - whose sequence number, session interval and `Min-SE` are not 1, 1800 - and 90), the in-dialog - requests, the ACKs, the CANCEL and - `BuildResponse200` by their lines, `BuildInviteResponse` by the lines of - one 180 and by a 486 without a Record-Route (`tests/Engine` checks the - responses `CallMachine` builds with it); the + variants, the in-dialog requests, the ACKs, the CANCEL and + `BuildResponse200` by their lines, `BuildInviteResponse` not there + (`tests/Engine` checks the responses `CallMachine` builds with it); the SMS over IP shapes (the `+g.3gpp.smsip` tag, the MESSAGE with an RP-DATA, the delivery report - with In-Reply-To, a 488) pinned against TS 24.341's clauses; `BuildResponse`, - `BuildResponse200` and `BuildInviteResponse` on a request whose header - names come in compact form; `BuildBadRequest` by the lines of one 400 - (every Via row echoed; the To tag sixteen hex digits of the MD5 of a - secret and the header section, the expected one from Python's hashlib; - the same request, the same 400; another request, another tag; another - secret, another tag; a To's own tag kept); `P-Access-Network-Info` - where the cell is known — after the RAck of a PRACK and the CSeq of a - BYE, in the 200 of `BuildResponse200` (before the Contact of one with an - answer), in the 488 of `BuildResponse`, in a 180 plain and reliable, a - 486 and a 200 of `BuildInviteResponse` — and in none of these where it - is not (the 488 and the plain 180 are pinned whole in both forms); where - the cell is known, in no 200 to a CANCEL, no 100 Trying, neither ACK and - no CANCEL; in no 400 of `BuildBadRequest`, which is built without the - context; and the 180 to an INVITE whose Allow names CANCEL is the 180 - to any other. + with In-Reply-To, a 488) pinned against TS 24.341's clauses. - `Sip` — the text layer's edge cases (empty header values, line anchoring, keepalive discards, a header read that stops at the first empty line — a body line spelling a header name picks nothing, leading empty lines are - skipped), `WithoutHeader` (a message less every line on which - one header is found: one such line, two, the last before the - empty line, a last line without its line end, the name in - another letter case, a compact form; the body, a message - without the header and a name that is part of a longer one left - as they are), the Content-Length the two framers read (zeros before its - number no part of it; a number past any that fits not read as zero; a - value that begins with no digit read as none), `CutShortRequest` (the - header section, unfolded, of a request with fewer body bytes than the - Content-Length read from it says, its version in upper or in lower case; none for a - body that is all there, for no Content-Length, no end of headers, a - response in either letter case, a status line whose phrase ends like a - version, a first line that ends in another version, in seven other - bytes or in more than the version, bytes that are no SIP, an ACK or a - CANCEL; for a MESSAGE, a header section exactly where - `DatagramMessage` calls the datagram truncated), the twelve compact forms (each through `Header`, in lower and - in upper case, and through `Headers`; no other letter taken for a - header name the suite lists; `l:` through the framer and - `DatagramMessage`), `ViaResponsePort`'s reading of a Via row — `rport` by its name (in - another case, with white space around it, with a value; those letters - in a value, in a longer name or in a quoted string not; a quoted string - ended by its closing quote — not by a quoted pair in it, and by the - quote behind an escaped backslash —), and of a row that holds a list - the top value alone (its port, a later value's `rport` and port not - counted, its own `rport` counted, last before the comma too; a comma - in a quoted string no end of it, the comma behind the closing quote - its end) —, white space before the colon (RFC 3261 7.3.1's four - spellings), `Unfolded` (7.3.1's own example, a tab, a bare LF, a value - begun on the next line, a line break that nothing follows kept) and both - framers on a 401 whose WWW-Authenticate goes over four lines — the - header section unfolded, a folded Content-Length framing the body, the - body as it came —, and `ViaResponsePort` on a Via list folded after its - comma, as the datagram framer hands it on, - `ResponseOf` (the transaction's own 100 Trying; a final whose CSeq parts - its number and its method by two spaces, by a tab or by both, or has - zeros before its number: the - transaction's; another number, another method, a method in other letter - case, a CSeq without one of the two: not), refused finals with reason - headers, `MinSe` (the number a `Min-SE` begins with, zeros before it - aside, whatever parameter follows; none for no such header, for a value - that begins with no digit and for a number of more than nine digits), + skipped), `ResponseOf`, refused finals with reason headers, reginfo documents, `HeaderUri` and `Body`. A change that flips one of those tests is a behaviour change, not a cleanup. - `Sdp` — the offer's exact bytes, the parser (the telephone-event payload @@ -454,8 +299,7 @@ What the suites pin: its extension table and the septet packing (the classic "hellohello" vector), UCS-2 with surrogate pairs (and U+0000 as U+FFFD), the address fields (international, a short code, `*`/`#`, an alphanumeric sender), SMS-SUBMIT (the classic - tutorial PDU, UCS-2, one with TP-RD, the concatenated pair for a - 161-character text and the one for a 71-character text in UCS-2, an + tutorial PDU, UCS-2, the concatenated pair for a 161-character text, an escape pair and a surrogate pair kept whole at a segment boundary, the 160/70-character fits), SMS-DELIVER (the classic "How are you?" PDU; a header with fill bits, a 16-bit concatenation reference, class 0, @@ -466,8 +310,7 @@ What the suites pin: TS 23.040 9.2.3.15 has the MS read it: every reserved value, bit 7 set among them, as "Service Rejected") and SMS-SUBMIT-REPORT, RP-DATA / RP-ACK / RP-ERROR both ways (a type read - against its direction refused), which RP causes of a submission have the - segment sent again (all 128 values), EF_SMSP on the KPN SIM's record (dev + against its direction refused), EF_SMSP on the KPN SIM's record (dev phone, 2026-10-16) straight from qmicli's dump, and the `Reassembler` (segments out of order, a lone message, a set dropped by `Purge`, a surrogate pair and an escape pair split across two segments whole @@ -476,99 +319,30 @@ What the suites pin: (reliable 18x/PRACK, 2xx ACK + media start, far-end hangup, CANCEL/answer races, busy/error finals, the terminating side's 100/180/200/486/487/488, G.711-only and AMR-NB gateway offers, ring timeout, BYE both ways, the - emergency chain, an INVITE refused 422 sent again in the same call (the - Call-ID, the From and the To kept, the number after the refused - INVITE's or after a PRACK's sent since, a branch of its own, the - refusal's `Min-SE` as its `Min-SE` and a session interval no smaller; - an answer with the replaced INVITE's number dropped; the PRACK numbered - after the second INVITE and naming it, the ACKs with its number; the - second INVITE starting without the first's ringing state, PRACKed 18x, - early answer, route and target, and with a resend of its own; the - journal's line with the minimum and the refusal's `Reason`; not sent - again for a `Min-SE` no larger than the one sent, for none that is - read, after three, after a hang-up's CANCEL or after the answer, nor - for a refusal that is no 422; an emergency attempt's INVITE sent again - like any other, and its fallback counting anew), an INVITE with no - response and no CANCEL yet sent again over a flow the shell reopened, - byte for byte and once per INVITE, and its call ended where the flow is - lost (an emergency call's - first attempt too), DTMF — sent to the leg on an active call that negotiated + emergency chain, DTMF — sent to the leg on an active call that negotiated telephone-event, dropped with the reason before the answer, after the call, without the negotiation, for a character that is no tone or for a string past `DtmfMaxTones`; the receive payload type: our offer's on a renumbered answer, the answer's when the audio took ours, the echoed - offer's on an incoming call; an incoming call from an INVITE, and an - outgoing call from responses, whose header names come in compact form; - `P-Access-Network-Info` through a call where the cell is known: in the - 180, the 200s, the 486 and the 487 of a call that comes in, in the PRACK - of a call imsd places and in a BYE either way, in no 100 Trying, no 200 - to a CANCEL, no ACK and no CANCEL) and + offer's on an incoming call) and `RegRecovery` (thresholds, backoffs, the throttle schedule, Retry-After, which waits a Dial may cut short, when the old registration counts as gone, the holds a restart takes over, a binding the - network terminated; the look after a local wait: 5 s after the - refusal is reported, and the time a sleeping phone is to be woken for - it, 10 s to 15 min by value, counted for no packet service from the - modem's first such word since the network's last answer and for the - kernel's refusals (the kind of a refusal that names none) from the - first since the modem was last without service or the network last - answered, where what starts a count over is the shell's word of an - answer, a refused reconnect, a refused or throttled fresh attempt or - a terminated binding, and not a silent cycle or attempt (a success - starts everything over); a step that - follows no local wait, and a - registration written off meanwhile, at the policy's own time) and - `WakeAt` (when the phone has to be awake for imsd: now while a call - or a text is in flight; with a registration on a live flow the - refresh's due time or the subscription's renewal, whichever comes - first; with a dead flow under a registration the recovery's word, - a due step as now; never where nothing waits); - and SMS over IP (TS 24.341): `SmsOutbound` through a + network terminated); and SMS over IP (TS 24.341): `SmsOutbound` through a submission — the MESSAGE with the RP-DATA to the SC's PSI, its 202, the RP-ACK ending it as sent with the SC's time stamp; a refused final; an - RP-ERROR with its cause and TP-FCS; the final's wait and the report's - running out (128 s and 130 s), each followed by the segment's repeat — the same - SMS-SUBMIT with TP-RD set and no other bit changed, under a Call-ID and - an RP-MR of its own — and the repeat accepted, rejected as a duplicate - (sent, with RP cause 41 as with another) or ended in its turn (failed, - both ends in the reason); a - duplicate rejection of a first attempt, a refusal like any other (RP - cause 21: failed), and one of a repeat whose first attempt an RP-ERROR - had refused, before the repeat went out or after (failed, both refusals - in the reason); the first attempt's - RP-ACK after the repeat went out taken by In-Reply-To and by RP-MR, its - RP-ERROR then — cause 41 or 28 — leaving the segment to the repeat's - answer (sent on its RP-ACK; failed on its wait, that RP-ERROR named as - the first attempt's end); an RP-ERROR with cause 41 repeated, and one - with a cause part 1 does not list (0, 2); one with 38, 42 or 47 failing - at once; a first segment's RP-ERROR not weighing - on the second segment's repeat; a 408 and a 504 final repeated, - a 403, a 480, a 500 and a 503 failing at once; a repeat the flow could - not send; a + RP-ERROR with its cause and TP-FCS; the final's wait and the report's running out; a failed send; two segments with consecutive RP-MR/TP-MR, the second sent - on the first's RP-ACK, a repeat under the next RP-MR; a destination that is no number; no service + on the first's RP-ACK; a destination that is no number; no service centre — and `OnSmsMessage`: a delivered message to the bus and its RP-ACK to the IP-SM-GW with In-Reply-To, a concatenated pair handed over once whole and each segment acknowledged, a status report, a submit - report routed to the message in flight (by In-Reply-To, else RP-MR), 200 - and the journal's line for one In-Reply-To a MESSAGE of ours no longer - in flight (ours once ended, an RP-ERROR's cause in the line; ours once - its segment was followed by the next), 488 for a stranger's, 200 for one - without In-Reply-To that no message in flight owns; `RecentSubmissions`: a Call-ID on - record for 3600 s, the first of a list that is ours, each segment's - MESSAGE put on record as it goes out; an unusable TPDU acknowledged with an + report routed to the message in flight (by In-Reply-To, else RP-MR), 488 + for one In-Reply-To no MESSAGE of ours in flight (a stranger's; ours once + ended; ours once its segment was superseded), 200 for one without + In-Reply-To for no message, an unusable TPDU acknowledged with an RP-ERROR, a body that is no RP message, a page-mode text 200'd and logged, a short message while SMS over IP is off refused with 480; - a delivered MESSAGE whose header names come in compact form — the 200 and - the delivery report of its long form, its retransmission key, the 480 - while SMS over IP is off — and a final in compact form taken by the - message in flight; a delivered MESSAGE whose Content-Type came folded, - taken for a short message once the datagram framer has unfolded it; - a class 2 message kept from the bus and refused with an RP-ERROR (cause - 111, TP-FCS 0xFF) — a (U)SIM data download, a text, a segment of a set — - or, naming no gateway, kept from the bus with no report; the other - classes, TP-PID 0x7F without class 2, and a short message type 0 with a - class 2 coding, received; a submit report before the MESSAGE's own final taken — the message sent and the late final nobody's; with two segments the second goes out under its own Call-ID — a text past 255 segments failed at once naming the fit, @@ -611,17 +385,19 @@ Rules: named here. The known gaps: the reg-event subscription schedule (the arming and KPN's `noresource` closure have run on hardware, the 60 s retry only on a - pre-fix build that renewed that closure, and the renewal firing on - the workstation, with the boot clock set ahead, 1.2.5's record below; - the retry on this code, Timer F, the doubling, a SUBSCRIBE - `Retry-After`, the + pre-fix build that renewed that closure; the retry on this code, the + renewal firing, Timer F, the doubling, a SUBSCRIBE `Retry-After`, the renew arm and the back-off's survival across a refresh have run nowhere — - §3, §7.4); a `Dial` bringing a recovery step + §3, §7.4); a `Retry-After` on a REGISTER has run in the field (one + report, a screenshot of 2026-10-08, O2, 0.3.10: a refresh's Retry-After + set the next step's time — `in 7 min`, then `in 13 min` — and the + refusals counted; the wait's length went unmeasured, the journal lines + on the screenshot carry no timestamps; KPN's refusals, all 403, carry + none) and a `Dial` bringing a recovery step forward (imsd-ofonod refuses the `Dial` itself and imsd-dialerd forwards - it) has run on the workstation in a coverage gap, where the step it - brought forward was the look at the modem (1.2.5's record below); one - that brings a reconnect, or a fresh attempt that is due, forward is - pinned in `tests/Engine` only; + it) is pinned in `tests/Engine` only; a 401 to a reregistration (the + refreshes KPN accepted were never challenged — consecutive CSeqs on every + bench — and O2 has not run this shape) and the escalation by one refused refresh that carries a `Retry-After` — the escalation to a fresh registration is pinned in `tests/Engine` only; a resume echoing a multi-mechanism Security-Server list on the wire (the @@ -629,77 +405,34 @@ Rules: list; KPN's has one mechanism, so on the bench the stored value and the rebuilt one are the same bytes; O2's six-entry list has not resumed on this code, and the state-file round trip is shell code no test - reaches); a resume whose rebuilt entry names another algorithm than - `hmac-sha-1-96` or another cipher than `aes-cbc` (pinned in `tests/Ipsec` - on the lines `ip xfrm state` prints; no such pair has been resumed on a - network); a list that marks one of two offered ciphers (pinned in - `tests/Ipsec` with two of O2's recorded lists, each its answer to an - offer of one cipher, and run against a stand-in P-CSCF that marks the - lower-q of the two as far as the `SA:` line; no capture holds O2's - answer to imsd offering two); the default offer's null cipher taken - by a network (KPN named `aes-cbc` to the two-cipher offer at a fresh - registration and answered a reregistration that carried it 200: the dev - phone, 2026-11-22, an earlier build of this change, on 1.2.0; the - selection of a null entry is pinned in `tests/Ipsec` with Odido's answer - of 2026-07-13 to the Python stack's offer of the null cipher and ran - against a stand-in P-CSCF on the workstation as far as the `SA:` line; - no capture holds a registration of imsd's over a null SA pair); an - ISIM's identity and an AKA in an ISIM (1.2.3; the dev phone's card has no - ISIM: the daemon ran its registration on the workstation against a - stand-in for qmicli and a stand-in network that answers a first REGISTER - of any other names than its subscriber's 480 and tells the two - applications' answers to the challenge apart — the fp6 journal's - `2026-11-23-isim-identity` capture, 46 scenarios: a card without an - ISIM, an ISIM that holds names of the operator's own and one that holds - the derived names, `ISIM=0`, another slot's ISIM, an ISIM listed `ready` - or with no state; an ISIM that gives no identity (no channel, no answer - to a SELECT, to a read or to the GET RESPONSE after one, no EF_DOMAIN, - a refused read, an - unused or a `tel:` first record of EF_IMPU, a private identity without - a realm); reads answered `6C XX` or `61 XX` first, one after the other, - or `61 XX` to every GET RESPONSE (two are sent, then the read counts as - failed), reads that end `91 XX` or `62 82`, and a length that counts - the padding in; channels 4 and 5; an ISIM that refuses the AUTHENTICATE - or answers a - synchronisation failure, the USIM asked after it; no application giving - a result (both refusing; a USIM with no channel, with an answer of one - byte, of bytes that are no result, with no answer to the AUTHENTICATE - or to the GET RESPONSE after it); the registration - made again over UDP; a second bring-up in one run at which the ISIM - gives none; resumes — of a registration of a card without an ISIM, of - one made under the ISIM's names, with and without `ISIM=0` at the - restart, of one 1.2.2 made under the derived names on a card whose ISIM - holds others (kept under the derived names; refused by a network that - knows the card's names only, and registered fresh under those), of a - state file whose identity fails the check, with a fresh target and - without (also under a forced `SIP_TRANSPORT` that is not the file's), or - lacks one of the three names — and, in a run that resumed, a - fresh registration the network refuses (the reconnect after it goes out - under the standing registration's names) and fresh registrations before - which an ISIM that gave none at the bring-up is read again: giving its - identity at the first, or none again at the first and its identity at - the second. On real cards: the reads' commands ran on two reporters' - cards in the journal's probe, and a reporter's journal has this daemon - read the US card's ISIM, register under its names on AT&T's network - and refresh that registration, with no `AKA:` line (§13)); a - Security-Server list `PersistState` writes empty (one with + reaches); a Security-Server list `PersistState` writes empty (one with a quote, a backslash or a newline — neither KPN's nor O2's list has one; the resume of such a file ran with a hand-edited empty key, 2026-10-11); a state write of a standing registration after a fresh - attempt that had its 401 and aborted before its SA setup - (`RegState::securityServer`, - not the attempt's `ss_`: since 1.2.5 the write is made when a - re-REGISTER is sent, so on KPN it follows the old SA's first retry - after a throttled attempt, which KPN has answered 403, 2026-10-03, and - 480, 2026-11-25; no daemon that writes at the send has had a throttled - attempt); the window that leaves a state file naming another + attempt that aborted before its SA setup (`RegState::securityServer`, + not the attempt's `ss_` — on KPN the old SA's retry after a throttled + attempt is refused 403, the throttled-attempt chain below, so no such + write follows here); the window that leaves a state file naming another SA pair than the kernel's (a stop or a crash between a fresh attempt's SA setup and its 200's state write — the check is pinned in `tests/Ipsec` and ran on a hand-edited list, 2026-10-11; the window itself is not - staged); the write-off of the old + staged); a + refused initial or fresh + REGISTER (403, 5xx) at bring-up or in recovery (KPN has only throttled or + stayed silent — pinned in `tests/Engine` only); the write-off of the old registration by a recovery's fresh attempt that fails past the SA setup (such attempts are on record only as a bring-up's fatal exit, which does - not pass that arm — pinned in `tests/Engine` only); the address moves + not pass that arm — pinned in `tests/Engine` only); the escalation by + two refused refreshes that carry no `Retry-After` (KPN refuses a refresh + only with the 403 that says the registration is gone — pinned in + `tests/Engine` only); of the throttled-attempt chain in recovery (a + throttled fresh attempt, the old SA retried once meanwhile with the stored + binding's Contact and refused 403, the deferred attempt accepted at the + hold's end — run 2026-10-03 on the series as it then stood) the deferred + attempt made by the + same process, since a restart inside the hold made it from the holds file + instead (the same process made it on 2026-09-24, on the build before the + policy's rework); the address moves writing `old_gone` to the holds file (the move benches predate that field); a SUBSCRIBE final read inside a REGISTER wait (KPN answers within the second); the shell's handling of a NOTIFY that terminates our own @@ -709,27 +442,19 @@ Rules: error, a bind() refused while the address is still on the link — which no bench reaches without fault injection (§3); a coverage gap on the air (no bench stages a radio gap without an RF shield) — the packet-service - read's rule has run through a fake `mmcli` (2026-10-03: `searching` - and `detached` not counted, `connecting` with `unknown` counted; the - bench of 1.2.5's record below: `searching` with `detached`, - `registered` with `attached`) and against the dev phone's own - ModemManager (2026-10-03: `connected` with `attached`, two silent - cycles counted); the read that follows a refresh unanswered over a - reconnected flow has found no packet service on no run (`refresh - unanswered while the modem reports no packet service`); and - `tests/Engine` - pin what the policy does with the modem's word, nothing - of the read; the REGISTER wait's diverting arms — a response to - another transaction ignored, a provisional + read's rule has run through a fake `mmcli` only (2026-10-03: `searching` + and `detached` not counted, `connecting` with `unknown` counted), its + other states, ModemManager not answering and its second site (a refresh + unanswered over a reconnected flow) not at all, and `tests/Engine` pin + nothing of it; the REGISTER wait's diverting arms — a datagram skipped on + the init port, a response to another transaction ignored, a provisional restarting the wait, a request (an INVITE among them) dispatched and answered under the wait; an incoming call answered from a session's dialer since the polkit gate — imsd-dialerd's `Accept` by the active session, or GNOME Calls' `Answer` through imsd-ofonod's gate (imsd's own `Accept` gate has run: refused for an account without a seat session and for nobody, accepted for root, 2026-10-04); a refused - final carrying a `Warning`, a `Reason` or a `Server` header (KPN's 403s - and 482s carried none, its 480s of 2026-11-25 a `Retry-After` and no - other — the rendering of the three is pinned + final carrying reason headers (KPN's 403s carry none — the rendering is pinned in `tests/Sip` only); an `AUDIO_USER` pin in imsd's own environment that names no account (the logind fallback) or an account without a PipeWire socket (a silent call) — a pin naming an account with one ran, 2026-10-04. @@ -874,21 +599,19 @@ Rules: same-second retransmission was answered again and absorbed, the delivery report answered 202. No capture of the benches on hardware holds a journal line of one of these arms (each arm's line is searched in them in the - fp6 journal's `2026-11-19-imsd-1.2.0-r32-cut` capture, `searches/arms.out`, and for the phone's - visits of 2026-11-20 to 2026-11-22 in its `2026-11-20-issues-2-5` - capture, `phone/arms.out` and `phone-form6/arms.out`): a refused final to a submission's MESSAGE, an RP-ERROR this - code sends (an RP-ERROR that came in was + fp6 journal's `2026-11-19-imsd-1.2.0-r32-cut` capture, `searches/arms.out`): a refused final to a submission's MESSAGE, an RP-ERROR this + code sends (the cause-96 unusable-TPDU path; an RP-ERROR that came in was reached: `smsc-override-2026-10-18-0217`, 02:19:41, RP cause 28 + TP-FCS - 0xc1, through `OnReport`), the final's wait running out (the report's ran out on the dev phone: the repeat's benches, below), a dead flow under a `Send`, a status report (one requested + 0xc1, through `OnReport`), the final's wait and the report's + running out, a dead flow under a `Send`, a status report (one requested at 01:33 with TP-SRR; none came in the following 11 minutes — the unfiltered journal of 01:33:30–01:45:00, `r23-phone-journal-2026-10-17-precise-and-modem-sms`; whether KPN's SC sends them over this path is unknown), 8-bit data (an MMS notification), a message while SMS over IP is off (the 480), a submit - report In-Reply-To no MESSAGE of ours in flight (1.2.0's 488: since then - the 200 for one of ours on record and the 488 for one that names none, - each with a line of its own that no bench on hardware has written) or one without - In-Reply-To that no message in flight owns (the 200), a page-mode MESSAGE, a body that is no RP message, a text + report In-Reply-To no MESSAGE of ours in flight (the 488) or one without + In-Reply-To for no message in flight (the 200), a page-mode MESSAGE, a + body that is no RP message, a delivery that names no gateway, a text past 255 segments, an EF_SMSP record 1 that cannot be read or holds no service centre, or one whose service centre is not an international number, a @@ -924,507 +647,14 @@ Rules: `IOError` for a record in a store directory made unwritable, the record still listed; the removal once it was writable; `FileNotFound` for an id with no record. - A store that cannot be read ran there too (2026-11-20 to 2026-11-22, the fp6 journal's - `2026-11-20-issues-2-5` capture, `list-io`): `List` answered `IOError` - with `Permission denied` for a store directory of mode 000, for one of - mode 400 (its names read, its first record's `stat` refused) and for a - record of mode 000, and with `Not a directory` for a file where the - directory should be; it answered an empty list with no store directory, - and the two records beside a file that is no record, a directory and a - dangling symbolic link named like records; a start with the directory - at mode 000 wrote the sweep's `cannot read` line and the daemon - answered afterwards. On the dev phone (2026-11-22, the - same capture, `phone-form6`, `checks.log`, the binary of 1.2.1) - `List` answered an empty list with the store directory - moved away and `IOError` with `Not a directory` with a file in its - place, with the journal's `cannot read` line for each of the two calls - it refused. Not reached by any bench: a directory or a file - whose read fails part-way, a file removed between the directory's read - and its own, a process out of descriptors, and the `stored` line - without its count, which takes a text received, and dev mode receives - none. Reached from 2026-10-18 02:17 (`smsc-override-2026-10-18-0217`): the `SMSC=` override — `SMSC=+31653131313` gives `service centre +31653131313 (SMSC=)` and a `Send` through it reaches `sent`; `SMSC=abc` gives `SMSC='abc' is not a number` (`ForNumber` dials digits, `*` and `#` only; the bench's first run, on a build outside this history that dialled a, b and c, submitted with them and got an RP-ERROR back, RP cause 28). - `to` and `operator` are in a `List` record from the dev phone (2026-11-20, - the fp6 journal's `2026-11-20-imsd-1.2.0-frozen-on-dev-phone` capture, - `checks.log`: a text sent to the own number over the bus, delivered - back and listed); no capture holds a `Received` with them; the store's - round trip with each is in `tests/Engine`. - A segment's repeat ran on the dev phone against KPN (2026-11-22, the fp6 - journal's `2026-11-20-issues-2-5` capture, `phone-form6`, - `repeat-bench.log`, the binary of 1.2.1): with the - phone deaf on its protected server port a text to the own number got - its 202 and no submit report and went out again 130 s after the final, - under RP-MR 178 after 177, with TP-MR 16 and TP-RD; the repeat got an - RP-ACK under a time stamp of its own (`sent`), and once the port was - open again the text came twice, under the two attempts' time stamps; - the message after it took RP-MR 179. The six benches before it went the - same way (`phone-form6/visit1` to `visit5`, 2026-11-21 and 2026-11-22, - on earlier builds; `phone`, 2026-11-20, on one that waited - 40 s). Run on no hardware: a repeat after the final's wait, - a 408, a 504 or an RP-ERROR; a repeat rejected as a duplicate, and one - ended in its turn; the first attempt's report after its repeat went - out. - `tests/Engine` pins the reducer for each, and the refusal of a class 2 - message: it ran on the dev phone's daemon for MESSAGEs the phone sent - to its own protected server port (`phone-form6`, `inject-bench.log`), among them one with a line per header - and one with its Content-Type on a continuation line and bytes after - its body — each answered 200, refused in the journal, stored nowhere - and, naming no gateway, reported to nobody. The read of the client flow before a wait is - judged: `SipFlow`'s two reads ran on the workstation's loopback, the - daemon's class built around a bench `main` (2026-11-20 to 2026-11-22, - the fp6 journal's `2026-11-20-issues-2-5` capture, `flow-read`: over TCP and - over UDP `RecvReady` returns a message the socket holds without - waiting and none when it holds none, and `RecvMsg` waits its time and - returns a message when one comes; over TCP `RecvReady` leaves a - message that is not whole yet; over UDP it passes a keepalive's CRLFs - over); the run loop around them judged a wait on the dev phone (the - report's, in the repeat's bench above), and has not run with a final - waiting unread at that pass. -- A request cut short of its Content-Length on the client flow ran on the - workstation's loopback (2026-11-22, the fp6 journal's - `2026-11-20-issues-2-5` capture, `cut-short`: `SipFlow` built around a - bench `main`, a peer on ::1 sending datagrams to the flow): a MESSAGE - with five body bytes of nine, its Content-Length on one line, drew a - 400 with its Via, From, Call-ID and CSeq echoed and its To tagged, and - the same 400 when it was sent again; a response, an ACK and a CANCEL - cut short the same way, and a request without an end of headers, were - ignored with their lines and drew nothing; a whole request sent after - them was returned by the flow; at the commit before, the cut-short - request was ignored as they were. Not in that bench: a 400 the flow - cannot send. -- The daemon reads SIP from a socket in four places — the client flow, - the server ports' datagrams, their connections, the init port — and - each goes through a framer of `Imsd:Sip`. The two datagram reads 1.2.1 put behind `DatagramMessage` ran on the workstation's loopback - (2026-11-22, the fp6 journal's `2026-11-20-issues-2-5` capture). The - init port (`init-port`: the daemon in dev mode, its card and modem - reads answered by stand-ins, a stand-in P-CSCF answering the - unprotected REGISTER): a datagram of no bytes and one of line - breaks alone passed over, a 401 cut short of its Content-Length ignored - with its `UDP: datagram truncated … on the init port` line, and the 401 - after each taken; at the commit before, the empty datagram ended the - wait (`no 401 to unprotected REGISTER`) and the cut-short 401 was taken - for the reply. A request sent there, cut short or whole, drew a line - and no answer at either commit. The server ports (`server-ports`: - `ServerPorts` built around a bench `main`): a request with bytes after - its body handed on without them; one whose body is shorter than its - Content-Length answered 400 on either port, its Via, From, Call-ID and - CSeq echoed and its To tagged — the Content-Length of each on one line; a response, an ACK and a CANCEL cut - short so, and a request without an end of headers, ignored with their - lines; a datagram of line breaks alone passed over, and one of no bytes - with the request behind it handed on in the same pass; at the commit - before, those requests were handed on as they came, and the datagram of no - bytes ended the pass, the request behind it handed on in the next. On - the dev phone (2026-11-22, the capture's `phone-form6`, the binary of - 1.2.1) the 401 of a fresh registration after a reboot - came through the init port's read, and the submit report and the - delivery of each of two texts through the server ports' as datagrams (two per - text by a packet counter, none over TCP: `checks.log`); a MESSAGE the - phone sent to its own server port with a Content-Length larger than - its body was answered 400 (`inject-bench.log`). - The unfolding ran in the same benches: the stand-in's 401 with its - WWW-Authenticate over four lines and its Security-Server over three - gave the Security-Server whole (at the commit before, its first line, - and the bring-up deferred: `Security-Server carries no - spi-c/spi-s/port-c/port-s`); a request whose Content-Type and - Content-Length stood on continuation lines came out of the server - ports unfolded and framed by that length, as a datagram and over a - connection (at the commit before, the datagram kept the bytes after - its body); a request cut short of a folded Content-Length, its Via on a continuation - line, was answered 400 with its Via whole, on a server port and, in - `cut-short`, on the client flow (at the commit before, its folded - length was not read and it was handed on as it came); a request on a - server port whose Via row held a list folded after its comma, `rport` - on its lower value, was answered by the way to the port its top value - names, as at the commit before. On the - phone the 401 of the fresh registration came from KPN, whose 401 of - 2026-07-18 had its WWW-Authenticate over four lines (§13; the fresh one was not - dumped). -- A call whose client flow is found dead before any response to its - INVITE (§7.6, 1.2.4). - The machine's side is pinned in `tests/Engine`; the shell's - (`MaybeResendInvite`) ran on the workstation against a stand-in network - (2026-11-24, the fp6 journal's `2026-11-24-crlf-keepalive` capture, - `bench/bench-dial.sh`: the daemon in dev mode, its card and modem reads - answered by stand-ins, a Dial put on its bus 25 s after the - registration, a network that answers a delivered INVITE 486 and can - drop a flow in several ways). On a flow the network had forgotten, - which it reset at the INVITE's bytes, the flow was reopened and the - INVITE delivered in the same second, the call ending `refused-or-busy` - as on a live flow; 1.2.3's call there ended `error` 100 s after the - Dial. The same outcome where the network closed the flow at the INVITE - and no acknowledgement of the daemon's own close reached it (what the - close without a FIN's exchange is for). Where the flow died on the - daemon's side at the kernel's retransmission limit, the first INVITE - never delivered, the second went out about 2 s after the death was - found and the call ended the same way. Where the network took no new - connection (it refused the reopen's connect), where it reset the - reopened flow at the second INVITE, and where a reg-event NOTIFY had - ended the binding before the reset, the call ended `error` within a - second of the Dial. Over UDP an ICMP port unreachable ended the flow: - the INVITE went out once more and the call ended `error` at the second - ICMP. On the dev phone (KPN, the same day, the capture's `phone3/`, the - binary of 1.2.4): a call to voicemail answered and hung up; and one - whose flow was made to die under the INVITE before the INVITE left the - phone (every segment of the flow dropped on the phone, five in all, and - the kernel's retransmission limit lowered for the moment; nothing of - the old connection's end went to the P-CSCF): the flow was reopened - from the same port, the INVITE went out again 2.1 s after the death was - found, and the call was answered 0.2 s after that. Not met by a call: - a P-CSCF that had dropped a flow's state, and one that had received - the first INVITE before the flow died; a reopen's connect that gets no - answer at all; the emergency chain on a network. -- The firewall's rule for ESP (§7.3, §13; 1.2.4) is the bring-up script's, - which no suite reaches. The script's firewall block ran by itself on the - workstation against nftables (2026-11-24 and -25, the fp6 journal's - `2026-11-24-incoming-dropped-without-ping` capture, - `bench/bench-esp-rule.sh`: two network namespaces, an ESP transport-mode - SA pair between them, the dev phone's ruleset as read from it loaded in - the one that stands for the phone, the connection tracker's generic - timeout at 8 s, plain TCP both ways and no imsd). 1.2.3's block left the - ruleset as it was, and a connection the network's side opened to port - 45062 11 s after the phone's last packet got no answer: its three ESP - packets were new to the tracker and none passed the chain. This script's - block inserted the rule (`nftables: accepting ESP on qmapmux*`; a second - run inserted nothing), and the same connection, 11 s after the last - packet, was accepted. An ESP packet whose SPI no SA has passed the chain - and was dropped by the kernel (`XfrmInNoStates`); a connection through - the SA to another port got no answer, its SYNs dropped by the chain - after decapsulation. On that ruleset without imsd's rules the block - inserted all three above the chain's own; with no `inet filter` table it - did nothing. After the ruleset was loaded again from its file the - script's rule was gone and the connection unanswered again; a file that - carries the rule kept it. ESP on another interface was not accepted and - neither was an AH packet; ESP over IPv4 on `qmapmux0.0` was accepted, - and ESP on a second `qmapmux` interface. On that ruleset without imsd's - rules, as the block left it, connections to both ports were accepted. - Eleven faults put into the block one at a time, ten in its rule for ESP, - that rule's check and its journal lines and one in a port rule, were - each caught by a step (`bench/run-mutations-esp.sh`). - `bench/bench-esp-pinhole.sh` there has the gap without the script: the - network's connection accepted a second after the phone's own exchange - and under a packet of the phone's every 3 s, and unanswered 11 s after - the last packet. On the dev phone (KPN, the capture's `phone/`), under a - daemon that sends no ping (the binary of 1.2.4, no `CRLF_KEEPALIVE`): - the tracker's entry for the P-CSCF's ESP was read counting down after a - refresh (575 s left 23 s after it, 15 s left 9 min 43 s after it) and - was gone 10 min 29 s after it (2026-11-24); the script, run at imsd's - start, inserted the rule above the two port rules it found, and the - daemon resumed its registration (2026-11-25). Then a text was sent to - the phone's own number with the tracker's timeout at 0 for the test, so - that every ESP packet from the network came without an entry: with the - rule, six such packets came, and the answer to the MESSAGE, the submit - report and the text's delivery reached the daemon within a second; with - the rule taken out, 23 came in 20 s and none of the three reached the - daemon in those 20 s. Not met: a request the network starts after the - entry has lapsed of itself, 600 s after the phone's last ESP packet (a - call to the phone from another line). -- The idle flow (§7.2 step 5; no CRLF keepalive unless `CRLF_KEEPALIVE` - names an interval, 1.2.4) is shell code no suite reaches; how the - setting's value is read is `WholeSeconds`, pinned in `tests/Util`. The - loop ran on the workstation against a stand-in network that prints - every ping and can close a flow it has heard nothing on, or forget it - and answer the next bytes on it with a reset (2026-11-24, the fp6 - journal's `2026-11-24-crlf-keepalive` capture, - `bench/bench-keepalive.sh`: the daemon in dev mode, its card and modem - reads answered by stand-ins). Left alone for 100 s after its - registration the daemon sent no ping, 1.2.3's three, and with - `CRLF_KEEPALIVE=10` nine, behind its start line (§7.8); over UDP with - that setting it sent none and no empty datagram; with - `CRLF_KEEPALIVE=0` and with an empty value it sent none and logged - nothing of the setting; with `CRLF_KEEPALIVE=30s` it logged the value - as not understood and sent none. A network that closes a flow after - 45 s of silence closed two in 130 s, each reconnected and re-registered - in the same second; it closed none under 1.2.3's pings or under - `CRLF_KEEPALIVE=30`, and one that closes after 60 s none under a refresh - every 40 s. A network that forgets a flow after 45 s of silence reset - the refresh that came at 60 s, twice in 140 s: `keepalive re-REGISTER - failed: no reply to re-REGISTER`, then the reconnect and the - registration in the same second; under `CRLF_KEEPALIVE=30`, as under - 1.2.3's pings, it forgot none and answered both refreshes; one that - forgets after 20 s reset each of 1.2.3's three pings, and each was - followed by the reconnect. Under a call the daemon had placed and - hung up 30 s later, a network that forgets a flow after 20 s of - silence reset the BYE's bytes, and one that closes it after 20 s had - closed it: in both the BYE was not delivered, the call ended - `local-hangup — HangUp; BYE sent`, and the recovery reconnected as - soon as the call was gone; 1.2.3's BYE was lost the same way on the - forgetting network (the fp6 journal's `2026-11-24-bye-resend` - capture, `bench/bench-hangup.sh`, the scenarios named `-not-resent` - and `hangup-forgotten-before`; §7.6). - On the dev phone (KPN, the same day; its - ModemManager has the WDS event reports off while the phone sleeps, - §13), with the binary of 1.2.4 (the capture's `phone3/`): no packet on - the ims netdev in two idle minutes, where 1.2.3 put one each way every - 30 s (`phone/`); with `CRLF_KEEPALIVE=30` the start line and a packet - each way every 30 s; with `CRLF_KEEPALIVE=30s` the line for a value not - understood and no packet. With builds of this change from before the - call's resend (two bullets above) was put under it (`phone2/`, - `phone/`): the netdev's counters stood still for the 1800 awake seconds - to the refresh, which the P-CSCF answered on the flow, silent until - then (no reconnect), twice; and two loops of deep suspends with a 150-s - alarm had no packet on the netdev, of seven sleeps (five ended by the - alarm, one after 9 s by the ADSP's battery manager, one after 98 s by a - file-system request of the modem's that no packet had preceded) and of - six (five ended by the alarm, one after 99 s by the ADSP's battery - manager). Not met: a real network that closes or forgets an idle flow; - a flow that dies with neither a close nor a reset; a reg-event - SUBSCRIBE as the first bytes on a forgotten flow; an incoming call - whose BYE is the first bytes on such a flow; an incoming text whose - delivery report is the first bytes on such a flow. A text's MESSAGE as - the first bytes on a flow the network had dropped was met once, in the - firewall's test above (2026-11-25): the phone had dropped the P-CSCF's - packets for 20 s, a text's first MESSAGE had gone unanswered for that, - and its repeat, 128 s on, was the first thing imsd sent on the flow - since. The flow was found dead 0.3 s after the repeat went out, the - recovery reconnected and re-registered 0.2 s after that, and the text - ended `failed`, its repeat lost with the flow. -- The CSeq of a re-REGISTER (§7.2 step 5) is the shell's, and no suite - reaches it. On the workstation the daemon ran against a stand-in network - that keeps the highest CSeq of the protected REGISTERs it has taken - per Call-ID, answers a protected REGISTER - that is not higher `482 Loop Detected`, and can take one refresh - without answering it or refuse one (the fp6 journal's - `2026-11-25-refresh-answer-lost` - capture, `bench/bench-cseq.sh`): after a refresh whose answer is lost - the reconnect's re-REGISTER carries the next number and is answered - 200, where 1.2.4's carried the lost one's, was refused twice and - registered fresh; a daemon killed under the wait resumes with the next - number, the state file having it, where 1.2.4's resume was refused and - registered fresh; after a refresh the stand-in refused (503) the - reconnect's re-REGISTER carries the next number, where 1.2.4's carried - the refused one's again (the stand-in keeps no number for a REGISTER - it refuses, and answered both 200). On the dev phone (KPN, - 2026-11-25, this commit's - daemon; the fp6 journal's `2026-11-25-through-sleep` capture, - `phone/cseqtest-2-a`), with the firewall's rule for ESP taken out and - the connection tracker's generic timeout at 0 around a refresh, so that - its answer was dropped: `keepalive re-REGISTER failed: no reply to - re-REGISTER`, and `reconnected + re-registered` 10 s later. Not run: the - number after a re-REGISTER whose send failed; a re-REGISTER's answer - lost over UDP; a restart after a daemon was told to stop (SIGTERM) - under the wait, where the bench kills it; a resume whose REGISTER gets - no answer; a state file torn by a kill during its write; and what a - 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; a Dial refused under a call that has its lock, which - asks nothing, and what logind signals after a suspend told to ignore - inhibitors under a call (the next entry has such a suspend; its run's - log has the lock listed before and after it, and no line of logind's - for the signal); a desktop's own request for a suspend under the lock. -- The registration through a sleep (§7.10) is shell code but for - `WakeAt` and the recovery policy's wake after a local wait, which - `tests/Engine` pins. On the workstation - (`bench/bench-sleep.sh` of the capture above) the bench's sleep is a - preloaded `clock_gettime` under which the boot clock runs ahead of the - steady clock by the seconds a file names: with the boot clock 50 s - ahead a refresh set for 60 s went out 20 s into the registration, and - 1.2.4's did not; with it 599500 s ahead the reg-event subscription was - renewed, and 1.2.4's was not; with no jump the refresh came at its - awake time and not before. The second lock was taken and released - around a refresh, asked for again at the stand-in logind's - `PrepareForSleep(false)` where that had refused it at a refresh's - start, and held from a text's sending to its `failed` where the - stand-in network answered no MESSAGE (256 s). In a gap of 40 s - (the stand-in modem without packet service, no SYN let through, the - flow closed by the network) no connect was tried and no lock taken, - the modem was asked every 5 s, the daemon's own processor time - stayed under a second (an earlier build, which kept the dead flow's - socket through the gap, used 33.9 s of it), and the reconnect came - 3 to 5 s after the gap's end; a `Dial` inside such a gap ended at - once, with nothing reopened under it, and the reconnect then came - 0.5 to 1.5 s after the gap's end. In a gap of 70 s that let no - segment through, the daemon had no socket of the old flow at the - gap's end, and the reconnect came 3 to 5 s after it, 0.5 to 1.5 s - where a `Dial` had been tried inside the gap. A - daemon started inside a hold of 60 s held no lock for - it. With `WAKE_TRACE=1`, a test seam, the daemon writes a line - whenever the time the alarm is armed for changes (by the second; one - line for a run of times less than two seconds ahead), with a timer - or without: in a gap - that a refresh ran into, with the boot clock put 1000 s ahead inside - it, the alarm named 900 s ahead; after the gap's end, where the old - flow's socket had two connects refused, it named no more than 30 s - ahead, and the reconnect came 15 to 16 s after the gap's end; and - where the stand-in modem reported service twice inside such a gap, - the alarm named 900 s ahead again after each. Where the modem still - reported service when the refresh failed, where the network stayed - silent for 80 s after the modem's return (two silent cycles, then a - fresh registration) and over UDP, the alarm named no more than 30 s - ahead from the modem's return to the recovery. While a step waited - for the network (a refresh's 12 s without a reply, a connect's 12 s - without an answer and the 10 s before the next try, a fresh - registration's two waits with the stand-in network holding its - answers back) the alarm was named a new time every second, and - through the connect for a call's resend it was named no time 2 s or - more ahead. Stopped 1.5 s into a fresh registration's wait for its - first 401 and continued 2 s later (a stop and a continue end a - datagram receive under a timeout as a suspend's freeze does, §13), - the daemon - registered when the stand-in's held-back 401 came, five runs of five; - an earlier build and 1.2.4 gave the wait up at the continue, five of - five each. The bench's - namespace gives no `CAP_WAKE_ALARM`: every life of this daemon there - says `no wake - alarm (Operation not permitted)` and runs on. The alarm is the dev - phone's (KPN, a 7.3 kernel, this commit's code under the next - commit's version string, `phone/` there, 2026-11-28), with - `REFRESH_INTERVAL=120` and deep suspends asked of logind: every - refresh that fell due under a sleep went out within 3 s of its due - time, after a resume whose first interrupt was the RTC's alarm - (1.2.4, in three sleeps of that script as it was on 2026-11-25, on - the same kernel build, sent no refresh in seven minutes); seven - recovery steps that fell due under a sleep ran 1.5 to 3 s after - their time (an earlier build, 2026-11-25); under a call a suspend - told to ignore inhibitors was refused by the kernel (`alarmtimer`, - -16), twice, systemd-sleep having tried its second state; and under - a refresh whose REGISTER the phone itself dropped, such a suspend a - second into the wait was ended by imsd's alarm (the RTC's the first - interrupt, 30.6 s in), after which imsd's timer, zero at the test's - first look, read 29 to 30 s ahead at each of its 32 looks from 0.2 s - later to the wait's end, which the test saw about 10 s after that - first look (an earlier build, which set the alarm once - for the wait, read zero at every reading until the wait had ended; - in another run, with two more such suspends in that wait, it slept - to the test's own alarm of 75 s both times). The re-registration - after that refresh came 71 s after its `no reply`, the kernel - refusing nine connects over a minute first (the old flow's socket, - §7.10). Not run: a - suspend under a fresh registration's first wait with the daemon on a - phone (the receive's `EINTR` at a resume was seen there with a test - program, §13); an alarm clock with no RTC behind it (`no RTC that - can wake the phone`), and a `timerfd_settime` that fails (`wake - alarm not set`); the alarm's disarming and `wake trace: none`, - which nothing reaches once the loop runs; a second suspend told to - ignore - inhibitors under one wait with this daemon on a phone (the dev - phone is not to be suspended within ten seconds of a resume: the - earlier build's run with three did so, and its wifi firmware - crashed; and the wait the test stages, an unanswered refresh's - 12 s, is over at about that time); the 1.9 s through a connect for - a call's resend that waits (the bench's is answered at once); a - fresh registration's look at the modem finding no packet service - (the reconnect's has run); a bring-up the network defers or refuses, - and a stop during a bring-up's hold; the work's lock asked for at - the bus connection's coming (no record tells that request from the - step's own); a coverage gap on a - phone, and the wake for its slower look; on a phone, a sleep longer - than a refresh interval of 1800 s; the alarm at most 30 s ahead - through a step's wait while a text is in flight, which is read from - the code; - the reg-event subscription's renewal on a network. -- Where an answer goes that the server ports send (§12) is the shell's - (`ServerPorts`), and no suite reaches it. On the workstation the daemon - ran against a stand-in network that sends it requests over TCP and UDP - and can close or reset a connection behind one (the fp6 journal's - `2026-12-04-pani-in-dialog` capture, `bench/bench-pani.sh`: the daemon - in dev mode, its card and modem reads answered by stand-ins, an - incoming call accepted on its bus). Where the network closed the - connection its INVITE had come on while the call rang, the 200 of the - Accept arrived on the connection the same peer had made again to the - same port, also where the network had reset the first right behind its - INVITE (that call's 100 and 180 did not arrive: the connection they - were written to had been reset); it was not sent, with the journal's - line, where the only new connection was another host's, another port's - of the same host, or the same peer's to the daemon's other port (the - release before, 1.2.6, wrote it on the other host's connection and on - the one to the other port; with another port of the same host it was - not run); and it arrived on the INVITE's own connection where the peer - made a second one to the other port while the call rang. Two requests - whose connections the network closed right behind them were not - answered, with one line. Over UDP five OPTIONS requests were answered - from the ports the release before answered them from; two of the five - had no `rport` in their Via and were answered at the port that Via - names. On the dev phone on KPN (2026-12-04; the fp6 journal's - `2026-12-04-imsd-1.2.7-range-on-dev-phone` capture: the daemon in the - packaged one's place, resuming its registration, and the SA pair's - packets read on the phone) the two requests that a text to the phone's - own number brings came in over UDP, and each 200 left from 45061 for - the P-CSCF's protected server port, which their Via names; the text - was delivered, and the network sent neither request again. A call - came in there over TCP, on a connection the P-CSCF had made to 45062 - and had sent two NOTIFYs on: the 200s to those, the call's 100, its - 180 and the 200 of the Accept left on that connection, and the 200 to - its BYE, which came over UDP, from 45061. Of what ran against the - stand-in network nothing else has been seen on a real one (a - connection closed or reset behind a request and an answer that is not - sent among it). - Not run: an answer given after the daemon has moved to another - address; a peer on a link-local or an IPv4 address; a connection that - ends in an error and is made again within one turn of the daemon's - loop. -- What an answer of the server ports keeps of `P-Access-Network-Info` - (§7.6, §12): the rule of the two paths is pinned in `tests/Ipsec` and - the line's removal in `tests/Sip`; the shell's part (the record of the - SA pair, the two ends an answer is judged by, the journal's line) ran - on the workstation against the same stand-in network (the same capture - and script; the bench installs no SA, its `ip` being a stand-in, and - the network tells the paths by the addresses and the ports, as the - record does). Eight OPTIONS requests (five over UDP, three over TCP) - were answered with the header to the P-CSCF's protected client port - from 45062, over UDP and over TCP, and to its protected server port - from 45061 by the request's Via, and without it to another port of the - P-CSCF's host, to another host and to a Via port that is not the - protected server port, with one line in the journal; the same after a - restart that resumed the registration with another P-CSCF configured - than the pair's; none of the eight answers carried it where one policy - add of the SA setup had failed, nor where the modem named no cell. Of - an incoming call, over TCP and over UDP by the Via, the reliable 180, - the 200s to its PRACK and its UPDATE, the 200 that answered it and the - 200 to its BYE carried the header and the 100 Trying did not; over TCP - a 486 and a 487 carried it and the 200 to the CANCEL did not; a call - from another host got its 180 and its 486 without it. The daemon's own - PRACK and BYE carried it, its ACKs and its CANCEL did not, and a - request on the client flow was answered there with it. On the dev - phone on KPN (2026-12-04, the capture of the entry above), with the - record of the pair made by a resume, these left with the header - inside the SA pair: the 200s to the two NOTIFYs that follow the - reg-event SUBSCRIBE and to a text's two requests; of a call that came - in the 180, the 200 that answered it and the 200 to its UPDATE; and - the daemon's own BYE, of that call and of one it placed. The call's - 100 Trying and the daemon's ACK left without it. After a boot, where - the record is made by the fresh registration's setup: the 200s to the - NOTIFY and to a text's two requests, a call's 180, its 200 and the - 200 to its BYE, and the BYE of a call the daemon placed, with the - header; the 100 Trying and the ACK without. The journal has no line - of an answer that went without it. Of what ran against the stand-in - network nothing else has been seen on a real one (an answer off the - pair's two paths, a PRACK either way, a 486, a 487 and a CANCEL among - it). Not run: a fresh registration whose setup fails while a pair is - on record; a bring-up that finds a dead pair; a fresh attempt to - another P-CSCF that fails before its SA setup; an address move. + No phone record shows `to` or `operator` in a `Received` or a `List`; the + store's round trip with each is in `tests/Engine`. - `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, @@ -1504,9 +734,7 @@ 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). On the same bus imsd is a client of logind's -(`org.freedesktop.login1`): the main thread takes its sleep inhibitors -there and listens for its `PrepareForSleep` (§7.6, §7.10). +(§7.9). 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 @@ -1566,7 +794,7 @@ The daemon's own bring-up (`BringUp()` in `main.cpp`): registration is due or a binding a NOTIFY terminated under the attempt write the registration off — either way the pair counts as one nothing can resume. A pair nothing can resume (its UE address left the link, no - state file, a file another attempt left behind or whose identity fails the check, written off before this start or + state file, a file another attempt left behind, written off before this start or given up by the engine during the attempt) is written off (`old_gone` in the holds — written as well for a pair `RESUME=0` leaves untried) and taken out of the kernel first (`the SA pair to … is nothing to resume: removing @@ -1575,37 +803,7 @@ The daemon's own bring-up (`BringUp()` in `main.cpp`): 2. `qmicli -d qrtr://0 --uim-get-card-status` finds the ready USIM (slot, AID); `mmcli -m any` gives the primary SIM path and the IMEI (for the `+sip.instance` URN); `mmcli -i ` gives IMSI and MCC/MNC, from which - the IMPI/IMPU/realm are derived (TS 23.003 13.2 to 13.4B) — the names - of a UE without an ISIM (TS 24.229 5.1.1.1A). Since 1.2.3, unless - `ISIM=0` is set, a card with an ISIM application in the USIM's slot - (`ParseIsimApp`, in whatever state the modem lists it) is asked for the - identity that ISIM holds: over a logical channel on the application imsd - reads EF_IMPI (the private identity), EF_DOMAIN (the home domain) and - record 1 of EF_IMPU (the public identity to register, GSMA IR.92 2.2.1), - each with a SELECT by file identifier and a read, and takes the three - when `IsimIdentity` accepts them (`identity: the ISIM's (application - state …): …`, with whether they are the names the IMSI gives). Then the - ISIM is asked for the answer to the challenge (step 4). When the card - has no ISIM, when `ISIM=0` is set, or when the ISIM gave no identity, - the derived identity and the USIM stand, as in 1.2.2, - and the `identity: derived from the IMSI …` line says which of the three - and, for the last, what was missing (§7.8). The read is made at every - bring-up of such a card, a resume's too, and at each recovery by a - fresh registration later in the same run (`FreshRecover`) while no read - since the bring-up has given one. That is the card's identity, and a fresh - registration is made under it. A resumed registration keeps the one it - was made under until its next fresh registration, as it keeps its - P-CSCF and its address (step 3): the state file records the three names - since 1.2.3, and a file without them is taken for one made under the - derived ones (`identity: the registration to - resume was made under …; it keeps them until the next fresh - registration, which takes the card's` when they are not the card's; - `identity: the fresh registration takes the card's: …` when that - registration comes under other names, and after an attempt that fails - the names are back that stood before it). The registration's home - domain is also what `RuriFor` and `ScPsi` take, for an outgoing call's - Request-URI and for the service centre's address of an SMS submission - (§12). With SMS over IP on and `SMSC=` unset, + the IMPI/IMPU/realm are derived; with SMS over IP on and `SMSC=` unset, `qmicli --uim-read-record` of EF_SMSP record 1 names the service centre (§7.9). `mmcli --location-get` fills `P-Access-Network-Info`. @@ -1663,65 +861,14 @@ The daemon's own bring-up (`BringUp()` in `main.cpp`): route (imsd's own `ip -6 route replace`; step 3 says which target), an unprotected REGISTER on `PCSCF_PORT` (UDP, always), the 401 with the AKA challenge and the `Security-Server` list, the AKA run over a UIM logical channel - (`--uim-open-logical-channel`, `--uim-send-apdu`) — in the ISIM when the - card's identity was read from it, else in the USIM; the command is the - same (AUTHENTICATE with P2 `81`: the 3G context of TS 31.102 7.1.2, the - IMS AKA context of TS 31.103 7.1.2), and an ISIM that gives no result - is followed by the same challenge to the card's USIM (`AKA: the ISIM - application gave no result (…); asking the USIM`). TS 24.229 5.1.1.1A - has the ISIM used for authentication whenever the card has one: with - `ISIM=0`, with an ISIM that gave no identity and behind one that gives - no result imsd asks the USIM —, the SA pair installed + (`--uim-open-logical-channel`, `--uim-send-apdu`), the SA pair installed with `ip xfrm`, the protected REGISTER over the negotiated transport (§10.1, `SIP_TRANSPORT`), `REGISTERED (fresh)`. Then the reg-event SUBSCRIBE (§7.4). -5. A keepalive re-REGISTER refresh at half the granted lifetime (of - 3600 s where none was granted), within - 120–1800 s (`REFRESH_INTERVAL`), only while idle; the time runs - through a suspend, and a sleeping phone is woken for it where imsd - has its wake alarm (§7.10). - Besides it an idle - phone whose registration stands sends what its reg-event subscription - needs (§7.4). The CRLF keepalive (RFC 5626 4.4.1) imsd sent every 30 s - until 1.2.3 is off unless `CRLF_KEEPALIVE` names an interval in whole - seconds (a TCP flow's only; an empty value is as none, any other that - is no whole number is reported and sends none; §13 has what a ping - costs a phone). No registration of imsd's negotiates keep-alives: its - REGISTER has no `outbound` in `Supported` and no `reg-id` (RFC 5626 - 4.2.1), and no `keep` in the Via (RFC 6223), which TS 24.229 5.1.1.2.1 - d) has a UE offer unless it is configured not to send keep-alives or - is directly connected to an IP-CAN for which usage of NAT is not - defined. What a ping does for a flow, outside a call (none is sent in - one): sent more often than a P-CSCF's timer for a flow it hears - nothing on, it keeps that P-CSCF from dropping the flow, and it draws - the reset of a P-CSCF that has lost the flow. On the phone it also - kept the connection tracker's entry for the P-CSCF's ESP, which the - firewall's rule for ESP makes needless (§13). Without the ping: a - close by the network is answered, outside a call, with a reconnect - and a refresh (`client flow dead; reconnecting`, §7.4); the reconnect's - first connect can be refused, the closed flow's socket still in the - kernel's table (`connect failed; retry in 10s (TIME_WAIT?)`: a user's - log on O2, 2026-09-24), and its second follows 10 s later. A flow the - network has dropped without closing, where it answers the next bytes - on it with a reset, is found at those bytes: where they are this - refresh's, it fails (`keepalive re-REGISTER failed: …`) and the same - reconnect follows; where they are a call's INVITE, the shell reopens - the flow for the call (§7.6); where they are a call's BYE, the BYE - is lost (§7.6); where they are a text's MESSAGE, it is lost with the - flow and the text's wait decides (§7.9); where they are the delivery - report of a text that came in, the report is lost with the flow and - not sent again. A flow that died with no close and no - reset reaching the phone is noticed when this refresh's re-REGISTER - gets no answer, or sooner where TCP gives up on bytes imsd sent on it - before that (924.6 s or more after them by the kernel's default - `tcp_retries2` of 15); until 1.2.3 a ping's were among those bytes - every 30 s outside a call. The refresh of a +5. A keepalive re-REGISTER refresh at half the granted lifetime, within + 120–1800 s (`REFRESH_INTERVAL`), only while idle. The refresh of a registration this process made fresh is a reregistration as TS 24.229 - 5.1.1.4.2 has it: the same Call-ID and Contact, the CSeq one above the - last REGISTER sent on that Call-ID, answered or not (RFC 3261 10.2; - the number is used, and in the state file, once the REGISTER is sent: - §13 has KPN's 482 to re-REGISTERs that, by 1.2.4's code, carried an - unanswered one's number), the + 5.1.1.4.2 has it: the same Call-ID and Contact, CSeq+1, the Authorization of the last successful authentication verbatim (the 401's nonce, our cnonce and response, kept in the state file), a Security-Client with new SPIs and a new client port (`PortUcNext`, @@ -1738,7 +885,7 @@ The daemon's own bring-up (`BringUp()` in `main.cpp`): `spi_uc`/`spi_us` are not the pair's, step 3), it sends — on the resume's re-REGISTER, the keepalive re-REGISTERs, the reg-event SUBSCRIBE and INVITEs, until its next fresh registration — the one - entry rebuilt from the SA, with the algorithms the kernel prints for it + entry rebuilt from the SA (`Imsd:Ipsec`, which makes the choice): KPN's one-entry answer to the default offer in the same bytes, not a list such as O2's six, which RFC 3329 §2.3.1 has the server answer with a 494 when it does not mirror its own; a refused resume registers fresh (with @@ -1751,12 +898,7 @@ The daemon's own bring-up (`BringUp()` in `main.cpp`): in-use SPIs) was refused with 503 (§13). The state file is JSON: `callid`, `ftag`, `cseq`, `spi_uc`, `spi_us`, -`expiry`, `route`, `ppi`, `aor`, `contact_user`, `transport`, since 1.2.3 -`impi`, `domain` and `impu` (the identity the registration was made under, -which a resume keeps — step 2; all three absent in an older file: the -derived identity; a file that holds one or two of them, or three that are -no identity `IsimIdentity` accepts, is not resumed: `the state file's -identity is not one imsd can register; …`), since 1.0.0 +`expiry`, `route`, `ppi`, `aor`, `contact_user`, `transport`, since 1.0.0 `pcscf` (the P-CSCF the registration was made to; named in the line that reports a file another attempt left behind — the check is the SPIs', `FileNamesAnotherPair`), since 0.3.12 @@ -1903,12 +1045,7 @@ configures the muxed netdev. Idempotent; a non-zero exit fails the unit. - Opens imsd's protected ports 45061–45062 (TCP and UDP) on `qmapmux*` in nftables when a `inet filter` table exists (pmOS's default INPUT chain drops inbound on `qmapmux*`, which silently killed every network-initiated - request after ESP decapsulation), and accepts ESP itself on `qmapmux*` - (the packet passes the chain before it is decapsulated too; §13). Each - under its own comment in the chain, `imsd-protected-ports` and `imsd-esp`, - and only where the chain has no rule under that comment. Best-effort, - and in the running ruleset only: what the script inserted is gone when - the ruleset is next loaded from its files (§13). + request after ESP decapsulation). Best-effort. - Writes `/run/imsd.env`: `DEV=`, `LOCAL=`, `PCSCF_DISCOVERED=` (comma-separated in the modem's order; empty when nothing was discovered or `PCSCF` is set) and `PCSCF_DISCOVERY=found|none|failed|skipped` @@ -1933,9 +1070,7 @@ configuration file's path — the bench's seam too). ### 7.4 Registration recovery (`RegRecovery`, `Imsd-Engine.cppm`) What the daemon does when the registration stops working after bring-up, as -a pure reducer the shell feeds with the clock, the network's answers and its -local waits (a connect the kernel refused, the modem without packet -service). Two +a pure reducer the shell feeds with the clock and the network's answers. Two kinds of failure reach it: a **refusal** (the network answered a refresh with a final other than 200 — a 401, re-authentication, included — or a fresh registration's REGISTER with a final other than the expected one: from 300 @@ -1954,12 +1089,11 @@ The policy, with its constants: |---|---| | Reconnect | Through the existing SA, then refresh. Back-off 5 s → 5 min (`ReconnectDelayMin`/`Max`). | | Escalate to a fresh registration | After one refused refresh whose `Retry-After` is at least a second (the network's considered answer; a `Retry-After` of 0 or one that does not parse counts as none; O2 2026-10-08: the refresh refused 503 with Retry-After 414 s, the refresh after that wait 503 with Retry-After 772 s) or a 401 (re-authentication, which imsd answers with a fresh registration rather than over temporary SAs), after two refused refreshes without one (`RefusalsBeforeFresh`), or two reconnect cycles that end without an answer (`SilentCyclesBeforeFresh`) while the modem reports packet service (`PacketServiceUp`: ModemManager's registration and packet-service state, as `ims-pdn-up.sh` reads them). A cycle that fails during a coverage gap is the phone's silence, not the network's: not counted, retried on the local-refusal pace, so a radio gap across a refresh does not escalate into a fresh registration, which KPN refuses while the registration is live and drops it for (§13). New Call-ID, new challenge, new SA pair (`registering fresh (recovery attempt N)`; with no fresh target the daemon restarts instead, §7.2 step 3). | -| No packet service | While the modem reports none (`PacketServiceUp`) the recovery tries no reconnect and no fresh attempt and holds no sleep off (§7.10; a bring-up does not ask the modem): the modem is asked again 5 s after each look while the phone is awake and no call is up (`LocalRetry`, the pause after a connect the kernel refuses locally as well), and where imsd has its wake alarm a sleeping phone is woken for the next look after as long again as that kind of wait has lasted, within 10 s and 15 min (`LocalWakeMin`/`Max`): where the modem has no service, since its first such word since the network last answered (an answered TCP connect of the resume or of a reconnect, a response to a REGISTER, a terminated binding, a success); where the kernel refuses the connect, since its first refusal since the modem was last without service or the network last answered, whichever came later. A report of service from the modem starts neither count over. A step that follows no local wait (the rows above and below) is woken for at its own time. A `Dial` on the dead flow meanwhile ends at once: nothing is reopened under it (§7.10). | | A refused or throttled fresh attempt | Waits on the **throttle schedule**: 21 min, growing ×1.5 to 60 (`ThrottleMinutesMin`/`Max`). KPN refuses a fresh SA pair on an address whose registration is live (§13), and drops that registration the moment an initial REGISTER arrives. | | A silent fresh attempt | Backs off 30 s → 10 min (`FreshDelayMin`/`Max`). | | `Retry-After` | Always wins over a shorter wait, honoured up to an hour (`RetryAfterMax`, the schedule's longest wait); a longer one is cut to an hour and the refusal heard again then. On a refused fresh attempt it replaces the schedule's wait, shorter or longer, never below 30 s (`FreshDelayMin`). | | A 403 | A refusal like the others: never hammered (the schedule), never abandoned (a SIM that is unbarred registers within the hour). | -| The old registration is gone | A 403 once a fresh registration is due, a fresh attempt that got past the SA setup, a binding the network terminated (reg-event), an older address that left the netdev, or a bring-up whose resume failed while a fresh registration follows (with no fresh target a resumable pair whose attempt failed is kept for the restart; a pair nothing can resume — given up or written off by the engine, its address off the link, no state file, a file another attempt left behind or whose identity fails the check, left untried by `RESUME=0` — is written off and taken out of the kernel, §7.2 step 1): no reconnect over the old SA from then on. Otherwise the existing SA is still retried on the reconnect back-off while a fresh registration is deferred. | +| The old registration is gone | A 403 once a fresh registration is due, a fresh attempt that got past the SA setup, a binding the network terminated (reg-event), an older address that left the netdev, or a bring-up whose resume failed while a fresh registration follows (with no fresh target a resumable pair whose attempt failed is kept for the restart; a pair nothing can resume — given up or written off by the engine, its address off the link, no state file, a file another attempt left behind, left untried by `RESUME=0` — is written off and taken out of the kernel, §7.2 step 1): no reconnect over the old SA from then on. Otherwise the existing SA is still retried on the reconnect back-off while a fresh registration is deferred. | | A `Dial` while unregistered | Brings the next recovery step forward (the reconnect, or the fresh attempt once it is due) — never a wait the network imposed (a `Retry-After`, or the schedule after a refused or throttled fresh attempt). imsd-ofonod refuses a `Dial` then and imsd-dialerd lists no modem. | | Success | Resets everything. | @@ -1973,8 +1107,7 @@ the SA setup, a binding the network terminated, an older address that left the netdev, and every bring-up that goes on to register fresh — its resume failed or there was nothing to resume; a bring-up with no fresh target writes `old_gone` when nothing can be resumed — a pair nothing can resume: its UE -address left the link, no state file, a file another attempt left behind or whose -identity fails the check, written +address left the link, no state file, a file another attempt left behind, written off before this start, given up or written off by the engine during the attempt, left untried by `RESUME=0` — never for a pair kept for the restart, §7.2 step 1); the reducer's refusal count travels too (`refusals`): a resume @@ -2001,16 +1134,11 @@ even after the holds run out, so a restart does not start it over at 21 min. When nothing is held the file is removed — when it is a regular file; `/dev/null` switches the knob off and anything that is not a regular file is emptied, never unlinked. The recovery policy's waits and the holds are -measured on the boot clock (`CLOCK_BOOTTIME`), so a suspend counts, and -so are the keepalive refresh's gate and the reg-event subscription's -renewal ahead of its granted lifetime's end (§7.10; awake seconds in -the releases up to 1.2.4); the CRLF keepalive (where `CRLF_KEEPALIVE` -sets one), the reg-event subscription's Timer F, its retries (after a -refusal, an unanswered SUBSCRIBE, a send that failed) and its renewal -after the S-CSCF has ended it, and the times SMS over IP measures -(§7.9: its two waits, the 30-minute age-out, the retransmission table's -32 s, the submissions table's hour) run on the steady clock and count -awake seconds only. +measured on the boot clock (`CLOCK_BOOTTIME`), so a suspend counts; the +keepalive refresh gate, the CRLF keepalive, the reg-event retry and +renewal timers and the times SMS over IP measures (§7.9: its two waits, +the 30-minute age-out, the retransmission table's 32 s) run on the steady +clock and count awake seconds only. The **reg-event subscription** (RFC 3680; the network's own view of the binding) is one live dialog per registration, subscribed anew ahead of the @@ -2113,27 +1241,8 @@ sent, emit this D-Bus state change, arm this deadline). States and reasons are t - Outgoing: INVITE with the SDP offer (AMR-WB + AMR + telephone-event by default; `CODECS` restricts and orders; `PRECOND=1` adds IR.92 preconditions), reliable 18x with PRACK, 2xx ACK and media start, CANCEL - before answer, BYE after. Busy and error finals end the call, unless - the emergency chain or the session timer (both below) has another - INVITE follow. Where the client flow is found dead after - an attempt's INVITE was sent and before any response to it (a 100 - included) or a CANCEL of it, the shell closes the dead socket without a - FIN's exchange, reopens the flow with one connect and the same INVITE - goes out again, once for each INVITE a call sends (an attempt of the - emergency chain's, or one sent again for a 422, below), the setup - deadline running from then (`MaybeResendInvite`). No REGISTER goes - first: the registration and its SAs stand (where a reg-event NOTIFY has - ended the binding, §7.4, nothing is reopened), and TS 33.203 7.1 has a - UE that has no TCP connection towards the P-CSCF set one up before it - sends a request. Where nothing is reopened, the connect fails (one that - gets no answer, after 12 s) or the flow dies again before a response, - the call ends with `error`. Under a call, a flow that died with no - reset and no close reaching the phone is found dead only when the - kernel gives up on bytes sent on it that were never acknowledged - (924.6 s or more after them by its default `tcp_retries2` of 15): an - attempt whose own INVITE is the first such bytes gets no response and - is cancelled at its setup deadline, long before that. A flow found dead - after a response to the INVITE is not reopened. + before answer, BYE after. Busy and error finals end the call with + `refused-or-busy` or `error`. - Incoming: an INVITE on a protected-port listener is validated before it is announced to the UI; 100 and 180 (reliable when the caller requires 100rel); `Accept` sends the 200 with the SDP answer at the offer's own @@ -2142,101 +1251,11 @@ sent, emit this D-Bus state change, arm this deadline). States and reasons are t unusable offer 488 naming what was offered; ring timeout 480. A landline gateway's G.711-only or AMR-NB offer rings and is answered at its own payload types. -- Hang-up: a BYE of imsd's goes out on the client flow, an incoming - call's too, and the call is over for imsd as the BYE is sent: the - media leg is stopped (RFC 3261 15.1.1 has the session terminated as - soon as the BYE is passed to the client transaction) and no response - to the BYE is waited for. The BYE is not kept and not sent again: on a - flow the network has closed or dropped it is lost, and the call's line - in the journal still ends `BYE sent`. A network that closes or drops a - TCP flow it hears nothing on (§7.2 step 5) can have done so by then: - under a call no ping goes out (with `CRLF_KEEPALIVE` neither), the - refresh waits for the call's end and the recovery does not reconnect. - That network's timer runs from the flow's last bytes. A call the - daemon placed restarts it with its own requests; an incoming call - sends none before its BYE, and where until 1.2.3 a ping went out every - 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. For a suspend that is told to - ignore inhibitors there is the wake alarm: what it holds under a call - and what it does not is in §7.10. - 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; a plain INVITE answered `380 Alternative Service` with an emergency body is - re-attempted as `urn:service:sos`. An attempt whose client flow is lost - (above) ends the call there: no fallback follows it. -- Session timer (RFC 4028): the first INVITE of a dialog announces - `timer` and asks for a session interval of 1800 s with `refresher=uac` - and a `Min-SE` of 90. The shell hands a call every response on the - client flow to an INVITE under its Call-ID; of a call imsd places the - machine takes those whose sequence number is its current INVITE's - (`ResponseOf`) and drops the others. Where the current INVITE awaits - its final (no CANCEL of it out, no answer taken) and is answered `422` - with a `Min-SE` (what `imsd::sip::MinSe` reads of it: a number of up to - nine digits, zeros before it aside) above the one it carried, the - INVITE goes out again in the same call (TS 24.229 5.1.2A.1.1; RFC 4028 - 7.3, 7.4), at most three times under one Call-ID (`MinSeAgainMax`, - imsd's own bound): the Call-ID, the From with its tag and the To as - they were, a new branch and the 422's `Min-SE` as its `Min-SE` - (`CallMachine::AgainWithMinSe`). The session interval it asks for is - the one asked for before, or that `Min-SE` where the interval was - smaller. Its sequence number is the next the Call-ID has not carried: - RFC 4028 7.3 has "one higher than the previous", which imsd takes as - the one after the refused INVITE's; where a PRACK followed that INVITE - imsd takes the one after the last PRACK's instead. The setup deadline - runs anew from each INVITE. Any other 422 to the current INVITE is a - refusal like any other, to a call and to an attempt of the emergency - chain, whose fallback is a new dialog and starts at 1800 and 90 again. - What answers an INVITE the call has replaced is dropped with the - others: its 422 coming a second time is not acknowledged again. In a - call it places imsd asks to be the refresher and sends no session - refresh of its own (the call machine sends no UPDATE and no re-INVITE; - one from the far side is answered). -- Access information: `P-Access-Network-Info` names the serving cell - (`ParsePani` of `mmcli --location-get`: no header before a read has - named a cell, and a read that names none leaves the last one). TS 24.229 - 5.1.2A.1.1 has a UE insert it "into any request for a dialog, any - subsequent request (except CANCEL requests) or response (except CANCEL - responses) within a dialog or any request for a standalone method", the - ACK at its choice, and 5.1.2A.2 into "any response to a request for a - dialog" and "any response to a standalone method" as well; RFC 7315 5.7 - has it appear in no ACK and no CANCEL. imsd writes it into its - REGISTERs, the reg-event SUBSCRIBE, an INVITE, a MESSAGE, a PRACK and a - BYE, and into every response it builds but three, the last two by its - own choice: the 200 to a CANCEL; a 100 Trying, which a stateful proxy - never forwards (RFC 3261 21.1.1) and for which the log of the stock - modem's capture has no value either (§13); and the 400 to a request cut - short (§7.9), which the transport answers without the registration's - context. The value is the one - `RefreshPani` last took — it reads at the bring-up and after a wait - there, before a refresh's, a reconnect's and a recovery's REGISTER and - before a dial — and not the cell of the moment a later message leaves at - (NOTE 13 of 5.1.2A.1.1 has the current one in a request or response - within a dialog): an incoming call's answers name the cell of the last - of those reads. What the server ports send in answer keeps the header on - the two paths of the SA pair on record and loses it anywhere else (§12). + re-attempted as `urn:service:sos`. - DTMF (`SendDtmf`): the tones go out as RFC 4733 telephone-event packets on the call's RTP stream, at the payload type the SDP negotiated for the codec's clock (`MediaLeg::dtmfPt`: the answer's for an outgoing call, the @@ -2336,35 +1355,7 @@ account `user`, its old default. Lines the operator (and the scripts) look for, all prefixed `imsd: `: -- `LOCAL=… P-CSCF=…`, `SIP transport: …` (behind it `CRLF keepalive: every N s on an idle TCP flow - (CRLF_KEEPALIVE)` where that setting names an interval), `ESP ciphers offered: …`, `SIM slot=… IMSI=… domain=…` at start - (the home domain of the card's identity, which the line before names); - `EALG entry '…' is not a cipher imsd can install; ignored` for a name in `EALG` that imsd cannot install, - `CRLF_KEEPALIVE=… is not a whole number of seconds; no CRLF keepalive` for a value of that setting, other than an empty one, that is no whole number. -- Before the `SIM slot=…` line, at every bring-up, where the identity is from (§7.2 step 2): `identity: the - ISIM's (application state S): private identity P, home domain D, public identity U; the names the IMSI gives` - or `…; not the names the IMSI gives (home domain D')`, `identity: derived from the IMSI (the card has no - ISIM application)`, `identity: derived from the IMSI (ISIM=0)`, `identity: derived from the IMSI: the ISIM - application (state S) gave none — …` with what was missing: `no logical channel opened on it`, `EF_X: the - SELECT answered `, `EF_X: the read answered `, `EF_X: no answer with a status - word to the SELECT`, `EF_X: an exchange of the read brought no answer with a status word` (the read or a - command the card asked for after it), `EF_X: no value in the N bytes read`, or `EF_IMPI '…', EF_DOMAIN - '…' and EF_IMPU record 1 '…' are no identity imsd can register`. At a resume whose - registration was made under other names than the card gives now: `identity: the registration to resume was - made under private identity P, home domain D, public identity U; it keeps them until the next fresh - registration, which takes the card's`; at a fresh registration under other names than the ones in use - before it: `identity: the fresh registration takes the card's: private identity P, home domain D, public - identity U`; - `the state file's identity is not one imsd can register; resume falls back to fresh` (with no fresh target - `…; nothing can resume it: the pair is removed`) for a file whose three names fail the check or that - holds one or two of them. At a recovery by a fresh registration, while the ISIM has given none since the - bring-up, it is read again and the line of that read follows: `identity: the ISIM's …` or - `… gave none — …`. -- `AKA: the ISIM application gave no result (…); asking the USIM` and, when no application gave one, `AKA: no - result (…)` before `USIM AKA failed`: `no logical channel opened`, `an exchange brought no answer with a - status word` (the AUTHENTICATE or a GET RESPONSE after it), - `status word `, `a synchronisation failure, tag DC`, or `N bytes that are no AKA result, - status word `. +- `LOCAL=… P-CSCF=…`, `SIP transport: …`, `SIM slot=… IMSI=… domain=…` at start. - `RESUME via existing SA (cseq N)`, `REGISTERED (resumed + true-refreshed)`, `FRESH registration`, `Security-Server: …`, `REGISTERED (fresh)`. - `bring-up deferred: …; next: fresh registration in N s` — one line; `in N @@ -2374,9 +1365,8 @@ Lines the operator (and the scripts) look for, all prefixed `imsd: `: `the refusal schedule stands at N min from before this start: …`. - `…; next: fresh registration in N s` (`in N min` from a minute, `now`), `registering fresh (recovery attempt N)`, - `fresh registration deferred/refused/failed: …`, `client flow dead; reconnecting` - (a reconnect over the registration's SAs begins, §7.4) and its - `reconnected + re-registered`, `recovered by a fresh registration`. + `fresh registration deferred/refused/failed: …`, `reconnected + re-registered`, + `recovered by a fresh registration`. - `the registration's SAs are on X, not the PDN's own address Y: resuming there until the next fresh registration`, `the fresh registration moves from X to the PDN's own address Y`, `back on X: the old registration stands @@ -2426,39 +1416,6 @@ Lines the operator (and the scripts) look for, all prefixed `imsd: `: failed: … — the resume is given up (the engine's rule): the pair is removed`). - `audio session: …` at start and at each call's media start; `CODECS override active: …`. -- `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. -- `call X: INVITE final 422, Min-SE N — the INVITE again with Session-Expires S` when an INVITE goes out again - for a 422 (§7.6). A 422 that is a refusal like any other has what was read of it in the line it leaves, as - `INVITE final 422, Min-SE N` or `INVITE final 422, no Min-SE read`: the call's `ended:` line, or an - emergency attempt's `— retrying as plain INVITE of the digits`. In each of the three a `Reason` header of - the 422 follows the `Min-SE` part (`…, Reason: …`). -- `an answer from port N to [address]:port is not sent: no connection from that peer to that port is held - (said once)` the first time in a run that an answer is given to the channel of a request that came in over - TCP and `ServerPorts` holds no connection from that request's peer to that port (§12). -- `an answer from port N to [address]:port is on neither path of the SA pair on record: it goes without - P-Access-Network-Info, as every such answer does (said once)` the first time in a run that the header is - taken out of an answer the server ports send (§12). -- `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. -- `wake alarm: a sleeping phone is woken when the registration's refresh - is due` when the alarm is first armed, `no wake alarm (…): a sleeping - phone is not woken for the registration's refresh` where the kernel - gives no such timer (its error) or has no RTC behind it (`no RTC that - can wake the phone`), `wake alarm not set: …` where setting it fails - (§7.10). -- `the modem reports no packet service: the reconnect waits until it has - it again` (or `the fresh registration waits …`) where a recovery step - finds the modem without packet service: once, and again after a look - that found it with service (§7.10). A cycle that was tried and went - unanswered, the modem then reporting none, has the line it had: `… - while the modem reports no packet service: not counted; next: …` - (§7.4). `wake trace: …` only with `WAKE_TRACE=1`, a test seam (§5). - `media 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 @@ -2497,48 +1454,28 @@ Lines the operator (and the scripts) look for, all prefixed `imsd: `: international number (+ and digits); …` and `SMS over IP: on (+g.3gpp.smsip advertised: …)`; per message of ours `sms : segment i/n to via : MESSAGE sent (RP-MR a, TP-MR b, N bytes)`, `sms : segment - i/n -> ; awaiting the submit report`, for a segment's repeat `sms - : ; sending the segment again, TP-RD - set` and `sms : segment i/n to via : MESSAGE sent again - (RP-MR a, TP-MR b with TP-RD, N bytes)`, and after it `sms : segment - i/n: the repeat was rejected as a duplicate (RP cause N (…), TP-FCS - 0xc5 (…)): the first attempt is taken for accepted`, `sms : segment i/n: the first attempt's - submit report came after the repeat went out: accepted` or `sms : - segment i/n refused by the SC: RP cause N (…)[, TP-FCS 0xNN (…)], in the - first attempt's report, which came after the repeat went out: the - repeat's decides`, - then `sms : sent: …` or + i/n -> ; awaiting the submit report`, then `sms : sent: …` or `sms : failed: …` (the reason: `'…' is not a number`, `no service centre …`, `the text does not fit 255 segments`, `imsd is not registered`, `the flow to the P-CSCF is down`, `segment i/n refused: `, `segment i/n refused by the SC: RP cause N (…)[, TP-FCS 0xNN (…)]`, `no answer to the MESSAGE - of segment i/n within 128 s`, `no submit report for segment i/n within - 130 s of the final`, `segment i/n not sent: the flow to the P-CSCF is - down`; of a segment that was sent again the reason is the repeat's - followed by `; the first attempt: ` — for a first - attempt that an RP-ERROR answered after the repeat went out, `segment - i/n refused by the SC: RP cause N (…)[, TP-FCS 0xNN (…)], in a report - that came after the repeat went out`) and, after a status report, `sms : delivered|delivery-pending| + of segment i/n within 32 s`, `no submit report for segment i/n within + 40 s of the final`, `segment i/n not sent: the flow to the P-CSCF is + down`) and, after a status report, `sms : delivered|delivery-pending| delivery-failed: ` or `sms : a segment delivered (TP-MR n); k still to be reported`, and for a report's word on the message still in flight `sms : delivered|delivery-pending| delivery-failed: — held until the submission ends`; per delivery `short message from via at