]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_pjsip_sdp_rtp: Skip formats without SDP details.
authorJoshua C. Colp <jcolp@sangoma.com>
Tue, 30 Aug 2022 13:01:29 +0000 (10:01 -0300)
committerFriendly Automation <jenkins2@gerrit.asterisk.org>
Sat, 10 Sep 2022 16:00:04 +0000 (11:00 -0500)
When producing an outgoing SDP we iterate through the configured
formats and produce SDP information. It is possible for some
configured formats to not have SDP information available. If this
is the case we skip over them to allow the SDP to still be
produced.

ASTERISK-29185

Change-Id: I3e37569aa4ca341260e6ca5904dc2f75e46a1749

res/res_pjsip_sdp_rtp.c

index 3e10cfdb0410eb28839c616a2d741ed90a681ccd..e7b19e46961efa3bd8e08b53ed2c67b03ad0bbab 100644 (file)
@@ -1902,6 +1902,16 @@ static int create_outgoing_sdp_stream(struct ast_sip_session *session, struct as
                        continue;
                }
 
+               /* It is possible for some formats not to have SDP information available for them
+                * and if this is the case, skip over them so the SDP can still be created.
+                */
+               if (!ast_rtp_lookup_sample_rate2(1, format, 0)) {
+                       ast_log(LOG_WARNING, "Format '%s' can not be added to SDP, consider disallowing it on endpoint '%s'\n",
+                               ast_format_get_name(format), ast_sorcery_object_get_id(session->endpoint));
+                       ao2_ref(format, -1);
+                       continue;
+               }
+
                /* If this stream is not a transport we need to use the transport codecs structure for payload management to prevent
                 * conflicts.
                 */