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:
Jorijn van der Graaf 2026-11-22 17:35:12 +01:00
commit 23892e8e81
Signed by: jorijnvdgraaf
GPG key ID: 2937E59CDCC1BCFB
7 changed files with 670 additions and 123 deletions

View file

@ -30,7 +30,8 @@ local-hangup/remote-hangup/refused-or-busy/error).
SMS over IP (TS 24.341) has its own reducers at the end: SmsOutbound, one
short message of ours on its way to the service centre segment by segment
(the MESSAGE with the RP-DATA, its final, the submit report that comes
back in a MESSAGE of its own), and OnSmsMessage, what an inbound
back in a MESSAGE of its own; a segment that gets no answer, or an
RP-ERROR with cause 41, sent once more, TP-RD set), and OnSmsMessage, what an inbound
MESSAGE outside a call's dialog leads to (the final for it, the message or
status report it delivered, the delivery report to send), with
RecentTransactions (a retransmitted request within 32 s gets its final
@ -1066,10 +1067,10 @@ export namespace imsd::engine {
// "indicates that the request corresponds to a short message submitted
// by the SM-over-IP sender" and 488 when it does not, and its NOTE 3
// has the sender store the Call-ID for that. The message in flight
// knows its own MESSAGE (SmsOutbound); this table keeps every one for
// an hour after it went out, so a report that comes once its message
// has ended — its wait run out, say — or once its segment was followed
// by the next is still known for ours: answered 200 and logged with
// knows the MESSAGEs of its segment in flight (SmsOutbound); this table
// keeps every one for an hour after it went out, so a report that comes
// once its message has ended — its waits run out, say — or once its
// segment was followed by the next is still known for ours: answered 200 and logged with
// the message's id. Nothing else follows from it: a message that has
// ended has had its word on the bus, and `failed` is its last (§8.4);
// one whose next segment is in flight goes on as it was. The table is
@ -1100,15 +1101,19 @@ export namespace imsd::engine {
std::map<std::string, Entry, std::less<>> byCallId_;
};
// The waits (TS 24.011 10: TR1M; TS 24.341 5.3.1.1 NOTE 1 has it
// exceed SIP timer F): a MESSAGE's final within 32 s
// of the MESSAGE or of its latest provisional, which starts the wait
// over; the submit report within 40 s of the final — a length TR1M may
// have, though 6.3.1 sets TR1M when the RP-DATA is transferred.
inline constexpr double SmsSendTimeout = 32.0;
inline constexpr double SmsReportTimeout = 40.0;
// What the bus hears: `sent` once every segment's submit report is
// in, `failed` with the reason; a status report's word
// The waits. TS 24.341 5.3.1.1 NOTE 1 has an SM-over-IP sender's TR1M
// set to a value greater than SIP timer F, and TS 24.229 table 7.7.1
// recommends a UE on a 3GPP access a T1 of 2 s and a timer F of 64*T1.
// So: a MESSAGE's final within 128 s of the MESSAGE — or of its latest
// provisional, which starts the wait over here, as it did in 1.2.0;
// RFC 3261's timer F does not start over —; the submit report within
// 130 s of the final — past the 35 to 45 s TS 24.011 10.1 has for
// TR1M, as the NOTE asks, and from the final, where 6.3.1 sets TR1M
// when the RP-DATA is transferred.
inline constexpr double SmsSendTimeout = 128.0;
inline constexpr double SmsReportTimeout = 130.0;
// What the bus hears: `sent` once the service centre has accepted
// every segment, `failed` with the reason; a status report's word
// after `sent` (StatusReportBook, SmsWordOrder, which also has the one
// failure posted as `sent`).
inline constexpr std::string_view SmsStateSent = "sent";
@ -1167,14 +1172,43 @@ export namespace imsd::engine {
std::optional<Word> held_;
};
// A segment's MESSAGEs at most: the first and one repeat. TS 23.040
// 9.2.3.6 has the MS repeat an SMS-SUBMIT that got no answer "in the
// range 1 to 3" times and leaves the number to the implementation.
inline constexpr std::size_t SmsAttempts = 2;
// One short message of ours on its way to the service centre, segment
// by segment: the MESSAGE with the segment's RP-DATA, its final, the
// submit report, then the next segment. RP-MR and TP-MR count up from
// the values the shell hands over (TS 23.040 9.2.3.6, 9.2.3.24.1; the
// shell keeps the counters across messages). No retransmission: an
// unanswered MESSAGE or a report that never comes fails the message
// (TS 23.040 9.2.3.6's automatic repeat with TP-RD is not done) and
// the bus hears why.
// shell keeps the counters across messages).
//
// A segment that gets no answer, or an RP-ERROR with cause 41, is sent
// once more, as 9.2.3.6 has it: "In the case where no response or an
// RP-ERROR with an appropriate cause value (see 3GPP TS 24.011 [13]) is
// received in response to an SMS-SUBMIT, then the MS shall automatically
// repeat the SMS-SUBMIT but must use the same TP-MR value and set the
// TP-RD bit to 1". Here that is: the final's wait or the report's run
// out; a final of 408 or 504 — no response in time, the server's own
// (RFC 3261 21.4.9) or one it waited for (21.5.5), so what became of
// the MESSAGE past it is as unknown as with no final; an RP-ERROR whose
// cause invites another attempt at once (RpCauseIsTemporary). The
// repeat is a MESSAGE of its own — its Call-ID, the next RP-MR — with
// the same SMS-SUBMIT, TP-RD set. A service centre that has the first
// "should discard" the repeat and answer it with an RP-ERROR whose
// TP-FCS is the duplicate rejection (0xC5), or with an RP-ACK (9.2.3.6
// again): either ends the segment as accepted — the rejection only
// where no RP-ERROR has refused the first attempt by then — and so
// does the first attempt's own RP-ACK when it comes after the repeat
// went out; its RP-ERROR then leaves the segment to the repeat's
// answer, and one that comes once that answer has ended the segment
// changes nothing (OnSmsMessage logs it). Any
// other refusal — a final that is neither of the two, an RP-ERROR with
// another cause, a flow that is down — fails the message at once, and
// so does whatever ends the repeat short of an acceptance; the reason
// then names the first attempt's end as well. Not done of the clause's
// repeat: it cannot be switched off, and a failed message is not kept
// for the user to send again under its TP-MR.
class SmsOutbound {
public:
struct Params {
@ -1192,10 +1226,10 @@ export namespace imsd::engine {
// `submitted`: where each MESSAGE this message goes out in is put on record
SmsOutbound(const imsd::msg::Context& ctx, imsd::util::Rng& rng, RecentSubmissions& submitted, std::string id, Params p)
: ctx_(ctx), rng_(rng), submitted_(submitted), id_(std::move(id)), p_(std::move(p)) {}
: ctx_(ctx), rng_(rng), submitted_(submitted), id_(std::move(id)), p_(std::move(p)), nextRpMr_(p_.rpMr) {}
const std::string& Id() const { return id_; }
// the segment in flight's MESSAGE (empty before the first went out)
// the MESSAGE in flight — the segment in flight's latest (empty before the first went out)
const std::string& CallId() const { return callid_; }
Phase State() const { return phase_; }
bool Done() const { return phase_ == Phase::Done; }
@ -1205,6 +1239,11 @@ export namespace imsd::engine {
// later status report to this message
const std::vector<std::uint8_t>& TpMrs() const { return tpMrs_; }
std::size_t Segments() const { return tpdus_.size(); }
// The RP-MR after the last this message used — every MESSAGE built
// for it took the next one from `rpMr` on, one the flow could not
// send as well: where the shell's counter goes on once the message
// has ended.
std::uint8_t NextRpMr() const { return nextRpMr_; }
// Builds the segments and sends the first. A destination that is
// no number, or a text past 255 segments, fails the message at once.
@ -1223,13 +1262,16 @@ export namespace imsd::engine {
out.push_back(Fail("no service centre (none from SMSC= or EF_SMSP)"));
return out;
}
s.rejectDuplicates = true; // each segment's repeat: the same SMS-SUBMIT with TP-RD set
repeats_ = imsd::sms::BuildSubmits(s, p_.text, p_.concatRef);
for (std::size_t i = 0; i < tpdus_.size(); i++) tpMrs_.push_back(static_cast<std::uint8_t>((p_.tpMr + i) & 0xFF));
SendSegment(out, now);
return out;
}
// The segment in flight's MESSAGE: its final is matched by Call-ID
// and CSeq.
// The MESSAGE in flight: its final is matched by Call-ID and CSeq.
// The first attempt's final, come after the repeat went out, is
// nobody's.
bool OwnsResponse(std::string_view msg) const {
return phase_ == Phase::Sending && imsd::sip::ResponseOf(msg, callid_, "1 MESSAGE");
}
@ -1242,8 +1284,13 @@ export namespace imsd::engine {
return out;
}
if (status >= 300) {
std::string why = std::format("segment {}/{} refused: {}", seg_ + 1, tpdus_.size(), imsd::sip::RefusalSummary(msg));
if (status == 408 || status == 504) { // Request Timeout, Server Time-out: no word on the MESSAGE's fate
EndAttempt(out, now, std::move(why));
return out;
}
phase_ = Phase::Done;
out.push_back(Fail(std::format("segment {}/{} refused: {}", seg_ + 1, tpdus_.size(), imsd::sip::RefusalSummary(msg))));
out.push_back(Fail(std::move(why)));
return out;
}
phase_ = Phase::AwaitingReport;
@ -1252,51 +1299,79 @@ export namespace imsd::engine {
return out;
}
// Whether an RP-ACK/RP-ERROR the IP-SM-GW sent is this segment's:
// In-Reply-To names our MESSAGE (TS 24.341 5.3.1.2), or — from an
// IP-SM-GW that sends none — the RP-MR is the one in flight. A
// report arriving before the MESSAGE's own final (the IP-SM-GW's
// order is its own) is taken as well.
bool OwnsReport(std::string_view inReplyTo, std::optional<std::uint8_t> rpMr) const {
if (phase_ != Phase::AwaitingReport && phase_ != Phase::Sending) return false;
if (!inReplyTo.empty()) // a list of Call-IDs (RFC 3261 20.21): ours among them
return std::ranges::contains(InReplyToCallIds(inReplyTo), std::string_view(callid_));
return rpMr && *rpMr == CurrentRpMr();
// Which of the segment in flight's MESSAGEs an RP-ACK/RP-ERROR the
// IP-SM-GW sent answers — 0 the first, 1 its repeat — or none of
// them: by In-Reply-To when the report has one (TS 24.341 5.3.1.2;
// the later MESSAGE when it lists both), else — from an IP-SM-GW
// that sends none — by RP-MR. A report arriving before the
// MESSAGE's own final (the IP-SM-GW's order is its own) is taken as
// well.
std::optional<std::size_t> ReportAttempt(std::string_view inReplyTo, std::optional<std::uint8_t> rpMr) const {
if (phase_ != Phase::AwaitingReport && phase_ != Phase::Sending) return std::nullopt;
const std::vector<std::string_view> named = InReplyToCallIds(inReplyTo); // a list of Call-IDs (RFC 3261 20.21): ours among them
for (std::size_t k = attempts_.size(); k-- > 0;) {
if (!inReplyTo.empty() ? std::ranges::contains(named, std::string_view(attempts_[k].callid)) : rpMr && *rpMr == attempts_[k].rpMr) return k;
}
return std::nullopt;
}
// The submit report for the segment in flight: an RP-ACK moves to
// the next segment, or ends the message as sent; an RP-ERROR fails
// it with its cause. The shell answers the report's MESSAGE
// itself.
std::vector<SmsAction> OnReport(const imsd::sms::Rp& rp, double now) {
// The submit report for the segment in flight, answering its
// MESSAGE number `attempt` (ReportAttempt; none given: the one in
// flight). An RP-ACK to either attempt moves to the next segment,
// or ends the message as sent. An RP-ERROR to the first attempt,
// come after its repeat went out, changes what is known of that
// attempt and nothing else: the repeat's answer ends the segment.
// An RP-ERROR to the attempt in flight: the duplicate rejection
// (TP-FCS 0xC5) of a repeat whose first attempt no RP-ERROR has
// refused so far is taken for that attempt accepted, whatever RP
// cause comes with it — 9.2.3.6 has the service centre discard a
// repeat of what it has —; a cause that
// invites another attempt at once (RpCauseIsTemporary) ends the
// attempt — the repeat follows, or the message has failed —; any
// other fails the message with its cause. The shell answers the
// report's MESSAGE itself.
std::vector<SmsAction> OnReport(const imsd::sms::Rp& rp, double now, std::optional<std::size_t> attempt = std::nullopt) {
std::vector<SmsAction> out;
if (phase_ != Phase::AwaitingReport && phase_ != Phase::Sending) return out;
const std::size_t inFlight = attempts_.size() - 1;
const std::size_t answered = std::min(attempt.value_or(inFlight), inFlight);
const bool late = answered < inFlight; // the first attempt's report, after the repeat went out
if (rp.type == imsd::sms::RpType::ErrorMt) {
std::string why = std::format("segment {}/{} refused by the SC: {}", seg_ + 1, tpdus_.size(), RpErrorWords(rp));
if (late) {
out.push_back(LogAct(std::format("sms {}: {}, in the first attempt's report, which came after the repeat went out: the repeat's decides", id_, why)));
firstRefused_ = true;
firstWhy_ = why + ", in a report that came after the repeat went out";
return out;
}
const auto report = imsd::sms::ParseSubmitReport(rp.tpdu, true);
if (answered > 0 && !firstRefused_ && report && report->failureCause == imsd::sms::FcsDuplicateRejected) {
out.push_back(LogAct(std::format("sms {}: segment {}/{}: the repeat was rejected as a duplicate ({}): the first attempt is taken for accepted", id_, seg_ + 1, tpdus_.size(), RpErrorWords(rp))));
Accepted(out, now);
return out;
}
if (imsd::sms::RpCauseIsTemporary(rp.cause.value_or(0))) {
firstRefused_ = true;
EndAttempt(out, now, std::move(why));
return out;
}
phase_ = Phase::Done;
out.push_back(Fail(std::format("segment {}/{} refused by the SC: {}", seg_ + 1, tpdus_.size(), RpErrorWords(rp))));
out.push_back(Fail(std::move(why)));
return out;
}
if (rp.type != imsd::sms::RpType::AckMt) return out;
if (late) out.push_back(LogAct(std::format("sms {}: segment {}/{}: the first attempt's submit report came after the repeat went out: accepted", id_, seg_ + 1, tpdus_.size())));
if (auto r = imsd::sms::ParseSubmitReport(rp.tpdu, false); r && !r->scts.empty()) scts_ = r->scts;
seg_++;
if (seg_ < tpdus_.size()) { SendSegment(out, now); return out; }
phase_ = Phase::Done;
deadline_ = 0;
out.push_back(StateAct(SmsStateSent, scts_.empty() ? std::format("{} segment(s) accepted by the SC", tpdus_.size()) : std::format("{} segment(s) accepted by the SC at {}", tpdus_.size(), scts_)));
Accepted(out, now);
return out;
}
// The wait ran out: no final to the MESSAGE, or no submit report.
std::vector<SmsAction> OnDeadline() {
std::vector<SmsAction> OnDeadline(double now) {
std::vector<SmsAction> out;
if (phase_ == Phase::Sending) {
phase_ = Phase::Done;
out.push_back(Fail(std::format("no answer to the MESSAGE of segment {}/{} within {:.0f} s", seg_ + 1, tpdus_.size(), SmsSendTimeout)));
} else if (phase_ == Phase::AwaitingReport) {
phase_ = Phase::Done;
out.push_back(Fail(std::format("no submit report for segment {}/{} within {:.0f} s of the final", seg_ + 1, tpdus_.size(), SmsReportTimeout)));
}
deadline_ = 0;
if (phase_ == Phase::Sending) EndAttempt(out, now, std::format("no answer to the MESSAGE of segment {}/{} within {:.0f} s", seg_ + 1, tpdus_.size(), SmsSendTimeout));
else if (phase_ == Phase::AwaitingReport) EndAttempt(out, now, std::format("no submit report for segment {}/{} within {:.0f} s of the final", seg_ + 1, tpdus_.size(), SmsReportTimeout));
else deadline_ = 0;
return out;
}
@ -1304,26 +1379,62 @@ export namespace imsd::engine {
std::vector<SmsAction> OnSendFailed() {
std::vector<SmsAction> out;
phase_ = Phase::Done;
deadline_ = 0;
out.push_back(Fail(std::format("segment {}/{} not sent: the flow to the P-CSCF is down", seg_ + 1, tpdus_.size())));
return out;
}
private:
std::uint8_t CurrentRpMr() const { return static_cast<std::uint8_t>((p_.rpMr + seg_) & 0xFF); }
// One MESSAGE the segment in flight went out in.
struct Attempt { std::string callid; std::uint8_t rpMr = 0; };
// The segment in flight as a MESSAGE: the first attempt with the
// SMS-SUBMIT as built, the repeat with TP-RD set in it, each under a
// Call-ID of its own and the next RP-MR, so a report without
// In-Reply-To still tells the two.
void SendSegment(std::vector<SmsAction>& out, double now) {
const bool repeat = !attempts_.empty();
const std::vector<std::uint8_t>& tpdu = repeat ? repeats_[seg_] : tpdus_[seg_];
callid_ = std::format("{}@{}", rng_.Token(16), ctx_.local);
attempts_.push_back({callid_, nextRpMr_++});
submitted_.Sent(callid_, id_, seg_ + 1, tpdus_.size(), now);
std::vector<std::uint8_t> rp = imsd::sms::BuildRpData(CurrentRpMr(), p_.scAddress, tpdus_[seg_]);
std::vector<std::uint8_t> rp = imsd::sms::BuildRpData(attempts_.back().rpMr, p_.scAddress, tpdu);
out.push_back(SmsAction{SmsAction::Type::SendClient, imsd::msg::BuildMessageSms(ctx_, p_.scTarget, callid_, rng_.Token(8), rng_.Token(16), rp)});
out.push_back(LogAct(std::format("sms {}: segment {}/{} to {} via {}: MESSAGE sent (RP-MR {}, TP-MR {}, {} bytes)", id_, seg_ + 1, tpdus_.size(), p_.number, p_.scTarget, CurrentRpMr(), tpMrs_[seg_], tpdus_[seg_].size())));
out.push_back(LogAct(std::format("sms {}: segment {}/{} to {} via {}: MESSAGE sent{} (RP-MR {}, TP-MR {}{}, {} bytes)", id_, seg_ + 1, tpdus_.size(), p_.number, p_.scTarget, repeat ? " again" : "", attempts_.back().rpMr, tpMrs_[seg_], repeat ? " with TP-RD" : "", tpdu.size())));
phase_ = Phase::Sending;
deadline_ = now + SmsSendTimeout;
}
// The attempt in flight ended without the service centre's word, or
// with RP cause 41 or one read as it (RpCauseIsTemporary): the
// repeat when the segment has had none, else the message has failed.
void EndAttempt(std::vector<SmsAction>& out, double now, std::string why) {
if (attempts_.size() >= SmsAttempts) {
phase_ = Phase::Done;
out.push_back(Fail(std::move(why)));
return;
}
out.push_back(LogAct(std::format("sms {}: {}; sending the segment again, TP-RD set", id_, why)));
firstWhy_ = std::move(why);
SendSegment(out, now);
}
// The service centre has the segment in flight: the next one, or
// the message is sent.
void Accepted(std::vector<SmsAction>& out, double now) {
seg_++;
attempts_.clear();
firstRefused_ = false;
if (seg_ < tpdus_.size()) { SendSegment(out, now); return; }
phase_ = Phase::Done;
deadline_ = 0;
out.push_back(StateAct(SmsStateSent, scts_.empty() ? std::format("{} segment(s) accepted by the SC", tpdus_.size()) : std::format("{} segment(s) accepted by the SC at {}", tpdus_.size(), scts_)));
}
// `failed` with the reason; of a segment that was sent again, how
// the first attempt ended as well.
SmsAction Fail(std::string why) {
deadline_ = 0;
if (attempts_.size() > 1) why += std::format("; the first attempt: {}", firstWhy_);
return StateAct(SmsStateFailed, std::move(why));
}
SmsAction StateAct(std::string_view state, std::string reason) {
@ -1340,10 +1451,15 @@ export namespace imsd::engine {
RecentSubmissions& submitted_;
std::string id_;
Params p_;
std::vector<std::vector<std::uint8_t>> tpdus_;
std::uint8_t nextRpMr_; // the RP-MR the next MESSAGE takes
std::vector<std::vector<std::uint8_t>> tpdus_; // each segment's SMS-SUBMIT
std::vector<std::vector<std::uint8_t>> repeats_; // the same with TP-RD set, for a segment's repeat
std::vector<std::uint8_t> tpMrs_;
std::size_t seg_ = 0;
std::string callid_; // the segment in flight's MESSAGE
std::vector<Attempt> attempts_; // the MESSAGEs the segment in flight went out in: the first, then its repeat
std::string firstWhy_; // how the first attempt ended, once the segment was sent again
bool firstRefused_ = false; // an RP-ERROR has answered an attempt of the segment in flight: where a repeat's duplicate rejection reads it, the first
std::string callid_; // the MESSAGE in flight
std::string scts_; // the SC's time stamp from the last RP-ACK's submit report
Phase phase_ = Phase::Idle;
double deadline_ = 0;
@ -1576,8 +1692,8 @@ export namespace imsd::engine {
if (rp.type == RpType::AckMt || rp.type == RpType::ErrorMt) {
std::string inReplyTo; // every In-Reply-To row: the rows are one list (RFC 3261 7.3.1)
for (std::string_view row : imsd::sip::Headers(message, "In-Reply-To")) inReplyTo.append(inReplyTo.empty() ? "" : ",").append(row);
if (outbound && outbound->OwnsReport(inReplyTo, rp.mr)) {
r.actions = outbound->OnReport(rp, now);
if (const auto attempt = outbound ? outbound->ReportAttempt(inReplyTo, rp.mr) : std::nullopt) {
r.actions = outbound->OnReport(rp, now, *attempt);
return r;
}
if (!inReplyTo.empty()) {