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).
This commit is contained in:
parent
ef04b473a7
commit
23892e8e81
7 changed files with 670 additions and 123 deletions
|
|
@ -688,6 +688,10 @@ export namespace imsd::sms {
|
|||
Bytes DeliverReportError(std::uint8_t fcs) { return {0x00, fcs, 0x00}; }
|
||||
constexpr std::uint8_t FcsUnspecified = 0xFF;
|
||||
constexpr std::uint8_t FcsTpduNotSupported = 0xB0;
|
||||
// "SM Rejected-Duplicate SM" (9.2.3.22): the cause 9.2.3.6 has the SC
|
||||
// give an SMS-SUBMIT with TP-RD set whose TP-MR is that of the one
|
||||
// before it
|
||||
constexpr std::uint8_t FcsDuplicateRejected = 0xC5;
|
||||
|
||||
// Segment capacities (9.2.3.24.1): a lone message, and one with the
|
||||
// 8-bit-reference concatenation header (six octets: UDHL + 00 03 r t s).
|
||||
|
|
@ -880,6 +884,25 @@ export namespace imsd::sms {
|
|||
default: return std::format("cause {}", cause & 0x7F);
|
||||
}
|
||||
}
|
||||
// Whether an RP-ERROR to a submission invites another attempt at once.
|
||||
// Of the causes table 8.4's part 1 lists for a mobile originating
|
||||
// transfer, Annex E-2 says so of one, 41 temporary failure: "the Mobile
|
||||
// Station may wish to try another short message transfer attempt
|
||||
// almost immediately" (of 38, network out of order, it says that
|
||||
// "immediately reattempting the short message transfer is not likely
|
||||
// to be successful"); and part 1 has every value it does not list
|
||||
// "treated as cause number 41". So: 41, and any value part 1 does not
|
||||
// list.
|
||||
constexpr bool RpCauseIsTemporary(std::uint8_t cause) {
|
||||
switch (cause & 0x7F) {
|
||||
// part 1's values but 41
|
||||
case 1: case 8: case 10: case 11: case 21: case 27: case 28: case 29: case 30: case 38: case 42: case 47:
|
||||
case 50: case 69: case 81: case 95: case 96: case 97: case 98: case 99: case 111: case 127:
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
constexpr std::uint8_t RpCauseMemoryCapacityExceeded = 22;
|
||||
constexpr std::uint8_t RpCauseInvalidMandatoryInformation = 96;
|
||||
constexpr std::uint8_t RpCauseProtocolError = 111;
|
||||
|
|
|
|||
Loading…
Reference in a new issue