From a1dba820cf96fbc8cd5f30760f5077f5b1fe3e8b Mon Sep 17 00:00:00 2001
From: Torrey Searle <torrey@voxbone.com>
Date: Fri, 6 Mar 2020 17:13:34 +0100
Subject: [PATCH] res_rtp_asterisk: Send correct sender SSRC when p2p bridge in
 use

bridge_p2p_rtp_write will forward rtp to the bridged rtp instance
without modifying the ssrc.  However, it is not updating the SSRC
in the bridged rtp.  Thus, when SSRC packets are generated, they
have the correct SSRC for the sender.

ASTERISK-28773 #close

Change-Id: I39f923bde28ebb4f0fddc926b92494aed294a478
---
 res/res_rtp_asterisk.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index 4705e929ef..366539f9fe 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -6604,6 +6604,11 @@ static int bridge_p2p_rtp_write(struct ast_rtp_instance *instance,
 	reconstruct |= (mark << 23);
 	rtpheader[0] = htonl(reconstruct);
 
+	if (mark) {
+		/* make this rtp instance aware of the new ssrc it is sending */
+		bridged->ssrc = ntohl(rtpheader[2]);
+	}
+
 	/* Send the packet back out */
 	res = rtp_sendto(instance1, (void *)rtpheader, len, 0, &remote_address, &ice);
 	if (res < 0) {
-- 
GitLab