]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
chan_sip: Handle invalid SDP answer to T.38 re-invite
authorFrancesco Castellano <francesco.castellano@messagenet.it>
Fri, 28 Jun 2019 16:15:31 +0000 (18:15 +0200)
committerBenjamin Keith Ford <bford@digium.com>
Thu, 11 Jul 2019 18:02:01 +0000 (12:02 -0600)
The chan_sip module performs a T.38 re-invite using a single media
stream of udptl, and expects the SDP answer to be the same.

If an SDP answer is received instead that contains an additional
media stream with no joint codec a crash will occur as the code
assumes that at least one joint codec will exist in this
scenario.

This change removes this assumption.

ASTERISK-28465

Change-Id: I8b02845b53344c6babe867a3f0a5231045c7ac87

channels/chan_sip.c

index fe2ae1e983c37f8f99537d4d4a801503b7a0dd4b..6251878d965b2397e103e961edf242f06f5595ec 100644 (file)
@@ -10921,7 +10921,13 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
                            ast_rtp_lookup_mime_multiple2(s3, NULL, newnoncodeccapability, 0, 0));
        }
 
-       if (portno != -1 || vportno != -1 || tportno != -1) {
+       /* When UDPTL is negotiated it is expected that there are no compatible codecs as audio or
+        * video is not being transported, thus we continue in this function further up if that is
+        * the case. If we receive an SDP answer containing both a UDPTL stream and another media
+        * stream however we need to check again to ensure that there is at least one joint codec
+        * instead of assuming there is one.
+        */
+       if ((portno != -1 || vportno != -1 || tportno != -1) && ast_format_cap_count(newjointcapability)) {
                /* We are now ready to change the sip session and RTP structures with the offered codecs, since
                   they are acceptable */
                unsigned int framing;