summaryrefslogtreecommitdiff
path: root/res/res_pjsip_sdp_rtp.c
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2013-11-28 02:12:45 +0000
committerJoshua Colp <jcolp@digium.com>2013-11-28 02:12:45 +0000
commit56290895aac6d16cec7805ca8c923616f722f705 (patch)
tree49f52277e5929666af23d6ddb48c408df5d98639 /res/res_pjsip_sdp_rtp.c
parentb315b16c90701ff2f1811220d151db6dcef1b60b (diff)
res_pjsip_sdp_rtp: Don't produce an invalid media stream with no formats.
Depending on configuration it was possible for a media stream to be created without any media formats. The produced SDP would fail internal validation and cause a crash. The code will now no longer add media streams with no formats to the SDP, allowing it to pass validation and work. (closes issue ASTERISK-22858) Reported by: Anthony Messina ........ Merged revisions 403223 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403224 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_pjsip_sdp_rtp.c')
-rw-r--r--res/res_pjsip_sdp_rtp.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c
index 96aad281b..48658cc16 100644
--- a/res/res_pjsip_sdp_rtp.c
+++ b/res/res_pjsip_sdp_rtp.c
@@ -983,6 +983,11 @@ static int create_outgoing_sdp_stream(struct ast_sip_session *session, struct as
}
}
+ /* If no formats were actually added to the media stream don't add it to the SDP */
+ if (!media->desc.fmt_count) {
+ return 1;
+ }
+
/* If ptime is set add it as an attribute */
if (min_packet_size) {
snprintf(tmp, sizeof(tmp), "%d", min_packet_size);