diff options
Diffstat (limited to 'third-party/pjproject')
-rw-r--r-- | third-party/pjproject/Makefile | 4 | ||||
-rw-r--r-- | third-party/pjproject/Makefile.rules | 5 | ||||
-rwxr-xr-x | third-party/pjproject/apply_patches | 1 | ||||
-rw-r--r-- | third-party/pjproject/configure.m4 | 2 | ||||
-rw-r--r-- | third-party/pjproject/patches/0050-dont_terminate_session_early.patch | 71 | ||||
-rw-r--r-- | third-party/pjproject/patches/0060-sip_msg-Prevent-crash-on-header-without-vptr.patch | 47 | ||||
-rw-r--r-- | third-party/pjproject/patches/asterisk_malloc_debug.c | 16 | ||||
-rw-r--r-- | third-party/pjproject/patches/asterisk_malloc_debug.h | 28 | ||||
-rw-r--r-- | third-party/pjproject/patches/config_site.h | 8 | ||||
-rw-r--r-- | third-party/pjproject/patches/user.mak | 2 |
10 files changed, 146 insertions, 38 deletions
diff --git a/third-party/pjproject/Makefile b/third-party/pjproject/Makefile index f7b9f0c3f..b95b33221 100644 --- a/third-party/pjproject/Makefile +++ b/third-party/pjproject/Makefile @@ -66,9 +66,9 @@ ifeq ($(SPECIAL_TARGETS),) endif ifeq ($(findstring MALLOC_DEBUG,$(MENUSELECT_CFLAGS)),MALLOC_DEBUG) CF += -DMALLOC_DEBUG - MALLOC_DEBUG_LIBS = source/pjsip-apps/lib/libasterisk_malloc_debug.a - MALLOC_DEBUG_LDFLAGS = -L$(PJDIR)/pjsip-apps/lib -Wl,-whole-archive -lasterisk_malloc_debug -Wl,-no-whole-archive endif + MALLOC_DEBUG_LIBS = source/pjsip-apps/lib/libasterisk_malloc_debug.a + MALLOC_DEBUG_LDFLAGS = -L$(PJDIR)/pjsip-apps/lib -Wl,-whole-archive -lasterisk_malloc_debug -Wl,-no-whole-archive ifeq ($(findstring DONT_OPTIMIZE,$(MENUSELECT_CFLAGS)),) CF += -O3 endif diff --git a/third-party/pjproject/Makefile.rules b/third-party/pjproject/Makefile.rules index 56b2c4934..ef1a70290 100644 --- a/third-party/pjproject/Makefile.rules +++ b/third-party/pjproject/Makefile.rules @@ -16,7 +16,7 @@ PJPROJECT_URL ?= https://raw.githubusercontent.com/asterisk/third-party/master/p PJPROJECT_CONFIG_OPTS = $(PJPROJECT_CONFIGURE_OPTS) --prefix=/opt/pjproject \ --disable-speex-codec \ --disable-speex-aec \ - --disable-speex-aec \ + --disable-bcg729 \ --disable-gsm-codec \ --disable-ilbc-codec \ --disable-l16-codec \ @@ -37,8 +37,7 @@ PJPROJECT_CONFIG_OPTS = $(PJPROJECT_CONFIGURE_OPTS) --prefix=/opt/pjproject \ --disable-ipp \ --disable-libwebrtc \ --without-external-pa \ - --without-external-srtp \ - --without-external-webrtc + --without-external-srtp ifeq ($(findstring TEST_FRAMEWORK,$(MENUSELECT_CFLAGS)),) PJPROJECT_CONFIG_OPTS += --disable-resample --disable-g711-codec diff --git a/third-party/pjproject/apply_patches b/third-party/pjproject/apply_patches index 134bd306f..23323fbef 100755 --- a/third-party/pjproject/apply_patches +++ b/third-party/pjproject/apply_patches @@ -31,4 +31,3 @@ for patchfile in "$patchdir"/*.patch ; do done exit 0 - diff --git a/third-party/pjproject/configure.m4 b/third-party/pjproject/configure.m4 index c1edaf9aa..42482b2e5 100644 --- a/third-party/pjproject/configure.m4 +++ b/third-party/pjproject/configure.m4 @@ -16,7 +16,7 @@ AC_DEFUN([_PJPROJECT_CONFIGURE], AC_MSG_RESULT(configuring) if test "x${DOWNLOAD_TO_STDOUT}" = "x" ; then - AC_MSG_ERROR(A download utility (wget, curl or fetch) is required to download bundled pjproject) + AC_MSG_ERROR(A download utility (wget, curl, or fetch) is required to download bundled pjproject) fi if test "${BZIP2}" = ":" ; then AC_MSG_ERROR(bzip2 is required to extract the pjproject tar file) diff --git a/third-party/pjproject/patches/0050-dont_terminate_session_early.patch b/third-party/pjproject/patches/0050-dont_terminate_session_early.patch new file mode 100644 index 000000000..718968c79 --- /dev/null +++ b/third-party/pjproject/patches/0050-dont_terminate_session_early.patch @@ -0,0 +1,71 @@ +commit ca0b723e92bd76bbda1bbd14477a829eaeeb675e +Author: Joshua Colp <jcolp@digium.com> +Date: Wed Dec 13 10:58:57 2017 +0000 + + Ignore transport error on completed transaction. + Don't disconnect call if transport error happens on transaction that is not initial INVITE transaction. + + Scenario: + + DNS lookup returning two servers. + Sending INVITE to first server over TCP. + Response received with code 503 (Service Unavailable). + Failover to second server, sending second INVITE after restarting the session. + TCP connection for the first INVITE getting disconnected and causing call disconnection (while second INVITE is still outstanding). + + This is a backport of 5714 from upstream PJSIP. + +diff --git a/pjsip/src/pjsip-ua/sip_inv.c b/pjsip/src/pjsip-ua/sip_inv.c +index ac4d1949..0173cb4c 100644 +--- a/pjsip/src/pjsip-ua/sip_inv.c ++++ b/pjsip/src/pjsip-ua/sip_inv.c +@@ -4254,8 +4254,7 @@ static void inv_on_state_calling( pjsip_inv_session *inv, pjsip_event *e) + if ((tsx->status_code == PJSIP_SC_CALL_TSX_DOES_NOT_EXIST && + tsx->method.id != PJSIP_CANCEL_METHOD) || + tsx->status_code == PJSIP_SC_REQUEST_TIMEOUT || +- tsx->status_code == PJSIP_SC_TSX_TIMEOUT || +- tsx->status_code == PJSIP_SC_TSX_TRANSPORT_ERROR) ++ tsx->status_code == PJSIP_SC_TSX_TIMEOUT) + { + inv_set_cause(inv, tsx->status_code, &tsx->status_text); + inv_set_state(inv, PJSIP_INV_STATE_DISCONNECTED, e); +diff --git a/pjsip/src/pjsip/sip_transaction.c b/pjsip/src/pjsip/sip_transaction.c +index 7ac3d1b7..d52b12a7 100644 +--- a/pjsip/src/pjsip/sip_transaction.c ++++ b/pjsip/src/pjsip/sip_transaction.c +@@ -2044,9 +2044,14 @@ static void transport_callback(void *token, pjsip_tx_data *tdata, + */ + lock_timer(tsx); + tsx->transport_err = (pj_status_t)-sent; +- tsx_cancel_timer(tsx, &tsx->timeout_timer); +- tsx_schedule_timer(tsx, &tsx->timeout_timer, &delay, +- TRANSPORT_ERR_TIMER); ++ /* Don't cancel timeout timer if tsx state is already ++ * PJSIP_TSX_STATE_COMPLETED (see #2076). ++ */ ++ if (tsx->state < PJSIP_TSX_STATE_COMPLETED) { ++ tsx_cancel_timer(tsx, &tsx->timeout_timer); ++ tsx_schedule_timer(tsx, &tsx->timeout_timer, &delay, ++ TRANSPORT_ERR_TIMER); ++ } + unlock_timer(tsx); + } + +@@ -2077,9 +2082,14 @@ static void tsx_tp_state_callback( pjsip_transport *tp, + */ + lock_timer(tsx); + tsx->transport_err = info->status; +- tsx_cancel_timer(tsx, &tsx->timeout_timer); +- tsx_schedule_timer(tsx, &tsx->timeout_timer, &delay, +- TRANSPORT_ERR_TIMER); ++ /* Don't cancel timeout timer if tsx state is already ++ * PJSIP_TSX_STATE_COMPLETED (see #2076). ++ */ ++ if (tsx->state < PJSIP_TSX_STATE_COMPLETED) { ++ tsx_cancel_timer(tsx, &tsx->timeout_timer); ++ tsx_schedule_timer(tsx, &tsx->timeout_timer, &delay, ++ TRANSPORT_ERR_TIMER); ++ } + unlock_timer(tsx); + } + } diff --git a/third-party/pjproject/patches/0060-sip_msg-Prevent-crash-on-header-without-vptr.patch b/third-party/pjproject/patches/0060-sip_msg-Prevent-crash-on-header-without-vptr.patch new file mode 100644 index 000000000..c96292a95 --- /dev/null +++ b/third-party/pjproject/patches/0060-sip_msg-Prevent-crash-on-header-without-vptr.patch @@ -0,0 +1,47 @@ +From cf6b662b8fe450ea7dc6eb5adb2b878971ce0d67 Mon Sep 17 00:00:00 2001 +From: George Joseph <gjoseph@digium.com> +Date: Wed, 10 Jan 2018 08:48:32 -0700 +Subject: [PATCH] sip_msg: Prevent crash on header without vptr + +Occasionally a header with no vptr gets into the list of header. This +causes a crash when printing them. We still need to figure out how +the header got there but this patch at least prevents the crash by checking +for a non-NULL vptr before attempting to call its print function. +--- + pjsip/src/pjsip/sip_msg.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/pjsip/src/pjsip/sip_msg.c b/pjsip/src/pjsip/sip_msg.c +index 76d07b563..194b5ee01 100644 +--- a/pjsip/src/pjsip/sip_msg.c ++++ b/pjsip/src/pjsip/sip_msg.c +@@ -26,6 +26,7 @@ + #include <pj/string.h> + #include <pj/pool.h> + #include <pj/assert.h> ++#include <pj/log.h> + #include <pjlib-util/string.h> + + PJ_DEF_DATA(const pjsip_method) pjsip_invite_method = +@@ -469,6 +470,8 @@ PJ_DEF(pj_ssize_t) pjsip_msg_print( const pjsip_msg *msg, + + *p++ = '\r'; + *p++ = '\n'; ++ } else { ++ PJ_LOG(1, ("sip_msg", "Header with no vptr encountered!! Current buffer: %.*s", (int)(p-buf), buf)); + } + } + +@@ -576,6 +579,9 @@ PJ_DEF(void*) pjsip_hdr_shallow_clone( pj_pool_t *pool, const void *hdr_ptr ) + PJ_DEF(int) pjsip_hdr_print_on( void *hdr_ptr, char *buf, pj_size_t len) + { + pjsip_hdr *hdr = (pjsip_hdr*) hdr_ptr; ++ if (!hdr->vptr) { ++ return 0; ++ } + return (*hdr->vptr->print_on)(hdr_ptr, buf, len); + } + +-- +2.14.3 + diff --git a/third-party/pjproject/patches/asterisk_malloc_debug.c b/third-party/pjproject/patches/asterisk_malloc_debug.c index c41767bd8..061bdd491 100644 --- a/third-party/pjproject/patches/asterisk_malloc_debug.c +++ b/third-party/pjproject/patches/asterisk_malloc_debug.c @@ -22,7 +22,7 @@ #include <string.h> #include <stdarg.h> -int __ast_asprintf(const char *file, int lineno, const char *func, char **strp, const char *format, ...) +int __ast_repl_asprintf(const char *file, int lineno, const char *func, char **strp, const char *format, ...) { va_list ap; int rc = 0; @@ -34,7 +34,7 @@ int __ast_asprintf(const char *file, int lineno, const char *func, char **strp, return rc; } -void *__ast_calloc(size_t nmemb, size_t size, const char *file, int lineno, const char *func) +void *__ast_repl_calloc(size_t nmemb, size_t size, const char *file, int lineno, const char *func) { return calloc(nmemb, size); } @@ -44,29 +44,27 @@ void __ast_free(void *ptr, const char *file, int lineno, const char *func) free(ptr); } -void *__ast_malloc(size_t size, const char *file, int lineno, const char *func) +void *__ast_repl_malloc(size_t size, const char *file, int lineno, const char *func) { return malloc(size); } -void *__ast_realloc(void *ptr, size_t size, const char *file, int lineno, const char *func) +void *__ast_repl_realloc(void *ptr, size_t size, const char *file, int lineno, const char *func) { return realloc(ptr, size); } -char *__ast_strdup(const char *s, const char *file, int lineno, const char *func) +char *__ast_repl_strdup(const char *s, const char *file, int lineno, const char *func) { return strdup(s); } -char *__ast_strndup(const char *s, size_t n, const char *file, int lineno, const char *func) +char *__ast_repl_strndup(const char *s, size_t n, const char *file, int lineno, const char *func) { return strndup(s, n); } -int __ast_vasprintf(char **strp, const char *format, va_list ap, const char *file, int lineno, const char *func) +int __ast_repl_vasprintf(char **strp, const char *format, va_list ap, const char *file, int lineno, const char *func) { return vasprintf(strp, format, ap); } - - diff --git a/third-party/pjproject/patches/asterisk_malloc_debug.h b/third-party/pjproject/patches/asterisk_malloc_debug.h index 44c473758..e5e04f1af 100644 --- a/third-party/pjproject/patches/asterisk_malloc_debug.h +++ b/third-party/pjproject/patches/asterisk_malloc_debug.h @@ -25,15 +25,15 @@ extern "C" { #endif -int __ast_asprintf(const char *file, int lineno, const char *func, char **strp, const char *format, ...) +int __ast_repl_asprintf(const char *file, int lineno, const char *func, char **strp, const char *format, ...) __attribute__((format(printf, 5, 6))); -void *__ast_calloc(size_t nmemb, size_t size, const char *file, int lineno, const char *func); +void *__ast_repl_calloc(size_t nmemb, size_t size, const char *file, int lineno, const char *func); void __ast_free(void *ptr, const char *file, int lineno, const char *func); -void *__ast_malloc(size_t size, const char *file, int lineno, const char *func); -void *__ast_realloc(void *ptr, size_t size, const char *file, int lineno, const char *func); -char *__ast_strdup(const char *s, const char *file, int lineno, const char *func); -char *__ast_strndup(const char *s, size_t n, const char *file, int lineno, const char *func); -int __ast_vasprintf(char **strp, const char *format, va_list ap, const char *file, int lineno, const char *func) +void *__ast_repl_malloc(size_t size, const char *file, int lineno, const char *func); +void *__ast_repl_realloc(void *ptr, size_t size, const char *file, int lineno, const char *func); +char *__ast_repl_strdup(const char *s, const char *file, int lineno, const char *func); +char *__ast_repl_strndup(const char *s, size_t n, const char *file, int lineno, const char *func); +int __ast_repl_vasprintf(char **strp, const char *format, va_list ap, const char *file, int lineno, const char *func) __attribute__((format(printf, 2, 0))); /* Undefine any macros */ @@ -48,28 +48,28 @@ int __ast_vasprintf(char **strp, const char *format, va_list ap, const char *fil /* Provide our own definitions */ #define asprintf(a, b, c...) \ - __ast_asprintf(__FILE__, __LINE__, __PRETTY_FUNCTION__, a, b, c) + __ast_repl_asprintf(__FILE__, __LINE__, __PRETTY_FUNCTION__, a, b, c) #define calloc(a,b) \ - __ast_calloc(a,b,__FILE__, __LINE__, __PRETTY_FUNCTION__) + __ast_repl_calloc(a,b,__FILE__, __LINE__, __PRETTY_FUNCTION__) #define free(a) \ __ast_free(a,__FILE__, __LINE__, __PRETTY_FUNCTION__) #define malloc(a) \ - __ast_malloc(a,__FILE__, __LINE__, __PRETTY_FUNCTION__) + __ast_repl_malloc(a,__FILE__, __LINE__, __PRETTY_FUNCTION__) #define realloc(a,b) \ - __ast_realloc(a,b,__FILE__, __LINE__, __PRETTY_FUNCTION__) + __ast_repl_realloc(a,b,__FILE__, __LINE__, __PRETTY_FUNCTION__) #define strdup(a) \ - __ast_strdup(a,__FILE__, __LINE__, __PRETTY_FUNCTION__) + __ast_repl_strdup(a,__FILE__, __LINE__, __PRETTY_FUNCTION__) #define strndup(a,b) \ - __ast_strndup(a,b,__FILE__, __LINE__, __PRETTY_FUNCTION__) + __ast_repl_strndup(a,b,__FILE__, __LINE__, __PRETTY_FUNCTION__) #define vasprintf(a,b,c) \ - __ast_vasprintf(a,b,c,__FILE__, __LINE__, __PRETTY_FUNCTION__) + __ast_repl_vasprintf(a,b,c,__FILE__, __LINE__, __PRETTY_FUNCTION__) #ifdef __cplusplus } diff --git a/third-party/pjproject/patches/config_site.h b/third-party/pjproject/patches/config_site.h index a11bc0640..67e3451d0 100644 --- a/third-party/pjproject/patches/config_site.h +++ b/third-party/pjproject/patches/config_site.h @@ -8,7 +8,7 @@ * Since both pjproject and asterisk source files will include config_site.h, * we need to make sure that only pjproject source files include asterisk_malloc_debug.h. */ -#if defined(MALLOC_DEBUG) && !defined(_ASTERISK_ASTMM_H) +#if !defined(_ASTERISK_ASTMM_H) #include "asterisk_malloc_debug.h" #endif @@ -20,12 +20,6 @@ */ #define PJMEDIA_HAS_SRTP 0 -/* - * Defining PJMEDIA_HAS_WEBRTC_AEC to 0 does NOT disable Asterisk's ability to use - * webrtc. It only disables the pjmedia webrtc transport which Asterisk doesn't use. - */ -#define PJMEDIA_HAS_WEBRTC_AEC 0 - #define PJ_HAS_IPV6 1 #if !defined(AST_DEVMODE) && !defined(PJPROJECT_BUNDLED_ASSERTIONS) #define NDEBUG 1 diff --git a/third-party/pjproject/patches/user.mak b/third-party/pjproject/patches/user.mak index dafb25919..b7eab5270 100644 --- a/third-party/pjproject/patches/user.mak +++ b/third-party/pjproject/patches/user.mak @@ -1,4 +1,4 @@ -NUBSV := $(shell gcc -Wno-unused-but-set-variable -o /dev/null -xc -c - </dev/null 2>/dev/null && echo -Wno-unused-but-set-variable) +NUBSV := $(shell ${CC} -Wno-unused-but-set-variable -Werror -o /dev/null -xc -c - </dev/null 2>/dev/null && echo -Wno-unused-but-set-variable) CFLAGS += -fPIC $(NUBSV) -Wno-unused-variable -Wno-unused-label -Wno-unused-function -Wno-strict-aliasing |