0c8f89a7a16fb7dd89a261701e497869787c17e5
[feed/telephony.git] / net / asterisk-15.x / patches / 160-AST-2019-003-15.diff
1 From a8cc63a8b2b973d6d34251d74b8d4576d6796dce Mon Sep 17 00:00:00 2001
2 From: Francesco Castellano <francesco.castellano@messagenet.it>
3 Date: Fri, 28 Jun 2019 18:15:31 +0200
4 Subject: [PATCH] chan_sip: Handle invalid SDP answer to T.38 re-invite
5
6 The chan_sip module performs a T.38 re-invite using a single media
7 stream of udptl, and expects the SDP answer to be the same.
8
9 If an SDP answer is received instead that contains an additional
10 media stream with no joint codec a crash will occur as the code
11 assumes that at least one joint codec will exist in this
12 scenario.
13
14 This change removes this assumption.
15
16 ASTERISK-28465
17
18 Change-Id: I8b02845b53344c6babe867a3f0a5231045c7ac87
19 ---
20
21 diff --git a/channels/chan_sip.c b/channels/chan_sip.c
22 index fe2ae1e..6251878 100644
23 --- a/channels/chan_sip.c
24 +++ b/channels/chan_sip.c
25 @@ -10921,7 +10921,13 @@
26 ast_rtp_lookup_mime_multiple2(s3, NULL, newnoncodeccapability, 0, 0));
27 }
28
29 - if (portno != -1 || vportno != -1 || tportno != -1) {
30 + /* When UDPTL is negotiated it is expected that there are no compatible codecs as audio or
31 + * video is not being transported, thus we continue in this function further up if that is
32 + * the case. If we receive an SDP answer containing both a UDPTL stream and another media
33 + * stream however we need to check again to ensure that there is at least one joint codec
34 + * instead of assuming there is one.
35 + */
36 + if ((portno != -1 || vportno != -1 || tportno != -1) && ast_format_cap_count(newjointcapability)) {
37 /* We are now ready to change the sip session and RTP structures with the offered codecs, since
38 they are acceptable */
39 unsigned int framing;