From 9fed01c46730c80e039650aefd96b09d9544e2e8 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 --- daemon/recording.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/daemon/recording.c b/daemon/recording.c index 837e95a1d..3eae08069 100644 --- a/daemon/recording.c +++ b/daemon/recording.c @@ -15,6 +15,7 @@ #include #include "call.h" +#include "main.h" #include "kernel.h" #include "bencode.h" #include "rtplib.h" @@ -663,8 +664,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);