Review at  https://gerrit.osmocom.org/4963

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
---
M src/osmo-bsc/osmo_bsc_bssap.c
1 file changed, 15 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/63/4963/1

diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c
index 59c2979..73776ad 100644
--- a/src/osmo-bsc/osmo_bsc_bssap.c
+++ b/src/osmo-bsc/osmo_bsc_bssap.c
@@ -24,7 +24,6 @@
 #include <osmocom/bsc/bsc_msc_data.h>
 #include <osmocom/bsc/debug.h>
 #include <osmocom/bsc/bsc_subscriber.h>
-#include <osmocom/legacy_mgcp/mgcp.h>
 #include <osmocom/bsc/osmo_bsc_mgcp.h>
 #include <osmocom/bsc/paging.h>
 #include <osmocom/bsc/gsm_04_08_utils.h>
@@ -454,6 +453,19 @@
        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 @@
        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 @@
                 * (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);
        }

-- 
To view, visit https://gerrit.osmocom.org/4963
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id10311332aeabd8fd3ba1922198e34708e04cef9
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: dexter <[email protected]>

Reply via email to