diff --git a/daemon/call.c b/daemon/call.c index 427a11ac5..741c130ff 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -2679,6 +2679,10 @@ static void __call_monologue_init_from_flags(struct call_monologue *ml, struct c ml->sdp_session_bandwidth.ct = flags->session_bandwidth.ct; if (flags->session_bandwidth.tias >= 0) ml->sdp_session_bandwidth.tias = flags->session_bandwidth.tias; + /* sdp session group */ + if (flags->session_group.len) + ml->sdp_session_group = call_strdup_len(call, flags->session_group.s, + flags->session_group.len); } // reset offer ipv4/ipv6/mixed media stats diff --git a/daemon/sdp.c b/daemon/sdp.c index 50463b3b1..6be4fe28c 100644 --- a/daemon/sdp.c +++ b/daemon/sdp.c @@ -1849,6 +1849,10 @@ int sdp_streams(const sdp_sessions_q *sessions, sdp_streams_q *streams, sdp_ng_f flags->session_bandwidth = session->bandwidth; flags->session_timing = session->session_timing; + attr = attr_get_by_id(&session->attributes, ATTR_GROUP); + if (attr) + flags->session_group = attr->strs.value; + for (__auto_type k = session->media_streams.head; k; k = k->next) { media = k->data; @@ -3621,6 +3625,8 @@ static void sdp_out_add_other(GString *out, struct call_monologue *monologue, bool media_has_ice = MEDIA_ISSET(media, ICE); bool media_has_ice_lite_self = MEDIA_ISSET(media, ICE_LITE_SELF); + struct media_subscription *ms = call_get_top_media_subscription(monologue); + /* add loop protectio if required */ if (flags->loop_protect) g_string_append_printf(out, "a=rtpengine:"STR_FORMAT"\r\n", STR_FMT(&rtpe_instance_id)); @@ -3629,6 +3635,10 @@ static void sdp_out_add_other(GString *out, struct call_monologue *monologue, if (media_has_ice && media_has_ice_lite_self) g_string_append_printf(out, "a=ice-lite\r\n"); + /* group */ + if (ms && ms->monologue && ms->monologue->sdp_session_group && flags->ice_option == ICE_FORCE_RELAY) + g_string_append_printf(out, "a=group:%s\r\n", ms->monologue->sdp_session_group); + /* carry other session level a= attributes to the outgoing SDP */ monologue->sdp_attr_print(out, monologue, flags); } diff --git a/include/call.h b/include/call.h index e189648da..e0be9c323 100644 --- a/include/call.h +++ b/include/call.h @@ -594,6 +594,7 @@ struct call_monologue { char *sdp_session_name; char *sdp_session_timing; + char *sdp_session_group; /* a=group: e.g. BUNDLE */ struct ssrc_hash *ssrc_hash; str metadata; struct janus_session *janus_session; diff --git a/include/call_interfaces.h b/include/call_interfaces.h index 57667972b..936e6af4d 100644 --- a/include/call_interfaces.h +++ b/include/call_interfaces.h @@ -67,6 +67,7 @@ struct sdp_ng_flags { str session_timing; /* t= line */ struct session_bandwidth session_bandwidth; + str session_group; /* a=group: e.g. BUNDLE */ /* commands to manipulate attr lines in SDP */ struct sdp_manipulations * sdp_manipulations[__MT_MAX];