diff options
author | Guido Falsi <mad@madpilot.net> | 2016-11-22 18:20:06 +0100 |
---|---|---|
committer | Joshua Colp <jcolp@digium.com> | 2016-11-30 20:03:11 +0000 |
commit | 798179995ba2ba1fdb6aa175d8603c6c02fb9a34 (patch) | |
tree | eff5be926cdd35bdab03192a77c739deb595c9fb /res | |
parent | 12517ad1f37daf0ff9ec55b92eb3cdf6843fdc64 (diff) |
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
Diffstat (limited to 'res')
-rw-r--r-- | res/res_pjsip_sdp_rtp.c | 7 | ||||
-rw-r--r-- | res/res_pjsip_t38.c | 7 |
2 files changed, 12 insertions, 2 deletions
diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c index 24d852c6c..8afa75d7f 100644 --- a/res/res_pjsip_sdp_rtp.c +++ b/res/res_pjsip_sdp_rtp.c @@ -52,6 +52,7 @@ ASTERISK_REGISTER_FILE() #include "asterisk/sdp_srtp.h" #include "asterisk/dsp.h" #include "asterisk/linkedlists.h" /* for AST_LIST_NEXT */ +#include "asterisk/utils.h" #include "asterisk/res_pjsip.h" #include "asterisk/res_pjsip_session.h" @@ -1511,7 +1512,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"); diff --git a/res/res_pjsip_t38.c b/res/res_pjsip_t38.c index b052cc428..f60f0ef09 100644 --- a/res/res_pjsip_t38.c +++ b/res/res_pjsip_t38.c @@ -44,6 +44,7 @@ ASTERISK_REGISTER_FILE() #include "asterisk/netsock2.h" #include "asterisk/channel.h" #include "asterisk/acl.h" +#include "asterisk/utils.h" #include "asterisk/res_pjsip.h" #include "asterisk/res_pjsip_session.h" @@ -918,7 +919,11 @@ static int load_module(void) { CHECK_PJSIP_SESSION_MODULE_LOADED(); - ast_sockaddr_parse(&address, "::", 0); + if (ast_check_ipv6()) { + ast_sockaddr_parse(&address, "::", 0); + } else { + ast_sockaddr_parse(&address, "0.0.0.0", 0); + } if (ast_sip_session_register_supplement(&t38_supplement)) { ast_log(LOG_ERROR, "Unable to register T.38 session supplement\n"); |