in ran_msg, return gsm0808_speech_codec (intra-MSC)

Do not convert to enum mgcp_codecs, but directly pass the
gsm0808_speech_codec IE from the A interface to codecs handling.

For Iu:
- RAN side: use ran_infra.force_mgw_codecs_to_ran to keep the MGW
  endpoint towards RAN on IUFP.
- CN side: introduce flag ran_msg.assignment_complete.codec_with_iuup,
  so to decide whether to forward IUFP towards CN, we don't need to test
  the RAN type, but use the flag from the ran_msg implementation.

In msc_vlr_tests, use the SDP codec string instead of enum
mgcp_codecs.

So far limit to intra-MSC related messaging, adjusting inter-MSC
handover follows in a separate patch.

Change-Id: Ia666cb697fbd140d7239089628faed93860ce671
diff --git a/include/osmocom/msc/ran_msg.h b/include/osmocom/msc/ran_msg.h
index 32b24a0..d6b1e75 100644
--- a/include/osmocom/msc/ran_msg.h
+++ b/include/osmocom/msc/ran_msg.h
@@ -240,7 +240,8 @@
 		struct {
 			struct osmo_sockaddr_str remote_rtp;
 			bool codec_present;
-			enum mgcp_codecs codec;
+			struct gsm0808_speech_codec codec;
+			bool codec_with_iuup;
 			const struct gsm0808_speech_codec_list *codec_list_bss_supported;
 			bool osmux_present;
 			uint8_t osmux_cid;
diff --git a/src/libmsc/msc_a.c b/src/libmsc/msc_a.c
index e9f1840..f1e365f 100644
--- a/src/libmsc/msc_a.c
+++ b/src/libmsc/msc_a.c
@@ -1325,8 +1325,8 @@
 {
 	struct gsm_trans *cc_trans = msc_a->cc.active_trans;
 	struct rtp_stream *rtps_to_ran = msc_a->cc.call_leg ? msc_a->cc.call_leg->rtp[RTP_TO_RAN] : NULL;
-	const enum mgcp_codecs *codec_if_known = ac->assignment_complete.codec_present ?
-							&ac->assignment_complete.codec : NULL;
+	const struct gsm0808_speech_codec *codec_if_known = ac->assignment_complete.codec_present ?
+							    &ac->assignment_complete.codec : NULL;
 	const struct codec_mapping *codec_cn = NULL;
 
 	if (!rtps_to_ran) {
@@ -1346,16 +1346,33 @@
 	}
 
 	if (codec_if_known) {
-		codec_cn = codec_mapping_by_mgcp_codec(*codec_if_known);
-		if (!codec_cn) {
-			LOG_TRANS(cc_trans, LOGL_ERROR, "Unknown codec in Assignment Complete: %s\n",
-				  osmo_mgcpc_codec_name(*codec_if_known));
-			call_leg_release(msc_a->cc.call_leg);
-			return;
+		if (ac->assignment_complete.codec_with_iuup) {
+			/* FUTURE: soon, we want to tell the MGW to decapsulate IuUP to plain AMR-FR/RTP. So far,
+			 * continue to forward IuUP to the CN.
+			 *
+			 * ran_msg_iu now returns AMR-FR as the assigned codec. If we use that directly, that will
+			 * instruct the MGW to decapsulate IuUP into plain RTP. Let's keep this change to an explicit
+			 * patch, while various codecs patches are still being applied.
+			 *
+			 * So instruct MGW to forward IuUP to CN:
+			 */
+			codec_cn = codec_mapping_by_subtype_name("VND.3GPP.IUFP");
+			OSMO_ASSERT(codec_cn);
+		} else {
+			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 */
+			if (!codec_cn) {
+				LOG_TRANS(cc_trans, LOGL_ERROR, "Unknown codec in Assignment Complete: %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 */
-		rtp_stream_set_one_codec(rtps_to_ran, &codec_cn->sdp);
+		/* 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)
+			rtp_stream_set_one_codec(rtps_to_ran, &codec_cn->sdp);
 
 		/* Update codec filter with Assignment result, for the CN side */
 		cc_trans->cc.codecs.assignment = codec_cn->sdp;
diff --git a/src/libmsc/ran_msg_a.c b/src/libmsc/ran_msg_a.c
index c9a13a2..56252f1 100644
--- a/src/libmsc/ran_msg_a.c
+++ b/src/libmsc/ran_msg_a.c
@@ -276,7 +276,6 @@
 	struct tlv_p_entry *ie_codec_list_bss_supported = TLVP_GET(tp, GSM0808_IE_SPEECH_CODEC_LIST);
 	struct tlv_p_entry *ie_osmux_cid = TLVP_GET(tp, GSM0808_IE_OSMO_OSMUX_CID);
 	struct sockaddr_storage rtp_addr;
-	struct gsm0808_speech_codec sc;
 	struct gsm0808_speech_codec_list codec_list_bss_supported;
 	int rc;
 	struct ran_msg ran_dec_msg = {
@@ -309,14 +308,14 @@
 
 	if (ie_speech_codec) {
 		/* Decode Speech Codec (Chosen) element */
-		rc = gsm0808_dec_speech_codec(&sc, ie_speech_codec->val, ie_speech_codec->len);
+		rc = gsm0808_dec_speech_codec(&ran_dec_msg.assignment_complete.codec,
+					      ie_speech_codec->val, ie_speech_codec->len);
 		if (rc < 0) {
 			LOG_RAN_A_DEC_MSG(LOGL_ERROR, "Assignment Complete: unable to decode IE Speech Codec (Chosen)"
 					  " (rc=%d).\n", rc);
 			return -EINVAL;
 		}
 		ran_dec_msg.assignment_complete.codec_present = true;
-		ran_dec_msg.assignment_complete.codec = ran_a_mgcp_codec_from_sc(&sc);
 	}
 
 	if (ie_codec_list_bss_supported) {
diff --git a/src/libmsc/ran_msg_iu.c b/src/libmsc/ran_msg_iu.c
index ee1d0a5..eb7fc93 100644
--- a/src/libmsc/ran_msg_iu.c
+++ b/src/libmsc/ran_msg_iu.c
@@ -153,8 +153,16 @@
 		.msg_type = RAN_MSG_ASSIGNMENT_COMPLETE,
 		.msg_name = "RANAP RAB Assignment Response",
 		.assignment_complete = {
+			/* For codec compatibility resolution, indicate AMR-FR */
 			.codec_present = true,
-			.codec = CODEC_IUFP,
+			.codec = {
+				.fi = true,
+				.type = GSM0808_SCT_FR3,
+				.cfg = GSM0808_SC_CFG_DEFAULT_FR_AMR,
+			},
+			/* Indicate that (at least) the first MGW endpoint towards RAN needs to expect VND.3GPP.IUFP
+			 * that encapsulates the AMR-FR RTP payload. */
+			.codec_with_iuup = true,
 		},
 	};
 	if (osmo_sockaddr_str_from_str(&ran_dec_msg->assignment_complete.remote_rtp, addr, port)) {
diff --git a/tests/msc_vlr/msc_vlr_test_call.c b/tests/msc_vlr/msc_vlr_test_call.c
index a547935..06602f7 100644
--- a/tests/msc_vlr/msc_vlr_test_call.c
+++ b/tests/msc_vlr/msc_vlr_test_call.c
@@ -227,7 +227,7 @@
 
 	btw("Assignment succeeds, triggering CRCX to CN");
 	expect_crcx(RTP_TO_CN);
-	ms_sends_assignment_complete(CODEC_AMR_8000_1);
+	ms_sends_assignment_complete("AMR");
 	OSMO_ASSERT(got_crcx);
 
 	btw("CN RTP address is available, trigger MNCC_RTP_CREATE");
@@ -339,7 +339,7 @@
 
 	btw("Assignment completes, triggering CRCX to CN");
 	expect_crcx(RTP_TO_CN);
-	ms_sends_assignment_complete(CODEC_AMR_8000_1);
+	ms_sends_assignment_complete("AMR");
 	OSMO_ASSERT(got_crcx);
 
 	btw("When the CN side RTP address is known, send MNCC_RTP_CREATE");
@@ -442,7 +442,7 @@
 
 	btw("Assignment completes, triggering CRCX to CN");
 	expect_crcx(RTP_TO_CN);
-	ms_sends_assignment_complete(CODEC_AMR_8000_1);
+	ms_sends_assignment_complete("AMR");
 	OSMO_ASSERT(got_crcx);
 
 	btw("When the CN side RTP address is known, send MNCC_RTP_CREATE");
@@ -539,7 +539,7 @@
 
 	btw("Assignment succeeds, triggering CRCX to CN");
 	expect_crcx(RTP_TO_CN);
-	ms_sends_assignment_complete(CODEC_AMR_8000_1);
+	ms_sends_assignment_complete("AMR");
 	OSMO_ASSERT(got_crcx);
 
 	btw("CN RTP address is available, trigger MNCC_RTP_CREATE");
@@ -635,7 +635,7 @@
 
 	btw("Assignment succeeds, triggering CRCX to CN");
 	expect_crcx(RTP_TO_CN);
-	ms_sends_assignment_complete(CODEC_AMR_8000_1);
+	ms_sends_assignment_complete("AMR");
 	OSMO_ASSERT(got_crcx);
 
 	btw("CN RTP address is available, trigger MNCC_RTP_CREATE");
diff --git a/tests/msc_vlr/msc_vlr_test_call.err b/tests/msc_vlr/msc_vlr_test_call.err
index 877015a..d97806d 100644
--- a/tests/msc_vlr/msc_vlr_test_call.err
+++ b/tests/msc_vlr/msc_vlr_test_call.err
@@ -314,13 +314,12 @@
 DMSC dummy_msc_i(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){0}: Received Event MSC_I_EV_FROM_A_FORWARD_ACCESS_SIGNALLING_REQUEST
 - Assignment succeeds, triggering CRCX to CN
 DIUCS msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){MSC_A_ST_COMMUNICATING}: RAN decode: ASSIGNMENT_COMPLETE
-DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483649:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting codecs to AMR:octet-align=1#112
-DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483649:RTP_TO_RAN:no-CI:local-10-23-23-1-23){UNINITIALIZED}: setting remote addr to 1.2.3.4:1234
+DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483649:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting remote addr to 1.2.3.4:1234
 DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483649:RTP_TO_RAN:no-CI:local-10-23-23-1-23:remote-1-2-3-4-1234){UNINITIALIZED}: Not committing: no MGW endpoint CI set up
-  MGW <--CRCX to RTP_TO_CN-- MSC: callref=0x80000001 codecs=AMR:octet-align=1#112
+  MGW <--CRCX to RTP_TO_CN-- MSC: callref=0x80000001 codecs=VND.3GPP.IUFP/16000#96
 DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){UNINITIALIZED}: Allocated
 DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){UNINITIALIZED}: is child of call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ)
-DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483649:RTP_TO_CN:no-CI){UNINITIALIZED}: setting codecs to AMR:octet-align=1#112
+DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483649:RTP_TO_CN:no-CI){UNINITIALIZED}: setting codecs to VND.3GPP.IUFP/16000#96
 - CN RTP address is available, trigger MNCC_RTP_CREATE
   MGW --CRCX OK to RTP_TO_CN--> MSC
 DCC call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){ESTABLISHING}: Received Event CALL_LEG_EV_RTP_STREAM_ADDR_AVAILABLE
