Commit graph imsd/tests/Sms
Author SHA1 Message Date
23892e8e81
sms, engine, imsd: a segment that gets no answer, or an RP-ERROR with cause 41, is sent once more with TP-RD set
A submission whose submit report did not come in time ended as
`failed`, and nothing was sent again. The service centre may have the
text all the same, and a user who then sends it again delivers it
twice: the second submission has a new TP-MR, and the service centre
cannot tell that it is a repeat (issue #3, the second of its three
cases).

TS 23.040 9.2.3.6 has the MS "automatically repeat the SMS-SUBMIT", one
to three times, with the same TP-MR and TP-RD set, when no response or
an RP-ERROR with an appropriate cause comes, so that the service centre
can discard a duplicate. SmsOutbound now sends a segment once more: when
either wait runs out, on a final of 408 or 504 (RFC 3261 21.4.9: the
server "could not produce a response within a suitable amount of time";
21.5.5: it "did not receive a timely response from an external server")
and on an RP-ERROR with cause 41, temporary failure, or with a value TS
24.011 table 8.4's part 1 does not list, which it has "treated as cause
number 41". Of the causes part 1 lists, Annex E-2 says of 41 alone that
the MS "may wish to try another short message transfer attempt almost
immediately". The repeat is a MESSAGE of its own, under its own Call-ID
and the next RP-MR — the shell's counter now goes on after the last
RP-MR a message used, one per MESSAGE built — with the same SMS-SUBMIT,
TP-RD set by the codec's flag, which nothing set until now.

The two waits are longer, so that a repeat does not overtake an answer
that is only late: 128 s for the final and 130 s from the final for the
report. TS 24.229 table 7.7.1 recommends a UE whose requests name one
of the accesses clause 7.7 lists in P-Access-Network-Info a T1 of 2 s
and a timer F of 64*T1, and TS 24.341 5.3.1.1 NOTE 1 has an SM-over-IP
sender's TR1M set to a value greater than timer F (Jorijn, 2026-11-21).

The segment is accepted by an RP-ACK to either attempt — the first
attempt's is taken when it comes after the repeat went out — and by the
RP-ERROR whose TP-FCS is the duplicate rejection (0xC5) when it answers
the repeat and no RP-ERROR has answered the first attempt by then: the
service centre is taken to have the first. An RP-ERROR to the first
attempt that comes after the repeat went out leaves the segment to the
repeat's answer. Any other end of the repeat fails the message, with
both attempts' ends in the reason. A final refused with another status
and an RP-ERROR with another cause fail the message at once, as before.

What the duplicate rejection does not say is which SMS-SUBMIT the
service centre holds: one of this subscription's that reached it
another way under the same TP-MR can draw the rejection too, and with
imsd's first attempt lost the message is then `sent` for a text that
never arrived (Jorijn, 2026-11-21: taken as the clause has it).

Not done of the clause's repeat: it cannot be switched off, and a failed
message is not kept for a user's retransmission under its TP-MR.

No member of the Messaging interface changes: `sent` and `failed` come
as before, a `failed` later by the waits — with nothing answering, 256 s
after the MESSAGE where 1.2.0 said it after 32 s — and texts queued
behind the message wait as long.

Tested by tests/Engine and tests/Sms (RpCauseIsTemporary over all 128
values; a cross-generated SMS-SUBMIT with TP-RD), and on the dev phone
against KPN with the binary of this range's last commit (the fp6
journal's 2026-11-20-issues-2-5 capture, phone-form6, repeat-bench.log):
with the phone deaf on its protected server port a text to the own
number got its 202 and no submit report, went out again 130 s after the
final under the next RP-MR, with the same TP-MR and TP-RD set, and ended
`sent`; the message after it took the RP-MR after the repeat's.

KPN's service centre did not discard the repeat in that bench, nor in
the six before it (one of them with a build that waited 40 s): the
repeat got an RP-ACK under a time stamp of its own, and once the port
was open again the text came twice, under the two attempts' time
stamps: the recipient got the text twice without the user sending it
again, and the message was `sent`. 1.2.0 ends a submission whose report
does not come as `failed` and sends nothing again.

