]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_rtp_asterisk: Always update SRTP on local SSRC change.
authorJoshua Colp <jcolp@digium.com>
Mon, 30 Apr 2018 14:38:36 +0000 (14:38 +0000)
committerJoshua Colp <jcolp@digium.com>
Mon, 30 Apr 2018 14:38:36 +0000 (14:38 +0000)
When the local SSRC changes we need to update the SRTP information
so that the proper key is used. This is commonly done as a result
of bridging two channels together. Previously we only updated
the SRTP information if media had already flowed, but in practice
the channel driver may have already performed SRTP negotiation and
set up the previous SSRC. We now always do it on a local SSRC
change.

ASTERISK-27795
ASTERISK-27800

Change-Id: Ia7c8e74c28841388b5244ac0b8fd6c1dc6ee4c10

res/res_rtp_asterisk.c

index 4ac20d5518e40504ab07c71a257430ad63b02c89..5579914afdd5176769e6c490c64c0362b592466b 100644 (file)
@@ -3947,15 +3947,15 @@ static void ast_rtp_change_source(struct ast_rtp_instance *instance)
        if (rtp->lastts) {
                /* We simply set this bit so that the next packet sent will have the marker bit turned on */
                ast_set_flag(rtp, FLAG_NEED_MARKER_BIT);
+       }
 
-               ast_debug(3, "Changing ssrc from %u to %u due to a source change\n", rtp->ssrc, ssrc);
+       ast_debug(3, "Changing ssrc from %u to %u due to a source change\n", rtp->ssrc, ssrc);
 
-               if (srtp) {
-                       ast_debug(3, "Changing ssrc for SRTP from %u to %u\n", rtp->ssrc, ssrc);
-                       res_srtp->change_source(srtp, rtp->ssrc, ssrc);
-                       if (rtcp_srtp != srtp) {
-                               res_srtp->change_source(rtcp_srtp, rtp->ssrc, ssrc);
-                       }
+       if (srtp) {
+               ast_debug(3, "Changing ssrc for SRTP from %u to %u\n", rtp->ssrc, ssrc);
+               res_srtp->change_source(srtp, rtp->ssrc, ssrc);
+               if (rtcp_srtp != srtp) {
+                       res_srtp->change_source(rtcp_srtp, rtp->ssrc, ssrc);
                }
        }