@@ -800,13 +799,12 @@
 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
 - Assignment completes, triggering CRCX to CN
 DIUCS msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){MSC_A_ST_COMMUNICATING}: RAN decode: ASSIGNMENT_COMPLETE
-DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP:trans-0:call-1059:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting codecs to AMR:octet-align=1#112
-DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP:trans-0:call-1059:RTP_TO_RAN:no-CI:local-10-23-23-1-23){UNINITIALIZED}: setting remote addr to 1.2.3.4:1234
+DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP:trans-0:call-1059:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting remote addr to 1.2.3.4:1234
 DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP:trans-0:call-1059:RTP_TO_RAN:no-CI:local-10-23-23-1-23:remote-1-2-3-4-1234){UNINITIALIZED}: Not committing: no MGW endpoint CI set up
-  MGW <--CRCX to RTP_TO_CN-- MSC: callref=0x423 codecs=AMR:octet-align=1#112
+  MGW <--CRCX to RTP_TO_CN-- MSC: callref=0x423 codecs=VND.3GPP.IUFP/16000#96
 DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){UNINITIALIZED}: Allocated
 DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){UNINITIALIZED}: is child of call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP)
-DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP:trans-0:call-1059:RTP_TO_CN:no-CI){UNINITIALIZED}: setting codecs to AMR:octet-align=1#112
+DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP:trans-0:call-1059:RTP_TO_CN:no-CI){UNINITIALIZED}: setting codecs to VND.3GPP.IUFP/16000#96
 - When the CN side RTP address is known, send MNCC_RTP_CREATE
   MGW --CRCX OK to RTP_TO_CN--> MSC
 DCC call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){ESTABLISHING}: Received Event CALL_LEG_EV_RTP_STREAM_ADDR_AVAILABLE
