From c80cce67afae521b76213fbebe6783375d840740 Mon Sep 17 00:00:00 2001 From: Philipp Maier Date: Wed, 1 Aug 2018 11:25:06 +0200 Subject: gscon: use BSS-common payload types on BSS side In cases where a codec has no fixed (IANA) payload type number, a dynamically coosen payload type number is used. For the route between BSC and MSC 3GPP as designated certain payload type numbers. However, beond that, those payload type numbers may not necessarly apply. The RTP communication between BTS and BSC still might run on a completely different payload type number. libosmo-netif contains a header file which payload type numbers shall be used. Lets use those in order to signal the same payload type numbers as we actually use in the RTP packets to the MGW. Change-Id: I507a1b1446c8f140b2950d73cf737797604c1ac3 Related: OS#2728 Related: OS#3384 --- src/osmo-bsc/mgw_endpoint_fsm.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'src/osmo-bsc/mgw_endpoint_fsm.c') diff --git a/src/osmo-bsc/mgw_endpoint_fsm.c b/src/osmo-bsc/mgw_endpoint_fsm.c index 18e9dcf5b..fc49886c3 100644 --- a/src/osmo-bsc/mgw_endpoint_fsm.c +++ b/src/osmo-bsc/mgw_endpoint_fsm.c @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -730,10 +731,31 @@ enum mgcp_codecs chan_mode_to_mgcp_codec(enum gsm48_chan_mode chan_mode, bool fu } } -void mgcp_pick_codec(struct mgcp_conn_peer *verb_info, const struct gsm_lchan *lchan) +int chan_mode_to_mgcp_bss_pt(enum mgcp_codecs codec) +{ + switch (codec) { + case CODEC_GSMHR_8000_1: + return RTP_PT_GSM_HALF; + + case CODEC_GSMEFR_8000_1: + return RTP_PT_GSM_EFR; + + case CODEC_AMR_8000_1: + return RTP_PT_AMR; + + default: + /* Not an error, we just leave it to libosmo-mgcp-client to + * decide over the PT. */ + return -1; + } +} + +void mgcp_pick_codec(struct mgcp_conn_peer *verb_info, const struct gsm_lchan *lchan, bool bss_side) { enum mgcp_codecs codec = chan_mode_to_mgcp_codec(lchan->tch_mode, lchan->type == GSM_LCHAN_TCH_H? false : true); + int custom_pt; + if (codec < 0) { LOG_LCHAN(lchan, LOGL_ERROR, "Unable to determine MGCP codec type for %s in chan-mode %s\n", @@ -744,4 +766,12 @@ void mgcp_pick_codec(struct mgcp_conn_peer *verb_info, const struct gsm_lchan *l verb_info->codecs[0] = codec; verb_info->codecs_len = 1; + + /* Setup custom payload types (only for BSS side and when required) */ + custom_pt = chan_mode_to_mgcp_bss_pt(codec); + if (bss_side && custom_pt > 0) { + verb_info->ptmap[0].codec = codec; + verb_info->ptmap[0].pt = custom_pt; + verb_info->ptmap_len = 1; + } } -- cgit v1.2.3