diff options
author | Harald Welte <laforge@gnumonks.org> | 2017-12-23 01:07:45 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2018-01-28 03:07:21 +0100 |
commit | 720de68cb064ea8a9203561756c24b48d8b5a67e (patch) | |
tree | baf287ec4fc5dfc3bbc8d6cebd6d3a2c480314b8 | |
parent | c751513c04b8422caf8ac33f4500c62381da231a (diff) |
bssmap_handle_assignm_req(): Decode channel type as first step
The decision on how to further process the request depends significantly
on the contents of the only mandatory IE of the ASSIGNMENT REQ. Let's
decode it first.
Change-Id: I030b5ad6f4fc33da9155c8a6061fd982312b20fb
-rw-r--r-- | src/osmo-bsc/osmo_bsc_bssap.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c index 586657f41..9bd3fe9a1 100644 --- a/src/osmo-bsc/osmo_bsc_bssap.c +++ b/src/osmo-bsc/osmo_bsc_bssap.c @@ -761,6 +761,22 @@ static int bssmap_handle_assignm_req(struct osmo_bsc_sccp_con *conn, goto reject; } + /* Decode Channel Type element */ + rc = gsm0808_dec_channel_type(&ct, TLVP_VAL(&tp, GSM0808_IE_CHANNEL_TYPE), + TLVP_LEN(&tp, GSM0808_IE_CHANNEL_TYPE)); + if (rc < 0) { + LOGP(DMSC, LOGL_ERROR, "unable to decode channel type.\n"); + goto reject; + } + + /* Currently we only support a limited subset of all + * possible channel types. The limitation ends by not using + * multi-slot, limiting the channel coding to speech */ + if (ct.ch_indctr != GSM0808_CHAN_SPEECH) { + LOGP(DMSC, LOGL_ERROR, "Unsupported channel type, currently only speech is supported!\n"); + goto reject; + } + /* Detect if a CIC code is present, if so, we use the classic ip.access * method to calculate the RTP port */ if (TLVP_PRESENT(&tp, GSM0808_IE_CIRCUIT_IDENTITY_CODE)) { @@ -803,23 +819,6 @@ static int bssmap_handle_assignm_req(struct osmo_bsc_sccp_con *conn, scl_ptr = &scl; } - /* Decode Channel Type element */ - rc = gsm0808_dec_channel_type(&ct, TLVP_VAL(&tp, GSM0808_IE_CHANNEL_TYPE), - TLVP_LEN(&tp, GSM0808_IE_CHANNEL_TYPE)); - if (rc < 0) { - LOGP(DMSC, LOGL_ERROR, "unable to decode channel type.\n"); - goto reject; - } - - /* Currently we only support a limited subset of all - * possible channel types. The limitation ends by not using - * multi-slot, limiting the channel coding to speech */ - if (ct.ch_indctr != GSM0808_CHAN_SPEECH) { - LOGP(DMSC, LOGL_ERROR, - "Unsupported channel type, currently only speech is supported!\n"); - goto reject; - } - /* Match codec information from the assignment command against the * local preferences of the BSC */ rc = match_codec_pref(&full_rate, &chan_mode, &ct, scl_ptr, msc); |