]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_pjsip_sdp_rtp.c: Fix DTMF Handling in Re-INVITE with dtmf_mode set to auto
authorTinet-mucw <mucw@ti-net.com.cn>
Fri, 2 Aug 2024 08:49:58 +0000 (16:49 +0800)
committerAsterisk Development Team <asteriskteam@digium.com>
Thu, 12 Sep 2024 18:46:27 +0000 (18:46 +0000)
When the endpoint dtmf_mode is set to auto, a SIP request is sent to the UAC, and the SIP SDP from the UAC does not include the telephone-event. Later, the UAC sends an INVITE, and the SIP SDP includes the telephone-event. In this case, DTMF should be sent by RFC2833 rather than using inband signaling.

Resolves: asterisk#826
(cherry picked from commit 6cf685608000a3b08e4e8b8a62995e233cc536bf)

res/res_pjsip_sdp_rtp.c

index c86a5059140e80bf61b09710297979a904fc123d..aa6fc94dc337c5534d7442266bd6c1157af32253 100644 (file)
@@ -384,9 +384,14 @@ 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) {
+               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_INBAND);
+                       ast_rtp_instance_set_prop(session_media->rtp, AST_RTP_PROPERTY_DTMF, 0);
+               }
        }
 
        if (session->dtmf == AST_SIP_DTMF_AUTO_INFO) {