rsl: parse_multirate_config(): check if AMR codec is used

3GPP TS 48.058 defines the MultiRate configuration IE as optional,
and states that it's "included if the Channel Mode indicates that a
multi-rate codec is used".  If I understand this correctly, it may
be omitted even if a multi-rate codec is requested.  Otherwise it
would have been defined as a conditional IE.

For now let's print a warnig if this IE was expected, but missing.
We may need to apply some hard-coded defaults in this case.

If this IE is present, but the Channel Mode indicates a codec other
than AMR, let's send NACK with cause=RSL_ERR_OPT_IE_ERROR, assuming
that the CHAN ACT/MODIFY message is malformed.

Change-Id: I6ddc0b46a268ed56ac727cda57d0d68b2746fd59
Related: SYS#5917, OS#4984
This commit is contained in:
Vadim Yanitskiy 2022-04-12 02:09:07 +03:00
parent e3ff3bc4e0
commit ab4ab48178
1 changed files with 15 additions and 1 deletions

View File

@ -1623,8 +1623,22 @@ static int parse_multirate_config(struct gsm_lchan *lchan,
{
int rc;
if (!TLVP_PRESENT(tp, RSL_IE_MR_CONFIG))
if (!TLVP_PRESENT(tp, RSL_IE_MR_CONFIG)) {
/* Included if the Channel Mode indicates that a multi-rate codec is used */
if (lchan->tch_mode == GSM48_CMODE_SPEECH_AMR) {
LOGPLCHAN(lchan, DRSL, LOGL_NOTICE, "Missing MultiRate conf IE "
"(TCH mode is %s)\n", gsm48_chan_mode_name(lchan->tch_mode));
/* TODO: init lchan->tch.amr_mr with some default values */
}
return 0;
}
/* Included if the Channel Mode indicates that a multi-rate codec is used */
if (lchan->tch_mode != GSM48_CMODE_SPEECH_AMR) {
LOGPLCHAN(lchan, DRSL, LOGL_ERROR, "Unexpected MultiRate conf IE "
"(TCH mode is %s)\n", gsm48_chan_mode_name(lchan->tch_mode));
return -RSL_ERR_OPT_IE_ERROR;
}
rc = amr_parse_mr_conf(&lchan->tch.amr_mr,
TLVP_VAL(tp, RSL_IE_MR_CONFIG),