From 222cf4a4dfbbed562cf8c8537dfd9cc083db1e16 Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Mon, 12 Oct 2026 14:24:53 +0200 Subject: [PATCH] MT#66271 discard ICE agent when peer drops ice or `ICE=remove` Both mean that the ice towards the offerer gets rejected. When a certain peer who previously offered ice, sends SDP without ice (e.g. T.38 re-invite), or the ice was requested to be removed (when processing answer) with `ICE=remove` then the ice agent is left alive with its learned ufrag, candidates and succeeded pairs. The stream endpoint is then taken from that SDP (non-ice path). If this peer later offers ice again with the same credentials (e.g. falling back to audio after an error response like 488 for that T.38), then this stale agent is reused: `__fill_stream()` ignores the new endpoint because the ice data considered as unchanged, and then the `ice_update()` drops these candidates as duplicates. Therefore no connectivity checks run and then the endpoint stays at the old non-iced address. Media gets bound to the wrong port. Shutdown the ice agent whenever the peer's own sdp no longer carries ice, or we get the `ICE=remove`. Then the offered ice again later starts from scratch. Change-Id: I5ff3b6454262099022bf4f61c84b978835130dcc (cherry picked from commit 39fd49b6c4a05d4260c8c5405b2dcd79076ccb80) (cherry picked from commit 447f72278a6a5dfbb62aab6abc6f07969f59d98c) --- daemon/call.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/daemon/call.c b/daemon/call.c index 92b866103..1a812cdc0 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -2255,8 +2255,12 @@ static void __ice_init(struct call_media *media) { ice_shutdown(&media->ice_agent); return; } - if (!MEDIA_ISSET(media, ICE)) /* don't init new ICE agent but leave it running if there is one */ + if (!MEDIA_ISSET(media, ICE)) { + /* not doing ICE anymore with this peer, + * discard this agent, so that ice offered again later starts afresh */ + ice_shutdown(&media->ice_agent); return; + } ice_agent_init(&media->ice_agent, media); }