csd_bs_to_gsm0808: add T 300 / proper ch_rate_type

There is no GSM0808_DATA_RATE_TRANSP_300 (not in libosmocore and not in
3GPP TS 48.008 ยง 3.2.11 on which the enum is based). As I understand it,
we need to use GSM0808_DATA_RATE_TRANSP_600.

As pointed out in review, either TCH/H2.4 or TCH/F2.4 would work for
rates below 9600, so use GSM0808_DATA_FULL_PREF.

Use GSM0808_DATA_FULL_BM instead of GSM0808_SPEECH_FULL_BM. The value is
0x8 for both, but this is the correct name.

Related: OS#4394
Change-Id: I7297cc481fbe36355b5231ca800cf566a1ee93c0
diff --git a/src/libmsc/csd_bs.c b/src/libmsc/csd_bs.c
index 967bd6d..1c40ef5 100644
--- a/src/libmsc/csd_bs.c
+++ b/src/libmsc/csd_bs.c
@@ -180,29 +180,40 @@
 	return csd_bs_to_str_c(OTC_SELECT, bs);
 }
 
-static int csd_bs_to_gsm0808_data_rate_transp(enum csd_bs bs)
+static int csd_bs_to_gsm0808_data_rate_transp(enum csd_bs bs, uint8_t *ch_rate_type)
 {
 	switch (bs_map[bs].rate) {
+	case 300:
+		*ch_rate_type = GSM0808_DATA_FULL_PREF;
+		return GSM0808_DATA_RATE_TRANSP_600;
 	case 1200:
+		*ch_rate_type = GSM0808_DATA_FULL_PREF;
 		return GSM0808_DATA_RATE_TRANSP_1k2;
 	case 2400:
+		*ch_rate_type = GSM0808_DATA_FULL_PREF;
 		return GSM0808_DATA_RATE_TRANSP_2k4;
 	case 4800:
+		*ch_rate_type = GSM0808_DATA_FULL_PREF;
 		return GSM0808_DATA_RATE_TRANSP_4k8;
 	case 9600:
+		*ch_rate_type = GSM0808_DATA_FULL_BM;
 		return GSM0808_DATA_RATE_TRANSP_9k6;
 	}
 	return -EINVAL;
 }
 
-static int csd_bs_to_gsm0808_data_rate_non_transp(enum csd_bs bs)
+static int csd_bs_to_gsm0808_data_rate_non_transp(enum csd_bs bs, uint8_t *ch_rate_type)
 {
 	uint16_t rate = bs_map[bs].rate;
 
-	if (rate < 6000)
+	if (rate < 6000) {
+		*ch_rate_type = GSM0808_DATA_FULL_PREF;
 		return GSM0808_DATA_RATE_NON_TRANSP_6k0;
-	if (rate < 12000)
+	}
+	if (rate < 12000) {
+		*ch_rate_type = GSM0808_DATA_FULL_BM;
 		return GSM0808_DATA_RATE_NON_TRANSP_12k0;
+	}
 
 	return -EINVAL;
 }
@@ -375,9 +386,9 @@
 
 	if (csd_bs_is_transp(list->bs[0])) {
 		ct->data_transparent = true;
-		rc = csd_bs_to_gsm0808_data_rate_transp(list->bs[0]);
+		rc = csd_bs_to_gsm0808_data_rate_transp(list->bs[0], &ct->ch_rate_type);
 	} else {
-		rc = csd_bs_to_gsm0808_data_rate_non_transp(list->bs[0]);
+		rc = csd_bs_to_gsm0808_data_rate_non_transp(list->bs[0], &ct->ch_rate_type);
 	}
 
 	if (rc < 0)
@@ -404,8 +415,6 @@
 			ct->data_rate_allowed_is_set = true;
 	}
 
-	ct->ch_rate_type = GSM0808_SPEECH_FULL_BM;
-
 	return 0;
 }