rtp_stream: allow multiple codecs / use codec filter from Assignment

Allow configuring MGW conns with multiple codecs. The new codecs filter
can have multiple results, and MGCP can configure multiple codecs. Get
rid of this bottleneck, that so far limits to a single codec to MGW.

On Assignment Complete, set codec_filter.assignment to the assigned
codec, and use that to set the resulting codec (possibly multiple codecs
in the future) to create the CN side MGW endpoint.

Related: SYS#5066
Change-Id: If9c67b298b30f893ec661f84c9fc622ad01b5ee5
diff --git a/tests/msc_vlr/msc_vlr_tests.c b/tests/msc_vlr/msc_vlr_tests.c
index b0c60ed..45b97a2 100644
--- a/tests/msc_vlr/msc_vlr_tests.c
+++ b/tests/msc_vlr/msc_vlr_tests.c
@@ -41,6 +41,7 @@
 #include <osmocom/msc/msc_t.h>
 #include <osmocom/msc/call_leg.h>
 #include <osmocom/msc/rtp_stream.h>
+#include <osmocom/msc/codec_mapping.h>
 
 #include "msc_vlr_tests.h"
 
@@ -852,20 +853,23 @@
 
 /* override, requires '-Wl,--wrap=call_leg_ensure_ci' */
 int __real_call_leg_ensure_ci(struct call_leg *cl, enum rtp_direction dir, uint32_t call_id, struct gsm_trans *for_trans,
-			      const enum mgcp_codecs *codec_if_known, const struct osmo_sockaddr_str *remote_addr_if_known);
+			      const struct sdp_audio_codecs *codecs_if_known,
+			      const struct osmo_sockaddr_str *remote_addr_if_known);
 int __wrap_call_leg_ensure_ci(struct call_leg *cl, enum rtp_direction dir, uint32_t call_id, struct gsm_trans *for_trans,
-			      const enum mgcp_codecs *codec_if_known, const struct osmo_sockaddr_str *remote_addr_if_known)
+			      const struct sdp_audio_codecs *codecs_if_known,
+			      const struct osmo_sockaddr_str *remote_addr_if_known)
 {
 	if (!cl->rtp[dir]) {
-		log("MGW <--CRCX to %s-- MSC: callref=0x%x", rtp_direction_name(dir), call_id);
+		log("MGW <--CRCX to %s-- MSC: callref=0x%x codecs=%s", rtp_direction_name(dir), call_id,
+		    codecs_if_known ? sdp_audio_codecs_to_str(codecs_if_known) : "unset");
 
 		OSMO_ASSERT(expecting_crcx == dir);
 		expecting_crcx = -1;
 		got_crcx = true;
 
 		call_leg_ensure_rtp_alloc(cl, dir, call_id, for_trans);
-		if (codec_if_known)
-			rtp_stream_set_codec(cl->rtp[dir], *codec_if_known);
+		if (codecs_if_known)
+			rtp_stream_set_codecs(cl->rtp[dir], codecs_if_known);
 		if (remote_addr_if_known && osmo_sockaddr_str_is_nonzero(remote_addr_if_known))
 			rtp_stream_set_remote_addr(cl->rtp[dir], remote_addr_if_known);
 	}