aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmsc/a_iface_bssap.c
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2017-05-29 13:18:44 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-06-18 17:50:08 +0200
commitdfe085d979ba8b7266a6c66ecb13bf5a11a8d86f (patch)
tree20a343521ce9e91024471c7b4e9728f2ddcf26d5 /openbsc/src/libmsc/a_iface_bssap.c
parente818b91729de56db7643c0961f810c1652f65701 (diff)
osmo-msc: Integrate A interface into existing call control
The MSC already has some basic call control handling mechanism, that was primarily used with 3G before. However, the already existing code that handles the 3G calls is also perfectly fine for handling 2G calls. This commit integrates the A interface without breaking it for 3G.
Diffstat (limited to 'openbsc/src/libmsc/a_iface_bssap.c')
-rw-r--r--openbsc/src/libmsc/a_iface_bssap.c43
1 files changed, 42 insertions, 1 deletions
diff --git a/openbsc/src/libmsc/a_iface_bssap.c b/openbsc/src/libmsc/a_iface_bssap.c
index 258f125fa..eafc4e418 100644
--- a/openbsc/src/libmsc/a_iface_bssap.c
+++ b/openbsc/src/libmsc/a_iface_bssap.c
@@ -30,6 +30,9 @@
#include <openbsc/a_iface_bssap.h>
#include <openbsc/iu.h>
#include <openbsc/osmo_msc.h>
+#include <osmocom/core/byteswap.h>
+
+#define IP_V4_ADDR_LEN 4
/* Addresses of all BSCs which have been registered to this MSC */
static LLIST_HEAD(bsc_addr_list);
@@ -526,14 +529,52 @@ static int bssmap_ass_compl(struct osmo_sccp_user *scu, struct a_conn_info *a_co
{
struct gsm_network *network = a_conn_info->network;
struct gsm_subscriber_connection *conn;
+ struct mgcpgw_client *mgcp;
+ struct tlv_parsed tp;
+ struct sockaddr_storage rtp_addr;
+ struct sockaddr_in *rtp_addr_in;
+ int rc;
conn = subscr_conn_lookup_a(network, a_conn_info->conn_id);
if (!conn)
goto fail;
+ mgcp = conn->network->mgcpgw.client;
+ OSMO_ASSERT(mgcp);
+
LOGP(DMSC, LOGL_NOTICE, "BSC sends assignment complete message (conn_id=%i)\n", conn->a.conn_id);
- /* Inform the MSC about the assignment completion event */
+ tlv_parse(&tp, gsm0808_att_tlvdef(), msg->l3h + 1, msgb_l3len(msg) - 1, 0, 0);
+
+ if (!TLVP_PRESENT(&tp, GSM0808_IE_AOIP_TRASP_ADDR)) {
+ LOGP(DMSC, LOGL_ERROR, "AoIP transport identifier missing -- discarding message!\n");
+ goto fail;
+ }
+
+ /* Decode AoIP transport address element */
+ rc = gsm0808_dec_aoip_trasp_addr(&rtp_addr, TLVP_VAL(&tp, GSM0808_IE_AOIP_TRASP_ADDR), TLVP_LEN(&tp, GSM0808_IE_AOIP_TRASP_ADDR));
+ if (rc < 0) {
+ LOGP(DMSC, LOGL_ERROR, "Unable to decode aoip transport address.\n");
+ goto fail;
+ }
+
+ /* use address / port supplied with the AoIP
+ * transport address element */
+ if(rtp_addr.ss_family == AF_INET)
+ {
+ rtp_addr_in = (struct sockaddr_in *)&rtp_addr;
+ conn->iu.mgcp_rtp_port_ue = osmo_ntohs(rtp_addr_in->sin_port);
+ /* FIXME: We also get the IP-Address of the remote (e.g. BTS)
+ * end with the response. Currently we just ignore that address.
+ * Instead we expect that our local MGCP gateway and the code
+ * controlling it, magically knows the IP of the remote end. */
+ } else {
+ LOGP(DMSC, LOGL_ERROR, "Unsopported addressing scheme. (supports only IPV4)\n");
+ goto fail;
+ }
+
+ /* FIXME: Seems to be related to authentication or,
+ encryption. Is this really in the right place? */
msc_rx_sec_mode_compl(conn);
msgb_free(msg);