]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
chan_sip: SDP: Sidestep stream parsing when its media is disabled.
authorAlexander Traud <pabstraud@compuserve.com>
Wed, 23 Dec 2020 14:44:45 +0000 (15:44 +0100)
committerGeorge Joseph <gjoseph@digium.com>
Wed, 13 Jan 2021 14:29:23 +0000 (08:29 -0600)
Previously, chan_sip parsed all known media streams in an SDP offer
like video (and text) even when videosupport=no (and textsupport=no).
This wasted processor power. Furthermore, chan_sip accepted SDP offers,
including no audio but just video (or text) streams although
videosupport=no (or textsupport=no). Finally, chan_sip denied the whole
offer instead of individual streams when they had encryption (SDES-sRTP)
unexpectedly enabled.

ASTERISK-29238
ASTERISK-29237
ASTERISK-29222

Change-Id: Ie49e4e2a11f0265f914b684738348ba8c0f89755

channels/chan_sip.c

index ad4f96864b0eae955243eac10de84af7978238df..18a02bc3647ce6a5e574b88ab7726e34474dc841 100644 (file)
@@ -10442,7 +10442,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
                rtcp_mux_offered = has_media_level_attribute(iterator, req, "rtcp-mux");
 
                /* Check for 'audio' media offer */
-               if (strncmp(m, "audio ", 6) == 0) {
+               if (p->rtp && strncmp(m, "audio ", 6) == 0) {
                        if ((sscanf(m, "audio %30u/%30u %17s %n", &x, &numberofports, protocol, &len) == 3 && len > 0) ||
                            (sscanf(m, "audio %30u %17s %n", &x, protocol, &len) == 2 && len > 0)) {
                                codecs = m + len;
@@ -10552,7 +10552,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
                        }
                }
                /* Check for 'video' media offer */
-               else if (strncmp(m, "video ", 6) == 0) {
+               else if (p->vrtp && strncmp(m, "video ", 6) == 0) {
                        if ((sscanf(m, "video %30u/%30u %17s %n", &x, &numberofports, protocol, &len) == 3 && len > 0) ||
                            (sscanf(m, "video %30u %17s %n", &x, protocol, &len) == 2 && len > 0)) {
                                codecs = m + len;
@@ -10631,7 +10631,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
                        }
                }
                /* Check for 'text' media offer */
-               else if (strncmp(m, "text ", 5) == 0) {
+               else if (p->trtp && strncmp(m, "text ", 5) == 0) {
                        if ((sscanf(m, "text %30u/%30u %17s %n", &x, &numberofports, protocol, &len) == 3 && len > 0) ||
                            (sscanf(m, "text %30u %17s %n", &x, protocol, &len) == 2 && len > 0)) {
                                codecs = m + len;