osmux: Make sure RTP AMR feed to osmux is in octet-aligned mode

The Osmux implementation in libosmo-netif expects to work with RTP AMR
in octet-aligned mode. Therefore, if the peer connection received RTP
AMR in bandwidth-efficient mode, we need to convert it to octet-aligned
before feeding the packets to the osmux layer.

Related: SYS#6161
Change-Id: Ifeec44241079f7a31da12745c92bfdc4fb222f3a
diff --git a/src/libosmo-mgcp/mgcp_osmux.c b/src/libosmo-mgcp/mgcp_osmux.c
index e1380ec..5df5446 100644
--- a/src/libosmo-mgcp/mgcp_osmux.c
+++ b/src/libosmo-mgcp/mgcp_osmux.c
@@ -226,6 +226,12 @@
 	if (!msg2)
 		return -1;
 
+	/* Osmux implementation works with AMR OA only, make sure we convert to it if needed: */
+	if (amr_oa_bwe_convert(conn->conn->endp, msg2, true) < 0) {
+		LOGPCONN(conn->conn, DOSMUX, LOGL_ERROR,
+			 "Error converting to AMR octet-aligned mode\n");
+		return -1;
+	}
 
 	while ((ret = osmux_xfrm_input(conn->osmux.in, msg2, conn->osmux.remote_cid)) > 0) {
 		/* batch full, build and deliver it */