diff options
-rw-r--r-- | include/osmocom/bsc/gsm_data.h | 3 | ||||
-rw-r--r-- | src/osmo-bsc/bsc_subscr_conn_fsm.c | 2 | ||||
-rw-r--r-- | src/osmo-bsc/osmo_bsc_bssap.c | 28 |
3 files changed, 33 insertions, 0 deletions
diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h index dc686c366..68c95e187 100644 --- a/include/osmocom/bsc/gsm_data.h +++ b/include/osmocom/bsc/gsm_data.h @@ -33,6 +33,7 @@ #include <osmocom/bsc/bsc_msg_filter.h> #include <osmocom/bsc/acc_ramp.h> #include <osmocom/bsc/neighbor_ident.h> +#include <osmocom/bsc/osmux.h> #define GSM_T3122_DEFAULT 10 @@ -120,6 +121,8 @@ struct assignment_request { char msc_rtp_addr[INET_ADDRSTRLEN]; uint16_t msc_rtp_port; + bool use_osmux; + uint8_t osmux_cid; /* Rate/codec setting in preference order (need at least 1 !) */ int n_ch_mode_rate; diff --git a/src/osmo-bsc/bsc_subscr_conn_fsm.c b/src/osmo-bsc/bsc_subscr_conn_fsm.c index f94443172..87ad56740 100644 --- a/src/osmo-bsc/bsc_subscr_conn_fsm.c +++ b/src/osmo-bsc/bsc_subscr_conn_fsm.c @@ -519,6 +519,8 @@ bool gscon_connect_mgw_to_msc(struct gsm_subscriber_connection *conn, .port = port, .call_id = conn->sccp.conn_id, .ptime = 20, + .x_osmo_osmux_use = conn->assignment.req.use_osmux, + .x_osmo_osmux_cid = conn->assignment.req.osmux_cid, }; mgcp_pick_codec(&mgw_info, for_lchan, false); diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c index 9dee2658a..dcd06f37a 100644 --- a/src/osmo-bsc/osmo_bsc_bssap.c +++ b/src/osmo-bsc/osmo_bsc_bssap.c @@ -776,6 +776,8 @@ static int bssmap_handle_assignm_req(struct gsm_subscriber_connection *conn, struct tlv_parsed tp; uint16_t cic = 0; bool aoip = false; + bool use_osmux = false; + uint8_t osmux_cid = 0; struct sockaddr_storage rtp_addr; struct gsm0808_channel_type ct; uint8_t cause; @@ -853,6 +855,30 @@ static int bssmap_handle_assignm_req(struct gsm_subscriber_connection *conn, goto reject; } + if (TLVP_PRESENT(&tp, GSM0808_IE_OSMO_OSMUX_CID)) { + if (conn->sccp.msc->use_osmux == OSMUX_USAGE_OFF) { + LOGP(DMSC, LOGL_ERROR, "MSC using Osmux but we have it disabled.\n"); + cause = GSM0808_CAUSE_INCORRECT_VALUE; + goto reject; + } + use_osmux = true; + rc = gsm0808_dec_osmux_cid(&osmux_cid, + TLVP_VAL(&tp, GSM0808_IE_OSMO_OSMUX_CID), + TLVP_LEN(&tp, GSM0808_IE_OSMO_OSMUX_CID)); + if (rc < 0) { + LOGP(DMSC, LOGL_ERROR, "Unable to decode Osmux CID.\n"); + cause = GSM0808_CAUSE_INCORRECT_VALUE; + goto reject; + } + } else { + if (conn->sccp.msc->use_osmux == OSMUX_USAGE_ONLY) { + LOGP(DMSC, LOGL_ERROR, "MSC not using Osmux but we are forced to use it.\n"); + cause = GSM0808_CAUSE_INCORRECT_VALUE; + goto reject; + } else if (conn->sccp.msc->use_osmux == OSMUX_USAGE_ON) + LOGP(DMSC, LOGL_NOTICE, "MSC not using Osmux but we have Osmux enabled.\n"); + } + /* Decode speech codec list. First set len = 0. */ conn->codec_list = (struct gsm0808_speech_codec_list){}; /* Check for speech codec list element */ @@ -878,6 +904,8 @@ static int bssmap_handle_assignm_req(struct gsm_subscriber_connection *conn, req = (struct assignment_request){ .aoip = aoip, .msc_assigned_cic = cic, + .use_osmux = use_osmux, + .osmux_cid = osmux_cid, }; /* Match codec information from the assignment command against the |