From da895b115127007fcdcb73ee2fa059b5eaf4ef86 Mon Sep 17 00:00:00 2001 From: Philipp Maier Date: Fri, 3 Aug 2018 12:16:37 +0200 Subject: [PATCH] network: do not patch PT of RTCP packets At the moment all packets that are sent with mgcp_send are fed into mgcp_patch_pt(). This functions corrects the payload type so that it matches the codec configuration on the egress side. However, this functions is only to be used with RTP packets and must not be used on RTCP packets, which we currently do because we do not check if the packet is RTCP or RTP. - Check if the packet is RTP before running mgcp_patch_pt() Change-Id: I55b8aa830e4e23f991373470bd04d4db12241c56 Related: OS#3444 --- src/libosmo-mgcp/mgcp_network.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/libosmo-mgcp/mgcp_network.c b/src/libosmo-mgcp/mgcp_network.c index 1b1867a7b..6dfc5a5a5 100644 --- a/src/libosmo-mgcp/mgcp_network.c +++ b/src/libosmo-mgcp/mgcp_network.c @@ -717,11 +717,13 @@ int mgcp_send(struct mgcp_endpoint *endp, int is_rtp, struct sockaddr_in *addr, * 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. */ - rc = mgcp_patch_pt(conn_src, conn_dst, buf, len); - if (rc < 0) { - LOGP(DRTP, LOGL_ERROR, - "endpoint:0x%x can not patch PT because no suitable egress codec was found.\n", - ENDPOINT_NUMBER(endp)); + if (is_rtp) { + rc = mgcp_patch_pt(conn_src, conn_dst, buf, len); + if (rc < 0) { + LOGP(DRTP, LOGL_ERROR, + "endpoint:0x%x can not patch PT because no suitable egress codec was found.\n", + ENDPOINT_NUMBER(endp)); + } } /* Note: In case of loopback configuration, both, the source and the