falconia has submitted this change. (
https://gerrit.osmocom.org/c/osmo-bsc/+/37129?usp=email )
Change subject: add support for RTP extensions via TW-TS-003
......................................................................
add support for RTP extensions via TW-TS-003
Themyscira Wireless Technical Specification TW-TS-003 defines
a mechanism whereby the CN can ask the BSS (via an extension to
BSSMAP Assignment procedure) to use enhanced RTP payload formats
that are contrary to the stipulations of 3GPP TS 48.103.
However, these RTP extensions need to originate at the BTS,
hence if the BSC receives a request from the CN to use them,
it needs to validate that request against BTS capabilities,
and then actually pass it to the BTS via an Osmocom-defined
RSL IE that replicates TW-TS-003 in Abis. Implement this logic.
Intra-BSC handovers: if ThemWi RTP extensions are used in a GSM
network that allows handovers, all deployed BTSes must have
the same capabilities with regard to these extensions, practically
meaning same or close-enough version of OsmoBTS. OsmoBSC checks
CN-requested RTP extensions against BTS capabilities on the
initial assignment, but not on subsequent handovers.
Inter-BSC handovers: support for RTP extensions in this deployment
configuration (networks that allow such handovers) remains to be
implemented.
OsmoMGW considerations: if all deployed BTSes are native IP
OsmoBTS, as opposed to E1-based, OsmoMGW does not need to know
anything at all about ThemWi RTP extensions. However, future
support for these RTP extensions with E1-based BTSes will require
adding a mechanism for communicating the necessary non-standard
request to OsmoMGW.
LCLS considerations: enabling ThemWi RTP extensions affects only
the uplink RTP output path in OsmoBTS and not the path from RTP
input to downlink Tx. The latter path accepts both basic and
extended RTP formats; any ThemWi extensions in the incoming RTP
stream are harmlessly ignored. Therefore, activation of ThemWi
RTP extensions will have no impact on LCLS operation.
Related: OS#6448
Depends: I0eccfe5ddcf44f8f20440acb01e2d4870ec0cd91 (libosmocore)
Change-Id: I2a742afff160a9a8286633bf5ae0dd4a828c7a42
---
M include/osmocom/bsc/gsm_data.h
M src/osmo-bsc/abis_rsl.c
M src/osmo-bsc/assignment_fsm.c
M src/osmo-bsc/osmo_bsc_bssap.c
4 files changed, 120 insertions(+), 0 deletions(-)
Approvals:
fixeria: Looks good to me, but someone else must approve
Jenkins Builder: Verified
laforge: Looks good to me, approved
diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index bd51a42..6bffcc4 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -150,6 +150,7 @@
uint16_t msc_rtp_port;
bool use_osmux;
uint8_t osmux_cid;
+ uint8_t rtp_extensions;
/* Rate/codec setting in preference order (need at least 1 !) */
int n_ch_mode_rate;
@@ -359,6 +360,7 @@
/* RTP address where the MSC expects us to send the RTP stream coming from the BTS. */
char msc_assigned_rtp_addr[INET6_ADDRSTRLEN];
uint16_t msc_assigned_rtp_port;
+ uint8_t rtp_extensions;
/* The endpoint at the MGW used to join both BTS and MSC side connections, e.g.
* "rtpbridge/23@mgw". */
diff --git a/src/osmo-bsc/abis_rsl.c b/src/osmo-bsc/abis_rsl.c
index 49e8b52..9d922d0 100644
--- a/src/osmo-bsc/abis_rsl.c
+++ b/src/osmo-bsc/abis_rsl.c
@@ -3033,6 +3033,11 @@
if (lchan->abis_ip.osmux.use)
msgb_tlv_put(msg, RSL_IE_OSMO_OSMUX_CID, 1, &lchan->abis_ip.osmux.local_cid);
+ /* Are we serving a GSM subscriber for whom the CN requested
+ * the use of RTP extensions? */
+ if (lchan->conn && lchan->conn->user_plane.rtp_extensions)
+ msgb_tlv_put(msg, RSL_IE_OSMO_RTP_EXTENSIONS, 1,
+ &lchan->conn->user_plane.rtp_extensions);
msg->dst = rsl_chan_link(lchan);
@@ -3077,6 +3082,9 @@
msgb_tv_put(msg, RSL_IE_IPAC_RTP_PAYLOAD2, lchan->abis_ip.rtp_payload2);
if (lchan->abis_ip.osmux.use)
msgb_tlv_put(msg, RSL_IE_OSMO_OSMUX_CID, 1, &lchan->abis_ip.osmux.local_cid);
+ if (lchan->conn && lchan->conn->user_plane.rtp_extensions)
+ msgb_tlv_put(msg, RSL_IE_OSMO_RTP_EXTENSIONS, 1,
+ &lchan->conn->user_plane.rtp_extensions);
msg->dst = rsl_chan_link(lchan);
diff --git a/src/osmo-bsc/assignment_fsm.c b/src/osmo-bsc/assignment_fsm.c
index 5e98a28..79c4ac7 100644
--- a/src/osmo-bsc/assignment_fsm.c
+++ b/src/osmo-bsc/assignment_fsm.c
@@ -22,6 +22,8 @@
#include <osmocom/core/tdef.h>
#include <osmocom/gsm/gsm0808.h>
+#include <osmocom/gsm/rtp_extensions.h>
+#include <osmocom/gsm/bts_features.h>
#include <osmocom/mgcp_client/mgcp_client_endpoint_fsm.h>
@@ -172,6 +174,13 @@
msg->l3h[1] = msgb_l3len(msg) - 2;
}
+static void bssap_extend_twts003(struct msgb *msg, uint8_t accepted_ext)
+{
+ OSMO_ASSERT(msg->l3h[1] == msgb_l3len(msg) - 2); /*TL not in len */
+ msgb_tlv_put(msg, GSM0808_IE_THEMWI_RTP_EXTENSIONS, 1, &accepted_ext);
+ msg->l3h[1] = msgb_l3len(msg) - 2;
+}
+
static void send_assignment_complete(struct gsm_subscriber_connection *conn)
{
int rc;
@@ -267,6 +276,9 @@
conn->assignment.req.use_osmux)
bssap_extend_osmux(resp, osmux_cid);
+ if (conn->user_plane.rtp_extensions)
+ bssap_extend_twts003(resp, conn->user_plane.rtp_extensions);
+
rate_ctr_inc(rate_ctr_group_get_ctr(conn->sccp.msc->msc_ctrs,
MSC_CTR_BSSMAP_TX_DT1_ASSIGNMENT_COMPLETE));
rc = gscon_sigtran_send(conn, resp);
if (rc) {
@@ -478,6 +490,7 @@
.aoip = gscon_is_aoip(conn),
.msc_assigned_cic = conn->user_plane.msc_assigned_cic,
.msc_rtp_port = conn->user_plane.msc_assigned_rtp_port,
+ .rtp_extensions = conn->user_plane.rtp_extensions,
.n_ch_mode_rate = 1,
.ch_mode_rate_list = { lchan->current_ch_mode_rate },
.target_lchan = to_lchan,
@@ -522,6 +535,31 @@
return _reassignment_request(assign_for, lchan, NULL, new_lchan_type, -1, -1);
}
+/*
+ * The CN may have requested RTP extensions (payload format modifications
+ * contrary to the stipulations of TS 48.103) via BSSMAP IE of TW-TS-003.
+ * 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.
+ */
+static void handle_rtp_extensions(struct gsm_subscriber_connection *conn,
+ struct gsm_bts *bts)
+{
+ const struct assignment_request *req = &conn->assignment.req;
+ uint8_t requested_ext = req->rtp_extensions;
+ uint8_t accepted_ext = 0;
+
+ if ((requested_ext & OSMO_RTP_EXT_TWTS001) &&
+ osmo_bts_has_feature(&bts->features, BTS_FEAT_TWTS001))
+ accepted_ext |= OSMO_RTP_EXT_TWTS001;
+
+ if ((requested_ext & OSMO_RTP_EXT_TWTS002) &&
+ osmo_bts_has_feature(&bts->features, BTS_FEAT_TWTS002))
+ accepted_ext |= OSMO_RTP_EXT_TWTS002;
+
+ conn->user_plane.rtp_extensions = accepted_ext;
+}
+
void assignment_fsm_start(struct gsm_subscriber_connection *conn, struct gsm_bts *bts,
struct assignment_request *req)
{
@@ -553,6 +591,8 @@
return;
conn->assignment.ch_indctr = req->ch_indctr;
+ handle_rtp_extensions(conn, bts);
+
if (!req->target_lchan && reuse_existing_lchan(conn)) {
/* The already existing lchan is suitable for this mode */
conn->assignment.new_lchan = NULL;
diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c
index 2a98054..c9e8e5e 100644
--- a/src/osmo-bsc/osmo_bsc_bssap.c
+++ b/src/osmo-bsc/osmo_bsc_bssap.c
@@ -992,6 +992,26 @@
return 0;
}
+static int bssmap_handle_ass_req_tp_rtp_ext(struct tlv_parsed *tp,
+ struct assignment_request *req,
+ uint8_t *cause)
+{
+ /* If the special TW-TS-003 BSSMAP IE is not included,
+ * we are in standard 3GPP-compliant operation mode -
+ * no more work is needed here. */
+ if (!TLVP_PRESENT(tp, GSM0808_IE_THEMWI_RTP_EXTENSIONS))
+ return 0;
+
+ /* the format is TLV with one required byte of value */
+ if (TLVP_LEN(tp, GSM0808_IE_THEMWI_RTP_EXTENSIONS) < 1) {
+ *cause = GSM0808_CAUSE_INFORMATION_ELEMENT_OR_FIELD_MISSING;
+ return -1;
+ }
+
+ req->rtp_extensions = *TLVP_VAL(tp, GSM0808_IE_THEMWI_RTP_EXTENSIONS);
+ return 0;
+}
+
static int bssmap_handle_ass_req_ct_data(struct gsm_subscriber_connection *conn, struct
tlv_parsed *tp,
struct gsm0808_channel_type *ct, struct assignment_request *req,
uint8_t *cause)
@@ -1056,6 +1076,10 @@
return -1;
}
+ /* optional RTP extensions per TW-TS-003 */
+ if (bssmap_handle_ass_req_tp_rtp_ext(tp, req, cause) < 0)
+ return -1;
+
return 0;
}
--
To view, visit
https://gerrit.osmocom.org/c/osmo-bsc/+/37129?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I2a742afff160a9a8286633bf5ae0dd4a828c7a42
Gerrit-Change-Number: 37129
Gerrit-PatchSet: 2
Gerrit-Owner: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: merged