osmith submitted this change.

View Change

Approvals: fixeria: Looks good to me, but someone else must approve pespin: Looks good to me, approved Jenkins Builder: Verified
gsm48_cc_tx_setup: fix speech bearer capabilities

Send the bearer capability IE from 3GPP TS 24.008 § D.1.2 for speech
instead of the result from gsm48_cc_tx_setup_set_bearer_cap() for the
network to MS direction. This is needed, because:

- We shall send spare bits for the radio channel requirement in the
network to MS direction, see 3GPP TS 24.008 § D.1.1 and Table
10.5.102).

- We could in theory send a speech version list that MS are then
supposed to ignore (end of Table 10.5.103), but this causes bugs in
some MS so it is better to not send it (OS#6656).

Related: OS#6657, OS#6655, OS#6656
Related: osmo-ttcn3-hacks I8fd33cf2f7fb8a1c34851ecf54fccddd2efd0536
Depends: libosmocore I97101c977104eae82e4850d40f9abd15aa03e33e
Change-Id: I7046e9244fd9d4301ee2c4df1147a619f753739c
---
M TODO-RELEASE
M src/libmsc/gsm_04_08_cc.c
M tests/msc_vlr/msc_vlr_test_call.c
M tests/msc_vlr/msc_vlr_test_call.err
4 files changed, 42 insertions(+), 27 deletions(-)

diff --git a/TODO-RELEASE b/TODO-RELEASE
index 0ed7189..6fb5213 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -7,3 +7,4 @@
# If any interfaces have been added since the last public release: c:r:a + 1.
# If any interfaces have been removed or changed since the last public release: c:r:0.
#library what description / commit summary line
+libosmocore > 1.11.0 uses new GSM48_BCAP_RRQ_SPARE_NETWORK_TO_MS (I97101c977104eae82e4850d40f9abd15aa03e33e)
diff --git a/src/libmsc/gsm_04_08_cc.c b/src/libmsc/gsm_04_08_cc.c
index 3968fbe..46ab176 100644
--- a/src/libmsc/gsm_04_08_cc.c
+++ b/src/libmsc/gsm_04_08_cc.c
@@ -911,8 +911,7 @@

/* Compose Bearer Capability information that reflects only the codecs (Speech
* Versions) / CSD bearer services remaining after intersecting MS, BSS and
- * remote call leg restrictions. To store in trans for later use, and to
- * include in the outgoing CC Setup message. */
+ * remote call leg restrictions. To store in trans for later use. */
static int gsm48_cc_tx_setup_set_bearer_cap(struct gsm_trans *trans, const struct gsm_mncc *setup)
{
int rc;
@@ -978,11 +977,30 @@
return 0;
}

-static struct msgb *gsm48_cc_tx_setup_encode_msg(const struct gsm_mncc_bearer_cap *bearer_cap,
+static struct msgb *gsm48_cc_tx_setup_encode_msg(const struct gsm_mncc_bearer_cap *bearer_cap_orig,
const struct gsm_mncc *setup)
{
struct msgb *msg = gsm48_msgb_alloc_name("GSM 04.08 CC SETUP");
struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_put(msg, sizeof(*gh));
+ const struct gsm_mncc_bearer_cap *bearer_cap = bearer_cap_orig;
+
+ /* Send the bearer capability IE from 3GPP TS 24.008 § D.1.2 for speech
+ * instead of the result from gsm48_cc_tx_setup_set_bearer_cap() for
+ * the network to MS direction. This is needed, because:
+ * - We shall send spare bits for the radio channel requirement in the
+ * network to MS direction (3GPP TS 24.008 § D.1.1 and Table
+ * 10.5.102).
+ * - We could in theory send a speech version list that MS are then
+ * supposed to ignore (end of Table 10.5.103), but this causes bugs
+ * in some MS so it is better to not send it (OS#6656). */
+ static const struct gsm_mncc_bearer_cap bcap_speech = {
+ .transfer = GSM48_BCAP_ITCAP_SPEECH,
+ .radio = GSM48_BCAP_RRQ_SPARE_NETWORK_TO_MS,
+ .speech_ver = { -1 },
+ };
+
+ if (bearer_cap->transfer == GSM48_BCAP_ITCAP_SPEECH)
+ bearer_cap = &bcap_speech;

gh->msg_type = GSM48_MT_CC_SETUP;

diff --git a/tests/msc_vlr/msc_vlr_test_call.c b/tests/msc_vlr/msc_vlr_test_call.c
index 14c8ea3..376a8c7 100644
--- a/tests/msc_vlr/msc_vlr_test_call.c
+++ b/tests/msc_vlr/msc_vlr_test_call.c
@@ -386,7 +386,7 @@
VERBOSE_ASSERT(security_mode_ctrl_sent, == true, "%d");

btw("MS sends SecurityModeControl acceptance, VLR accepts, sends CC Setup");
- dtap_expect_tx("0305" /* CC: Setup */ "04 04 60 04 05 8b" /* Bearer Cap, speech ver of AMR-FR and AMR-HR */);
+ dtap_expect_tx("0305" /* CC: Setup */ "04 01 a0" /* Bearer Cap, TS 24.008 § D.1.2 (OS#6657) */);
ms_sends_security_mode_complete(1);

btw("MS confirms call, we create a RAN-side RTP and forward MNCC_CALL_CONF_IND");
@@ -524,7 +524,7 @@
VERBOSE_ASSERT(security_mode_ctrl_sent, == true, "%d");

btw("MS sends SecurityModeControl acceptance, VLR accepts, sends CC Setup");
- dtap_expect_tx("0305" /* CC: Setup */ "04 04 60 04 05 8b" /* Bearer Cap, speech ver of AMR-FR and AMR-HR */);
+ dtap_expect_tx("0305" /* CC: Setup */ "04 01 a0" /* Bearer Cap, TS 24.008 § D.1.2 (OS#6657) */);
ms_sends_security_mode_complete(1);

btw("MS confirms call, we create a RAN-side RTP and forward MNCC_CALL_CONF_IND");
@@ -1510,17 +1510,13 @@
return;
}

- btw("VLR accepts, MSC sends CC Setup with Bearer Capability = %s",
- bcap_name(t->mt_tx_cc_setup_bcap));
- char *cc_setup_bcap = talloc_asprintf(msc_vlr_tests_ctx, "0305%s",
- bcap_hexstr(t->mt_tx_cc_setup_bcap));
- dtap_expect_tx(cc_setup_bcap);
+ btw("VLR accepts, MSC sends CC Setup with Bearer Capability = TS 24.008 § D.1.2");
+ dtap_expect_tx("0305" /* CC: Setup */ "04 01 a0" /* Bearer Cap, TS 24.008 § D.1.2 (OS#6657) */);
ms_sends_compl_l3("062707"
"03575886" /* classmark 2 */
"089910070000106005" /* IMSI */,
codec_list(t->mt_rx_compl_l3_codec_list_bss_supported));
OSMO_ASSERT(dtap_tx_confirmed);
- talloc_free(cc_setup_bcap);

btw("MS confirms call, we create a RAN-side RTP and forward MNCC_CALL_CONF_IND");
expect_crcx(RTP_TO_CN);
diff --git a/tests/msc_vlr/msc_vlr_test_call.err b/tests/msc_vlr/msc_vlr_test_call.err
index ffef105..b7929b7 100644
--- a/tests/msc_vlr/msc_vlr_test_call.err
+++ b/tests/msc_vlr/msc_vlr_test_call.err
@@ -800,7 +800,7 @@
DCC trans(CC:NULL IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP callref-0x423 tid-0) new state NULL -> CALL_PRESENT
DIUCS msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){MSC_A_ST_COMMUNICATING}: Sending DTAP: CC GSM48_MT_CC_SETUP
DMSC msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){MSC_A_ST_COMMUNICATING}: RAN encode: DTAP on UTRAN-Iu
-- DTAP --UTRAN-Iu--> MS: GSM48_MT_CC_SETUP: 030504046004058b
+- DTAP --UTRAN-Iu--> MS: GSM48_MT_CC_SETUP: 03050401a0
- DTAP matches expected message
DMSC dummy_msc_i(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){0}: Received Event MSC_I_EV_FROM_A_FORWARD_ACCESS_SIGNALLING_REQUEST
DVLR VLR subscr IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100 - Paging: now used by 3 (attached,CC,active-conn)
@@ -1320,7 +1320,7 @@
DCC trans(CC:NULL IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP callref-0x423 tid-0) new state NULL -> CALL_PRESENT
DIUCS msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){MSC_A_ST_COMMUNICATING}: Sending DTAP: CC GSM48_MT_CC_SETUP
DMSC msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){MSC_A_ST_COMMUNICATING}: RAN encode: DTAP on UTRAN-Iu
-- DTAP --UTRAN-Iu--> MS: GSM48_MT_CC_SETUP: 030504046004058b
+- DTAP --UTRAN-Iu--> MS: GSM48_MT_CC_SETUP: 03050401a0
- DTAP matches expected message
DMSC dummy_msc_i(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){0}: Received Event MSC_I_EV_FROM_A_FORWARD_ACCESS_SIGNALLING_REQUEST
DVLR VLR subscr IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100 - Paging: now used by 3 (attached,CC,active-conn)
@@ -2875,7 +2875,7 @@
DVLR VLR subscr IMSI-901700000010650:MSISDN-46071 - mncc_tx_to_gsm_cc: now used by 3 (attached,CC,Paging)
paging_sent == 1
- MS replies with Paging Response, with Codec List (BSS Supported) = FR1 FR2 FR3 HR1 HR3
-- VLR accepts, MSC sends CC Setup with Bearer Capability = AMR AMR AMR GSM-EFR GSM GSM-HR-08
+- VLR accepts, MSC sends CC Setup with Bearer Capability = TS 24.008 § D.1.2
MSC <--GERAN-A-- MS: GSM48_MT_RR_PAG_RESP
new conn
DMSC msub_fsm{active}: Allocated
@@ -2923,7 +2923,7 @@
DCC trans(CC:NULL IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP callref-0x423 tid-0) new state NULL -> CALL_PRESENT
DBSSAP msc_a(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP){MSC_A_ST_COMMUNICATING}: Sending DTAP: CC GSM48_MT_CC_SETUP
DMSC msc_a(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP){MSC_A_ST_COMMUNICATING}: RAN encode: DTAP on GERAN-A
-- DTAP --GERAN-A--> MS: GSM48_MT_CC_SETUP: 030504076004050b020081
+- DTAP --GERAN-A--> MS: GSM48_MT_CC_SETUP: 03050401a0
- DTAP matches expected message
DMSC dummy_msc_i(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP){0}: Received Event MSC_I_EV_FROM_A_FORWARD_ACCESS_SIGNALLING_REQUEST
DVLR VLR subscr IMSI-901700000010650:MSISDN-46071 - Paging: now used by 4 (attached,CC,proc_arq_vlr_fn_init,active-conn)
@@ -3490,7 +3490,7 @@
DVLR VLR subscr IMSI-901700000010650:MSISDN-46071 - mncc_tx_to_gsm_cc: now used by 3 (attached,CC,Paging)
paging_sent == 1
- MS replies with Paging Response, with Codec List (BSS Supported) = FR1 FR2 FR3 HR1 HR3
-- VLR accepts, MSC sends CC Setup with Bearer Capability = GSM
+- VLR accepts, MSC sends CC Setup with Bearer Capability = TS 24.008 § D.1.2
MSC <--GERAN-A-- MS: GSM48_MT_RR_PAG_RESP
new conn
DMSC msub_fsm{active}: Allocated
@@ -3538,7 +3538,7 @@
DCC trans(CC:NULL IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP callref-0x423 tid-0) new state NULL -> CALL_PRESENT
DBSSAP msc_a(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP){MSC_A_ST_COMMUNICATING}: Sending DTAP: CC GSM48_MT_CC_SETUP
DMSC msc_a(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP){MSC_A_ST_COMMUNICATING}: RAN encode: DTAP on GERAN-A
-- DTAP --GERAN-A--> MS: GSM48_MT_CC_SETUP: 030504022080
+- DTAP --GERAN-A--> MS: GSM48_MT_CC_SETUP: 03050401a0
- DTAP matches expected message
DMSC dummy_msc_i(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP){0}: Received Event MSC_I_EV_FROM_A_FORWARD_ACCESS_SIGNALLING_REQUEST
DVLR VLR subscr IMSI-901700000010650:MSISDN-46071 - Paging: now used by 4 (attached,CC,proc_arq_vlr_fn_init,active-conn)
@@ -4093,7 +4093,7 @@
DVLR VLR subscr IMSI-901700000010650:MSISDN-46071 - mncc_tx_to_gsm_cc: now used by 3 (attached,CC,Paging)
paging_sent == 1
- MS replies with Paging Response, with Codec List (BSS Supported) = FR1 FR2 FR3 HR1 HR3
-- VLR accepts, MSC sends CC Setup with Bearer Capability = GSM
+- VLR accepts, MSC sends CC Setup with Bearer Capability = TS 24.008 § D.1.2
MSC <--GERAN-A-- MS: GSM48_MT_RR_PAG_RESP
new conn
DMSC msub_fsm{active}: Allocated
@@ -4141,7 +4141,7 @@
DCC trans(CC:NULL IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP callref-0x423 tid-0) new state NULL -> CALL_PRESENT
DBSSAP msc_a(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP){MSC_A_ST_COMMUNICATING}: Sending DTAP: CC GSM48_MT_CC_SETUP
DMSC msc_a(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP){MSC_A_ST_COMMUNICATING}: RAN encode: DTAP on GERAN-A
-- DTAP --GERAN-A--> MS: GSM48_MT_CC_SETUP: 030504022080
+- DTAP --GERAN-A--> MS: GSM48_MT_CC_SETUP: 03050401a0
- DTAP matches expected message
DMSC dummy_msc_i(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP){0}: Received Event MSC_I_EV_FROM_A_FORWARD_ACCESS_SIGNALLING_REQUEST
DVLR VLR subscr IMSI-901700000010650:MSISDN-46071 - Paging: now used by 4 (attached,CC,proc_arq_vlr_fn_init,active-conn)
@@ -4723,7 +4723,7 @@
DVLR VLR subscr IMSI-901700000010650:MSISDN-46071 - mncc_tx_to_gsm_cc: now used by 3 (attached,CC,Paging)
paging_sent == 1
- MS replies with Paging Response, with Codec List (BSS Supported) = FR1
-- VLR accepts, MSC sends CC Setup with Bearer Capability = GSM
+- VLR accepts, MSC sends CC Setup with Bearer Capability = TS 24.008 § D.1.2
MSC <--GERAN-A-- MS: GSM48_MT_RR_PAG_RESP
new conn
DMSC msub_fsm{active}: Allocated
@@ -4771,7 +4771,7 @@
DCC trans(CC:NULL IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP callref-0x423 tid-0) new state NULL -> CALL_PRESENT
DBSSAP msc_a(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP){MSC_A_ST_COMMUNICATING}: Sending DTAP: CC GSM48_MT_CC_SETUP
DMSC msc_a(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP){MSC_A_ST_COMMUNICATING}: RAN encode: DTAP on GERAN-A
-- DTAP --GERAN-A--> MS: GSM48_MT_CC_SETUP: 030504022080
+- DTAP --GERAN-A--> MS: GSM48_MT_CC_SETUP: 03050401a0
- DTAP matches expected message
DMSC dummy_msc_i(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP){0}: Received Event MSC_I_EV_FROM_A_FORWARD_ACCESS_SIGNALLING_REQUEST
DVLR VLR subscr IMSI-901700000010650:MSISDN-46071 - Paging: now used by 4 (attached,CC,proc_arq_vlr_fn_init,active-conn)
@@ -5353,7 +5353,7 @@
DVLR VLR subscr IMSI-901700000010650:MSISDN-46071 - mncc_tx_to_gsm_cc: now used by 3 (attached,CC,Paging)
paging_sent == 1
- MS replies with Paging Response, with Codec List (BSS Supported) = FR1 FR2 FR3 HR1 HR3
-- VLR accepts, MSC sends CC Setup with Bearer Capability = AMR AMR AMR GSM-EFR GSM GSM-HR-08
+- VLR accepts, MSC sends CC Setup with Bearer Capability = TS 24.008 § D.1.2
MSC <--GERAN-A-- MS: GSM48_MT_RR_PAG_RESP
new conn
DMSC msub_fsm{active}: Allocated
@@ -5401,7 +5401,7 @@
DCC trans(CC:NULL IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP callref-0x423 tid-0) new state NULL -> CALL_PRESENT
DBSSAP msc_a(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP){MSC_A_ST_COMMUNICATING}: Sending DTAP: CC GSM48_MT_CC_SETUP
DMSC msc_a(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP){MSC_A_ST_COMMUNICATING}: RAN encode: DTAP on GERAN-A
-- DTAP --GERAN-A--> MS: GSM48_MT_CC_SETUP: 030504076004050b020081
+- DTAP --GERAN-A--> MS: GSM48_MT_CC_SETUP: 03050401a0
- DTAP matches expected message
DMSC dummy_msc_i(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP){0}: Received Event MSC_I_EV_FROM_A_FORWARD_ACCESS_SIGNALLING_REQUEST
DVLR VLR subscr IMSI-901700000010650:MSISDN-46071 - Paging: now used by 4 (attached,CC,proc_arq_vlr_fn_init,active-conn)
@@ -5980,7 +5980,7 @@
DVLR VLR subscr IMSI-901700000010650:MSISDN-46071 - mncc_tx_to_gsm_cc: now used by 3 (attached,CC,Paging)
paging_sent == 1
- MS replies with Paging Response, with Codec List (BSS Supported) = FR1 FR2 FR3 HR1 HR3
-- VLR accepts, MSC sends CC Setup with Bearer Capability = AMR AMR AMR GSM-EFR GSM GSM-HR-08
+- VLR accepts, MSC sends CC Setup with Bearer Capability = TS 24.008 § D.1.2
MSC <--GERAN-A-- MS: GSM48_MT_RR_PAG_RESP
new conn
DMSC msub_fsm{active}: Allocated
@@ -6028,7 +6028,7 @@
DCC trans(CC:NULL IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP callref-0x423 tid-0) new state NULL -> CALL_PRESENT
DBSSAP msc_a(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP){MSC_A_ST_COMMUNICATING}: Sending DTAP: CC GSM48_MT_CC_SETUP
DMSC msc_a(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP){MSC_A_ST_COMMUNICATING}: RAN encode: DTAP on GERAN-A
-- DTAP --GERAN-A--> MS: GSM48_MT_CC_SETUP: 030504076004050b020081
+- DTAP --GERAN-A--> MS: GSM48_MT_CC_SETUP: 03050401a0
- DTAP matches expected message
DMSC dummy_msc_i(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP){0}: Received Event MSC_I_EV_FROM_A_FORWARD_ACCESS_SIGNALLING_REQUEST
DVLR VLR subscr IMSI-901700000010650:MSISDN-46071 - Paging: now used by 4 (attached,CC,proc_arq_vlr_fn_init,active-conn)
@@ -6619,7 +6619,7 @@
DVLR VLR subscr IMSI-901700000010650:MSISDN-46071 - mncc_tx_to_gsm_cc: now used by 3 (attached,CC,Paging)
paging_sent == 1
- MS replies with Paging Response, with Codec List (BSS Supported) = FR1 FR2 FR3 HR1 HR3
-- VLR accepts, MSC sends CC Setup with Bearer Capability = AMR AMR AMR GSM-EFR GSM GSM-HR-08
+- VLR accepts, MSC sends CC Setup with Bearer Capability = TS 24.008 § D.1.2
MSC <--GERAN-A-- MS: GSM48_MT_RR_PAG_RESP
new conn
DMSC msub_fsm{active}: Allocated
@@ -6667,7 +6667,7 @@
DCC trans(CC:NULL IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP callref-0x423 tid-0) new state NULL -> CALL_PRESENT
DBSSAP msc_a(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP){MSC_A_ST_COMMUNICATING}: Sending DTAP: CC GSM48_MT_CC_SETUP
DMSC msc_a(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP){MSC_A_ST_COMMUNICATING}: RAN encode: DTAP on GERAN-A
-- DTAP --GERAN-A--> MS: GSM48_MT_CC_SETUP: 030504076004050b020081
+- DTAP --GERAN-A--> MS: GSM48_MT_CC_SETUP: 03050401a0
- DTAP matches expected message
DMSC dummy_msc_i(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP){0}: Received Event MSC_I_EV_FROM_A_FORWARD_ACCESS_SIGNALLING_REQUEST
DVLR VLR subscr IMSI-901700000010650:MSISDN-46071 - Paging: now used by 4 (attached,CC,proc_arq_vlr_fn_init,active-conn)

To view, visit change 41043. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: I7046e9244fd9d4301ee2c4df1147a619f753739c
Gerrit-Change-Number: 41043
Gerrit-PatchSet: 3
Gerrit-Owner: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>