]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Stop sending out RTCP if RTP is inactive
authorKinsey Moore <kmoore@digium.com>
Mon, 2 Apr 2012 22:18:17 +0000 (22:18 +0000)
committerKinsey Moore <kmoore@digium.com>
Mon, 2 Apr 2012 22:18:17 +0000 (22:18 +0000)
This change prevents Asterisk from sending RTCP receiver reports during a
remote bridge since it is no longer receiving media and should not be
reporting anything.

(related to ASTERISK-19366)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@360987 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index c16b91b61cd5a815f0d753f3f8efed9643af5300..73e7e64accdc84704a8bd0ed1615d0dd7e8d5784 100644 (file)
@@ -29222,16 +29222,48 @@ static int sip_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *i
 
        if (instance) {
                changed |= ast_rtp_instance_get_and_cmp_remote_address(instance, &p->redirip);
+
+               if (p->rtp) {
+                       /* Prevent audio RTCP reads */
+                       ast_channel_set_fd(chan, 1, -1);
+                       /* Silence RTCP while audio RTP is inactive */
+                       ast_rtp_instance_set_prop(p->rtp, AST_RTP_PROPERTY_RTCP, 0);
+               }
        } else if (!ast_sockaddr_isnull(&p->redirip)) {
                memset(&p->redirip, 0, sizeof(p->redirip));
                changed = 1;
+
+               if (p->rtp) {
+                       /* Enable RTCP since it will be inactive if we're coming back
+                        * from a reinvite */
+                       ast_rtp_instance_set_prop(p->rtp, AST_RTP_PROPERTY_RTCP, 1);
+                       /* Enable audio RTCP reads */
+                       ast_channel_set_fd(chan, 1, ast_rtp_instance_fd(p->rtp, 1));
+               }
        }
+
        if (vinstance) {
                changed |= ast_rtp_instance_get_and_cmp_remote_address(vinstance, &p->vredirip);
+
+               if (p->vrtp) {
+                       /* Prevent video RTCP reads */
+                       ast_channel_set_fd(chan, 3, -1);
+                       /* Silence RTCP while video RTP is inactive */
+                       ast_rtp_instance_set_prop(p->vrtp, AST_RTP_PROPERTY_RTCP, 0);
+               }
        } else if (!ast_sockaddr_isnull(&p->vredirip)) {
                memset(&p->vredirip, 0, sizeof(p->vredirip));
                changed = 1;
+
+               if (p->vrtp) {
+                       /* Enable RTCP since it will be inactive if we're coming back
+                        * from a reinvite */
+                       ast_rtp_instance_set_prop(p->vrtp, AST_RTP_PROPERTY_RTCP, 1);
+                       /* Enable video RTCP reads */
+                       ast_channel_set_fd(chan, 3, ast_rtp_instance_fd(p->vrtp, 1));
+               }
        }
+
        if (tinstance) {
                changed |= ast_rtp_instance_get_and_cmp_remote_address(tinstance, &p->tredirip);
        } else if (!ast_sockaddr_isnull(&p->tredirip)) {