From ba377c439d83f5b72ccc4e4d6f454dc3ba643a4a Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Fri, 19 Jan 2024 06:08:54 +0100 Subject: [PATCH] msc_vlr_test_call: test AMR speech_codec cfg Use the full struct gsm0808_speech_codec instead of just the enum gsm0808_speech_codec_type: allow testing specific AMR mode-sets on A/Iu signalling. Prepare for matching AMR fmtp parameters between call legs. Change-Id: I387490525007bdf2e95306fd9b4e5e3b7e487d0f --- tests/msc_vlr/msc_vlr_test_call.c | 45 +++++++++++++++-------------- tests/msc_vlr/msc_vlr_test_call.err | 24 +++++++-------- 2 files changed, 36 insertions(+), 33 deletions(-) diff --git a/tests/msc_vlr/msc_vlr_test_call.c b/tests/msc_vlr/msc_vlr_test_call.c index 046fd72f2..01dedbba6 100644 --- a/tests/msc_vlr/msc_vlr_test_call.c +++ b/tests/msc_vlr/msc_vlr_test_call.c @@ -785,7 +785,7 @@ struct codec_test { const char *desc; /* What to send during Complete Layer 3 as Codec List (BSS Supported). List ends with a LIST_END entry */ - enum gsm0808_speech_codec_type mo_rx_compl_l3_codec_list_bss_supported[8]; + struct gsm0808_speech_codec mo_rx_compl_l3_codec_list_bss_supported[8]; /* What to send during CC Setup as MS Bearer Capability. List ends with a LIST_END entry */ enum gsm48_bcap_speech_ver mo_rx_ms_bcap[8]; @@ -810,7 +810,7 @@ struct codec_test { /* mt_rx_sdp_mncc_setup_req == mo_tx_sdp_mncc_rtp_create */ #define mt_rx_sdp_mncc_setup_req mo_tx_sdp_mncc_rtp_create - enum gsm0808_speech_codec_type mt_rx_compl_l3_codec_list_bss_supported[8]; + struct gsm0808_speech_codec mt_rx_compl_l3_codec_list_bss_supported[8]; bool expect_codec_mismatch_on_paging_response; enum gsm48_bcap_speech_ver mt_tx_cc_setup_bcap[8]; enum gsm48_bcap_speech_ver mt_rx_ms_bcap[8]; @@ -839,13 +839,16 @@ struct codec_test { const char *mo_tx_sdp_mncc_setup_compl_ind[8]; }; +/* define a struct gsm0808_speech_codec */ +#define SC(TYPE, CFG) { .fi = true, .type = TYPE, .cfg = CFG } + +/* define a struct gsm0808_speech_codec list[] */ #define CODEC_LIST_ALL_GSM { \ - GSM0808_SCT_FR1, \ - GSM0808_SCT_FR2, \ - GSM0808_SCT_FR3, \ - GSM0808_SCT_HR1, \ - GSM0808_SCT_HR3, \ - LIST_END \ + SC(GSM0808_SCT_FR1, 0), \ + SC(GSM0808_SCT_FR2, 0), \ + SC(GSM0808_SCT_FR3, GSM0808_SC_CFG_DEFAULT_FR_AMR), \ + SC(GSM0808_SCT_HR1, 0), \ + SC(GSM0808_SCT_HR3, GSM0808_SC_CFG_DEFAULT_HR_AMR), \ } #define BCAP_ALL_GSM { \ @@ -913,7 +916,7 @@ static const struct codec_test codec_tests[] = { { .desc = "FR1 picked by MO from Codec List (BSS Supported), MT hence also picks FR1", - .mo_rx_compl_l3_codec_list_bss_supported = { GSM0808_SCT_FR1, LIST_END }, + .mo_rx_compl_l3_codec_list_bss_supported = { SC(GSM0808_SCT_FR1, 0) }, .mo_rx_ms_bcap = BCAP_ALL_GSM, .mo_tx_sdp_mncc_setup_ind = { "GSM" }, .mo_rx_sdp_mncc_rtp_create = {}, @@ -968,7 +971,7 @@ static const struct codec_test codec_tests[] = { .mo_tx_sdp_mncc_rtp_create = { "AMR", "GSM-EFR", "GSM", "GSM-HR-08" }, /* This is the codec limitation this test verifies, Codec List (BSS Supported): */ - .mt_rx_compl_l3_codec_list_bss_supported = { GSM0808_SCT_FR1, LIST_END }, + .mt_rx_compl_l3_codec_list_bss_supported = { SC(GSM0808_SCT_FR1, 0) }, /* from above codec list, MSC derives the limited bcap sent in CC Setup to MS */ .mt_tx_cc_setup_bcap = { @@ -1115,28 +1118,28 @@ static const struct codec_test codec_tests[] = { static char namebuf[4][1024]; static int use_namebuf = 0; -static const char *codec_list_name(const enum gsm0808_speech_codec_type compl_l3_codec_list_bss_supported[]) +static const char *codec_list_name(const struct gsm0808_speech_codec compl_l3_codec_list_bss_supported[]) { struct osmo_strbuf sb = { .buf = namebuf[use_namebuf], .len = sizeof(namebuf[0]) }; use_namebuf = (use_namebuf + 1) % ARRAY_SIZE(namebuf); - const enum gsm0808_speech_codec_type *pos; + const struct gsm0808_speech_codec *pos; sb.buf[0] = '\0'; - for (pos = compl_l3_codec_list_bss_supported; *pos != LIST_END; pos++) - OSMO_STRBUF_PRINTF(sb, " %s", gsm0808_speech_codec_type_name(*pos)); + for (pos = compl_l3_codec_list_bss_supported; pos->fi; pos++) { + OSMO_STRBUF_PRINTF(sb, " %s", gsm0808_speech_codec_type_name(pos->type)); + if (pos->cfg) + OSMO_STRBUF_PRINTF(sb, ":%x", pos->cfg); + } return sb.buf; } -static const struct gsm0808_speech_codec_list *codec_list(const enum gsm0808_speech_codec_type compl_l3_codec_list_bss_supported[]) +static const struct gsm0808_speech_codec_list *codec_list(const struct gsm0808_speech_codec compl_l3_codec_list_bss_supported[]) { static struct gsm0808_speech_codec_list scl; scl = (struct gsm0808_speech_codec_list){}; - const enum gsm0808_speech_codec_type *pos; - for (pos = compl_l3_codec_list_bss_supported; *pos != LIST_END; pos++) { - scl.codec[scl.len] = (struct gsm0808_speech_codec){ - .fi = true, - .type = *pos, - }; + const struct gsm0808_speech_codec *pos; + for (pos = compl_l3_codec_list_bss_supported; pos->fi; pos++) { + scl.codec[scl.len] = *pos; scl.len++; } return &scl; diff --git a/tests/msc_vlr/msc_vlr_test_call.err b/tests/msc_vlr/msc_vlr_test_call.err index 6a890ae00..ca0a88f16 100644 --- a/tests/msc_vlr/msc_vlr_test_call.err +++ b/tests/msc_vlr/msc_vlr_test_call.err @@ -2521,7 +2521,7 @@ DMSC msc_a(IMSI-901700000010650:MSISDN-46071:GERAN-A:LU){MSC_A_ST_RELEASED}: Dea - ======================== MO call: AMR picked by both MO and MT -- CM Service Request with Codec List (BSS Supported) = FR1 FR2 FR3 HR1 HR3 +- CM Service Request with Codec List (BSS Supported) = FR1 FR2 FR3:57ff HR1 HR3:73f MSC <--GERAN-A-- MS: GSM48_MT_MM_CM_SERV_REQ new conn DMSC msub_fsm{active}: Allocated @@ -2874,7 +2874,7 @@ DPAG Paging: IMSI-901700000010650:MSISDN-46071 for MNCC: establish call: Startin DREF VLR subscr IMSI-901700000010650:MSISDN-46071 + Paging: now used by 4 (attached,mncc_tx_to_gsm_cc,CC,Paging) DREF 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 +- MS replies with Paging Response, with Codec List (BSS Supported) = FR1 FR2 FR3:57ff HR1 HR3:73f - VLR accepts, MSC sends CC Setup with Bearer Capability = AMR AMR GSM-EFR GSM GSM-HR-08 MSC <--GERAN-A-- MS: GSM48_MT_RR_PAG_RESP new conn @@ -3489,7 +3489,7 @@ DPAG Paging: IMSI-901700000010650:MSISDN-46071 for MNCC: establish call: Startin DREF VLR subscr IMSI-901700000010650:MSISDN-46071 + Paging: now used by 4 (attached,mncc_tx_to_gsm_cc,CC,Paging) DREF 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 +- MS replies with Paging Response, with Codec List (BSS Supported) = FR1 FR2 FR3:57ff HR1 HR3:73f - VLR accepts, MSC sends CC Setup with Bearer Capability = GSM MSC <--GERAN-A-- MS: GSM48_MT_RR_PAG_RESP new conn @@ -3763,7 +3763,7 @@ DMSC msc_a(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP){MSC_A_ST_RELEA - ======================== MO call: FR1 picked by MO from Bearer Cap, MT hence also picks FR1 -- CM Service Request with Codec List (BSS Supported) = FR1 FR2 FR3 HR1 HR3 +- CM Service Request with Codec List (BSS Supported) = FR1 FR2 FR3:57ff HR1 HR3:73f MSC <--GERAN-A-- MS: GSM48_MT_MM_CM_SERV_REQ new conn DMSC msub_fsm{active}: Allocated @@ -4092,7 +4092,7 @@ DPAG Paging: IMSI-901700000010650:MSISDN-46071 for MNCC: establish call: Startin DREF VLR subscr IMSI-901700000010650:MSISDN-46071 + Paging: now used by 4 (attached,mncc_tx_to_gsm_cc,CC,Paging) DREF 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 +- MS replies with Paging Response, with Codec List (BSS Supported) = FR1 FR2 FR3:57ff HR1 HR3:73f - VLR accepts, MSC sends CC Setup with Bearer Capability = GSM MSC <--GERAN-A-- MS: GSM48_MT_RR_PAG_RESP new conn @@ -4366,7 +4366,7 @@ DMSC msc_a(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP){MSC_A_ST_RELEA - ======================== MO call: FR1 picked by MT's Codec List (BSS Supported), hence MO re-assigns to FR1 -- CM Service Request with Codec List (BSS Supported) = FR1 FR2 FR3 HR1 HR3 +- CM Service Request with Codec List (BSS Supported) = FR1 FR2 FR3:57ff HR1 HR3:73f MSC <--GERAN-A-- MS: GSM48_MT_MM_CM_SERV_REQ new conn DMSC msub_fsm{active}: Allocated @@ -4996,7 +4996,7 @@ DMSC msc_a(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP){MSC_A_ST_RELEA - ======================== MO call: FR1 picked by MT's MS Bearer Capability, hence MO re-assigns to FR1 -- CM Service Request with Codec List (BSS Supported) = FR1 FR2 FR3 HR1 HR3 +- CM Service Request with Codec List (BSS Supported) = FR1 FR2 FR3:57ff HR1 HR3:73f MSC <--GERAN-A-- MS: GSM48_MT_MM_CM_SERV_REQ new conn DMSC msub_fsm{active}: Allocated @@ -5352,7 +5352,7 @@ DPAG Paging: IMSI-901700000010650:MSISDN-46071 for MNCC: establish call: Startin DREF VLR subscr IMSI-901700000010650:MSISDN-46071 + Paging: now used by 4 (attached,mncc_tx_to_gsm_cc,CC,Paging) DREF 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 +- MS replies with Paging Response, with Codec List (BSS Supported) = FR1 FR2 FR3:57ff HR1 HR3:73f - VLR accepts, MSC sends CC Setup with Bearer Capability = AMR AMR GSM-EFR GSM GSM-HR-08 MSC <--GERAN-A-- MS: GSM48_MT_RR_PAG_RESP new conn @@ -5626,7 +5626,7 @@ DMSC msc_a(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP){MSC_A_ST_RELEA - ======================== MO call: AMR picked by both MO and MT, but MT assigns a different payload type number -- CM Service Request with Codec List (BSS Supported) = FR1 FR2 FR3 HR1 HR3 +- CM Service Request with Codec List (BSS Supported) = FR1 FR2 FR3:57ff HR1 HR3:73f MSC <--GERAN-A-- MS: GSM48_MT_MM_CM_SERV_REQ new conn DMSC msub_fsm{active}: Allocated @@ -5979,7 +5979,7 @@ DPAG Paging: IMSI-901700000010650:MSISDN-46071 for MNCC: establish call: Startin DREF VLR subscr IMSI-901700000010650:MSISDN-46071 + Paging: now used by 4 (attached,mncc_tx_to_gsm_cc,CC,Paging) DREF 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 +- MS replies with Paging Response, with Codec List (BSS Supported) = FR1 FR2 FR3:57ff HR1 HR3:73f - VLR accepts, MSC sends CC Setup with Bearer Capability = AMR AMR GSM-EFR GSM GSM-HR-08 MSC <--GERAN-A-- MS: GSM48_MT_RR_PAG_RESP new conn @@ -6265,7 +6265,7 @@ DMSC msc_a(IMSI-901700000010650:MSISDN-46071:GERAN-A:PAGING_RESP){MSC_A_ST_RELEA - ======================== MO call: AMR picked by both MO and MT, but MO assigns a different payload type number -- CM Service Request with Codec List (BSS Supported) = FR1 FR2 FR3 HR1 HR3 +- CM Service Request with Codec List (BSS Supported) = FR1 FR2 FR3:57ff HR1 HR3:73f MSC <--GERAN-A-- MS: GSM48_MT_MM_CM_SERV_REQ new conn DMSC msub_fsm{active}: Allocated @@ -6618,7 +6618,7 @@ DPAG Paging: IMSI-901700000010650:MSISDN-46071 for MNCC: establish call: Startin DREF VLR subscr IMSI-901700000010650:MSISDN-46071 + Paging: now used by 4 (attached,mncc_tx_to_gsm_cc,CC,Paging) DREF 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 +- MS replies with Paging Response, with Codec List (BSS Supported) = FR1 FR2 FR3:57ff HR1 HR3:73f - VLR accepts, MSC sends CC Setup with Bearer Capability = AMR AMR GSM-EFR GSM GSM-HR-08 MSC <--GERAN-A-- MS: GSM48_MT_RR_PAG_RESP new conn