gsm48_ie: fix parsing of Bearer capability IE without octet 3a

The testcase in gsm0408_test is still failing because the encoder
produces a different result (with octet 3a present).  There is no
way to tell the encoder to use the implicit coding, and in general
this is not that critical, so we can live with that.

Change-Id: I722c168f01bffa915cb155eac234a796549d3762
diff --git a/src/gsm/gsm48_ie.c b/src/gsm/gsm48_ie.c
index 4fa4924..bbaec3d 100644
--- a/src/gsm/gsm48_ie.c
+++ b/src/gsm/gsm48_ie.c
@@ -203,6 +203,23 @@
 	case GSM_MNCC_BCAP_SPEECH:
 		i = 1;
 		s = 0;
+		if ((lv[1] & 0x80) != 0) { /* octet 3a is absent */
+			switch (bcap->radio) {
+			case GSM48_BCAP_RRQ_FR_ONLY:
+				bcap->speech_ver[s++] = GSM48_BCAP_SV_FR;
+				break;
+			case GSM48_BCAP_RRQ_DUAL_HR:
+				bcap->speech_ver[s++] = GSM48_BCAP_SV_HR;
+				bcap->speech_ver[s++] = GSM48_BCAP_SV_FR;
+				break;
+			case GSM48_BCAP_RRQ_DUAL_FR:
+				bcap->speech_ver[s++] = GSM48_BCAP_SV_FR;
+				bcap->speech_ver[s++] = GSM48_BCAP_SV_HR;
+				break;
+			}
+			bcap->speech_ver[s] = -1; /* end of list */
+			return 0;
+		}
 		while (!(lv[i] & 0x80)) {
 			i++; /* octet 3a etc */
 			if (in_len < i)
diff --git a/tests/gsm0408/gsm0408_test.err b/tests/gsm0408/gsm0408_test.err
index 1f0236c..8aeda3e 100644
--- a/tests/gsm0408/gsm0408_test.err
+++ b/tests/gsm0408/gsm0408_test.err
@@ -1,3 +1,3 @@
-Incorrect decoded result of Speech, without octet 3a:
- should: 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 ff ff ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
- is:     00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 ff ff ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+Incorrect encoded result of Speech, without octet 3a:
+ should: 01 a0 
+ is:     02 20 80