]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_pjsip_sdp_rtp: Fix accidentally native bridging calls
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>
Wed, 23 Sep 2020 03:39:12 +0000 (11:39 +0800)
committerFriendly Automation <jenkins2@gerrit.asterisk.org>
Wed, 30 Sep 2020 12:09:30 +0000 (07:09 -0500)
Stop advertising RFC2833 support on the rtp_engine when DTMF mode is
auto but no tel_event was found inside SDP file.

On an incoming call create_rtp will be called and when session->dtmf is
set to AST_SIP_DTMF_AUTO, the AST_RTP_PROPERTY_DTMF will be set without
looking at the SDP file.

Once get_codecs gets called we move the DTMF mode from RFC2833 to INBAND
but continued to advertise RFC2833 support.

This meant the native_rtp bridge would falsely consider the two channels
as compatible. In addition to changing the DTMF mode we now set or
remove the AST_RTP_PROPERTY_DTMF.

The property is checked in ast_rtp_dtmf_compatible and called by
native_rtp_bridge_compatible.

ASTERISK-29051 #close

Change-Id: I1e0c1e324598a437932c0b7836bcb626aba8e287

res/res_pjsip_sdp_rtp.c

index b4e95ab3f2ff7773edb2f1e197a81c43e1f1255c..cb100dbdac3bc5eb8599e76f819b3f8183bed196 100644 (file)
@@ -376,13 +376,16 @@ static void get_codecs(struct ast_sip_session *session, const struct pjmedia_sdp
        }
        if (!tel_event && (session->dtmf == AST_SIP_DTMF_AUTO)) {
                ast_rtp_instance_dtmf_mode_set(session_media->rtp, AST_RTP_DTMF_MODE_INBAND);
+               ast_rtp_instance_set_prop(session_media->rtp, AST_RTP_PROPERTY_DTMF, 0);
        }
 
        if (session->dtmf == AST_SIP_DTMF_AUTO_INFO) {
                if  (tel_event) {
                        ast_rtp_instance_dtmf_mode_set(session_media->rtp, AST_RTP_DTMF_MODE_RFC2833);
+                       ast_rtp_instance_set_prop(session_media->rtp, AST_RTP_PROPERTY_DTMF, 1);
                } else {
                        ast_rtp_instance_dtmf_mode_set(session_media->rtp, AST_RTP_DTMF_MODE_NONE);
+                       ast_rtp_instance_set_prop(session_media->rtp, AST_RTP_PROPERTY_DTMF, 0);
                }
        }