From bd8ac51b60ccc3883ac500fda9629dcd090d570b Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Fri, 19 Jan 2024 06:38:11 +0100 Subject: [PATCH] cosmetic: move check for CSD further above Currently the CSD check is in the middle of figuring out the voice codec for normal voice calls. Rather do the CSD check first, and then do voice in one coherent section. (prep for upcoming change in this code, to support AMR rate selection.) Change-Id: Ibd21f0bb46c66a406904105564ce961a8760cbe7 --- src/libmsc/msc_a.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/libmsc/msc_a.c b/src/libmsc/msc_a.c index 4fa967633..38f05a6d4 100644 --- a/src/libmsc/msc_a.c +++ b/src/libmsc/msc_a.c @@ -1464,6 +1464,15 @@ static void msc_a_up_call_assignment_complete(struct msc_a *msc_a, const struct if (codec_if_known) { const struct codec_mapping *codec_assigned; + /* Check for unexpected codec with CSD */ + if (cc_trans->bearer_cap.transfer == GSM48_BCAP_ITCAP_UNR_DIG_INF && + codec_if_known->type != GSM0808_SCT_CSD) { + LOG_TRANS(cc_trans, LOGL_ERROR, "Unexpected codec in Assignment Complete for CSD: %s\n", + gsm0808_speech_codec_type_name(codec_if_known->type)); + call_leg_release(msc_a->cc.call_leg); + return; + } + /* For 2G: * - The Assignment Complete has returned a specific codec (e.g. FR3 for AMR FR). * - Set this codec at the MGW endpoint facing the RAN. @@ -1486,15 +1495,6 @@ static void msc_a_up_call_assignment_complete(struct msc_a *msc_a, const struct return; } - /* Check for unexpected codec with CSD */ - if (cc_trans->bearer_cap.transfer == GSM48_BCAP_ITCAP_UNR_DIG_INF && - codec_if_known->type != GSM0808_SCT_CSD) { - LOG_TRANS(cc_trans, LOGL_ERROR, "Unexpected codec in Assignment Complete for CSD: %s\n", - gsm0808_speech_codec_type_name(codec_if_known->type)); - call_leg_release(msc_a->cc.call_leg); - return; - } - /* Update RAN-side endpoint CI from Assignment result -- unless it is forced by the ran_infra, in which * case it remains unchanged as passed to the earlier call of call_leg_ensure_ci(). */ if (msc_a->c.ran->force_mgw_codecs_to_ran.count == 0)