aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/osmocom/gsm/protocol/gsm_08_08.h8
-rw-r--r--src/gsm/gsm0808_utils.c4
-rw-r--r--tests/gsm0808/gsm0808_test.c14
3 files changed, 13 insertions, 13 deletions
diff --git a/include/osmocom/gsm/protocol/gsm_08_08.h b/include/osmocom/gsm/protocol/gsm_08_08.h
index 947f90f2..4539b960 100644
--- a/include/osmocom/gsm/protocol/gsm_08_08.h
+++ b/include/osmocom/gsm/protocol/gsm_08_08.h
@@ -460,16 +460,16 @@ struct gsm0808_speech_codec {
* configuration that is used on the air interface (Um).
*
* Default values for FR_AMR, HR_AMR and OHR_AMR:
- * See also: 3GPP TS 28.062, Table 7.11.3.1.3-2: Preferred
- * Configurations for the Adaptive Multi-Rate Codec Types
+ * See also: 3GPP TS 28.062, Table 7.11.3.1.3-2: Preferred Configurations for
+ * the Adaptive Multi-Rate Codec Types and 3GPP TS 48.008, Section 3.2.2.103.
*
* Default values for FR_AMR_WB, OFR_AMR_WB and OHR_AMR_WB:
* See also: 3GPP TS 26.103, Table 5.7-1: Allowed Configurations
* for the Adaptive Multi-Rate - Wideband Codec Types */
enum gsm0808_speech_codec_defaults {
- GSM0808_SC_CFG_DEFAULT_FR_AMR = 0xffff,
+ GSM0808_SC_CFG_DEFAULT_FR_AMR = 0x57ff,
GSM0808_SC_CFG_DEFAULT_HR_AMR = 0x073f,
- GSM0808_SC_CFG_DEFAULT_OHR_AMR = 0xffff,
+ GSM0808_SC_CFG_DEFAULT_OHR_AMR = 0x57ff,
GSM0808_SC_CFG_DEFAULT_FR_AMR_WB = 0x01,
GSM0808_SC_CFG_DEFAULT_OFR_AMR_WB = 0x3f,
GSM0808_SC_CFG_DEFAULT_OHR_AMR_WB = 0x01,
diff --git a/src/gsm/gsm0808_utils.c b/src/gsm/gsm0808_utils.c
index b58a4b8a..776f091d 100644
--- a/src/gsm/gsm0808_utils.c
+++ b/src/gsm/gsm0808_utils.c
@@ -210,7 +210,7 @@ static uint8_t enc_speech_codec(struct msgb *msg,
case GSM0808_SCT_FR3:
case GSM0808_SCT_HR3:
case GSM0808_SCT_HR6:
- msgb_put_u16(msg, sc->cfg);
+ msgb_put_u16(msg, osmo_ntohs(sc->cfg));
break;
case GSM0808_SCT_FR4:
case GSM0808_SCT_FR5:
@@ -320,7 +320,7 @@ int gsm0808_dec_speech_codec(struct gsm0808_speech_codec *sc,
case GSM0808_SCT_HR6:
if (len < 2)
return -EINVAL;
- sc->cfg = osmo_load16be(elem);
+ sc->cfg = osmo_load16le(elem);
elem += 2;
break;
default:
diff --git a/tests/gsm0808/gsm0808_test.c b/tests/gsm0808/gsm0808_test.c
index 4bd81b49..c3c86dc1 100644
--- a/tests/gsm0808/gsm0808_test.c
+++ b/tests/gsm0808/gsm0808_test.c
@@ -88,7 +88,7 @@ static void test_create_layer3_aoip()
0x00, 0x17, 0x57, 0x05, 0x08, 0x00, 0x77, 0x62,
0x83, 0x33, 0x66, 0x44, 0x88, 0x17, 0x01, 0x23,
GSM0808_IE_SPEECH_CODEC_LIST, 0x07, GSM0808_SCT_FR3 | 0x50,
- 0xcd, 0xef, GSM0808_SCT_FR2 | 0xa0, 0x9f,
+ 0xef, 0xcd, GSM0808_SCT_FR2 | 0xa0, 0x9f,
GSM0808_SCT_CSD | 0x90, 0xc0
};
@@ -284,7 +284,7 @@ static void test_create_ass()
{ 0x00, 0x20, 0x01, 0x0b, 0x04, 0x01, 0x0b, 0xa1, 0x25, 0x01, 0x00,
0x04, GSM0808_IE_AOIP_TRASP_ADDR, 0x06, 0xc0, 0xa8, 0x64, 0x17,
0x04, 0xd2, GSM0808_IE_SPEECH_CODEC_LIST, 0x07,
- GSM0808_SCT_FR3 | 0x50, 0xcd, 0xef, GSM0808_SCT_FR2 | 0xa0, 0x9f,
+ GSM0808_SCT_FR3 | 0x50, 0xef, 0xcd, GSM0808_SCT_FR2 | 0xa0, 0x9f,
GSM0808_SCT_CSD | 0x90, 0xc0, GSM0808_IE_CALL_ID, 0xaa, 0xbb,
0xcc, 0xdd };
@@ -354,8 +354,8 @@ static void test_create_ass_compl_aoip()
{ 0x00, 0x1d, 0x02, 0x15, 0x23, 0x21, 0x42, 0x2c, 0x11, 0x40, 0x22,
GSM0808_IE_AOIP_TRASP_ADDR, 0x06, 0xc0, 0xa8, 0x64, 0x17, 0x04,
0xd2, GSM0808_IE_SPEECH_CODEC, 0x01, GSM0808_SCT_HR1 | 0x90,
- GSM0808_IE_SPEECH_CODEC_LIST, 0x07, GSM0808_SCT_FR3 | 0x50, 0xcd,
- 0xef, GSM0808_SCT_FR2 | 0xa0, 0x9f, GSM0808_SCT_CSD | 0x90, 0xc0 };
+ GSM0808_IE_SPEECH_CODEC_LIST, 0x07, GSM0808_SCT_FR3 | 0x50, 0xef,
+ 0xcd, GSM0808_SCT_FR2 | 0xa0, 0x9f, GSM0808_SCT_CSD | 0x90, 0xc0 };
struct msgb *msg;
memset(&sin, 0, sizeof(sin));
@@ -402,12 +402,12 @@ static void test_create_ass_fail_aoip()
{
static const uint8_t res1[] =
{ 0x00, 0x0d, 0x03, 0x04, 0x01, 0x23, GSM0808_IE_SPEECH_CODEC_LIST,
- 0x07, GSM0808_SCT_FR3 | 0x50, 0xcd, 0xef, GSM0808_SCT_FR2 | 0xa0,
+ 0x07, GSM0808_SCT_FR3 | 0x50, 0xef, 0xcd, GSM0808_SCT_FR2 | 0xa0,
0x9f, GSM0808_SCT_CSD | 0x90, 0xc0 };
static const uint8_t res2[] =
{ 0x00, 0x0f, 0x03, 0x04, 0x01, 0x23, 0x15, 0x02,
- GSM0808_IE_SPEECH_CODEC_LIST, 0x07, GSM0808_SCT_FR3 | 0x50, 0xcd,
- 0xef, GSM0808_SCT_FR2 | 0xa0, 0x9f, GSM0808_SCT_CSD | 0x90, 0xc0 };
+ GSM0808_IE_SPEECH_CODEC_LIST, 0x07, GSM0808_SCT_FR3 | 0x50, 0xef,
+ 0xcd, GSM0808_SCT_FR2 | 0xa0, 0x9f, GSM0808_SCT_CSD | 0x90, 0xc0 };
uint8_t rr_res = 2;
struct msgb *msg;
struct gsm0808_speech_codec_list sc_list;