mirror of
https://github.com/asterisk/asterisk.git
synced 2026-06-25 01:46:44 -07:00
Merge "res_rtp: Fix regression when IPv6 is not available." into 14
This commit is contained in:
@@ -1127,4 +1127,13 @@ int ast_file_is_readable(const char *filename);
|
||||
*/
|
||||
int ast_compare_versions(const char *version1, const char *version2);
|
||||
|
||||
/*
|
||||
* \brief Test that an OS supports IPv6 Networking.
|
||||
* \since 13.14.0
|
||||
*
|
||||
* \return True (non-zero) if the IPv6 supported.
|
||||
* \return False (zero) if the OS doesn't support IPv6.
|
||||
*/
|
||||
int ast_check_ipv6(void);
|
||||
|
||||
#endif /* _ASTERISK_UTILS_H */
|
||||
|
||||
@@ -2420,6 +2420,18 @@ char *ast_utils_which(const char *binary, char *fullpath, size_t fullpath_size)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int ast_check_ipv6(void)
|
||||
{
|
||||
int udp6_socket = socket(AF_INET6, SOCK_DGRAM, 0);
|
||||
|
||||
if (udp6_socket < 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
close(udp6_socket);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void DO_CRASH_NORETURN ast_do_crash(void)
|
||||
{
|
||||
#if defined(DO_CRASH)
|
||||
|
||||
@@ -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");
|
||||
|
||||
+6
-1
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user