From: Joshua Colp Date: Tue, 9 Oct 2012 21:34:01 +0000 (+0000) Subject: Improve logging for DTLS-SRTP failure situations. X-Git-Tag: 11.1.0-rc1~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=332407b5f844abb8ed9c1faf0bbed12bee2fe576;p=thirdparty%2Fasterisk.git Improve logging for DTLS-SRTP failure situations. (closes issue ASTERISK-20487) Reported by: mjordan git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@374756 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 4f7e151dda..eaa19e72bc 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -5531,11 +5531,21 @@ static int dialog_initialize_dtls_srtp(const struct sip_pvt *dialog, struct ast_ return -1; } - if (!(dtls = ast_rtp_instance_get_dtls(rtp)) || - dtls->set_configuration(rtp, &dialog->dtls_cfg) || - !(*srtp = sip_srtp_alloc())) { + if (!(dtls = ast_rtp_instance_get_dtls(rtp))) { ast_log(LOG_ERROR, "No DTLS-SRTP support present on engine for RTP instance '%p', was it compiled with support for it?\n", - instance); + rtp); + return -1; + } + + if (dtls->set_configuration(rtp, &dialog->dtls_cfg)) { + ast_log(LOG_ERROR, "Attempted to set an invalid DTLS-SRTP configuration on RTP instance '%p'\n", + rtp); + return -1; + } + + if (!(*srtp = sip_srtp_alloc())) { + ast_log(LOG_ERROR, "Failed to create required SRTP structure on RTP instance '%p'\n", + rtp); return -1; }