@@ -1270,13 +1268,12 @@
 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
 - Assignment completes, triggering CRCX to CN
 DIUCS msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){MSC_A_ST_COMMUNICATING}: RAN decode: ASSIGNMENT_COMPLETE
-DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP:trans-0:call-1059:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting codecs to AMR:octet-align=1#112
-DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP:trans-0:call-1059:RTP_TO_RAN:no-CI:local-10-23-23-1-23){UNINITIALIZED}: setting remote addr to 1.2.3.4:1234
+DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP:trans-0:call-1059:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting remote addr to 1.2.3.4:1234
 DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP:trans-0:call-1059:RTP_TO_RAN:no-CI:local-10-23-23-1-23:remote-1-2-3-4-1234){UNINITIALIZED}: Not committing: no MGW endpoint CI set up
-  MGW <--CRCX to RTP_TO_CN-- MSC: callref=0x423 codecs=AMR:octet-align=1#112
+  MGW <--CRCX to RTP_TO_CN-- MSC: callref=0x423 codecs=VND.3GPP.IUFP/16000#96
 DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){UNINITIALIZED}: Allocated
 DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){UNINITIALIZED}: is child of call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP)
-DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP:trans-0:call-1059:RTP_TO_CN:no-CI){UNINITIALIZED}: setting codecs to AMR:octet-align=1#112
+DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP:trans-0:call-1059:RTP_TO_CN:no-CI){UNINITIALIZED}: setting codecs to VND.3GPP.IUFP/16000#96
 - When the CN side RTP address is known, send MNCC_RTP_CREATE
   MGW --CRCX OK to RTP_TO_CN--> MSC
 DCC call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:PAGING_RESP){ESTABLISHING}: Received Event CALL_LEG_EV_RTP_STREAM_ADDR_AVAILABLE
