From 12f935db9c6efa4b2b51f147b4d1186b2f5cdc00 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Fri, 6 Feb 2026 12:09:46 -0400 Subject: [PATCH] MT#55283 support bidirectional publish Change-Id: I530dbe297e839560055da94911a73e7c14e08dc0 --- daemon/call.c | 5 +++- daemon/call_interfaces.c | 3 ++ docs/ng_control_protocol.md | 5 ++++ include/call_interfaces.h | 1 + t/auto-daemon-tests-pubsub.pl | 53 +++++++++++++++++++++++++++++++++++ 5 files changed, 66 insertions(+), 1 deletion(-) diff --git a/daemon/call.c b/daemon/call.c index 0e3d0edbd..2d2401540 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -4334,8 +4334,11 @@ int monologue_publish(struct call_monologue *ml, sdp_streams_q *streams, sdp_ng_ if (codec_store_accept_one(&media->codecs, &flags->codec_accept, !!flags->accept_any)) return -1; - // the most we can do is receive + // we can definitely receive if needed bf_copy(&media->media_flags, MEDIA_FLAG_RECV, &sp->sp_flags, SP_FLAG_SEND); + // and also send if so desired + if (flags->bidirectional) + bf_copy(&media->media_flags, MEDIA_FLAG_SEND, &sp->sp_flags, SP_FLAG_RECV); if (sp->rtp_endpoint.port) { __dtls_logic(flags, media, sp); diff --git a/daemon/call_interfaces.c b/daemon/call_interfaces.c index a6c791adf..dc3284d03 100644 --- a/daemon/call_interfaces.c +++ b/daemon/call_interfaces.c @@ -1110,6 +1110,9 @@ void call_ng_flags_flags(str *s, unsigned int idx, helper_arg arg) { case CSH_LOOKUP("player"): out->audio_player = AP_TRANSCODING; break; + case CSH_LOOKUP("bidirectional"): + out->bidirectional = true; + break; case CSH_LOOKUP("block-dtmf"): case CSH_LOOKUP("block-DTMF"): case CSH_LOOKUP("block dtmf"): diff --git a/docs/ng_control_protocol.md b/docs/ng_control_protocol.md index dce216b0b..fbf487e5e 100644 --- a/docs/ng_control_protocol.md +++ b/docs/ng_control_protocol.md @@ -1043,6 +1043,11 @@ Spaces in each string may be replaced by hyphens. Corresponds to the *rtpproxy* `a` flag. Advertises an RTP endpoint which uses asymmetric RTP, which disables learning of endpoint addresses (see below). +* `bidirectional` + + For `publish` messages, support bidirectional media flow, i.e. don't + respond with `recvonly` media but instead respond with `sendrecv`. + * `block DTMF` Useful in `offer` or `answer` messages to immdiately enable DTMF blocking diff --git a/include/call_interfaces.h b/include/call_interfaces.h index 1f3f1776b..d3f7aee4f 100644 --- a/include/call_interfaces.h +++ b/include/call_interfaces.h @@ -298,6 +298,7 @@ RTPE_NG_FLAGS_STR_CASE_HT_PARAMS nat_wait:1, pierce_nat:1, directional:1, + bidirectional:1, fatal:1, new_branch:1, provisional:1, diff --git a/t/auto-daemon-tests-pubsub.pl b/t/auto-daemon-tests-pubsub.pl index c7c7234a7..94362b5ef 100755 --- a/t/auto-daemon-tests-pubsub.pl +++ b/t/auto-daemon-tests-pubsub.pl @@ -4339,5 +4339,58 @@ is($resp->{interfaces}[1]{ports}{used}, 2, 'port usage'); +new_call; + +publish('sendrecv pub control', + { }, < ['bidirectional'] }, <