From bdbb7723fdef03c3f996a21f3fe3441623a9cc13 Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Fri, 31 May 2013 15:15:05 +0200 Subject: HO: Remove all TCH rates from bearer capability that are not available When the MNCC application negotiates the codec, it must be sure that the TCH rates of the neotiation results can be assigned to the MS. Therefore not only the codecs that are unsupported by BTS are removed, but also the codecs that require channels that are not available. --- src/libmsc/gsm_04_08.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/libmsc/gsm_04_08.c b/src/libmsc/gsm_04_08.c index 75a77f5f5..402be2f34 100644 --- a/src/libmsc/gsm_04_08.c +++ b/src/libmsc/gsm_04_08.c @@ -82,10 +82,21 @@ struct gsm_lai { static int apply_codec_restrictions(struct gsm_bts *bts, struct gsm_mncc_bearer_cap *bcap) { + int tchf_count = lc_count_bts(bts, GSM_PCHAN_TCH_F); + int tchh_count = lc_count_bts(bts, GSM_PCHAN_TCH_H); int i, j; /* remove unsupported speech versions from list */ for (i = 0, j = 0; bcap->speech_ver[i] >= 0; i++) { + /* filter TCH rates currently available */ + if ((bcap->speech_ver[i] & 1)) { + if (!tchh_count) + continue; + } else { + if (!tchf_count) + continue; + } + /* filter codecs supported by BTS */ if (bcap->speech_ver[i] == 0) bcap->speech_ver[j++] = 0; if (bcap->speech_ver[i] == 2 && bts->codec.efr) -- cgit v1.2.3