@@ -1680,13 +1677,12 @@
 DMSC dummy_msc_i(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){0}: Received Event MSC_I_EV_FROM_A_FORWARD_ACCESS_SIGNALLING_REQUEST
 - Assignment succeeds, triggering CRCX to CN
 DIUCS msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){MSC_A_ST_COMMUNICATING}: RAN decode: ASSIGNMENT_COMPLETE
-DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483650:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting codecs to AMR:octet-align=1#112
-DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483650:RTP_TO_RAN:no-CI:local-10-23-23-1-23){UNINITIALIZED}: setting remote addr to 1.2.3.4:1234
+DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483650:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting remote addr to 1.2.3.4:1234
 DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483650:RTP_TO_RAN:no-CI:local-10-23-23-1-23:remote-1-2-3-4-1234){UNINITIALIZED}: Not committing: no MGW endpoint CI set up
-  MGW <--CRCX to RTP_TO_CN-- MSC: callref=0x80000002 codecs=AMR:octet-align=1#112
+  MGW <--CRCX to RTP_TO_CN-- MSC: callref=0x80000002 codecs=VND.3GPP.IUFP/16000#96
 DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){UNINITIALIZED}: Allocated
 DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){UNINITIALIZED}: is child of call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ)
-DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483650:RTP_TO_CN:no-CI){UNINITIALIZED}: setting codecs to AMR:octet-align=1#112
+DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483650:RTP_TO_CN:no-CI){UNINITIALIZED}: setting codecs to VND.3GPP.IUFP/16000#96
 - CN RTP address is available, trigger MNCC_RTP_CREATE
   MGW --CRCX OK to RTP_TO_CN--> MSC
 DCC call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){ESTABLISHING}: Received Event CALL_LEG_EV_RTP_STREAM_ADDR_AVAILABLE
