imsd: when the client flow is found dead before any response to a call's INVITE, one reconnect and the INVITE again, else the call ends
A flow that is dead in a way imsd has not seen yet, the peer having dropped the connection's state, shows itself at the next bytes sent on it, where the peer answers them with a reset. Where those bytes were an outgoing call's INVITE, imsd read the reset, marked the flow dead and did nothing more for the call: no reconnect runs while a call is up, so the attempt stayed in `dialing` until its setup deadline, 90 s, sent a CANCEL that could not go out and was given up 10 s later, where a call that is no emergency call ends (`setup deadline expired`); the flow was reconnected only once the call was gone. Against a stand-in network that forgets a flow after 20 s of silence, 1.2.3's call ended 100 s after the Dial. The engine's loop now takes such a call up (MaybeResendInvite). When the client flow is found dead under an outgoing attempt whose INVITE has had no response, a 100 included, and no CANCEL, the dead socket is closed without a FIN's exchange, the flow is reopened with one connect and the same INVITE is sent again, the setup deadline running from then. Once per attempt: an emergency call's fallback attempt has a resend of its own. The INVITE is the first one byte for byte, its branch included, so a server that did receive the first matches the second to its transaction (RFC 3261 17.2.3). No REGISTER goes first: the registration and its SAs stand, and TS 33.203 7.1 has a UE with no TCP connection towards the P-CSCF set one up before it sends a request. Where a reg-event NOTIFY has ended the binding nothing is reopened. 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`, an emergency call's first attempt too: there is no flow for its fallback. The recovery policy takes the flow up once the call is gone, as before. The close without a FIN's exchange is for a flow the peer closed: closed the usual way, such a socket stays in the kernel's table until the peer has acknowledged imsd's own FIN, and a connect from its port before that is refused. A reset goes out in the FIN's place there; after a reset or the kernel's own giving up the socket is closed already and nothing is sent; and the reopen runs on a flow already found dead only. The recovery's reconnect closes the usual way, as before, and connects once more 10 s after such a refusal (one is in a user's log on O2, 2026-09-24, in the second the flow was found dead). Not changed: 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 unacknowledged bytes, 924.6 s or more after them by its default tcp_retries2, so an attempt whose own INVITE is the first such bytes gets no response and is cancelled at its setup deadline, as before; a flow found dead after a response to the INVITE is not reopened, as before; a Dial whose INVITE cannot be sent ends its call at once, as before. Tested: tests/Engine (which attempt is sent again, the same bytes, once per attempt, the deadline anew, the call's end where the flow is lost); the daemon of this commit and 1.2.3's on the workstation against a stand-in network (the fp6 journal's 2026-11-24-crlf-keepalive capture, bench-dial.sh): a flow the network forgot, reopened and the INVITE answered 486 as on a live flow, where 1.2.3's call ended after 100 s; a flow the network closed at the INVITE, with the acknowledgement of the daemon's close kept back; one that died on the daemon's side at the kernel's retransmission limit; a network that takes no new connection, one that resets the second INVITE's flow too and one that has ended the binding, where the call ended within a second; UDP. And on the dev phone on KPN, the binary of the range's tip: 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: reopened from the same port, the INVITE again 2.1 s after the death was found, answered 0.2 s later. By a call, no P-CSCF that had dropped a flow's state has been met, and none that had received the first INVITE before the flow died.
This commit is contained in:
parent
d3e495c333
commit
0aea0dac7f
4 changed files with 231 additions and 9 deletions
72
AGENTS.md
72
AGENTS.md
|
|
@ -158,7 +158,13 @@ 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). SMS over IP (1.2.0, §7.9) keeps in the
|
||||
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 attempt 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). 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
|
||||
|
|
@ -414,7 +420,10 @@ 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, DTMF — sent to the leg on an active call that negotiated
|
||||
emergency chain, an attempt's INVITE with no response and no CANCEL yet
|
||||
sent again over a flow the shell reopened, byte for byte and once per
|
||||
attempt, 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
|
||||
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
|
||||
|
|
@ -948,6 +957,40 @@ Rules:
|
|||
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.
|
||||
- `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,
|
||||
|
|
@ -1579,7 +1622,24 @@ sent, emit this D-Bus state change, arm this deadline). States and reasons are t
|
|||
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 with
|
||||
`refused-or-busy` or `error`.
|
||||
`refused-or-busy` or `error`. 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 per attempt of the emergency chain, 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.
|
||||
- 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
|
||||
|
|
@ -1592,7 +1652,8 @@ sent, emit this D-Bus state change, arm this deadline). States and reasons are t
|
|||
`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`.
|
||||
re-attempted as `urn:service:sos`. An attempt whose client flow is lost
|
||||
(above) ends the call there: no fallback follows it.
|
||||
- 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
|
||||
|
|
@ -1779,6 +1840,9 @@ 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.
|
||||
- `media <codec> 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
|
||||
|
|
|
|||
Loading…
Reference in a new issue