From 75230f4c0135f4885a49f2e5105b6ad70477f3c6 Mon Sep 17 00:00:00 2001 From: Guido Falsi Date: Tue, 22 Nov 2016 18:20:06 +0100 Subject: res_rtp: Fix regression when IPv6 is not available. The latest Release candidate fails to create RTP streams when IPv6 is not available. Due to the changes made in September the ast_sockaddr structure passed around to create these streams is always of AF_INET6 type, causing failure when used for IPv4. This patch adds a utility function to check for availability of IPv6 and applies such check at startup to determine how to create the ast_sockaddr structures. ASTERISK-26617 #close Change-Id: I627a4e91795e821111e1cda523f083a40d0e0c3e --- res/res_pjsip_sdp_rtp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'res/res_pjsip_sdp_rtp.c') diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c index 7fd4f9abc..4d6a1a168 100644 --- a/res/res_pjsip_sdp_rtp.c +++ b/res/res_pjsip_sdp_rtp.c @@ -38,6 +38,7 @@ #include #include +#include "asterisk/utils.h" #include "asterisk/module.h" #include "asterisk/format.h" #include "asterisk/format_cap.h" @@ -1514,7 +1515,11 @@ static int load_module(void) { CHECK_PJSIP_SESSION_MODULE_LOADED(); - ast_sockaddr_parse(&address_rtp, "::", 0); + if (ast_check_ipv6()) { + ast_sockaddr_parse(&address_rtp, "::", 0); + } else { + ast_sockaddr_parse(&address_rtp, "0.0.0.0", 0); + } if (!(sched = ast_sched_context_create())) { ast_log(LOG_ERROR, "Unable to create scheduler context.\n"); -- cgit v1.2.3