]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
chan_sip: SDP: Reject audio streams correctly.
authorAlexander Traud <pabstraud@compuserve.com>
Thu, 21 Jan 2021 19:28:06 +0000 (20:28 +0100)
committerFriendly Automation <jenkins2@gerrit.asterisk.org>
Wed, 27 Jan 2021 16:14:43 +0000 (10:14 -0600)
This completes the fix for ASTERISK_24543. Only when the call is an
outgoing call, consult and append the configured format capabilities
(p->caps). When all audio formats got rejected the negotiated format
capabilities (p->jointcaps) contain no audio formats for incoming
calls. This is required when there are other accepted media streams.

ASTERISK-29258

Change-Id: I8bab31c7f3f3700dce204b429ad238a524efebb9

channels/chan_sip.c

index ca0f7bf74f68616410cd466dcb1fd03e72096aa8..1c9c72965c22f8b77e7ea21cc8364fdd4faf1e90 100644 (file)
@@ -13607,10 +13607,11 @@ static enum sip_result add_sdp(struct sip_request *resp, struct sip_pvt *p, int
                        ast_format_cap_append_from_cap(tmpcap, p->jointcaps, AST_MEDIA_TYPE_UNKNOWN);
                }
 
-               /* Check if we need audio */
-               if (ast_format_cap_has_type(tmpcap, AST_MEDIA_TYPE_AUDIO)
-                       || ast_format_cap_has_type(p->caps, AST_MEDIA_TYPE_AUDIO)) {
-                       needaudio = TRUE;
+               /* Check if we need audio in this call */
+               needaudio = ast_format_cap_has_type(tmpcap, AST_MEDIA_TYPE_AUDIO);
+               if (!needaudio && p->outgoing_call) {
+                       /* p->caps are added conditionally, see below "Finally our remain..." */
+                       needaudio = ast_format_cap_has_type(p->caps, AST_MEDIA_TYPE_AUDIO);
                }
 
                /* Check if we need video in this call */