7afc4898758bd1bb0852a84569f58005cb74f018
[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 --- a/channels/chan_sip.c
22 +++ b/channels/chan_sip.c
23 @@ -10917,7 +10917,13 @@ static int process_sdp(struct sip_pvt *p
24 ast_rtp_lookup_mime_multiple2(s3, NULL, newnoncodeccapability, 0, 0));
25 }
26
27 - if (portno != -1 || vportno != -1 || tportno != -1) {
28 + /* When UDPTL is negotiated it is expected that there are no compatible codecs as audio or
29 + * video is not being transported, thus we continue in this function further up if that is
30 + * the case. If we receive an SDP answer containing both a UDPTL stream and another media
31 + * stream however we need to check again to ensure that there is at least one joint codec
32 + * instead of assuming there is one.
33 + */
34 + if ((portno != -1 || vportno != -1 || tportno != -1) && ast_format_cap_count(newjointcapability)) {
35 /* We are now ready to change the sip session and RTP structures with the offered codecs, since
36 they are acceptable */
37 ast_format_cap_remove_by_type(p->jointcaps, AST_MEDIA_TYPE_UNKNOWN);