aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bsc
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2018-08-01 11:25:06 +0200
committerPhilipp Maier <pmaier@sysmocom.de>2018-08-01 11:27:17 +0200
commitc80cce67afae521b76213fbebe6783375d840740 (patch)
tree96159a2aaa395f5897c2dd948784037d066cacfb /src/osmo-bsc
parenta406b167c19cebbdf4285c4b03dd44a34563af1b (diff)
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
Diffstat (limited to 'src/osmo-bsc')
-rw-r--r--src/osmo-bsc/bsc_subscr_conn_fsm.c2
-rw-r--r--src/osmo-bsc/lchan_rtp_fsm.c4
-rw-r--r--src/osmo-bsc/mgw_endpoint_fsm.c32
-rw-r--r--src/osmo-bsc/osmo_bsc_lcls.c4
4 files changed, 36 insertions, 6 deletions
diff --git a/src/osmo-bsc/bsc_subscr_conn_fsm.c b/src/osmo-bsc/bsc_subscr_conn_fsm.c
index fd3c2931f..81fe9f6cc 100644
--- a/src/osmo-bsc/bsc_subscr_conn_fsm.c
+++ b/src/osmo-bsc/bsc_subscr_conn_fsm.c
@@ -491,7 +491,7 @@ bool gscon_connect_mgw_to_msc(struct gsm_subscriber_connection *conn,
.call_id = conn->sccp.conn_id,
.ptime = 20,
};
- mgcp_pick_codec(&mgw_info, for_lchan);
+ mgcp_pick_codec(&mgw_info, for_lchan, false);
rc = osmo_strlcpy(mgw_info.addr, addr, sizeof(mgw_info.addr));
if (rc <= 0 || rc >= sizeof(mgw_info.addr)) {
diff --git a/src/osmo-bsc/lchan_rtp_fsm.c b/src/osmo-bsc/lchan_rtp_fsm.c
index f7efc1ba8..2cc9a781c 100644
--- a/src/osmo-bsc/lchan_rtp_fsm.c
+++ b/src/osmo-bsc/lchan_rtp_fsm.c
@@ -157,7 +157,7 @@ static void lchan_rtp_fsm_wait_mgw_endpoint_available_onenter(struct osmo_fsm_in
if (lchan->conn)
crcx_info.call_id = lchan->conn->sccp.conn_id;
crcx_info.ptime = 20;
- mgcp_pick_codec(&crcx_info, lchan);
+ mgcp_pick_codec(&crcx_info, lchan, true);
mgw_endpoint_ci_request(lchan->mgw_endpoint_ci_bts, MGCP_VERB_CRCX, &crcx_info,
fi, LCHAN_RTP_EV_MGW_ENDPOINT_AVAILABLE, LCHAN_RTP_EV_MGW_ENDPOINT_ERROR,
@@ -406,7 +406,7 @@ static void connect_mgw_endpoint_to_lchan(struct osmo_fsm_inst *fi,
.port = to_lchan->abis_ip.bound_port,
.ptime = 20,
};
- mgcp_pick_codec(&mdcx_info, to_lchan);
+ mgcp_pick_codec(&mdcx_info, to_lchan, true);
addr.s_addr = ntohl(to_lchan->abis_ip.bound_ip);
addr_str = inet_ntoa(addr);
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 <osmocom/core/fsm.h>
#include <osmocom/core/byteswap.h>
+#include <osmocom/netif/rtp.h>
#include <osmocom/bsc/debug.h>
#include <osmocom/bsc/gsm_timers.h>
@@ -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;
+ }
}
diff --git a/src/osmo-bsc/osmo_bsc_lcls.c b/src/osmo-bsc/osmo_bsc_lcls.c
index 04826615b..4639c4e36 100644
--- a/src/osmo-bsc/osmo_bsc_lcls.c
+++ b/src/osmo-bsc/osmo_bsc_lcls.c
@@ -242,7 +242,7 @@ static void lcls_break_local_switching(struct gsm_subscriber_connection *conn)
.port = conn->user_plane.msc_assigned_rtp_port,
};
osmo_strlcpy(mdcx_info.addr, conn->user_plane.msc_assigned_rtp_addr, sizeof(mdcx_info.addr));
- mgcp_pick_codec(&mdcx_info, conn->lchan);
+ mgcp_pick_codec(&mdcx_info, conn->lchan, false);
mgw_endpoint_ci_request(conn->user_plane.mgw_endpoint_ci_msc,
MGCP_VERB_MDCX, &mdcx_info,
@@ -573,7 +573,7 @@ static void lcls_locally_switched_onenter(struct osmo_fsm_inst *fi, uint32_t pre
mdcx_info = *other_mgw_info;
/* Make sure the request doesn't want to use the other side's endpoint string. */
mdcx_info.endpoint[0] = 0;
- mgcp_pick_codec(&mdcx_info, conn->lchan);
+ mgcp_pick_codec(&mdcx_info, conn->lchan, false);
mgw_endpoint_ci_request(conn->user_plane.mgw_endpoint_ci_msc,
MGCP_VERB_MDCX, &mdcx_info,
NULL, 0, 0, NULL);