From daf5508c4e2bb124b2aa32365437436dad56c1ab Mon Sep 17 00:00:00 2001 From: yksp <41427038+yksp@users.noreply.github.com> Date: Thu, 21 Dec 2023 11:28:34 +0530 Subject: [PATCH] MT#55283 Fixing Source and Destination fields when record-egress is enabled closes #1776 Change-Id: I98fbf1eda5b69fb3d4f1bb95b5e2beab75bb7b60 (cherry picked from commit 9fed01c46730c80e039650aefd96b09d9544e2e8) --- daemon/recording.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/daemon/recording.c b/daemon/recording.c index 3db55e390..ba5bd0158 100644 --- a/daemon/recording.c +++ b/daemon/recording.c @@ -16,6 +16,7 @@ #include "xt_RTPENGINE.h" #include "call.h" +#include "main.h" #include "kernel.h" #include "bencode.h" #include "rtplib.h" @@ -647,8 +648,15 @@ static void rec_pcap_recording_finish_file(struct recording *recording) { // "out" must be at least inp->len + MAX_PACKET_HEADER_LEN bytes static unsigned int fake_ip_header(unsigned char *out, struct media_packet *mp, const str *inp) { - endpoint_t *src_endpoint = &mp->fsin; - endpoint_t *dst_endpoint = &mp->sfd->socket.local; + endpoint_t *src_endpoint, *dst_endpoint; + if (!rtpe_config.rec_egress) { + src_endpoint = &mp->fsin; + dst_endpoint = &mp->sfd->socket.local; + } + else { + src_endpoint = &mp->sfd->socket.local; + dst_endpoint = &mp->fsin; + } unsigned int hdr_len = endpoint_packet_header(out, src_endpoint, dst_endpoint, inp->len);