diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2019-04-16 20:05:32 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2019-05-19 22:36:18 +0000 |
commit | 83c0f76d2182063a09584cd623720b1c9fb7fbc9 (patch) | |
tree | fbb489dd06662365e0a8f31bf3447519af313a2e /src/osmo-bsc/osmo_bsc_bssap.c | |
parent | 4dc95597284972b8c862f63121b91d177569b3a4 (diff) |
bssap: Parse Osmux CID on BSSAP Assign Req recv and use it in MGCP
The Osmux CID obtained from the MSC is passed to the co-located BSC MGW
to configure the MSC-side MGW conn of a call leg.
Depends on: osmo-mgw.git I73b4c62baf39050da81d65553cbea07bc51163de
Change-Id: I86e7e13fc7921e3209fb764c0e7797e7ec09b79e
Diffstat (limited to 'src/osmo-bsc/osmo_bsc_bssap.c')
-rw-r--r-- | src/osmo-bsc/osmo_bsc_bssap.c | 28 |
1 files changed, 28 insertions, 0 deletions
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 |