From 30b47fb8a01018ec1d9c3afe2d50f3ac2a0585eb Mon Sep 17 00:00:00 2001
From: "Kevin P. Fleming" <kpfleming@digium.com>
Date: Thu, 2 Nov 2006 16:45:50 +0000
Subject: [PATCH] Merged revisions 46937 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r46937 | kpfleming | 2006-11-02 10:45:32 -0600 (Thu, 02 Nov 2006) | 2 lines

don't send INVITE when we have determined that we can't offer any audio formats due to lack of trancoding support (or incorrect configuration)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46938 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 channels/chan_sip.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index eca85c4f32..f8b3a18968 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -6096,6 +6096,12 @@ static int add_sdp(struct sip_request *resp, struct sip_pvt *p)
 	/* Ok, let's start working with codec selection here */
 	capability = ast_translate_available_formats(p->jointcapability, p->prefcodec);
 
+	/* If there are no audio formats left to offer, punt */
+	if (!(capability & AST_FORMAT_AUDIO_MASK)) {
+		ast_log(LOG_WARNING, "No audio format found to offer.\n");
+		return -1;
+	}
+
 	if (option_debug > 1) {
 		char codecbuf[BUFSIZ];
 		ast_log(LOG_DEBUG, "** Our capability: %s Video flag: %s\n", ast_getformatname_multiple(codecbuf, sizeof(codecbuf), capability), ast_test_flag(&p->flags[0], SIP_NOVIDEO) ? "True" : "False");
-- 
GitLab