aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2023-09-13 22:42:08 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2023-09-13 23:04:42 +0200
commita597325751c8fe32524a63c05d95b63b55fd3dd4 (patch)
tree1ec779d9e35999cfc94c33098c20bb23caec56b0
parent48b3633140a801d445db37807179a09154ccc5bd (diff)
cosmetic tweaks in msc_a_up_call_assignment_complete()neels/dev
Move the CSD check upwards, out of the middle of codecs stuff. Improve the comments. Change-Id: I1c13fd8aec5b43b0ccc78d80c1bee28504510051
-rw-r--r--src/libmsc/msc_a.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/src/libmsc/msc_a.c b/src/libmsc/msc_a.c
index b4776a025..b37c34f21 100644
--- a/src/libmsc/msc_a.c
+++ b/src/libmsc/msc_a.c
@@ -1461,18 +1461,32 @@ static void msc_a_up_call_assignment_complete(struct msc_a *msc_a, const struct
if (codec_if_known) {
const struct codec_mapping *codec_cn;
- /* 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.
- * - Also set this codec at the MGW endpoint facing the CN -- we require an exact match on both call
- * legs.
+
+ /* 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;
+ }
+
+ /*
+ * The Assignment Complete has returned a specific codec in codec_if_known.
+ *
+ * For 2G:
+ * - Set this codec at the MGW endpoint on both the RAN and the CN sides.
* - TODO: be aware of transcoding that the MGW is capable of, e.g. AMR octet-aligned to AMR
* bandwidth-efficient...
*
+ * RAN <--CODEC--> MGW <--CODEC--> CN
+ *
* For 3G:
* - ran_infra->force_mgw_codecs_to_ran sets VND.3GPP.IUFP as single codec at the MGW towards RAN.
- * - ran_msg_iu.c always returns FR3 (AMR FR) for the assigned codec. Set that at the MGW towards CN.
+ * - Iu always returns FR3 (AMR FR) in codec_if_known. Set that at the MGW towards CN.
* - So the MGW decapsulates IuUP <-> AMR
+ *
+ * RAN <--IuFP--> MGW <--CODEC=AMR--> CN
*/
codec_cn = codec_mapping_by_gsm0808_speech_codec_type(codec_if_known->type);
/* TODO: use codec_mapping_by_gsm0808_speech_codec() to also match on codec_if_known->cfg */
@@ -1483,15 +1497,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)