The repeat is sent all the same, on Jorijn's decision of 2026-11-20 with
the first of those benches before him: the clause has the MS repeat
("shall") and the service centre discard ("should"), and Android's
framework sends its own retries so (AOSP's ImsSmsDispatcher and
GsmSMSDispatcher set TP-RD and the earlier TP-MR; the capture's
repeat-research).
2026-11-22 17:35:12 +01:00
910e2594a0
project, docs: the linter goes
The Catcrafts house-style rules (Crafter.LintRules) rode in project.cpp
as a dependency crafter-build cloned once and built on every load; the tree
never passed them (111 findings on the 1.1.0 tree, 156 on an early freeze
of this range (2e87e26), 100 of the 156 the shared naming rule's, each
for a variable whose name begins with a capital — the
fp6 journal's lint captures, lint-tip-2e87e26), CI never ran them,
and AGENTS.md kept a census nobody acted on. Out: the dependency, the
import and the five AddRules calls, the lint-disable comments in 25
files and on 4 lines, §4.2 and the census of §6 — now "Code style", the
three rules that were never the linter's; the cross-compiling section
becomes §4.2 and its six citations — §4.1's sysroot sentence, §9.1, the CI
workflow, the APKBUILD, build-package.sh, make-sysroot.sh — follow. Jorijn, 2026-10-17: "just
remove the linter, we are ignoring it anyway".
2026-11-19 16:43:16 +01:00
c88de31a0a
sms: the short message codecs of TS 23.038, 23.040 and 24.011, and EF_SMSP
SMS over IP (TS 24.341) carries the bytes a 2G/3G phone puts in an
RP-DATA inside a SIP MESSAGE body of type application/vnd.3gpp.sms, so
imsd needs the whole stack below SIP once it owns SMS on a carrier whose
modem IMS is off: the GSM 7-bit default alphabet with its extension table
and the septet packing, UCS-2 for everything else (TS 23.038); SMS-SUBMIT
built per segment with the concatenation header, SMS-DELIVER,
SMS-STATUS-REPORT and SMS-SUBMIT-REPORT parsed, the SMS-DELIVER-REPORT
that acknowledges a delivery, the user-data header and the reassembly of
a concatenated message (TS 23.040); RP-DATA, RP-ACK and RP-ERROR in both
directions with their causes (TS 24.011); and EF_SMSP, where the (U)SIM
names the service centre the RP-DATA is addressed to (TS 31.102 4.2.27,
the KPN SIM's record read on the dev phone on 2026-10-16: +31653131313).

A new partition, Imsd:Sms, pure std with no SIP, clock or I/O; tests/Sms
checks it against the classic
public PDU vectors ("hellohello", the "How are you?" SMS-DELIVER) and
vectors cross-generated by an independent Python reference.

A concatenated set with one alphabet throughout is decoded from its
segments' joined units — the septets, or the UTF-16BE octets — not from
the segments' texts, so a surrogate pair or an escape pair a sender cut
at a segment boundary comes out whole; a U+0000 in UCS-2 decodes as
U+FFFD, since no text means it and a D-Bus string cannot carry it.

A status report's TP-ST is read as TS 23.040 9.2.3.15 has the MS read it:
a reserved value, any with bit 7 set among them, as "Service Rejected" —
a temporary error after which the SC is not making any more transfer
attempts (StatusAsRead, pinned over all 256 values; StatusText has the
clause's four classes in words). Three more readings follow their
clauses the same way, each pinned: a time stamp semi-octet that is no
digit reads as 0 (9.2.3.11); `1111` before an address's last semi-octet
is skipped, not taken for its end (9.1.2.3); an SMS-SUBMIT-REPORT for
RP-ERROR with an unused bit of its first octet set gives TP-FCS 0xFF,
unspecified, with nothing else examined (9.2.2.2a).
2026-11-19 16:43:15 +01:00