aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2022-10-24 01:00:26 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2022-10-24 21:23:15 +0200
commitc1468ef7a5eee28c95a5fb38c538e3aad5ec1380 (patch)
treeb2d8e356240e744652830cb672b02c237687343f /src
parent24763eaa73d1ee2de4cb031b3bcc8b167419ce46 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/libosmo-mgcp/mgcp_network.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/libosmo-mgcp/mgcp_network.c b/src/libosmo-mgcp/mgcp_network.c
index bb8cfa3ad..29c0dc2b8 100644
--- a/src/libosmo-mgcp/mgcp_network.c
+++ b/src/libosmo-mgcp/mgcp_network.c
@@ -1160,17 +1160,21 @@ int mgcp_send(struct mgcp_endpoint *endp, int is_rtp, struct osmo_sockaddr *addr
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");
}