diff --git a/configure b/configure index 9b0d46e845ac8d229791c19f204435e0e3a95501..6c5d97331ebc8984f881fc5de5e9252419e15d5d 100755 --- a/configure +++ b/configure @@ -930,6 +930,10 @@ PBX_POPT POPT_DIR POPT_INCLUDE POPT_LIB +PBX_PJSIP_ENDPOINT_COMPACT_FORM +PJSIP_ENDPOINT_COMPACT_FORM_DIR +PJSIP_ENDPOINT_COMPACT_FORM_INCLUDE +PJSIP_ENDPOINT_COMPACT_FORM_LIB PBX_PJSIP_INV_ACCEPT_MULTIPLE_SDP_ANSWERS PJSIP_INV_ACCEPT_MULTIPLE_SDP_ANSWERS_DIR PJSIP_INV_ACCEPT_MULTIPLE_SDP_ANSWERS_INCLUDE @@ -9440,6 +9444,9 @@ $as_echo "#define HAVE_PJSIP_TSX_LAYER_FIND_TSX2 1" >>confdefs.h $as_echo "#define HAVE_PJSIP_INV_ACCEPT_MULTIPLE_SDP_ANSWERS 1" >>confdefs.h +$as_echo "#define HAVE_PJSIP_ENDPOINT_COMPACT_FORM 1" >>confdefs.h + + @@ -11582,6 +11589,18 @@ PBX_PJSIP_INV_ACCEPT_MULTIPLE_SDP_ANSWERS=0 + +PJSIP_ENDPOINT_COMPACT_FORM_DESCRIP="PJSIP Compact Form Support on Endpoint" +PJSIP_ENDPOINT_COMPACT_FORM_OPTION=pjsip +PJSIP_ENDPOINT_COMPACT_FORM_DIR=${PJPROJECT_DIR} + +PBX_PJSIP_ENDPOINT_COMPACT_FORM=0 + + + + + + fi @@ -25450,6 +25469,46 @@ $as_echo "#define HAVE_PJSIP_INV_ACCEPT_MULTIPLE_SDP_ANSWERS 1" >>confdefs.h +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CPPFLAGS="${saved_cppflags}" + fi + + + if test "x${PBX_PJSIP_ENDPOINT_COMPACT_FORM}" != "x1" -a "${USE_PJSIP_ENDPOINT_COMPACT_FORM}" != "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if \"pjsip_cfg()->endpt.use_compact_form = PJ_TRUE;\" compiles using pjsip.h" >&5 +$as_echo_n "checking if \"pjsip_cfg()->endpt.use_compact_form = PJ_TRUE;\" compiles using pjsip.h... " >&6; } + saved_cppflags="${CPPFLAGS}" + if test "x${PJSIP_ENDPOINT_COMPACT_FORM_DIR}" != "x"; then + PJSIP_ENDPOINT_COMPACT_FORM_INCLUDE="-I${PJSIP_ENDPOINT_COMPACT_FORM_DIR}/include" + fi + CPPFLAGS="${CPPFLAGS} ${PJSIP_ENDPOINT_COMPACT_FORM_INCLUDE}" + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + #include <pjsip.h> +int +main () +{ + pjsip_cfg()->endpt.use_compact_form = PJ_TRUE;; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + PBX_PJSIP_ENDPOINT_COMPACT_FORM=1 + +$as_echo "#define HAVE_PJSIP_ENDPOINT_COMPACT_FORM 1" >>confdefs.h + + + else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } diff --git a/configure.ac b/configure.ac index 2fd8eac0573bf8bf0de14e9f914ccfe52d5701ae..7efbec14e93c600180d0af487d2ba91224fdc667 100644 --- a/configure.ac +++ b/configure.ac @@ -536,6 +536,7 @@ AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_INV_SESSION_REF], [PJSIP INVITE Session Refere AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_AUTH_CLT_DEINIT], [pjsip_auth_clt_deinit support], [PJPROJECT], [pjsip]) AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_TSX_LAYER_FIND_TSX2], [pjsip_tsx_layer_find_tsx2 support], [PJPROJECT], [pjsip]) AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_INV_ACCEPT_MULTIPLE_SDP_ANSWERS], [PJSIP INVITE Accept Multiple SDP Answers], [PJPROJECT], [pjsip]) +AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_ENDPOINT_COMPACT_FORM], [PJSIP Compact Form Support on Endpoint], [PJPROJECT], [pjsip]) fi AST_EXT_LIB_SETUP([POPT], [popt], [popt]) @@ -2371,6 +2372,7 @@ if test "$USE_PJPROJECT" != "no" ; then LIBS="${LIBS} ${PJPROJECT_LIB}" AST_C_COMPILE_CHECK([PJSIP_TLS_TRANSPORT_PROTO], [struct pjsip_tls_setting setting; int proto; proto = setting.proto;], [pjsip.h]) AST_C_COMPILE_CHECK([PJSIP_INV_ACCEPT_MULTIPLE_SDP_ANSWERS], [pjsip_cfg()->endpt.accept_multiple_sdp_answers = 0;], [pjsip.h]) + AST_C_COMPILE_CHECK([PJSIP_ENDPOINT_COMPACT_FORM], [pjsip_cfg()->endpt.use_compact_form = PJ_TRUE;], [pjsip.h]) LIBS="${saved_libs}" CPPFLAGS="${saved_cppflags}" diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in index 5d22ae18a5265894b4848e65ec970c1580e63d50..69ab58501bbe5a72164f1520bfec0aadc86a4f8a 100644 --- a/include/asterisk/autoconfig.h.in +++ b/include/asterisk/autoconfig.h.in @@ -613,6 +613,9 @@ Lock feature. */ #undef HAVE_PJSIP_DLG_CREATE_UAS_AND_INC_LOCK +/* Define if your system has the PJSIP_ENDPOINT_COMPACT_FORM headers. */ +#undef HAVE_PJSIP_ENDPOINT_COMPACT_FORM + /* Define to 1 if PJPROJECT has the PJSIP EVSUB Group Lock support feature. */ #undef HAVE_PJSIP_EVSUB_GRP_LOCK diff --git a/res/res_pjsip/config_system.c b/res/res_pjsip/config_system.c index 2ff0a65efe680477a5f9e1ef9a2842b7b2f2bbcb..52f66a5264b96703a1113483aef0fb9990388672 100644 --- a/res/res_pjsip/config_system.c +++ b/res/res_pjsip/config_system.c @@ -114,9 +114,13 @@ static int system_apply(const struct ast_sorcery *system_sorcery, void *obj) #endif if (system->compactheaders) { +#ifdef HAVE_PJSIP_ENDPOINT_COMPACT_FORM + pjsip_cfg()->endpt.use_compact_form = PJ_TRUE; +#else extern pj_bool_t pjsip_use_compact_form; pjsip_use_compact_form = PJ_TRUE; +#endif } sip_threadpool_options.initial_size = system->threadpool.initial_size; diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c index 359d9c1b5711f29a2a179c87cd5777aaf6006a79..288961554b2aaf53e281eeb59249be0ad6f0030c 100644 --- a/res/res_pjsip_sdp_rtp.c +++ b/res/res_pjsip_sdp_rtp.c @@ -516,7 +516,11 @@ static int set_caps(struct ast_sip_session *session, static pjmedia_sdp_attr* generate_rtpmap_attr(struct ast_sip_session *session, pjmedia_sdp_media *media, pj_pool_t *pool, int rtp_code, int asterisk_format, struct ast_format *format, int code) { +#ifndef HAVE_PJSIP_ENDPOINT_COMPACT_FORM extern pj_bool_t pjsip_use_compact_form; +#else + pj_bool_t pjsip_use_compact_form = pjsip_cfg()->endpt.use_compact_form; +#endif pjmedia_sdp_rtpmap rtpmap; pjmedia_sdp_attr *attr = NULL; char tmp[64]; diff --git a/third-party/pjproject/Makefile.rules b/third-party/pjproject/Makefile.rules index e38024a460e588700ee1dc11a92e81efe066f2cf..6a48e866c7da263be61eec510cd58c21f1b9d9c7 100644 --- a/third-party/pjproject/Makefile.rules +++ b/third-party/pjproject/Makefile.rules @@ -30,7 +30,6 @@ PJPROJECT_CONFIG_OPTS = $(PJPROJECT_CONFIGURE_OPTS) --prefix=/opt/pjproject \ --disable-v4l2 \ --disable-sound \ --disable-ext-sound \ - --disable-oss \ --disable-sdl \ --disable-libyuv \ --disable-ffmpeg \ diff --git a/third-party/pjproject/configure.m4 b/third-party/pjproject/configure.m4 index ecdd138612f2f8359a592521f6238f72502cbaaa..94be9b83794e7468692aeef2aa811424b7d4a949 100644 --- a/third-party/pjproject/configure.m4 +++ b/third-party/pjproject/configure.m4 @@ -105,6 +105,7 @@ AC_DEFUN([_PJPROJECT_CONFIGURE], AC_DEFINE([HAVE_PJSIP_AUTH_CLT_DEINIT], 1, [Define if your system has pjsip_auth_clt_deinit declared.]) AC_DEFINE([HAVE_PJSIP_TSX_LAYER_FIND_TSX2], 1, [Define if your system has pjsip_tsx_layer_find_tsx2 declared.]) AC_DEFINE([HAVE_PJSIP_INV_ACCEPT_MULTIPLE_SDP_ANSWERS], 1, [Define if your system has HAVE_PJSIP_INV_ACCEPT_MULTIPLE_SDP_ANSWERS declared.]) + AC_DEFINE([HAVE_PJSIP_ENDPOINT_COMPACT_FORM], 1, [Define if your system has HAVE_PJSIP_ENDPOINT_COMPACT_FORM declared.]) AC_SUBST([PJPROJECT_BUNDLED]) AC_SUBST([PJPROJECT_DIR]) diff --git a/third-party/pjproject/patches/0000-remove-third-party.patch b/third-party/pjproject/patches/0000-remove-third-party.patch index 7cde2f44e0baf6a6bba7199bfc4b9b9fb97fc3d2..54d8774c761ae0b0732ee074c783eb94f0ca2a8f 100644 --- a/third-party/pjproject/patches/0000-remove-third-party.patch +++ b/third-party/pjproject/patches/0000-remove-third-party.patch @@ -8,7 +8,7 @@ Subject: [PATCH 1/3] 0000-remove-third-party.patch 1 file changed, 107 deletions(-) diff --git a/build.mak.in b/build.mak.in -index 6c263a9..36e7ff4 100644 +index 80ccad12..41ec64ea 100644 --- a/build.mak.in +++ b/build.mak.in @@ -1,4 +1,3 @@ @@ -16,7 +16,7 @@ index 6c263a9..36e7ff4 100644 include $(PJDIR)/version.mak export PJ_DIR := $(PJDIR) -@@ -28,19 +27,6 @@ export APP_THIRD_PARTY_EXT := +@@ -37,19 +36,6 @@ export APP_THIRD_PARTY_EXT := export APP_THIRD_PARTY_LIBS := export APP_THIRD_PARTY_LIB_FILES := @@ -36,7 +36,7 @@ index 6c263a9..36e7ff4 100644 ifeq (@ac_pjmedia_resample@,libresample) APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libresample-$(LIB_SUFFIX) ifeq ($(PJ_SHARED_LIBRARIES),) -@@ -57,99 +43,6 @@ APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libresample.$(SHLIB_SUFFI +@@ -66,89 +52,6 @@ APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libresample.$(SHLIB_SUFFI endif endif @@ -89,19 +89,9 @@ index 6c263a9..36e7ff4 100644 -endif -endif - --ifneq ($(findstring pa,@ac_pjmedia_snd@),) -ifeq (@ac_external_pa@,1) -# External PA -APP_THIRD_PARTY_EXT += -lportaudio --else --APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libportaudio-$(LIB_SUFFIX) --ifeq ($(PJ_SHARED_LIBRARIES),) --APP_THIRD_PARTY_LIBS += -lportaudio-$(TARGET_NAME) --else --APP_THIRD_PARTY_LIBS += -lportaudio --APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libportaudio.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/third_party/lib/libportaudio.$(SHLIB_SUFFIX) --endif --endif -endif - -ifneq (@ac_no_yuv@,1) @@ -136,6 +126,3 @@ index 6c263a9..36e7ff4 100644 # Additional flags @ac_build_mak_vars@ --- -2.7.4 - diff --git a/third-party/pjproject/patches/0000-solaris.patch b/third-party/pjproject/patches/0000-solaris.patch index 0790627c38868dc3b6c9ef0858dc320c569d41d7..0e25c55161ba07b908c52584ce89be21e557d001 100644 --- a/third-party/pjproject/patches/0000-solaris.patch +++ b/third-party/pjproject/patches/0000-solaris.patch @@ -40,7 +40,6 @@ Updated by ASTERISK-27997 --- pjlib/include/pj/sock.h | 8 +++++++- pjlib/src/pj/sock_bsd.c | 2 +- - pjlib/src/pj/sock_linux_kernel.c | 2 +- pjlib/src/pj/sock_symbian.cpp | 2 +- pjlib/src/pj/sock_uwp.cpp | 2 +- pjsip/src/test/transport_test.c | 2 +- @@ -92,19 +91,6 @@ index 95c3804..daefc54 100644 { char tempaddr[PJ_INET_ADDRSTRLEN]; -diff --git a/pjlib/src/pj/sock_linux_kernel.c b/pjlib/src/pj/sock_linux_kernel.c -index 899b486..10d84cd 100644 ---- a/pjlib/src/pj/sock_linux_kernel.c -+++ b/pjlib/src/pj/sock_linux_kernel.c -@@ -149,7 +149,7 @@ PJ_DEF(char*) pj_inet_ntoa(pj_in_addr in) - * numbers-and-dots notation into binary data and stores it in the structure - * that inp points to. - */ --PJ_DEF(int) pj_inet_aton(const pj_str_t *ccp, struct pj_in_addr *addr) -+PJ_DEF(int) pj_inet_aton(const pj_str_t *ccp, pj_in_addr *addr) - { - pj_uint32_t val; - int base, n; diff --git a/pjlib/src/pj/sock_symbian.cpp b/pjlib/src/pj/sock_symbian.cpp index 09239b0..e72bbda 100644 --- a/pjlib/src/pj/sock_symbian.cpp diff --git a/third-party/pjproject/patches/0021-sip_parser-Fix-return-code-in-pjsip_find_msg-and-add.patch b/third-party/pjproject/patches/0021-sip_parser-Fix-return-code-in-pjsip_find_msg-and-add.patch deleted file mode 100644 index 86d5aa7ddb7161f1d9c19fd3d50e26b401a4893b..0000000000000000000000000000000000000000 --- a/third-party/pjproject/patches/0021-sip_parser-Fix-return-code-in-pjsip_find_msg-and-add.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 186f82627c40d0c3a56a6a94ce55c055ad1f7620 Mon Sep 17 00:00:00 2001 -From: George Joseph <gjoseph@digium.com> -Date: Fri, 10 Nov 2017 09:26:29 -0700 -Subject: [PATCH] sip_parser: Fix return code in pjsip_find_msg and add - "volatile" - -The default return code for pjsip_find_msg was PJ_SUCCESS so if -a Content-Length header wasn't found at all, pjsip_find_msg was -returning PJ_SUCCESS instead of PJSIP_EMISSINGHDR. - -Also added the volatile keyword to a few variables what are used -both insude and outsude the PJ_TRY/PJ_CATCH block. ---- - pjsip/src/pjsip/sip_parser.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/pjsip/src/pjsip/sip_parser.c b/pjsip/src/pjsip/sip_parser.c -index f9a0e65b5..f65ffca5a 100644 ---- a/pjsip/src/pjsip/sip_parser.c -+++ b/pjsip/src/pjsip/sip_parser.c -@@ -834,13 +834,13 @@ PJ_DEF(pj_status_t) pjsip_find_msg( const char *buf, pj_size_t size, - pj_bool_t is_datagram, pj_size_t *msg_size) - { - #if PJ_HAS_TCP -- const char *hdr_end; -- const char *body_start; -+ const char *volatile hdr_end; -+ const char *volatile body_start; - const char *pos; -- const char *line; -+ const char *volatile line; - int content_length = -1; - pj_str_t cur_msg; -- pj_status_t status = PJ_SUCCESS; -+ volatile pj_status_t status = PJSIP_EMISSINGHDR; - const pj_str_t end_hdr = { "\n\r\n", 3}; - - *msg_size = size; --- -2.13.6 - diff --git a/third-party/pjproject/patches/0030-sip_transport-Destroy-transports-not-in-hash.patch b/third-party/pjproject/patches/0030-sip_transport-Destroy-transports-not-in-hash.patch deleted file mode 100644 index e42b0f7c64adba8fd6a430dcc3a0d8bc95e8a046..0000000000000000000000000000000000000000 --- a/third-party/pjproject/patches/0030-sip_transport-Destroy-transports-not-in-hash.patch +++ /dev/null @@ -1,27 +0,0 @@ -diff --git a/pjsip/src/pjsip/sip_transport.c b/pjsip/src/pjsip/sip_transport.c -index e4bec24..a39b56e 100644 ---- a/pjsip/src/pjsip/sip_transport.c -+++ b/pjsip/src/pjsip/sip_transport.c -@@ -957,7 +957,21 @@ static pj_bool_t is_transport_valid(pjsip_tpmgr *tpmgr, pjsip_transport *tp, - const pjsip_transport_key *key, - int key_len) - { -- return (pj_hash_get(tpmgr->table, key, key_len, NULL) == (void*)tp); -+ transport *tp_iter; -+ -+ if (pj_hash_get(tpmgr->table, key, key_len, NULL) == (void*)tp) { -+ return PJ_TRUE; -+ } -+ -+ tp_iter = tpmgr->tp_list.next; -+ while (tp_iter != &tpmgr->tp_list) { -+ if (tp_iter->tp == tp) { -+ return PJ_TRUE; -+ } -+ tp_iter = tp_iter->next; -+ } -+ -+ return PJ_FALSE; - } - - /* diff --git a/third-party/pjproject/patches/0040-183_without_to_tag.patch b/third-party/pjproject/patches/0040-183_without_to_tag.patch deleted file mode 100644 index e8692fe1b10f49b38a1516deef65cdf1492f1ba8..0000000000000000000000000000000000000000 --- a/third-party/pjproject/patches/0040-183_without_to_tag.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/pjsip/src/pjsip-ua/sip_inv.c b/pjsip/src/pjsip-ua/sip_inv.c -index c9686a0..fc52a63 100644 ---- a/pjsip/src/pjsip-ua/sip_inv.c -+++ b/pjsip/src/pjsip-ua/sip_inv.c -@@ -4156,9 +4156,10 @@ static void inv_on_state_calling( pjsip_inv_session *inv, pjsip_event *e) - status = pjsip_inv_send_msg(inv, cancel); - } - -- if (dlg->remote.info->tag.slen) { -+ if (tsx->status_code != 100) { - -- inv_set_state(inv, PJSIP_INV_STATE_EARLY, e); -+ if (dlg->remote.info->tag.slen) -+ inv_set_state(inv, PJSIP_INV_STATE_EARLY, e); - - inv_check_sdp_in_incoming_msg(inv, tsx, - e->body.tsx_state.src.rdata); diff --git a/third-party/pjproject/patches/0050-dont_terminate_session_early.patch b/third-party/pjproject/patches/0050-dont_terminate_session_early.patch deleted file mode 100644 index 718968c79d6db661f1f632b202a178193e9ee897..0000000000000000000000000000000000000000 --- a/third-party/pjproject/patches/0050-dont_terminate_session_early.patch +++ /dev/null @@ -1,71 +0,0 @@ -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 deleted file mode 100644 index 7508ab81879029f34629d354bdbf4f0e031fb6ff..0000000000000000000000000000000000000000 --- a/third-party/pjproject/patches/0060-sip_msg-Prevent-crash-on-header-without-vptr.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 88409082a4cbf27b308c76c148270ee72fdcb503 Mon Sep 17 00:00:00 2001 -From: Riza Sulistyo <riza@teluu.com> -Date: Wed, 17 Jan 2018 11:30:52 +0000 -Subject: [PATCH] r5727 svn backport sip_msg: Prevent crash on header without - vptr - -Re #2059 (misc): Prevent corrupt header from causing a crash when printed. -Thanks to George Joseph for the patch. - -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 | 11 +++++++++-- - 1 file changed, 9 insertions(+), 2 deletions(-) - -diff --git a/pjsip/src/pjsip/sip_msg.c b/pjsip/src/pjsip/sip_msg.c -index a13f80e..8819dd9 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 = -@@ -461,8 +462,13 @@ PJ_DEF(pj_ssize_t) pjsip_msg_print( const pjsip_msg *msg, - /* Print each of the headers. */ - for (hdr=msg->hdr.next; hdr!=&msg->hdr; hdr=hdr->next) { - len = pjsip_hdr_print_on(hdr, p, end-p); -- if (len < 0) -- return -1; -+ if (len < 0) { -+ if (len == -2) { -+ PJ_LOG(5, ("sip_msg", "Header with no vptr encountered!! "\ -+ "Current buffer: %.*s", (int)(p-buf), buf)); -+ } -+ return len; -+ } - - if (len > 0) { - p += len; -@@ -578,6 +584,7 @@ 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; -+ PJ_ASSERT_RETURN(hdr->vptr, -2); - return (*hdr->vptr->print_on)(hdr_ptr, buf, len); - } - --- -2.7.4 - diff --git a/third-party/pjproject/patches/0070-os_core_unix-Set-mutex-NULL-in-atomic-destroy-and-ad.patch b/third-party/pjproject/patches/0070-os_core_unix-Set-mutex-NULL-in-atomic-destroy-and-ad.patch deleted file mode 100644 index 3aafd69e87b68219b05fd1ed41e075d444267636..0000000000000000000000000000000000000000 --- a/third-party/pjproject/patches/0070-os_core_unix-Set-mutex-NULL-in-atomic-destroy-and-ad.patch +++ /dev/null @@ -1,114 +0,0 @@ -From 67485f3a6c711f67a40ff46288cb6be1658023bd Mon Sep 17 00:00:00 2001 -From: nanang <nanang@localhost> -Date: Mon, 26 Mar 2018 10:33:50 +0000 -Subject: [PATCH] Close #2101: - set atomic's mutex to NULL in atomic destroy - - added few sanity checks to the atomic functions. - ---- - pjlib/src/pj/os_core_unix.c | 20 ++++++++++++++++++-- - pjlib/src/pj/os_core_win32.c | 4 ++++ - 2 files changed, 22 insertions(+), 2 deletions(-) - -diff --git a/pjlib/src/pj/os_core_unix.c b/pjlib/src/pj/os_core_unix.c -index ebfe84348..c17ad4ef0 100644 ---- a/pjlib/src/pj/os_core_unix.c -+++ b/pjlib/src/pj/os_core_unix.c -@@ -879,9 +879,16 @@ PJ_DEF(pj_status_t) pj_atomic_create( pj_pool_t *pool, - */ - PJ_DEF(pj_status_t) pj_atomic_destroy( pj_atomic_t *atomic_var ) - { -+ pj_status_t status; -+ - PJ_ASSERT_RETURN(atomic_var, PJ_EINVAL); -+ - #if PJ_HAS_THREADS -- return pj_mutex_destroy( atomic_var->mutex ); -+ status = pj_mutex_destroy( atomic_var->mutex ); -+ if (status == PJ_SUCCESS) { -+ atomic_var->mutex = NULL; -+ } -+ return status; - #else - return 0; - #endif -@@ -892,10 +899,16 @@ PJ_DEF(pj_status_t) pj_atomic_destroy( pj_atomic_t *atomic_var ) - */ - PJ_DEF(void) pj_atomic_set(pj_atomic_t *atomic_var, pj_atomic_value_t value) - { -+ pj_status_t status; -+ - PJ_CHECK_STACK(); -+ PJ_ASSERT_ON_FAIL(atomic_var, return); - - #if PJ_HAS_THREADS -- pj_mutex_lock( atomic_var->mutex ); -+ status = pj_mutex_lock( atomic_var->mutex ); -+ if (status != PJ_SUCCESS) { -+ return; -+ } - #endif - atomic_var->value = value; - #if PJ_HAS_THREADS -@@ -946,6 +959,7 @@ PJ_DEF(pj_atomic_value_t) pj_atomic_inc_and_get(pj_atomic_t *atomic_var) - */ - PJ_DEF(void) pj_atomic_inc(pj_atomic_t *atomic_var) - { -+ PJ_ASSERT_ON_FAIL(atomic_var, return); - pj_atomic_inc_and_get(atomic_var); - } - -@@ -974,6 +988,7 @@ PJ_DEF(pj_atomic_value_t) pj_atomic_dec_and_get(pj_atomic_t *atomic_var) - */ - PJ_DEF(void) pj_atomic_dec(pj_atomic_t *atomic_var) - { -+ PJ_ASSERT_ON_FAIL(atomic_var, return); - pj_atomic_dec_and_get(atomic_var); - } - -@@ -1005,6 +1020,7 @@ PJ_DEF(pj_atomic_value_t) pj_atomic_add_and_get( pj_atomic_t *atomic_var, - PJ_DEF(void) pj_atomic_add( pj_atomic_t *atomic_var, - pj_atomic_value_t value ) - { -+ PJ_ASSERT_ON_FAIL(atomic_var, return); - pj_atomic_add_and_get(atomic_var, value); - } - -diff --git a/pjlib/src/pj/os_core_win32.c b/pjlib/src/pj/os_core_win32.c -index 1cb6004d3..8c934b34d 100644 ---- a/pjlib/src/pj/os_core_win32.c -+++ b/pjlib/src/pj/os_core_win32.c -@@ -750,6 +750,7 @@ PJ_DEF(pj_status_t) pj_atomic_destroy( pj_atomic_t *var ) - PJ_DEF(void) pj_atomic_set( pj_atomic_t *atomic_var, pj_atomic_value_t value) - { - PJ_CHECK_STACK(); -+ PJ_ASSERT_ON_FAIL(atomic_var, return); - - InterlockedExchange(&atomic_var->value, value); - } -@@ -784,6 +785,7 @@ PJ_DEF(pj_atomic_value_t) pj_atomic_inc_and_get(pj_atomic_t *atomic_var) - */ - PJ_DEF(void) pj_atomic_inc(pj_atomic_t *atomic_var) - { -+ PJ_ASSERT_ON_FAIL(atomic_var, return); - pj_atomic_inc_and_get(atomic_var); - } - -@@ -806,6 +808,7 @@ PJ_DEF(pj_atomic_value_t) pj_atomic_dec_and_get(pj_atomic_t *atomic_var) - */ - PJ_DEF(void) pj_atomic_dec(pj_atomic_t *atomic_var) - { -+ PJ_ASSERT_ON_FAIL(atomic_var, return); - pj_atomic_dec_and_get(atomic_var); - } - -@@ -815,6 +818,7 @@ PJ_DEF(void) pj_atomic_dec(pj_atomic_t *atomic_var) - PJ_DEF(void) pj_atomic_add( pj_atomic_t *atomic_var, - pj_atomic_value_t value ) - { -+ PJ_ASSERT_ON_FAIL(atomic_var, return); - #if defined(PJ_WIN32_WINNT) && PJ_WIN32_WINNT >= 0x0400 - InterlockedExchangeAdd( &atomic_var->value, value ); - #else --- -2.14.3 - diff --git a/third-party/pjproject/patches/0090-sip_transaction-In-tsx_timer_callback-check-if-tsx-i.patch b/third-party/pjproject/patches/0090-sip_transaction-In-tsx_timer_callback-check-if-tsx-i.patch deleted file mode 100644 index 12df3469c245442c0db6ed4c8a38a514d2760770..0000000000000000000000000000000000000000 --- a/third-party/pjproject/patches/0090-sip_transaction-In-tsx_timer_callback-check-if-tsx-i.patch +++ /dev/null @@ -1,31 +0,0 @@ -From beaa7874ff8e3b1d2951218c94e7e6bbba9c0531 Mon Sep 17 00:00:00 2001 -From: George Joseph <gjoseph@digium.com> -Date: Sun, 25 Mar 2018 12:30:05 -0600 -Subject: [PATCH] sip_transaction: In tsx_timer_callback, check if tsx is - already gone - -There have been cases that when the transaction timer callback is called -the tsx is already destroyed. This causes a crash. We now check the -tsx state and return if the tsx is already destroyed. ---- - pjsip/src/pjsip/sip_transaction.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/pjsip/src/pjsip/sip_transaction.c b/pjsip/src/pjsip/sip_transaction.c -index d52b12a72..6d4cdc65f 100644 ---- a/pjsip/src/pjsip/sip_transaction.c -+++ b/pjsip/src/pjsip/sip_transaction.c -@@ -1119,6 +1119,10 @@ static void tsx_timer_callback( pj_timer_heap_t *theap, pj_timer_entry *entry) - - PJ_UNUSED_ARG(theap); - -+ if (tsx->state >= PJSIP_TSX_STATE_DESTROYED) { -+ return; -+ } -+ - if (entry->id == TRANSPORT_ERR_TIMER) { - /* Posted transport error event */ - entry->id = 0; --- -2.14.3 - diff --git a/third-party/pjproject/patches/0100-sip_inv-Add-option-to-accept-updated-SDP-on-same-To-.patch b/third-party/pjproject/patches/0100-sip_inv-Add-option-to-accept-updated-SDP-on-same-To-.patch deleted file mode 100644 index cfcc9e8826e2584288af24c46f2a36840eda28b3..0000000000000000000000000000000000000000 --- a/third-party/pjproject/patches/0100-sip_inv-Add-option-to-accept-updated-SDP-on-same-To-.patch +++ /dev/null @@ -1,215 +0,0 @@ -From 13e20772cd3c8735a6b78e30391a33f3eba4c023 Mon Sep 17 00:00:00 2001 -From: George Joseph <gjoseph@digium.com> -Date: Fri, 22 Jun 2018 09:33:34 -0600 -Subject: [PATCH] sip_inv: Add option to accept updated SDP on same To tag - -Currently, setting pjsip_cfg()->endpt.follow_early_media_fork allows -sip_inv to process media updates when the To tag is different. There -are some cases where media updates need to be processed when the tags -are the same. Since removing the requirement for different tags would -change default behavior, a new option "accept_multiple_sdp_answers" -has been added along with a new pjsip_inv_session flag -"updated_sdp_answer" to indicate under which condition we're -updating. - -The logic was also updated to more closely follow RFC6337 in that -if 100rel is efffect, do not accept updated SDPs. - -See -https://tools.ietf.org/html/rfc6337#section-3.1.1 -for more information. ---- - pjsip/include/pjsip-ua/sip_inv.h | 2 ++ - pjsip/include/pjsip/sip_config.h | 25 ++++++++++++++++ - pjsip/src/pjsip-ua/sip_inv.c | 62 +++++++++++++++++++++++++--------------- - pjsip/src/pjsip/sip_config.c | 3 +- - 4 files changed, 68 insertions(+), 24 deletions(-) - -diff --git a/pjsip/include/pjsip-ua/sip_inv.h b/pjsip/include/pjsip-ua/sip_inv.h -index 1bb7b8adc..77ef070c3 100644 ---- a/pjsip/include/pjsip-ua/sip_inv.h -+++ b/pjsip/include/pjsip-ua/sip_inv.h -@@ -442,6 +442,8 @@ struct pjsip_inv_session - pj_bool_t following_fork; /**< Internal, following - forked media? */ - pj_atomic_t *ref_cnt; /**< Reference counter. */ -+ pj_bool_t updated_sdp_answer; /**< SDP answer just been -+ updated? */ - }; - - -diff --git a/pjsip/include/pjsip/sip_config.h b/pjsip/include/pjsip/sip_config.h -index b3a9468e2..b7cf6feed 100644 ---- a/pjsip/include/pjsip/sip_config.h -+++ b/pjsip/include/pjsip/sip_config.h -@@ -157,6 +157,17 @@ typedef struct pjsip_cfg_t - */ - pj_bool_t disable_secure_dlg_check; - -+ /** -+ * Accept multiple SDP answers on non-reliable 18X responses and the 2XX -+ * response when they are all received from the same source (same To tag). -+ * -+ * See also: -+ * https://tools.ietf.org/html/rfc6337#section-3.1.1 -+ * -+ * Default is PJSIP_ACCEPT_MULTIPLE_SDP_ANSWERS. -+ */ -+ pj_bool_t accept_multiple_sdp_answers; -+ - } endpt; - - /** Transaction layer settings. */ -@@ -402,6 +413,20 @@ PJ_INLINE(pjsip_cfg_t*) pjsip_cfg(void) - #endif - - -+/** -+ * Accept multiple SDP answers on non-reliable 18X responses and the 2XX -+ * response when they are all received from the same source (same To tag). -+ * -+ * This option can also be controlled at run-time by the -+ * \a accept_multiple_sdp_answers setting in pjsip_cfg_t. -+ * -+ * Default is PJ_FALSE. -+ */ -+#ifndef PJSIP_ACCEPT_MULTIPLE_SDP_ANSWERS -+# define PJSIP_ACCEPT_MULTIPLE_SDP_ANSWERS PJ_TRUE -+#endif -+ -+ - /** - * Specify whether "alias" param should be added to the Via header - * in any outgoing request with connection oriented transport. -diff --git a/pjsip/src/pjsip-ua/sip_inv.c b/pjsip/src/pjsip-ua/sip_inv.c -index c9686a088..c22726bad 100644 ---- a/pjsip/src/pjsip-ua/sip_inv.c -+++ b/pjsip/src/pjsip-ua/sip_inv.c -@@ -162,6 +162,7 @@ struct tsx_inv_data - pj_bool_t retrying; /* Resend (e.g. due to 401/407) */ - pj_str_t done_tag; /* To tag in RX response with answer */ - pj_bool_t done_early;/* Negotiation was done for early med? */ -+ pj_bool_t done_early_rel;/* Early med was realiable? */ - pj_bool_t has_sdp; /* Message with SDP? */ - }; - -@@ -2000,18 +2001,20 @@ static pj_status_t inv_check_sdp_in_incoming_msg( pjsip_inv_session *inv, - - /* Initialize info that we are following forked media */ - inv->following_fork = PJ_FALSE; -+ inv->updated_sdp_answer = PJ_FALSE; - - /* MUST NOT do multiple SDP offer/answer in a single transaction, -- * EXCEPT if: -- * - this is an initial UAC INVITE transaction (i.e. not re-INVITE), and -- * - the previous negotiation was done on an early media (18x) and -- * this response is a final/2xx response, and -- * - the 2xx response has different To tag than the 18x response -- * (i.e. the request has forked). -+ * EXCEPT previous nego was in 18x (early media) and any of the following -+ * condition is met: -+ * - Non-forking scenario: -+ * - 'accept_multiple_sdp_answers' is set, and -+ * - previous early response was not reliable (rfc6337 section 3.1.1). -+ * - Forking scenario: -+ * - This response has different To tag than the previous response, and -+ * - This response is 18x/2xx (early or final). If this is 18x, -+ * only do multiple SDP nego if 'follow_early_media_fork' is set. - * -- * The exception above is to add a rudimentary support for early media -- * forking (sample case: custom ringback). See this ticket for more -- * info: http://trac.pjsip.org/repos/ticket/657 -+ * See also ticket #657, #1644, #1764 for more info. - */ - if (tsx_inv_data->sdp_done) { - pj_str_t res_tag; -@@ -2020,21 +2023,29 @@ static pj_status_t inv_check_sdp_in_incoming_msg( pjsip_inv_session *inv, - res_tag = rdata->msg_info.to->tag; - st_code = rdata->msg_info.msg->line.status.code; - -- /* Allow final/early response after SDP has been negotiated in early -- * media, IF this response is a final/early response with different -- * tag. -- * See ticket #1644 and #1764 for forked early media case. -- */ -- if (tsx->role == PJSIP_ROLE_UAC && -- (st_code/100 == 2 || -- (st_code/10 == 18 /* st_code == 18x */ -- && pjsip_cfg()->endpt.follow_early_media_fork)) && -- tsx_inv_data->done_early && -- pj_stricmp(&tsx_inv_data->done_tag, &res_tag)) -+ if (tsx->role == PJSIP_ROLE_UAC && tsx_inv_data->done_early && -+ ( -+ /* Non-forking scenario */ -+ ( -+ !tsx_inv_data->done_early_rel && -+ (st_code/100 == 2 || st_code/10 == 18) && -+ pjsip_cfg()->endpt.accept_multiple_sdp_answers && -+ !pj_stricmp(&tsx_inv_data->done_tag, &res_tag) -+ ) -+ || -+ /* Forking scenario */ -+ ( -+ (st_code/100 == 2 || -+ (st_code/10 == 18 && -+ pjsip_cfg()->endpt.follow_early_media_fork)) && -+ pj_stricmp(&tsx_inv_data->done_tag, &res_tag) -+ ) -+ ) -+ ) - { - const pjmedia_sdp_session *reoffer_sdp = NULL; - -- PJ_LOG(4,(inv->obj_name, "Received forked %s response " -+ PJ_LOG(4,(inv->obj_name, "Received %s response " - "after SDP negotiation has been done in early " - "media. Renegotiating SDP..", - (st_code/10==18? "early" : "final" ))); -@@ -2054,7 +2065,9 @@ static pj_status_t inv_check_sdp_in_incoming_msg( pjsip_inv_session *inv, - return status; - } - -- inv->following_fork = PJ_TRUE; -+ inv->following_fork = !!pj_stricmp(&tsx_inv_data->done_tag, -+ &res_tag); -+ inv->updated_sdp_answer = PJ_TRUE; - - } else { - -@@ -2135,6 +2148,7 @@ static pj_status_t inv_check_sdp_in_incoming_msg( pjsip_inv_session *inv, - PJMEDIA_SDP_NEG_STATE_LOCAL_OFFER) - { - int status_code; -+ pjsip_msg *msg = rdata->msg_info.msg; - - /* This is an answer. - * Process and negotiate remote answer. -@@ -2161,8 +2175,10 @@ static pj_status_t inv_check_sdp_in_incoming_msg( pjsip_inv_session *inv, - */ - - tsx_inv_data->sdp_done = 1; -- status_code = rdata->msg_info.msg->line.status.code; -+ status_code = msg->line.status.code; - tsx_inv_data->done_early = (status_code/100==1); -+ tsx_inv_data->done_early_rel = tsx_inv_data->done_early && -+ pjsip_100rel_is_reliable(rdata); - pj_strdup(tsx->pool, &tsx_inv_data->done_tag, - &rdata->msg_info.to->tag); - -diff --git a/pjsip/src/pjsip/sip_config.c b/pjsip/src/pjsip/sip_config.c -index 3576f351e..316824a00 100644 ---- a/pjsip/src/pjsip/sip_config.c -+++ b/pjsip/src/pjsip/sip_config.c -@@ -34,7 +34,8 @@ pjsip_cfg_t pjsip_sip_cfg_var = - PJSIP_FOLLOW_EARLY_MEDIA_FORK, - PJSIP_REQ_HAS_VIA_ALIAS, - PJSIP_RESOLVE_HOSTNAME_TO_GET_INTERFACE, -- 0 -+ 0, -+ PJSIP_ACCEPT_MULTIPLE_SDP_ANSWERS - }, - - /* Transaction settings */ --- -2.14.4 - diff --git a/third-party/pjproject/patches/0110_fix_tdata_rexmit_deadlock.patch b/third-party/pjproject/patches/0110_fix_tdata_rexmit_deadlock.patch deleted file mode 100644 index a9aca5b46b760b5e0a7791144ab2a2b6cd86a2ff..0000000000000000000000000000000000000000 --- a/third-party/pjproject/patches/0110_fix_tdata_rexmit_deadlock.patch +++ /dev/null @@ -1,203 +0,0 @@ -From 3c9ad14b32ddb881559c05ea742aba3153a8cb8f Mon Sep 17 00:00:00 2001 -From: Riza Sulistyo <riza@teluu.com> -Date: Wed, 1 Aug 2018 10:49:51 -0500 -Subject: [PATCH] r5851 svn backport sip_inv.c: Fix race condition in 183 - re-transmission deadlock - -Fixed #2137: Race condition in 183 re-transmission can result in a deadlock. - -The tdata containing the response can be shared by both the dialog -object and the tsx object. In order to prevent the race condition -between the tsx retransmission and the dialog sending a response, -clone the tdata before modifying it for the dialog send response. - -ASTERISK-27966 ---- - pjsip/include/pjsip/sip_transport.h | 16 +++++++++++++ - pjsip/src/pjsip-ua/sip_100rel.c | 43 +-------------------------------- - pjsip/src/pjsip-ua/sip_inv.c | 14 ++++++++++- - pjsip/src/pjsip/sip_transport.c | 47 +++++++++++++++++++++++++++++++++++++ - 4 files changed, 77 insertions(+), 43 deletions(-) - -diff --git a/pjsip/include/pjsip/sip_transport.h b/pjsip/include/pjsip/sip_transport.h -index 10a50ef..36581dc 100644 ---- a/pjsip/include/pjsip/sip_transport.h -+++ b/pjsip/include/pjsip/sip_transport.h -@@ -721,6 +721,22 @@ PJ_DECL(char*) pjsip_tx_data_get_info( pjsip_tx_data *tdata ); - PJ_DECL(pj_status_t) pjsip_tx_data_set_transport(pjsip_tx_data *tdata, - const pjsip_tpselector *sel); - -+/** -+ * Clone pjsip_tx_data. This will duplicate the message contents of -+ * pjsip_tx_data (pjsip_tx_data.msg) and add reference count to the tdata. -+ * Once application has finished using the cloned pjsip_tx_data, -+ * it must release it by calling #pjsip_tx_data_dec_ref(). -+ * Currently, this will only clone response message. -+ * -+ * @param src The source to be cloned. -+ * @param flags Optional flags. Must be zero for now. -+ * @param p_rdata Pointer to receive the cloned tdata. -+ * -+ * @return PJ_SUCCESS on success or the appropriate error. -+ */ -+PJ_DECL(pj_status_t) pjsip_tx_data_clone(const pjsip_tx_data *src, -+ unsigned flags, -+ pjsip_tx_data **p_rdata); - - /***************************************************************************** - * -diff --git a/pjsip/src/pjsip-ua/sip_100rel.c b/pjsip/src/pjsip-ua/sip_100rel.c -index eb9e587..7bf0ad1 100644 ---- a/pjsip/src/pjsip-ua/sip_100rel.c -+++ b/pjsip/src/pjsip-ua/sip_100rel.c -@@ -634,47 +634,6 @@ static void on_retransmit(pj_timer_heap_t *timer_heap, - } - - --/* Clone response. */ --static pjsip_tx_data *clone_tdata(dlg_data *dd, -- const pjsip_tx_data *src) --{ -- pjsip_tx_data *dst; -- const pjsip_hdr *hsrc; -- pjsip_msg *msg; -- pj_status_t status; -- -- status = pjsip_endpt_create_tdata(dd->inv->dlg->endpt, &dst); -- if (status != PJ_SUCCESS) -- return NULL; -- -- msg = pjsip_msg_create(dst->pool, PJSIP_RESPONSE_MSG); -- dst->msg = msg; -- pjsip_tx_data_add_ref(dst); -- -- /* Duplicate status line */ -- msg->line.status.code = src->msg->line.status.code; -- pj_strdup(dst->pool, &msg->line.status.reason, -- &src->msg->line.status.reason); -- -- /* Duplicate all headers */ -- hsrc = src->msg->hdr.next; -- while (hsrc != &src->msg->hdr) { -- pjsip_hdr *h = (pjsip_hdr*) pjsip_hdr_clone(dst->pool, hsrc); -- pjsip_msg_add_hdr(msg, h); -- hsrc = hsrc->next; -- } -- -- /* Duplicate message body */ -- if (src->msg->body) -- msg->body = pjsip_msg_body_clone(dst->pool, src->msg->body); -- -- PJ_LOG(5,(dd->inv->dlg->obj_name, -- "Reliable response %s created", -- pjsip_tx_data_get_info(dst))); -- -- return dst; --} -- - - /* Check if any pending response in transmission list has SDP */ - static pj_bool_t has_sdp(dlg_data *dd) -@@ -725,7 +684,7 @@ PJ_DEF(pj_status_t) pjsip_100rel_tx_response(pjsip_inv_session *inv, - * if it wants to send another response. - */ - old_tdata = tdata; -- tdata = clone_tdata(dd, old_tdata); -+ pjsip_tx_data_clone(old_tdata, 0, &tdata); - pjsip_tx_data_dec_ref(old_tdata); - - -diff --git a/pjsip/src/pjsip-ua/sip_inv.c b/pjsip/src/pjsip-ua/sip_inv.c -index 16a0e17..da28903 100644 ---- a/pjsip/src/pjsip-ua/sip_inv.c -+++ b/pjsip/src/pjsip-ua/sip_inv.c -@@ -2382,6 +2382,7 @@ PJ_DEF(pj_status_t) pjsip_inv_answer( pjsip_inv_session *inv, - pjsip_tx_data **p_tdata ) - { - pjsip_tx_data *last_res; -+ pjsip_tx_data *old_res; - pj_status_t status; - - /* Verify arguments. */ -@@ -2397,8 +2398,19 @@ PJ_DEF(pj_status_t) pjsip_inv_answer( pjsip_inv_session *inv, - - pjsip_dlg_inc_lock(inv->dlg); - -+ /* Clone last response. -+ * The tdata (last_answer) is a shared object used by the transaction. -+ * Modifying a shared object might lead to a deadlock. -+ * Refer to ticket #2137 for more detail. -+ */ -+ status = pjsip_tx_data_clone(inv->last_answer, 0, &last_res); -+ if (status != PJ_SUCCESS) -+ goto on_return; -+ old_res = inv->last_answer; -+ inv->last_answer = last_res; -+ pjsip_tx_data_dec_ref(old_res); -+ - /* Modify last response. */ -- last_res = inv->last_answer; - status = pjsip_dlg_modify_response(inv->dlg, last_res, st_code, st_text); - if (status != PJ_SUCCESS) - goto on_return; -diff --git a/pjsip/src/pjsip/sip_transport.c b/pjsip/src/pjsip/sip_transport.c -index f350fe7..3a8baca 100644 ---- a/pjsip/src/pjsip/sip_transport.c -+++ b/pjsip/src/pjsip/sip_transport.c -@@ -643,6 +643,53 @@ PJ_DEF(pj_status_t) pjsip_tx_data_set_transport(pjsip_tx_data *tdata, - return PJ_SUCCESS; - } - -+/* Clone pjsip_tx_data. */ -+PJ_DEF(pj_status_t) pjsip_tx_data_clone(const pjsip_tx_data *src, -+ unsigned flags, -+ pjsip_tx_data ** p_tdata) -+{ -+ pjsip_tx_data *dst; -+ const pjsip_hdr *hsrc; -+ pjsip_msg *msg; -+ pj_status_t status; -+ -+ PJ_UNUSED_ARG(flags); -+ -+ status = pjsip_tx_data_create(src->mgr, p_tdata); -+ if (status != PJ_SUCCESS) -+ return status; -+ -+ dst = *p_tdata; -+ -+ msg = pjsip_msg_create(dst->pool, PJSIP_RESPONSE_MSG); -+ dst->msg = msg; -+ pjsip_tx_data_add_ref(dst); -+ -+ /* Duplicate status line */ -+ msg->line.status.code = src->msg->line.status.code; -+ pj_strdup(dst->pool, &msg->line.status.reason, -+ &src->msg->line.status.reason); -+ -+ /* Duplicate all headers */ -+ hsrc = src->msg->hdr.next; -+ while (hsrc != &src->msg->hdr) { -+ pjsip_hdr *h = (pjsip_hdr*) pjsip_hdr_clone(dst->pool, hsrc); -+ pjsip_msg_add_hdr(msg, h); -+ hsrc = hsrc->next; -+ } -+ -+ /* Duplicate message body */ -+ if (src->msg->body) -+ msg->body = pjsip_msg_body_clone(dst->pool, src->msg->body); -+ -+ dst->is_pending = src->is_pending; -+ -+ PJ_LOG(5,(THIS_FILE, -+ "Tx data %s cloned", -+ pjsip_tx_data_get_info(dst))); -+ -+ return PJ_SUCCESS; -+} - - PJ_DEF(char*) pjsip_rx_data_get_info(pjsip_rx_data *rdata) - { --- -2.7.4 - diff --git a/third-party/pjproject/pjproject-2.7.2.tar.bz2.md5 b/third-party/pjproject/pjproject-2.7.2.tar.bz2.md5 deleted file mode 100644 index 2ea6b429bca5424f10c2ad523efdb0abc958ab7a..0000000000000000000000000000000000000000 --- a/third-party/pjproject/pjproject-2.7.2.tar.bz2.md5 +++ /dev/null @@ -1,2 +0,0 @@ -8119f0d91a00b6f553099e6ee5358ade *pjproject-2.7.2.zip -fa3f0bc098c4bff48ddd92db1c016a7a pjproject-2.7.2.tar.bz2 diff --git a/third-party/pjproject/pjproject-2.8.tar.bz2.md5 b/third-party/pjproject/pjproject-2.8.tar.bz2.md5 new file mode 100644 index 0000000000000000000000000000000000000000..5e3e7f6becc7a1c8a9bb0ec3099b3868c9bef54a --- /dev/null +++ b/third-party/pjproject/pjproject-2.8.tar.bz2.md5 @@ -0,0 +1,2 @@ +1d3cb8fd2752c724dc8798900f102e75 *pjproject-2.8.zip +6487d54213f270d307eaa60efc9f56f3 pjproject-2.8.tar.bz2 \ No newline at end of file diff --git a/third-party/versions.mak b/third-party/versions.mak index faf7aecfb7085f59dc36c3d7bdac374665450b95..052e6b4e269df0e66bafafed1f0454e82cfd1ecd 100644 --- a/third-party/versions.mak +++ b/third-party/versions.mak @@ -1,2 +1,2 @@ JANSSON_VERSION = 2.11 -PJPROJECT_VERSION = 2.7.2 +PJPROJECT_VERSION = 2.8