falconia has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-msc/+/41698?usp=email )
Change subject: add vty setting for ThemWi RTP formats ......................................................................
add vty setting for ThemWi RTP formats
For every GSM speech codec and for CSD, Osmocom BSS supports both the standard RTP format prescribed by 3GPP and an alternative enhanced RTP format invented by Themyscira Wireless: TW-TS-001, TW-TS-002, TW-TS-006 and TW-TS-007. In order to enable these enhanced RTP formats, the MSC needs to include an extension IE in the Assignment Request it sends to the BSS. Until now there was no way to do so in mainline OsmoMSC, only via local code patches - fix this omission.
The following considerations apply to this new tw-rtp-formats vty setting:
* When internal MNCC is used, it is beneficial to enable enhanced TW RTP formats, especially when using E1 BTS with tw-e1abis-mgw: the DL call leg receives more complete information content from the UL call leg in each direction.
* When external MNCC is used with non-ThemWi CN software (e.g., with a PBX via osmo-sip-connector), tw-rtp-formats should NOT be enabled - off-the-shelf PBX etc software won't understand them.
* Future patches will allow osmo-msc to operate with a ThemWi transcoding MGW (TC to G.711) in the place of non-TC osmo-mgw; in that configuration TW RTP formats will become mandatory, as they are strictly required by ThemWi TC implementation.
Change-Id: Icea152f5f2cdbcb0df09ef5b7211d1461b499f14 --- M include/osmocom/msc/gsm_data.h M include/osmocom/msc/ran_msg.h M src/libmsc/msc_a.c M src/libmsc/msc_vty.c M src/libmsc/ran_msg_a.c 5 files changed, 112 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/98/41698/1
diff --git a/include/osmocom/msc/gsm_data.h b/include/osmocom/msc/gsm_data.h index 36149e1..80a7854 100644 --- a/include/osmocom/msc/gsm_data.h +++ b/include/osmocom/msc/gsm_data.h @@ -265,6 +265,24 @@ /* Whether we want to use Osmux against BSCs. Controlled via VTY */ enum osmux_usage use_osmux;
+ /* For every GSM speech codec supported in Osmocom, there are two + * possible RTP representations: the standard one originally invented + * by IETF and then adopted by 3GPP in Rel8 (globally recognized + * standard, but suffers from information loss relative to TRAU frame + * formats of previous GSM/3GPP releases), and an alternative format + * invented by Themyscira Wireless that restores TRAU-like information + * content at the price of non-standard RTP format. A similar + * situation exists for GSM CSD, although here the diff between + * 3GPP-standard and ThemWi RTP formats is a matter of encoding + * efficiency and payload size economy rather than information content. + * Osmocom BSS supports these AoIP RTP extensions, requested via a + * BSSMAP extension IE, and if they are desired, they need to be + * enabled from the MSC. The RTP extension selection octet sent via + * that BSSMAP extension (TW-TS-003) is a bit mask - allow it to be + * configured via vty. + */ + uint8_t tw_rtp_formats; + /* Whether to use call waiting on the network */ bool call_waiting;
diff --git a/include/osmocom/msc/ran_msg.h b/include/osmocom/msc/ran_msg.h index dc1483c..799dff3 100644 --- a/include/osmocom/msc/ran_msg.h +++ b/include/osmocom/msc/ran_msg.h @@ -106,6 +106,7 @@ enum nsap_addr_enc rab_assign_addr_enc; bool osmux_present; uint8_t osmux_cid; + uint8_t rtp_extensions; bool call_id_present; uint32_t call_id; struct osmo_lcls *lcls; diff --git a/src/libmsc/msc_a.c b/src/libmsc/msc_a.c index 97f723c..c682004 100644 --- a/src/libmsc/msc_a.c +++ b/src/libmsc/msc_a.c @@ -682,6 +682,7 @@ struct ran_msg msg; struct gsm_trans *cc_trans = msc_a->cc.active_trans; struct gsm0808_channel_type channel_type; + struct gsm_network *net = msc_a_net(msc_a);
/* Do not dispatch another Assignment Command before an earlier assignment is completed. This is a sanity * safeguard, ideally callers should not even invoke this function when an Assignment is already ongoing. @@ -756,6 +757,7 @@ .channel_type = &channel_type, .osmux_present = msc_a->cc.call_leg->rtp[RTP_TO_RAN]->use_osmux, .osmux_cid = msc_a->cc.call_leg->rtp[RTP_TO_RAN]->local_osmux_cid, + .rtp_extensions = net->tw_rtp_formats, .call_id_present = true, .call_id = cc_trans->call_id, .lcls = cc_trans->cc.lcls, diff --git a/src/libmsc/msc_vty.c b/src/libmsc/msc_vty.c index cbcad24..7ba5be6 100644 --- a/src/libmsc/msc_vty.c +++ b/src/libmsc/msc_vty.c @@ -34,6 +34,7 @@ #include <osmocom/gsm/protocol/gsm_04_14.h> #include <osmocom/gsm/protocol/gsm_08_08.h> #include <osmocom/gsm/gsm23236.h> +#include <osmocom/gsm/rtp_extensions.h>
#include <osmocom/sigtran/sccp_helpers.h>
@@ -684,6 +685,76 @@ return CMD_SUCCESS; }
+#define TWFORMAT_STR "Use ThemWi RTP formats\n" +#define TWCODEC_PAR_STR " (fr|hr|amr|csd)" +#define TWCODEC_HELP_STR "TW-TS-001 for FR & EFR\nTW-TS-002 for HRv1\n" \ + "TW-TS-006 for AMR\nTW-TS-007 for CSD\n" + +static uint8_t parse_twext_codec_list(int argc, const char *argv[]) +{ + uint8_t mask = 0; + int i; + + for (i = 0; i < argc; i++) { + if (!strcmp(argv[i], "fr")) + mask |= OSMO_RTP_EXT_TWTS001; + else if (!strcmp(argv[i], "hr")) + mask |= OSMO_RTP_EXT_TWTS002; + else if (!strcmp(argv[i], "amr")) + mask |= OSMO_RTP_EXT_TWTS006; + else if (!strcmp(argv[i], "csd")) + mask |= OSMO_RTP_EXT_TWTS007; + } + return mask; +} + +DEFUN(cfg_msc_twformat1, + cfg_msc_twformat1_cmd, + "tw-rtp-formats" TWCODEC_PAR_STR, + TWFORMAT_STR TWCODEC_HELP_STR) +{ + gsmnet->tw_rtp_formats = parse_twext_codec_list(1, argv); + return CMD_SUCCESS; +} + +DEFUN(cfg_msc_twformat2, + cfg_msc_twformat2_cmd, + "tw-rtp-formats" TWCODEC_PAR_STR TWCODEC_PAR_STR, + TWFORMAT_STR TWCODEC_HELP_STR TWCODEC_HELP_STR) +{ + gsmnet->tw_rtp_formats = parse_twext_codec_list(2, argv); + return CMD_SUCCESS; +} + +DEFUN(cfg_msc_twformat3, + cfg_msc_twformat3_cmd, + "tw-rtp-formats" TWCODEC_PAR_STR TWCODEC_PAR_STR TWCODEC_PAR_STR, + TWFORMAT_STR TWCODEC_HELP_STR TWCODEC_HELP_STR TWCODEC_HELP_STR) +{ + gsmnet->tw_rtp_formats = parse_twext_codec_list(3, argv); + return CMD_SUCCESS; +} + +DEFUN(cfg_msc_twformat4, + cfg_msc_twformat4_cmd, + "tw-rtp-formats" TWCODEC_PAR_STR TWCODEC_PAR_STR TWCODEC_PAR_STR + TWCODEC_PAR_STR, + TWFORMAT_STR TWCODEC_HELP_STR TWCODEC_HELP_STR TWCODEC_HELP_STR + TWCODEC_HELP_STR) +{ + gsmnet->tw_rtp_formats = parse_twext_codec_list(4, argv); + return CMD_SUCCESS; +} + +DEFUN(cfg_msc_no_twformat, + cfg_msc_no_twformat_cmd, + "no tw-rtp-formats", + NO_STR TWFORMAT_STR) +{ + gsmnet->tw_rtp_formats = 0; + return CMD_SUCCESS; +} + #define NRI_STR "Mapping of Network Resource Indicators to this MSC, for MSC pooling\n" DEFUN(cfg_msc_nri_bitlen, cfg_msc_nri_bitlen_cmd, "nri bitlen <0-15>", @@ -810,6 +881,19 @@ VTY_NEWLINE); }
+ if (gsmnet->tw_rtp_formats) { + vty_out(vty, " tw-rtp-formats"); + if (gsmnet->tw_rtp_formats & OSMO_RTP_EXT_TWTS001) + vty_out(vty, " fr"); + if (gsmnet->tw_rtp_formats & OSMO_RTP_EXT_TWTS002) + vty_out(vty, " hr"); + if (gsmnet->tw_rtp_formats & OSMO_RTP_EXT_TWTS006) + vty_out(vty, " amr"); + if (gsmnet->tw_rtp_formats & OSMO_RTP_EXT_TWTS007) + vty_out(vty, " csd"); + vty_out(vty, "%s", VTY_NEWLINE); + } + mgcp_client_config_write(vty, " ");
neighbor_ident_vty_write(vty); @@ -2108,6 +2192,11 @@ install_element(MSC_NODE, &cfg_msc_sms_over_gsup_cmd); install_element(MSC_NODE, &cfg_msc_no_sms_over_gsup_cmd); install_element(MSC_NODE, &cfg_msc_osmux_cmd); + install_element(MSC_NODE, &cfg_msc_twformat1_cmd); + install_element(MSC_NODE, &cfg_msc_twformat2_cmd); + install_element(MSC_NODE, &cfg_msc_twformat3_cmd); + install_element(MSC_NODE, &cfg_msc_twformat4_cmd); + install_element(MSC_NODE, &cfg_msc_no_twformat_cmd); install_element(MSC_NODE, &cfg_msc_handover_number_range_cmd); install_element(MSC_NODE, &cfg_msc_nri_bitlen_cmd); install_element(MSC_NODE, &cfg_msc_nri_add_cmd); diff --git a/src/libmsc/ran_msg_a.c b/src/libmsc/ran_msg_a.c index d904120..8d649fd 100644 --- a/src/libmsc/ran_msg_a.c +++ b/src/libmsc/ran_msg_a.c @@ -1465,6 +1465,8 @@ gsm0808_enc_group_callref(msg, &ac->callref); if (ac->osmux_present) msgb_tv_put(msg, GSM0808_IE_OSMO_OSMUX_CID, ac->osmux_cid); + if (ac->rtp_extensions) + msgb_tlv_put(msg, GSM0808_IE_THEMWI_RTP_EXTENSIONS, 1, &ac->rtp_extensions); msg->l3h[1] = msgb_l3len(msg) - 2; return msg; }