falconia has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-mgw/+/39730?usp=email )
Change subject: MGCP extension: add parameters for TW-TS-001 & TW-TS-002 ......................................................................
MGCP extension: add parameters for TW-TS-001 & TW-TS-002
TW-TS-001 and TW-TS-002 are enhanced RTP transport formats for GSM FR/HR/EFR codecs that restore the lost semantics of GSM 08.60 and 08.61 TRAU-UL frames.
TW-TS-003 BSSMAP extension provides a way for a core network to ask the BSS to use these TRAU-like enhanced RTP formats instead of those specified in 3GPP TS 48.103; OsmoBSC already supports this mechanism when the BSS is comprised of IP-native OsmoBTS.
However, in order to achieve the same effect when using E1-based legacy BTS hardware, the task of generating TW-TS-001/002 RTP packets for UL and accepting them for DL moves from OsmoBTS to the E1-Abis-interfacing MGW. osmo_trau2rtp() is already capable of generating these extended RTP formats on request, but until now there was no mechanism to signal from OsmoBSC to its associated E1 Abis MGW whether and when these extensions should be used.
Considering that MGCP as it is used in Osmocom is essentially a private interface between OsmoBSC or OsmoMSC masters and OsmoMGW slaves, while the externally defined and generally interoperable interface is 3GPP TS 48.008, possibly extended with TW-TS-003, the sensible solution is to make a private extension to the way FR, EFR and HR codecs are described in SDP in the context of Osmocom-MGCP.
The SDP extension birthed in the present patch consists of an fmtp parameter for GSM, GSM-EFR and GSM-HR-08 codecs that is structured just like the already implemented octet-align parameter for AMR. TW-TS-001 for FR and EFR shall be described as follows:
m=audio 1234 RTP/AVP 3 110 a=rtpmap:3 GSM/8000/1 a=fmtp:3 tw-ts-001=1 a=rtpmap:110 GSM-EFR/8000/1 a=fmtp:110 tw-ts-001=1
TW-TS-002 for HR codec shall be described as follows:
m=audio 1234 RTP/AVP 111 a=rtpmap:111 GSM-HR-08/8000/1 a=fmtp:111 tw-ts-002=1
The present patch adds the new parameters to struct mgcp_codec_param in mgcp_common.h and equips libosmo-mgcp-client with the ability to emit these parameters upon request - but no MGW-side implementation yet. On the MGW side, this MGCP extension will be implemented at first in tw-e1abis-mgw, an experimental alternative to OsmoMGW that is strictly limited to the role of E1-Abis-interfacing MGW working with OsmoBSC, while implementation in mainline OsmoMGW remains an open question, to be addressed later based on the outcome of tw-e1abis-mgw experiments.
Related: OS#6614 Change-Id: I0d58e6d84418f50670c8ab7cf8490af3bc2f5c26 --- M include/osmocom/mgcp/mgcp_common.h M src/libosmo-mgcp-client/mgcp_client.c 2 files changed, 29 insertions(+), 8 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/30/39730/1
diff --git a/include/osmocom/mgcp/mgcp_common.h b/include/osmocom/mgcp/mgcp_common.h index 05ae95f..14b226f 100644 --- a/include/osmocom/mgcp/mgcp_common.h +++ b/include/osmocom/mgcp/mgcp_common.h @@ -63,6 +63,10 @@ struct mgcp_codec_param { bool amr_octet_aligned_present; bool amr_octet_aligned; + bool fr_efr_twts001_present; + bool fr_efr_twts001; + bool hr_twts002_present; + bool hr_twts002; };
/* Ensure that the msg->l2h is NUL terminated. */ diff --git a/src/libosmo-mgcp-client/mgcp_client.c b/src/libosmo-mgcp-client/mgcp_client.c index ab8ba9f..889782b 100644 --- a/src/libosmo-mgcp-client/mgcp_client.c +++ b/src/libosmo-mgcp-client/mgcp_client.c @@ -1426,15 +1426,32 @@ /* Add optional codec parameters (fmtp) */ if (mgcp_msg->param_present) { for (i = 0; i < mgcp_msg->ptmap_len; i++) { - /* The following is only applicable for AMR */ - if (mgcp_msg->ptmap[i].codec != CODEC_AMR_8000_1 - && mgcp_msg->ptmap[i].codec != CODEC_AMRWB_16000_1) - continue; pt = mgcp_msg->ptmap[i].pt; - if (mgcp_msg->param.amr_octet_aligned_present && mgcp_msg->param.amr_octet_aligned) - MSGB_PRINTF_OR_RET("a=fmtp:%u octet-align=1\r\n", pt); - else if (mgcp_msg->param.amr_octet_aligned_present && !mgcp_msg->param.amr_octet_aligned) - MSGB_PRINTF_OR_RET("a=fmtp:%u octet-align=0\r\n", pt); + switch (mgcp_msg->ptmap[i].codec) { + case CODEC_AMR_8000_1: + case CODEC_AMRWB_16000_1: + if (!mgcp_msg->param.amr_octet_aligned_present) + break; + MSGB_PRINTF_OR_RET("a=fmtp:%u octet-align=%d\r\n", + pt, (int) mgcp_msg->param.amr_octet_aligned); + break; + case CODEC_GSM_8000_1: + case CODEC_GSMEFR_8000_1: + if (!mgcp_msg->param.fr_efr_twts001_present) + break; + MSGB_PRINTF_OR_RET("a=fmtp:%u tw-ts-001=%d\r\n", + pt, (int) mgcp_msg->param.fr_efr_twts001); + break; + case CODEC_GSMHR_8000_1: + if (!mgcp_msg->param.hr_twts002_present) + break; + MSGB_PRINTF_OR_RET("a=fmtp:%u tw-ts-002=%d\r\n", + pt, (int) mgcp_msg->param.hr_twts002); + break; + default: + /* no parameters for the remaining codecs */ + break; + } } }