IuUP->AMR: do not patch payload type a second time

When converting IuUP to AMR/RTP, bridge_iuup_to_rtp_peer() sets the AMR
side's payload type number and then calls mgcp_send(). In mgcp_send(),
do not attempt to patch the payload type number a second time.

In mgcp_send(), skip patching payload type numbers if the source side is
IuUP. This matches exactly the case of converting IuUP to AMR/RTP.

There already is a check for IuUP, but for the wrong side. Drop that one
and explain in a comment why.

Move the comment about transcoding into the failure branch, where it is
relevant and doesn't clutter the new explanation of payload type
patching conditions.

Related: OS#5720
Related: SYS#5092
Change-Id: I7c722cd959f76bd104ae4941d182c77e5c025867
diff --git a/src/libosmo-mgcp/mgcp_network.c b/src/libosmo-mgcp/mgcp_network.c
index bb8cfa3..29c0dc2 100644
--- a/src/libosmo-mgcp/mgcp_network.c
+++ b/src/libosmo-mgcp/mgcp_network.c
@@ -1160,17 +1160,21 @@
 	else
 		LOGPENDP(endp, DRTP, LOGL_DEBUG, "delivering RTCP packet...\n");
 
-	/* FIXME: It is legal that the payload type on the egress connection is
-	 * different from the payload type that has been negotiated on the
-	 * ingress connection. Essentially the codecs are the same so we can
-	 * match them and patch the payload type. However, if we can not find
-	 * the codec pendant (everything ist equal except the PT), we are of
-	 * course unable to patch the payload type. A situation like this
-	 * should not occur if transcoding is consequently avoided. Until
-	 * we have transcoding support in osmo-mgw we can not resolve this. */
-	if (is_rtp && !mgcp_conn_rtp_is_iuup(conn_dst)) {
+	/* Patch the payload type number: translate from conn_src to conn_dst.
+	 * Do not patch for IuUP, where the correct payload type number is already set in bridge_iuup_to_rtp_peer():
+	 * IuUP -> AMR: calls this function, skip patching if conn_src is IuUP.
+	 * {AMR or IuUP} -> IuUP: calls mgcp_udp_send() directly, skipping this function: No need to examine dst. */
+	if (is_rtp && !mgcp_conn_rtp_is_iuup(conn_src)) {
 		rc = mgcp_patch_pt(conn_src, conn_dst, msg);
 		if (rc < 0) {
+			/* FIXME: It is legal that the payload type on the egress connection is
+			 * different from the payload type that has been negotiated on the
+			 * ingress connection. Essentially the codecs are the same so we can
+			 * match them and patch the payload type. However, if we can not find
+			 * the codec pendant (everything ist equal except the PT), we are of
+			 * course unable to patch the payload type. A situation like this
+			 * should not occur if transcoding is consequently avoided. Until
+			 * we have transcoding support in osmo-mgw we can not resolve this. */
 			LOGPENDP(endp, DRTP, LOGL_DEBUG,
 				 "can not patch PT because no suitable egress codec was found.\n");
 		}