falconia has uploaded this change for review.

View Change

TW-TS-* support: pass RTP extensions to MGW

As of 2025-03-10 (I0d58e6d84418f50670c8ab7cf8490af3bc2f5c26 merge)
OsmoMGW supports an SDP extension that enables the use of TW-TS-001
and TW-TS-002 enhanced RTP formats for FR/EFR and HRv1, respectively;
libosmo-mgcp-client likewise supports a mechanism to request these
extensions. At the present time OsmoMGW rtpbridge endpoints don't
do anything different when these extensions are enabled (they
originate from OsmoBTS in this case), but for E1 Abis endpoints
the new MGCP extension controls whether or not these MGW endpoints
emit the enhanced RTP formats in question.

Changes to OsmoBSC:

1) Allow TW-TS-001 and TW-TS-002 to be enabled on all E1 BTS -
previously not allowed.

2) Whether E1-based or IP-based BTS are used, when RTP extensions
have been enabled by CN request (BSSMAP IE of TW-TS-003),
pass them to the MGW endpoint controlled by this BSC.

The second change makes RTP extensions work on E1 BTS, and also
paves the way for future OsmoMGW rtpbridge improvements where
the MGW might do additional processing that needs to be disabled
when TW-TS-* extensions are in use.

Depends: osmo-mgw.git I0d58e6d84418f50670c8ab7cf8490af3bc2f5c26
Change-Id: Iaa6e4c56313f06b79852c06dcec686f21950e638
---
M TODO-RELEASE
M src/osmo-bsc/assignment_fsm.c
M src/osmo-bsc/lchan_rtp_fsm.c
3 files changed, 38 insertions(+), 2 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/98/39798/1
diff --git a/TODO-RELEASE b/TODO-RELEASE
index 0ed7189..c6495da 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -7,3 +7,4 @@
# If any interfaces have been added since the last public release: c:r:a + 1.
# If any interfaces have been removed or changed since the last public release: c:r:0.
#library what description / commit summary line
+libosmo-mgcp-client bump_dep Depend on I0d58e6d84418f50670c8ab7cf8490af3bc2f5c26
diff --git a/src/osmo-bsc/assignment_fsm.c b/src/osmo-bsc/assignment_fsm.c
index 79c4ac7..4c54632 100644
--- a/src/osmo-bsc/assignment_fsm.c
+++ b/src/osmo-bsc/assignment_fsm.c
@@ -541,6 +541,11 @@
* This function checks whether or not we can fulfill that request
* based on BTS capabilities, and sets the bitmask of accepted extensions
* that will be passed on to the BTS via Abis RSL.
+ *
+ * Note that specific BTS features are needed only for IP-based BTS;
+ * for E1 BTS no special support is needed from the BTS itself in order
+ * to enable these RTP extensions, as they are implemented entirely
+ * in the BSC-controlled MGW in this case.
*/
static void handle_rtp_extensions(struct gsm_subscriber_connection *conn,
struct gsm_bts *bts)
@@ -550,11 +555,11 @@
uint8_t accepted_ext = 0;

if ((requested_ext & OSMO_RTP_EXT_TWTS001) &&
- osmo_bts_has_feature(&bts->features, BTS_FEAT_TWTS001))
+ (osmo_bts_has_feature(&bts->features, BTS_FEAT_TWTS001) || is_e1_bts(bts)))
accepted_ext |= OSMO_RTP_EXT_TWTS001;

if ((requested_ext & OSMO_RTP_EXT_TWTS002) &&
- osmo_bts_has_feature(&bts->features, BTS_FEAT_TWTS002))
+ (osmo_bts_has_feature(&bts->features, BTS_FEAT_TWTS002) || is_e1_bts(bts)))
accepted_ext |= OSMO_RTP_EXT_TWTS002;

conn->user_plane.rtp_extensions = accepted_ext;
diff --git a/src/osmo-bsc/lchan_rtp_fsm.c b/src/osmo-bsc/lchan_rtp_fsm.c
index e8384c6..559a30b 100644
--- a/src/osmo-bsc/lchan_rtp_fsm.c
+++ b/src/osmo-bsc/lchan_rtp_fsm.c
@@ -21,6 +21,7 @@
*/

#include <osmocom/core/fsm.h>
+#include <osmocom/gsm/rtp_extensions.h>
#include <osmocom/netif/rtp.h>
#include <osmocom/mgcp_client/mgcp_client_endpoint_fsm.h>

@@ -954,6 +955,35 @@
else if (!bss_side && verb_info->codecs[0] == CODEC_AMR_8000_1) {
verb_info->param.amr_octet_aligned = lchan->conn->sccp.msc->amr_octet_aligned;
}
+
+ /* If the CN has requested RTP payload format extensions (change from
+ * RFC 3551 to TW-TS-001 for FR/EFR, or from RFC 5993 to TW-TS-002
+ * for HRv1) via BSSMAP IE of TW-TS-003, we need to pass this request
+ * to the MGW. With E1 BTS our MGW is the origin of the RTP stream
+ * and thus the party responsible for payload format choices; with
+ * IP BTS our MGW is merely a forwarder and thus can get by without
+ * this detailed knowledge, but it doesn't hurt to inform the MGW
+ * in all cases.
+ *
+ * Note that the following code does not perform conditional checks
+ * of whether the selected codec is FR/EFR for TW-TS-001 or HRv1
+ * for TW-TS-002, but instead checks only the extension mode bits.
+ * This simplification is allowed by libosmo-mgcp-client API:
+ * struct mgcp_codec_param has dedicated fields for fr_efr_twts001
+ * and hr_twts002 parameters, and the code in libosmo-mgcp-client
+ * then emits the corresponding a=fmtp lines only when the SDP
+ * includes those codecs to which these attributes apply.
+ */
+ if (lchan->conn->user_plane.rtp_extensions & OSMO_RTP_EXT_TWTS001) {
+ verb_info->param_present = true;
+ verb_info->param.fr_efr_twts001_present = true;
+ verb_info->param.fr_efr_twts001 = true;
+ }
+ if (lchan->conn->user_plane.rtp_extensions & OSMO_RTP_EXT_TWTS002) {
+ verb_info->param_present = true;
+ verb_info->param.hr_twts002_present = true;
+ verb_info->param.hr_twts002 = true;
+ }
}

bool mgcp_codec_is_picked(const struct mgcp_conn_peer *verb_info, enum mgcp_codecs codec)

To view, visit change 39798. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Iaa6e4c56313f06b79852c06dcec686f21950e638
Gerrit-Change-Number: 39798
Gerrit-PatchSet: 1
Gerrit-Owner: falconia <falcon@freecalypso.org>