@@ -2107,13 +2103,12 @@
 DMSC dummy_msc_i(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){0}: Received Event MSC_I_EV_FROM_A_FORWARD_ACCESS_SIGNALLING_REQUEST
 - Assignment succeeds, triggering CRCX to CN
 DIUCS msc_a(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){MSC_A_ST_COMMUNICATING}: RAN decode: ASSIGNMENT_COMPLETE
-DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483651:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting codecs to AMR:octet-align=1#112
-DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483651:RTP_TO_RAN:no-CI:local-10-23-23-1-23){UNINITIALIZED}: setting remote addr to 1.2.3.4:1234
+DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483651:RTP_TO_RAN:no-CI){UNINITIALIZED}: setting remote addr to 1.2.3.4:1234
 DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483651:RTP_TO_RAN:no-CI:local-10-23-23-1-23:remote-1-2-3-4-1234){UNINITIALIZED}: Not committing: no MGW endpoint CI set up
-  MGW <--CRCX to RTP_TO_CN-- MSC: callref=0x80000003 codecs=AMR:octet-align=1#112
+  MGW <--CRCX to RTP_TO_CN-- MSC: callref=0x80000003 codecs=VND.3GPP.IUFP/16000#96
 DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){UNINITIALIZED}: Allocated
 DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){UNINITIALIZED}: is child of call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ)
-DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483651:RTP_TO_CN:no-CI){UNINITIALIZED}: setting codecs to AMR:octet-align=1#112
+DCC rtp_stream(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ:trans-8:call-2147483651:RTP_TO_CN:no-CI){UNINITIALIZED}: setting codecs to VND.3GPP.IUFP/16000#96
 - CN RTP address is available, trigger MNCC_RTP_CREATE
   MGW --CRCX OK to RTP_TO_CN--> MSC
 DCC call_leg(IMSI-901700000010650:MSISDN-42342:TMSI-0x03020100:UTRAN-Iu:CM_SERVICE_REQ){ESTABLISHING}: Received Event CALL_LEG_EV_RTP_STREAM_ADDR_AVAILABLE
diff --git a/tests/msc_vlr/msc_vlr_tests.c b/tests/msc_vlr/msc_vlr_tests.c
index 45b97a2..646633c 100644
--- a/tests/msc_vlr/msc_vlr_tests.c
+++ b/tests/msc_vlr/msc_vlr_tests.c
@@ -1014,15 +1014,19 @@
 		g_msub = NULL;
 }
 
-void ms_sends_assignment_complete(enum mgcp_codecs assigned_codec)
+void ms_sends_assignment_complete(const char *sdp_codec_name)
 {
 	struct ran_msg ran_dec;
+	const struct codec_mapping *m = codec_mapping_by_subtype_name(sdp_codec_name);
+	OSMO_ASSERT(m);
+	OSMO_ASSERT(m->has_gsm0808_speech_codec);
 
 	ran_dec = (struct ran_msg){
 		.msg_type = RAN_MSG_ASSIGNMENT_COMPLETE,
 		.assignment_complete = {
 			.codec_present = true,
-			.codec = assigned_codec,
+			.codec = m->gsm0808_speech_codec,
+			.codec_with_iuup = (rx_from_ran == OSMO_RAT_UTRAN_IU),
 		},
 	};
 	osmo_sockaddr_str_from_str(&ran_dec.assignment_complete.remote_rtp, "1.2.3.4", 1234);
diff --git a/tests/msc_vlr/msc_vlr_tests.h b/tests/msc_vlr/msc_vlr_tests.h
index 1f83013..1a57101 100644
--- a/tests/msc_vlr/msc_vlr_tests.h
+++ b/tests/msc_vlr/msc_vlr_tests.h
@@ -186,7 +186,7 @@
 void ms_sends_classmark_update(const struct osmo_gsm48_classmark *classmark);
 void ms_sends_ciphering_mode_complete(const char *inner_nas_msg);
 void ms_sends_security_mode_complete(uint8_t utran_encryption);
-void ms_sends_assignment_complete(enum mgcp_codecs assigned_codec);
+void ms_sends_assignment_complete(const char *sdp_codec_name);
 void gsup_rx(const char *rx_hex, const char *expect_tx_hex);
 void send_sms(struct vlr_subscr *receiver,
 	      struct vlr_subscr *sender,