From ef64c3069e0b3a8917878670ef536f442da6f7d8 Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Tue, 17 Sep 2024 12:07:54 +0200 Subject: [PATCH] MT#60476 sdp_create: keep an original media port for message/force relay Always keep an original media port for message or force relay. Change-Id: I77e148ca9dcee176e75334813dd0df328c2e4c47 --- daemon/sdp.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/daemon/sdp.c b/daemon/sdp.c index b8c2515be..d6744dbaa 100644 --- a/daemon/sdp.c +++ b/daemon/sdp.c @@ -3870,6 +3870,16 @@ int sdp_create(str *out, struct call_monologue *monologue, sdp_ng_flags *flags) /* set port to 0 in case when there is no FD found (usecase with OSRTP scenarios) */ port = rtp_ps->selected_sfd ? rtp_ps->selected_sfd->socket.local.port : 0; + /* we want to keep an original media port for message or force relay */ + if (media->type_id == MT_MESSAGE || flags->ice_option == ICE_FORCE_RELAY) { + struct media_subscription *ms = media->media_subscriptions.head ? media->media_subscriptions.head->data : NULL; + if (ms && ms->media && ms->media->streams.head) + { + __auto_type sub_ps = ms->media->streams.head->data; + port = sub_ps->advertised_endpoint.port; + } + } + prtp = NULL; if (media->protocol && media->protocol->srtp) prtp = &transport_protocols[media->protocol->rtp_proto];