From bad11ae8125cb9b08531ff40928d30a28d562019 Mon Sep 17 00:00:00 2001 From: Philipp Maier Date: Wed, 22 Nov 2017 13:18:09 +0100 Subject: bssap: remove libosmo-legacy-mgcp dependancy the functions mgcp_timeslot_to_endpoint() and rtp_calculate_port() which are used to calculate the port in the sccp-lite / non AoIP case are part of libosmo-legacy-mgcp. Unfortunately libosmo-mgcp and libosmo-legacy-mgcp cause problems when used at the same time. Replace the functions mgcp_timeslot_to_endpoint() and rtp_calculate_port() with a local helper function. Change-Id: Id10311332aeabd8fd3ba1922198e34708e04cef9 --- src/osmo-bsc/osmo_bsc_bssap.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c index 59c2979bc..73776adde 100644 --- a/src/osmo-bsc/osmo_bsc_bssap.c +++ b/src/osmo-bsc/osmo_bsc_bssap.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include @@ -454,6 +453,19 @@ reject: return -1; } +/* Helper function to calculate the port number for a given + * timeslot/multiplex. This functionality is needed to support + * the sccp-lite scenario where the MGW is handled externally */ +static inline int mgcp_timeslot_to_port(int multiplex, int timeslot, int base) +{ + if (timeslot == 0) { + LOGP(DLMGCP, LOGL_ERROR, "Timeslot should not be 0\n"); + timeslot = 255; + } + + return base + (timeslot + (32 * multiplex)) * 2; +} + /* * Handle the assignment request message. * @@ -468,7 +480,7 @@ static int bssmap_handle_assignm_req(struct osmo_bsc_sccp_con *conn, uint8_t timeslot = 0; uint8_t multiplex = 0; enum gsm48_chan_mode chan_mode = GSM48_CMODE_SIGN; - int port, full_rate = -1; + int full_rate = -1; bool aoip = false; struct sockaddr_storage rtp_addr; struct gsm0808_channel_type ct; @@ -603,8 +615,7 @@ static int bssmap_handle_assignm_req(struct osmo_bsc_sccp_con *conn, * (the MSC does that for us). We set conn->rtp_ip to 0 and check * on this later. By this we know that we have to behave accordingly * to sccp-lite. */ - port = mgcp_timeslot_to_endpoint(multiplex, timeslot); - conn->rtp_port = rtp_calculate_port(port, msc->rtp_base); + conn->rtp_port = mgcp_timeslot_to_port(multiplex, timeslot, msc->rtp_base); conn->rtp_ip = 0; return gsm0808_assign_req(conn->conn, chan_mode, full_rate); } -- cgit v1.2.3