<p>Joshua Colp has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/10169">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">pjproject: Upgrade to 2.8.<br><br>This change brings in PJSIP 2.8, removes all the patches<br>that were merged upstream, and makes a minor change to<br>support a breaking change that was done.<br><br>ASTERISK-28059<br><br>Change-Id: I5097772b11b0f95c3c1f52df6400158666f0a189<br>---<br>M configure<br>M configure.ac<br>M include/asterisk/autoconfig.h.in<br>M res/res_pjsip/config_system.c<br>M third-party/pjproject/Makefile.rules<br>M third-party/pjproject/configure.m4<br>M third-party/pjproject/patches/0000-remove-third-party.patch<br>M third-party/pjproject/patches/0000-solaris.patch<br>D third-party/pjproject/patches/0021-sip_parser-Fix-return-code-in-pjsip_find_msg-and-add.patch<br>D third-party/pjproject/patches/0030-sip_transport-Destroy-transports-not-in-hash.patch<br>D third-party/pjproject/patches/0040-183_without_to_tag.patch<br>D third-party/pjproject/patches/0050-dont_terminate_session_early.patch<br>D third-party/pjproject/patches/0060-sip_msg-Prevent-crash-on-header-without-vptr.patch<br>D third-party/pjproject/patches/0070-os_core_unix-Set-mutex-NULL-in-atomic-destroy-and-ad.patch<br>D third-party/pjproject/patches/0090-sip_transaction-In-tsx_timer_callback-check-if-tsx-i.patch<br>D third-party/pjproject/patches/0100-sip_inv-Add-option-to-accept-updated-SDP-on-same-To-.patch<br>D third-party/pjproject/patches/0110_fix_tdata_rexmit_deadlock.patch<br>D third-party/pjproject/pjproject-2.7.2.tar.bz2.md5<br>A third-party/pjproject/pjproject-2.8.tar.bz2.md5<br>M third-party/versions.mak<br>20 files changed, 75 insertions(+), 809 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/69/10169/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/configure b/configure</span><br><span>index 9b0d46e..6c5d973 100755</span><br><span>--- a/configure</span><br><span>+++ b/configure</span><br><span>@@ -930,6 +930,10 @@</span><br><span> POPT_DIR</span><br><span> POPT_INCLUDE</span><br><span> POPT_LIB</span><br><span style="color: hsl(120, 100%, 40%);">+PBX_PJSIP_ENDPOINT_COMPACT_FORM</span><br><span style="color: hsl(120, 100%, 40%);">+PJSIP_ENDPOINT_COMPACT_FORM_DIR</span><br><span style="color: hsl(120, 100%, 40%);">+PJSIP_ENDPOINT_COMPACT_FORM_INCLUDE</span><br><span style="color: hsl(120, 100%, 40%);">+PJSIP_ENDPOINT_COMPACT_FORM_LIB</span><br><span> PBX_PJSIP_INV_ACCEPT_MULTIPLE_SDP_ANSWERS</span><br><span> PJSIP_INV_ACCEPT_MULTIPLE_SDP_ANSWERS_DIR</span><br><span> PJSIP_INV_ACCEPT_MULTIPLE_SDP_ANSWERS_INCLUDE</span><br><span>@@ -9440,6 +9444,9 @@</span><br><span> $as_echo "#define HAVE_PJSIP_INV_ACCEPT_MULTIPLE_SDP_ANSWERS 1" >>confdefs.h</span><br><span> </span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+$as_echo "#define HAVE_PJSIP_ENDPOINT_COMPACT_FORM 1" >>confdefs.h</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> </span><br><span> </span><br><span> </span><br><span>@@ -11582,6 +11589,18 @@</span><br><span> </span><br><span> </span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+PJSIP_ENDPOINT_COMPACT_FORM_DESCRIP="PJSIP Compact Form Support on Endpoint"</span><br><span style="color: hsl(120, 100%, 40%);">+PJSIP_ENDPOINT_COMPACT_FORM_OPTION=pjsip</span><br><span style="color: hsl(120, 100%, 40%);">+PJSIP_ENDPOINT_COMPACT_FORM_DIR=${PJPROJECT_DIR}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+PBX_PJSIP_ENDPOINT_COMPACT_FORM=0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> fi</span><br><span> </span><br><span> </span><br><span>@@ -25459,6 +25478,46 @@</span><br><span> CPPFLAGS="${saved_cppflags}"</span><br><span> fi</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if test "x${PBX_PJSIP_ENDPOINT_COMPACT_FORM}" != "x1" -a "${USE_PJSIP_ENDPOINT_COMPACT_FORM}" != "no"; then</span><br><span style="color: hsl(120, 100%, 40%);">+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if \"pjsip_cfg()->endpt.use_compact_form = PJ_TRUE;\" compiles using pjsip.h" >&5</span><br><span style="color: hsl(120, 100%, 40%);">+$as_echo_n "checking if \"pjsip_cfg()->endpt.use_compact_form = PJ_TRUE;\" compiles using pjsip.h... " >&6; }</span><br><span style="color: hsl(120, 100%, 40%);">+ saved_cppflags="${CPPFLAGS}"</span><br><span style="color: hsl(120, 100%, 40%);">+ if test "x${PJSIP_ENDPOINT_COMPACT_FORM_DIR}" != "x"; then</span><br><span style="color: hsl(120, 100%, 40%);">+ PJSIP_ENDPOINT_COMPACT_FORM_INCLUDE="-I${PJSIP_ENDPOINT_COMPACT_FORM_DIR}/include"</span><br><span style="color: hsl(120, 100%, 40%);">+ fi</span><br><span style="color: hsl(120, 100%, 40%);">+ CPPFLAGS="${CPPFLAGS} ${PJSIP_ENDPOINT_COMPACT_FORM_INCLUDE}"</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext</span><br><span style="color: hsl(120, 100%, 40%);">+/* end confdefs.h. */</span><br><span style="color: hsl(120, 100%, 40%);">+ #include <pjsip.h></span><br><span style="color: hsl(120, 100%, 40%);">+int</span><br><span style="color: hsl(120, 100%, 40%);">+main ()</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ pjsip_cfg()->endpt.use_compact_form = PJ_TRUE;;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ ;</span><br><span style="color: hsl(120, 100%, 40%);">+ return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+_ACEOF</span><br><span style="color: hsl(120, 100%, 40%);">+if ac_fn_c_try_compile "$LINENO"; then :</span><br><span style="color: hsl(120, 100%, 40%);">+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5</span><br><span style="color: hsl(120, 100%, 40%);">+$as_echo "yes" >&6; }</span><br><span style="color: hsl(120, 100%, 40%);">+ PBX_PJSIP_ENDPOINT_COMPACT_FORM=1</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+$as_echo "#define HAVE_PJSIP_ENDPOINT_COMPACT_FORM 1" >>confdefs.h</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+else</span><br><span style="color: hsl(120, 100%, 40%);">+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5</span><br><span style="color: hsl(120, 100%, 40%);">+$as_echo "no" >&6; }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+fi</span><br><span style="color: hsl(120, 100%, 40%);">+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext</span><br><span style="color: hsl(120, 100%, 40%);">+ CPPFLAGS="${saved_cppflags}"</span><br><span style="color: hsl(120, 100%, 40%);">+ fi</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> LIBS="${saved_libs}"</span><br><span> CPPFLAGS="${saved_cppflags}"</span><br><span> </span><br><span>diff --git a/configure.ac b/configure.ac</span><br><span>index 2fd8eac..7efbec1 100644</span><br><span>--- a/configure.ac</span><br><span>+++ b/configure.ac</span><br><span>@@ -536,6 +536,7 @@</span><br><span> AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_AUTH_CLT_DEINIT], [pjsip_auth_clt_deinit support], [PJPROJECT], [pjsip])</span><br><span> AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_TSX_LAYER_FIND_TSX2], [pjsip_tsx_layer_find_tsx2 support], [PJPROJECT], [pjsip])</span><br><span> AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_INV_ACCEPT_MULTIPLE_SDP_ANSWERS], [PJSIP INVITE Accept Multiple SDP Answers], [PJPROJECT], [pjsip])</span><br><span style="color: hsl(120, 100%, 40%);">+AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_ENDPOINT_COMPACT_FORM], [PJSIP Compact Form Support on Endpoint], [PJPROJECT], [pjsip])</span><br><span> fi</span><br><span> </span><br><span> AST_EXT_LIB_SETUP([POPT], [popt], [popt])</span><br><span>@@ -2371,6 +2372,7 @@</span><br><span> LIBS="${LIBS} ${PJPROJECT_LIB}"</span><br><span> AST_C_COMPILE_CHECK([PJSIP_TLS_TRANSPORT_PROTO], [struct pjsip_tls_setting setting; int proto; proto = setting.proto;], [pjsip.h])</span><br><span> AST_C_COMPILE_CHECK([PJSIP_INV_ACCEPT_MULTIPLE_SDP_ANSWERS], [pjsip_cfg()->endpt.accept_multiple_sdp_answers = 0;], [pjsip.h])</span><br><span style="color: hsl(120, 100%, 40%);">+ AST_C_COMPILE_CHECK([PJSIP_ENDPOINT_COMPACT_FORM], [pjsip_cfg()->endpt.use_compact_form = PJ_TRUE;], [pjsip.h])</span><br><span> LIBS="${saved_libs}"</span><br><span> CPPFLAGS="${saved_cppflags}"</span><br><span> </span><br><span>diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in</span><br><span>index 5d22ae1..69ab585 100644</span><br><span>--- a/include/asterisk/autoconfig.h.in</span><br><span>+++ b/include/asterisk/autoconfig.h.in</span><br><span>@@ -613,6 +613,9 @@</span><br><span> Lock feature. */</span><br><span> #undef HAVE_PJSIP_DLG_CREATE_UAS_AND_INC_LOCK</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/* Define if your system has the PJSIP_ENDPOINT_COMPACT_FORM headers. */</span><br><span style="color: hsl(120, 100%, 40%);">+#undef HAVE_PJSIP_ENDPOINT_COMPACT_FORM</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /* Define to 1 if PJPROJECT has the PJSIP EVSUB Group Lock support feature. */</span><br><span> #undef HAVE_PJSIP_EVSUB_GRP_LOCK</span><br><span> </span><br><span>diff --git a/res/res_pjsip/config_system.c b/res/res_pjsip/config_system.c</span><br><span>index 2ff0a65..52f66a5 100644</span><br><span>--- a/res/res_pjsip/config_system.c</span><br><span>+++ b/res/res_pjsip/config_system.c</span><br><span>@@ -114,9 +114,13 @@</span><br><span> #endif</span><br><span> </span><br><span> if (system->compactheaders) {</span><br><span style="color: hsl(120, 100%, 40%);">+#ifdef HAVE_PJSIP_ENDPOINT_COMPACT_FORM</span><br><span style="color: hsl(120, 100%, 40%);">+ pjsip_cfg()->endpt.use_compact_form = PJ_TRUE;</span><br><span style="color: hsl(120, 100%, 40%);">+#else</span><br><span> extern pj_bool_t pjsip_use_compact_form;</span><br><span> </span><br><span> pjsip_use_compact_form = PJ_TRUE;</span><br><span style="color: hsl(120, 100%, 40%);">+#endif</span><br><span> }</span><br><span> </span><br><span> sip_threadpool_options.initial_size = system->threadpool.initial_size;</span><br><span>diff --git a/third-party/pjproject/Makefile.rules b/third-party/pjproject/Makefile.rules</span><br><span>index e38024a..6a48e86 100644</span><br><span>--- a/third-party/pjproject/Makefile.rules</span><br><span>+++ b/third-party/pjproject/Makefile.rules</span><br><span>@@ -30,7 +30,6 @@</span><br><span> --disable-v4l2 \</span><br><span> --disable-sound \</span><br><span> --disable-ext-sound \</span><br><span style="color: hsl(0, 100%, 40%);">- --disable-oss \</span><br><span> --disable-sdl \</span><br><span> --disable-libyuv \</span><br><span> --disable-ffmpeg \</span><br><span>diff --git a/third-party/pjproject/configure.m4 b/third-party/pjproject/configure.m4</span><br><span>index ecdd138..94be9b8 100644</span><br><span>--- a/third-party/pjproject/configure.m4</span><br><span>+++ b/third-party/pjproject/configure.m4</span><br><span>@@ -105,6 +105,7 @@</span><br><span> AC_DEFINE([HAVE_PJSIP_AUTH_CLT_DEINIT], 1, [Define if your system has pjsip_auth_clt_deinit declared.])</span><br><span> AC_DEFINE([HAVE_PJSIP_TSX_LAYER_FIND_TSX2], 1, [Define if your system has pjsip_tsx_layer_find_tsx2 declared.])</span><br><span> AC_DEFINE([HAVE_PJSIP_INV_ACCEPT_MULTIPLE_SDP_ANSWERS], 1, [Define if your system has HAVE_PJSIP_INV_ACCEPT_MULTIPLE_SDP_ANSWERS declared.])</span><br><span style="color: hsl(120, 100%, 40%);">+ AC_DEFINE([HAVE_PJSIP_ENDPOINT_COMPACT_FORM], 1, [Define if your system has HAVE_PJSIP_ENDPOINT_COMPACT_FORM declared.])</span><br><span> </span><br><span> AC_SUBST([PJPROJECT_BUNDLED])</span><br><span> AC_SUBST([PJPROJECT_DIR])</span><br><span>diff --git a/third-party/pjproject/patches/0000-remove-third-party.patch b/third-party/pjproject/patches/0000-remove-third-party.patch</span><br><span>index 7cde2f4..54d8774 100644</span><br><span>--- a/third-party/pjproject/patches/0000-remove-third-party.patch</span><br><span>+++ b/third-party/pjproject/patches/0000-remove-third-party.patch</span><br><span>@@ -8,7 +8,7 @@</span><br><span> 1 file changed, 107 deletions(-)</span><br><span> </span><br><span> diff --git a/build.mak.in b/build.mak.in</span><br><span style="color: hsl(0, 100%, 40%);">-index 6c263a9..36e7ff4 100644</span><br><span style="color: hsl(120, 100%, 40%);">+index 80ccad12..41ec64ea 100644</span><br><span> --- a/build.mak.in</span><br><span> +++ b/build.mak.in</span><br><span> @@ -1,4 +1,3 @@</span><br><span>@@ -16,7 +16,7 @@</span><br><span> include $(PJDIR)/version.mak</span><br><span> export PJ_DIR := $(PJDIR)</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-@@ -28,19 +27,6 @@ export APP_THIRD_PARTY_EXT :=</span><br><span style="color: hsl(120, 100%, 40%);">+@@ -37,19 +36,6 @@ export APP_THIRD_PARTY_EXT :=</span><br><span> export APP_THIRD_PARTY_LIBS :=</span><br><span> export APP_THIRD_PARTY_LIB_FILES :=</span><br><span> </span><br><span>@@ -36,7 +36,7 @@</span><br><span> ifeq (@ac_pjmedia_resample@,libresample)</span><br><span> APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libresample-$(LIB_SUFFIX)</span><br><span> ifeq ($(PJ_SHARED_LIBRARIES),)</span><br><span style="color: hsl(0, 100%, 40%);">-@@ -57,99 +43,6 @@ APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libresample.$(SHLIB_SUFFI</span><br><span style="color: hsl(120, 100%, 40%);">+@@ -66,89 +52,6 @@ APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libresample.$(SHLIB_SUFFI</span><br><span> endif</span><br><span> endif</span><br><span> </span><br><span>@@ -89,19 +89,9 @@</span><br><span> -endif</span><br><span> -endif</span><br><span> -</span><br><span style="color: hsl(0, 100%, 40%);">--ifneq ($(findstring pa,@ac_pjmedia_snd@),)</span><br><span> -ifeq (@ac_external_pa@,1)</span><br><span> -# External PA</span><br><span> -APP_THIRD_PARTY_EXT += -lportaudio</span><br><span style="color: hsl(0, 100%, 40%);">--else</span><br><span style="color: hsl(0, 100%, 40%);">--APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libportaudio-$(LIB_SUFFIX)</span><br><span style="color: hsl(0, 100%, 40%);">--ifeq ($(PJ_SHARED_LIBRARIES),)</span><br><span style="color: hsl(0, 100%, 40%);">--APP_THIRD_PARTY_LIBS += -lportaudio-$(TARGET_NAME)</span><br><span style="color: hsl(0, 100%, 40%);">--else</span><br><span style="color: hsl(0, 100%, 40%);">--APP_THIRD_PARTY_LIBS += -lportaudio</span><br><span style="color: hsl(0, 100%, 40%);">--APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libportaudio.$(SHLIB_SUFFIX).$(PJ_VERSION_MAJOR) $(PJ_DIR)/third_party/lib/libportaudio.$(SHLIB_SUFFIX)</span><br><span style="color: hsl(0, 100%, 40%);">--endif</span><br><span style="color: hsl(0, 100%, 40%);">--endif</span><br><span> -endif</span><br><span> -</span><br><span> -ifneq (@ac_no_yuv@,1)</span><br><span>@@ -136,6 +126,3 @@</span><br><span> # Additional flags</span><br><span> @ac_build_mak_vars@</span><br><span> </span><br><span>--- </span><br><span style="color: hsl(0, 100%, 40%);">-2.7.4</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span>diff --git a/third-party/pjproject/patches/0000-solaris.patch b/third-party/pjproject/patches/0000-solaris.patch</span><br><span>index 0790627..0e25c55 100644</span><br><span>--- a/third-party/pjproject/patches/0000-solaris.patch</span><br><span>+++ b/third-party/pjproject/patches/0000-solaris.patch</span><br><span>@@ -40,7 +40,6 @@</span><br><span> ---</span><br><span> pjlib/include/pj/sock.h | 8 +++++++-</span><br><span> pjlib/src/pj/sock_bsd.c | 2 +-</span><br><span style="color: hsl(0, 100%, 40%);">- pjlib/src/pj/sock_linux_kernel.c | 2 +-</span><br><span> pjlib/src/pj/sock_symbian.cpp | 2 +-</span><br><span> pjlib/src/pj/sock_uwp.cpp | 2 +-</span><br><span> pjsip/src/test/transport_test.c | 2 +-</span><br><span>@@ -92,19 +91,6 @@</span><br><span> {</span><br><span> char tempaddr[PJ_INET_ADDRSTRLEN];</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-diff --git a/pjlib/src/pj/sock_linux_kernel.c b/pjlib/src/pj/sock_linux_kernel.c</span><br><span style="color: hsl(0, 100%, 40%);">-index 899b486..10d84cd 100644</span><br><span>---- a/pjlib/src/pj/sock_linux_kernel.c</span><br><span style="color: hsl(0, 100%, 40%);">-+++ b/pjlib/src/pj/sock_linux_kernel.c</span><br><span style="color: hsl(0, 100%, 40%);">-@@ -149,7 +149,7 @@ PJ_DEF(char*) pj_inet_ntoa(pj_in_addr in)</span><br><span style="color: hsl(0, 100%, 40%);">- * numbers-and-dots notation into binary data and stores it in the structure</span><br><span style="color: hsl(0, 100%, 40%);">- * that inp points to. </span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">--PJ_DEF(int) pj_inet_aton(const pj_str_t *ccp, struct pj_in_addr *addr)</span><br><span style="color: hsl(0, 100%, 40%);">-+PJ_DEF(int) pj_inet_aton(const pj_str_t *ccp, pj_in_addr *addr)</span><br><span style="color: hsl(0, 100%, 40%);">- {</span><br><span style="color: hsl(0, 100%, 40%);">- pj_uint32_t val;</span><br><span style="color: hsl(0, 100%, 40%);">- int base, n;</span><br><span> diff --git a/pjlib/src/pj/sock_symbian.cpp b/pjlib/src/pj/sock_symbian.cpp</span><br><span> index 09239b0..e72bbda 100644</span><br><span> --- a/pjlib/src/pj/sock_symbian.cpp</span><br><span>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</span><br><span>deleted file mode 100644</span><br><span>index 86d5aa7..0000000</span><br><span>--- a/third-party/pjproject/patches/0021-sip_parser-Fix-return-code-in-pjsip_find_msg-and-add.patch</span><br><span>+++ /dev/null</span><br><span>@@ -1,41 +0,0 @@</span><br><span style="color: hsl(0, 100%, 40%);">-From 186f82627c40d0c3a56a6a94ce55c055ad1f7620 Mon Sep 17 00:00:00 2001</span><br><span style="color: hsl(0, 100%, 40%);">-From: George Joseph <gjoseph@digium.com></span><br><span style="color: hsl(0, 100%, 40%);">-Date: Fri, 10 Nov 2017 09:26:29 -0700</span><br><span style="color: hsl(0, 100%, 40%);">-Subject: [PATCH] sip_parser: Fix return code in pjsip_find_msg and add</span><br><span style="color: hsl(0, 100%, 40%);">- "volatile"</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-The default return code for pjsip_find_msg was PJ_SUCCESS so if</span><br><span style="color: hsl(0, 100%, 40%);">-a Content-Length header wasn't found at all, pjsip_find_msg was</span><br><span style="color: hsl(0, 100%, 40%);">-returning PJ_SUCCESS instead of PJSIP_EMISSINGHDR.</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-Also added the volatile keyword to a few variables what are used</span><br><span style="color: hsl(0, 100%, 40%);">-both insude and outsude the PJ_TRY/PJ_CATCH block.</span><br><span>----</span><br><span style="color: hsl(0, 100%, 40%);">- pjsip/src/pjsip/sip_parser.c | 8 ++++----</span><br><span style="color: hsl(0, 100%, 40%);">- 1 file changed, 4 insertions(+), 4 deletions(-)</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-diff --git a/pjsip/src/pjsip/sip_parser.c b/pjsip/src/pjsip/sip_parser.c</span><br><span style="color: hsl(0, 100%, 40%);">-index f9a0e65b5..f65ffca5a 100644</span><br><span>---- a/pjsip/src/pjsip/sip_parser.c</span><br><span style="color: hsl(0, 100%, 40%);">-+++ b/pjsip/src/pjsip/sip_parser.c</span><br><span style="color: hsl(0, 100%, 40%);">-@@ -834,13 +834,13 @@ PJ_DEF(pj_status_t) pjsip_find_msg( const char *buf, pj_size_t size,</span><br><span style="color: hsl(0, 100%, 40%);">- pj_bool_t is_datagram, pj_size_t *msg_size)</span><br><span style="color: hsl(0, 100%, 40%);">- {</span><br><span style="color: hsl(0, 100%, 40%);">- #if PJ_HAS_TCP</span><br><span style="color: hsl(0, 100%, 40%);">-- const char *hdr_end;</span><br><span style="color: hsl(0, 100%, 40%);">-- const char *body_start;</span><br><span style="color: hsl(0, 100%, 40%);">-+ const char *volatile hdr_end;</span><br><span style="color: hsl(0, 100%, 40%);">-+ const char *volatile body_start;</span><br><span style="color: hsl(0, 100%, 40%);">- const char *pos;</span><br><span style="color: hsl(0, 100%, 40%);">-- const char *line;</span><br><span style="color: hsl(0, 100%, 40%);">-+ const char *volatile line;</span><br><span style="color: hsl(0, 100%, 40%);">- int content_length = -1;</span><br><span style="color: hsl(0, 100%, 40%);">- pj_str_t cur_msg;</span><br><span style="color: hsl(0, 100%, 40%);">-- pj_status_t status = PJ_SUCCESS;</span><br><span style="color: hsl(0, 100%, 40%);">-+ volatile pj_status_t status = PJSIP_EMISSINGHDR;</span><br><span style="color: hsl(0, 100%, 40%);">- const pj_str_t end_hdr = { "\n\r\n", 3};</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">- *msg_size = size;</span><br><span>--- </span><br><span style="color: hsl(0, 100%, 40%);">-2.13.6</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span>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</span><br><span>deleted file mode 100644</span><br><span>index e42b0f7..0000000</span><br><span>--- a/third-party/pjproject/patches/0030-sip_transport-Destroy-transports-not-in-hash.patch</span><br><span>+++ /dev/null</span><br><span>@@ -1,27 +0,0 @@</span><br><span style="color: hsl(0, 100%, 40%);">-diff --git a/pjsip/src/pjsip/sip_transport.c b/pjsip/src/pjsip/sip_transport.c</span><br><span style="color: hsl(0, 100%, 40%);">-index e4bec24..a39b56e 100644</span><br><span>---- a/pjsip/src/pjsip/sip_transport.c</span><br><span style="color: hsl(0, 100%, 40%);">-+++ b/pjsip/src/pjsip/sip_transport.c</span><br><span style="color: hsl(0, 100%, 40%);">-@@ -957,7 +957,21 @@ static pj_bool_t is_transport_valid(pjsip_tpmgr *tpmgr, pjsip_transport *tp,</span><br><span style="color: hsl(0, 100%, 40%);">- const pjsip_transport_key *key,</span><br><span style="color: hsl(0, 100%, 40%);">- int key_len)</span><br><span style="color: hsl(0, 100%, 40%);">- {</span><br><span style="color: hsl(0, 100%, 40%);">-- return (pj_hash_get(tpmgr->table, key, key_len, NULL) == (void*)tp);</span><br><span style="color: hsl(0, 100%, 40%);">-+ transport *tp_iter;</span><br><span style="color: hsl(0, 100%, 40%);">-+</span><br><span style="color: hsl(0, 100%, 40%);">-+ if (pj_hash_get(tpmgr->table, key, key_len, NULL) == (void*)tp) {</span><br><span style="color: hsl(0, 100%, 40%);">-+ return PJ_TRUE;</span><br><span style="color: hsl(0, 100%, 40%);">-+ }</span><br><span style="color: hsl(0, 100%, 40%);">-+</span><br><span style="color: hsl(0, 100%, 40%);">-+ tp_iter = tpmgr->tp_list.next;</span><br><span style="color: hsl(0, 100%, 40%);">-+ while (tp_iter != &tpmgr->tp_list) {</span><br><span style="color: hsl(0, 100%, 40%);">-+ if (tp_iter->tp == tp) {</span><br><span style="color: hsl(0, 100%, 40%);">-+ return PJ_TRUE;</span><br><span style="color: hsl(0, 100%, 40%);">-+ }</span><br><span style="color: hsl(0, 100%, 40%);">-+ tp_iter = tp_iter->next;</span><br><span style="color: hsl(0, 100%, 40%);">-+ }</span><br><span style="color: hsl(0, 100%, 40%);">-+</span><br><span style="color: hsl(0, 100%, 40%);">-+ return PJ_FALSE;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">- /*</span><br><span>diff --git a/third-party/pjproject/patches/0040-183_without_to_tag.patch b/third-party/pjproject/patches/0040-183_without_to_tag.patch</span><br><span>deleted file mode 100644</span><br><span>index e8692fe..0000000</span><br><span>--- a/third-party/pjproject/patches/0040-183_without_to_tag.patch</span><br><span>+++ /dev/null</span><br><span>@@ -1,17 +0,0 @@</span><br><span style="color: hsl(0, 100%, 40%);">-diff --git a/pjsip/src/pjsip-ua/sip_inv.c b/pjsip/src/pjsip-ua/sip_inv.c</span><br><span style="color: hsl(0, 100%, 40%);">-index c9686a0..fc52a63 100644</span><br><span>---- a/pjsip/src/pjsip-ua/sip_inv.c</span><br><span style="color: hsl(0, 100%, 40%);">-+++ b/pjsip/src/pjsip-ua/sip_inv.c</span><br><span style="color: hsl(0, 100%, 40%);">-@@ -4156,9 +4156,10 @@ static void inv_on_state_calling( pjsip_inv_session *inv, pjsip_event *e)</span><br><span style="color: hsl(0, 100%, 40%);">- status = pjsip_inv_send_msg(inv, cancel);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">-- if (dlg->remote.info->tag.slen) {</span><br><span style="color: hsl(0, 100%, 40%);">-+ if (tsx->status_code != 100) {</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">-- inv_set_state(inv, PJSIP_INV_STATE_EARLY, e);</span><br><span style="color: hsl(0, 100%, 40%);">-+ if (dlg->remote.info->tag.slen)</span><br><span style="color: hsl(0, 100%, 40%);">-+ inv_set_state(inv, PJSIP_INV_STATE_EARLY, e);</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">- inv_check_sdp_in_incoming_msg(inv, tsx, </span><br><span style="color: hsl(0, 100%, 40%);">- e->body.tsx_state.src.rdata);</span><br><span>diff --git a/third-party/pjproject/patches/0050-dont_terminate_session_early.patch b/third-party/pjproject/patches/0050-dont_terminate_session_early.patch</span><br><span>deleted file mode 100644</span><br><span>index 718968c..0000000</span><br><span>--- a/third-party/pjproject/patches/0050-dont_terminate_session_early.patch</span><br><span>+++ /dev/null</span><br><span>@@ -1,71 +0,0 @@</span><br><span style="color: hsl(0, 100%, 40%);">-commit ca0b723e92bd76bbda1bbd14477a829eaeeb675e</span><br><span style="color: hsl(0, 100%, 40%);">-Author: Joshua Colp <jcolp@digium.com></span><br><span style="color: hsl(0, 100%, 40%);">-Date: Wed Dec 13 10:58:57 2017 +0000</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- Ignore transport error on completed transaction.</span><br><span style="color: hsl(0, 100%, 40%);">- Don't disconnect call if transport error happens on transaction that is not initial INVITE transaction.</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">- Scenario:</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">- DNS lookup returning two servers.</span><br><span style="color: hsl(0, 100%, 40%);">- Sending INVITE to first server over TCP.</span><br><span style="color: hsl(0, 100%, 40%);">- Response received with code 503 (Service Unavailable).</span><br><span style="color: hsl(0, 100%, 40%);">- Failover to second server, sending second INVITE after restarting the session.</span><br><span style="color: hsl(0, 100%, 40%);">- TCP connection for the first INVITE getting disconnected and causing call disconnection (while second INVITE is still outstanding).</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">- This is a backport of 5714 from upstream PJSIP.</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-diff --git a/pjsip/src/pjsip-ua/sip_inv.c b/pjsip/src/pjsip-ua/sip_inv.c</span><br><span style="color: hsl(0, 100%, 40%);">-index ac4d1949..0173cb4c 100644</span><br><span>---- a/pjsip/src/pjsip-ua/sip_inv.c</span><br><span style="color: hsl(0, 100%, 40%);">-+++ b/pjsip/src/pjsip-ua/sip_inv.c</span><br><span style="color: hsl(0, 100%, 40%);">-@@ -4254,8 +4254,7 @@ static void inv_on_state_calling( pjsip_inv_session *inv, pjsip_event *e)</span><br><span style="color: hsl(0, 100%, 40%);">- if ((tsx->status_code == PJSIP_SC_CALL_TSX_DOES_NOT_EXIST &&</span><br><span style="color: hsl(0, 100%, 40%);">- tsx->method.id != PJSIP_CANCEL_METHOD) ||</span><br><span style="color: hsl(0, 100%, 40%);">- tsx->status_code == PJSIP_SC_REQUEST_TIMEOUT ||</span><br><span style="color: hsl(0, 100%, 40%);">-- tsx->status_code == PJSIP_SC_TSX_TIMEOUT ||</span><br><span style="color: hsl(0, 100%, 40%);">-- tsx->status_code == PJSIP_SC_TSX_TRANSPORT_ERROR)</span><br><span style="color: hsl(0, 100%, 40%);">-+ tsx->status_code == PJSIP_SC_TSX_TIMEOUT)</span><br><span style="color: hsl(0, 100%, 40%);">- {</span><br><span style="color: hsl(0, 100%, 40%);">- inv_set_cause(inv, tsx->status_code, &tsx->status_text);</span><br><span style="color: hsl(0, 100%, 40%);">- inv_set_state(inv, PJSIP_INV_STATE_DISCONNECTED, e);</span><br><span style="color: hsl(0, 100%, 40%);">-diff --git a/pjsip/src/pjsip/sip_transaction.c b/pjsip/src/pjsip/sip_transaction.c</span><br><span style="color: hsl(0, 100%, 40%);">-index 7ac3d1b7..d52b12a7 100644</span><br><span>---- a/pjsip/src/pjsip/sip_transaction.c</span><br><span style="color: hsl(0, 100%, 40%);">-+++ b/pjsip/src/pjsip/sip_transaction.c</span><br><span style="color: hsl(0, 100%, 40%);">-@@ -2044,9 +2044,14 @@ static void transport_callback(void *token, pjsip_tx_data *tdata,</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">- lock_timer(tsx);</span><br><span style="color: hsl(0, 100%, 40%);">- tsx->transport_err = (pj_status_t)-sent;</span><br><span style="color: hsl(0, 100%, 40%);">-- tsx_cancel_timer(tsx, &tsx->timeout_timer);</span><br><span style="color: hsl(0, 100%, 40%);">-- tsx_schedule_timer(tsx, &tsx->timeout_timer, &delay,</span><br><span style="color: hsl(0, 100%, 40%);">-- TRANSPORT_ERR_TIMER);</span><br><span style="color: hsl(0, 100%, 40%);">-+ /* Don't cancel timeout timer if tsx state is already</span><br><span style="color: hsl(0, 100%, 40%);">-+ * PJSIP_TSX_STATE_COMPLETED (see #2076).</span><br><span style="color: hsl(0, 100%, 40%);">-+ */</span><br><span style="color: hsl(0, 100%, 40%);">-+ if (tsx->state < PJSIP_TSX_STATE_COMPLETED) {</span><br><span style="color: hsl(0, 100%, 40%);">-+ tsx_cancel_timer(tsx, &tsx->timeout_timer);</span><br><span style="color: hsl(0, 100%, 40%);">-+ tsx_schedule_timer(tsx, &tsx->timeout_timer, &delay,</span><br><span style="color: hsl(0, 100%, 40%);">-+ TRANSPORT_ERR_TIMER);</span><br><span style="color: hsl(0, 100%, 40%);">-+ }</span><br><span style="color: hsl(0, 100%, 40%);">- unlock_timer(tsx);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">-@@ -2077,9 +2082,14 @@ static void tsx_tp_state_callback( pjsip_transport *tp,</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">- lock_timer(tsx);</span><br><span style="color: hsl(0, 100%, 40%);">- tsx->transport_err = info->status;</span><br><span style="color: hsl(0, 100%, 40%);">-- tsx_cancel_timer(tsx, &tsx->timeout_timer);</span><br><span style="color: hsl(0, 100%, 40%);">-- tsx_schedule_timer(tsx, &tsx->timeout_timer, &delay,</span><br><span style="color: hsl(0, 100%, 40%);">-- TRANSPORT_ERR_TIMER);</span><br><span style="color: hsl(0, 100%, 40%);">-+ /* Don't cancel timeout timer if tsx state is already</span><br><span style="color: hsl(0, 100%, 40%);">-+ * PJSIP_TSX_STATE_COMPLETED (see #2076).</span><br><span style="color: hsl(0, 100%, 40%);">-+ */</span><br><span style="color: hsl(0, 100%, 40%);">-+ if (tsx->state < PJSIP_TSX_STATE_COMPLETED) {</span><br><span style="color: hsl(0, 100%, 40%);">-+ tsx_cancel_timer(tsx, &tsx->timeout_timer);</span><br><span style="color: hsl(0, 100%, 40%);">-+ tsx_schedule_timer(tsx, &tsx->timeout_timer, &delay,</span><br><span style="color: hsl(0, 100%, 40%);">-+ TRANSPORT_ERR_TIMER);</span><br><span style="color: hsl(0, 100%, 40%);">-+ }</span><br><span style="color: hsl(0, 100%, 40%);">- unlock_timer(tsx);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span>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</span><br><span>deleted file mode 100644</span><br><span>index 7508ab8..0000000</span><br><span>--- a/third-party/pjproject/patches/0060-sip_msg-Prevent-crash-on-header-without-vptr.patch</span><br><span>+++ /dev/null</span><br><span>@@ -1,56 +0,0 @@</span><br><span style="color: hsl(0, 100%, 40%);">-From 88409082a4cbf27b308c76c148270ee72fdcb503 Mon Sep 17 00:00:00 2001</span><br><span style="color: hsl(0, 100%, 40%);">-From: Riza Sulistyo <riza@teluu.com></span><br><span style="color: hsl(0, 100%, 40%);">-Date: Wed, 17 Jan 2018 11:30:52 +0000</span><br><span style="color: hsl(0, 100%, 40%);">-Subject: [PATCH] r5727 svn backport sip_msg: Prevent crash on header without</span><br><span style="color: hsl(0, 100%, 40%);">- vptr</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-Re #2059 (misc): Prevent corrupt header from causing a crash when printed.</span><br><span style="color: hsl(0, 100%, 40%);">-Thanks to George Joseph for the patch.</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-Occasionally a header with no vptr gets into the list of header. This</span><br><span style="color: hsl(0, 100%, 40%);">-causes a crash when printing them. We still need to figure out how</span><br><span style="color: hsl(0, 100%, 40%);">-the header got there but this patch at least prevents the crash by checking</span><br><span style="color: hsl(0, 100%, 40%);">-for a non-NULL vptr before attempting to call its print function.</span><br><span>----</span><br><span style="color: hsl(0, 100%, 40%);">- pjsip/src/pjsip/sip_msg.c | 11 +++++++++--</span><br><span style="color: hsl(0, 100%, 40%);">- 1 file changed, 9 insertions(+), 2 deletions(-)</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-diff --git a/pjsip/src/pjsip/sip_msg.c b/pjsip/src/pjsip/sip_msg.c</span><br><span style="color: hsl(0, 100%, 40%);">-index a13f80e..8819dd9 100644</span><br><span>---- a/pjsip/src/pjsip/sip_msg.c</span><br><span style="color: hsl(0, 100%, 40%);">-+++ b/pjsip/src/pjsip/sip_msg.c</span><br><span style="color: hsl(0, 100%, 40%);">-@@ -26,6 +26,7 @@</span><br><span style="color: hsl(0, 100%, 40%);">- #include <pj/string.h></span><br><span style="color: hsl(0, 100%, 40%);">- #include <pj/pool.h></span><br><span style="color: hsl(0, 100%, 40%);">- #include <pj/assert.h></span><br><span style="color: hsl(0, 100%, 40%);">-+#include <pj/log.h></span><br><span style="color: hsl(0, 100%, 40%);">- #include <pjlib-util/string.h></span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">- PJ_DEF_DATA(const pjsip_method) pjsip_invite_method =</span><br><span style="color: hsl(0, 100%, 40%);">-@@ -461,8 +462,13 @@ PJ_DEF(pj_ssize_t) pjsip_msg_print( const pjsip_msg *msg,</span><br><span style="color: hsl(0, 100%, 40%);">- /* Print each of the headers. */</span><br><span style="color: hsl(0, 100%, 40%);">- for (hdr=msg->hdr.next; hdr!=&msg->hdr; hdr=hdr->next) {</span><br><span style="color: hsl(0, 100%, 40%);">- len = pjsip_hdr_print_on(hdr, p, end-p);</span><br><span style="color: hsl(0, 100%, 40%);">-- if (len < 0)</span><br><span style="color: hsl(0, 100%, 40%);">-- return -1;</span><br><span style="color: hsl(0, 100%, 40%);">-+ if (len < 0) {</span><br><span style="color: hsl(0, 100%, 40%);">-+ if (len == -2) {</span><br><span style="color: hsl(0, 100%, 40%);">-+ PJ_LOG(5, ("sip_msg", "Header with no vptr encountered!! "\</span><br><span style="color: hsl(0, 100%, 40%);">-+ "Current buffer: %.*s", (int)(p-buf), buf));</span><br><span style="color: hsl(0, 100%, 40%);">-+ }</span><br><span style="color: hsl(0, 100%, 40%);">-+ return len;</span><br><span style="color: hsl(0, 100%, 40%);">-+ }</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">- if (len > 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- p += len;</span><br><span style="color: hsl(0, 100%, 40%);">-@@ -578,6 +584,7 @@ PJ_DEF(void*) pjsip_hdr_shallow_clone( pj_pool_t *pool, const void *hdr_ptr )</span><br><span style="color: hsl(0, 100%, 40%);">- PJ_DEF(int) pjsip_hdr_print_on( void *hdr_ptr, char *buf, pj_size_t len)</span><br><span style="color: hsl(0, 100%, 40%);">- {</span><br><span style="color: hsl(0, 100%, 40%);">- pjsip_hdr *hdr = (pjsip_hdr*) hdr_ptr;</span><br><span style="color: hsl(0, 100%, 40%);">-+ PJ_ASSERT_RETURN(hdr->vptr, -2);</span><br><span style="color: hsl(0, 100%, 40%);">- return (*hdr->vptr->print_on)(hdr_ptr, buf, len);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span>--- </span><br><span style="color: hsl(0, 100%, 40%);">-2.7.4</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span>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</span><br><span>deleted file mode 100644</span><br><span>index 3aafd69..0000000</span><br><span>--- a/third-party/pjproject/patches/0070-os_core_unix-Set-mutex-NULL-in-atomic-destroy-and-ad.patch</span><br><span>+++ /dev/null</span><br><span>@@ -1,114 +0,0 @@</span><br><span style="color: hsl(0, 100%, 40%);">-From 67485f3a6c711f67a40ff46288cb6be1658023bd Mon Sep 17 00:00:00 2001</span><br><span style="color: hsl(0, 100%, 40%);">-From: nanang <nanang@localhost></span><br><span style="color: hsl(0, 100%, 40%);">-Date: Mon, 26 Mar 2018 10:33:50 +0000</span><br><span style="color: hsl(0, 100%, 40%);">-Subject: [PATCH] Close #2101: - set atomic's mutex to NULL in atomic destroy </span><br><span style="color: hsl(0, 100%, 40%);">- - added few sanity checks to the atomic functions.</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span>----</span><br><span style="color: hsl(0, 100%, 40%);">- pjlib/src/pj/os_core_unix.c | 20 ++++++++++++++++++--</span><br><span style="color: hsl(0, 100%, 40%);">- pjlib/src/pj/os_core_win32.c | 4 ++++</span><br><span style="color: hsl(0, 100%, 40%);">- 2 files changed, 22 insertions(+), 2 deletions(-)</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-diff --git a/pjlib/src/pj/os_core_unix.c b/pjlib/src/pj/os_core_unix.c</span><br><span style="color: hsl(0, 100%, 40%);">-index ebfe84348..c17ad4ef0 100644</span><br><span>---- a/pjlib/src/pj/os_core_unix.c</span><br><span style="color: hsl(0, 100%, 40%);">-+++ b/pjlib/src/pj/os_core_unix.c</span><br><span style="color: hsl(0, 100%, 40%);">-@@ -879,9 +879,16 @@ PJ_DEF(pj_status_t) pj_atomic_create( pj_pool_t *pool,</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">- PJ_DEF(pj_status_t) pj_atomic_destroy( pj_atomic_t *atomic_var )</span><br><span style="color: hsl(0, 100%, 40%);">- {</span><br><span style="color: hsl(0, 100%, 40%);">-+ pj_status_t status;</span><br><span style="color: hsl(0, 100%, 40%);">-+</span><br><span style="color: hsl(0, 100%, 40%);">- PJ_ASSERT_RETURN(atomic_var, PJ_EINVAL);</span><br><span style="color: hsl(0, 100%, 40%);">-+ </span><br><span style="color: hsl(0, 100%, 40%);">- #if PJ_HAS_THREADS</span><br><span style="color: hsl(0, 100%, 40%);">-- return pj_mutex_destroy( atomic_var->mutex );</span><br><span style="color: hsl(0, 100%, 40%);">-+ status = pj_mutex_destroy( atomic_var->mutex );</span><br><span style="color: hsl(0, 100%, 40%);">-+ if (status == PJ_SUCCESS) {</span><br><span style="color: hsl(0, 100%, 40%);">-+ atomic_var->mutex = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">-+ }</span><br><span style="color: hsl(0, 100%, 40%);">-+ return status;</span><br><span style="color: hsl(0, 100%, 40%);">- #else</span><br><span style="color: hsl(0, 100%, 40%);">- return 0;</span><br><span style="color: hsl(0, 100%, 40%);">- #endif</span><br><span style="color: hsl(0, 100%, 40%);">-@@ -892,10 +899,16 @@ PJ_DEF(pj_status_t) pj_atomic_destroy( pj_atomic_t *atomic_var )</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">- PJ_DEF(void) pj_atomic_set(pj_atomic_t *atomic_var, pj_atomic_value_t value)</span><br><span style="color: hsl(0, 100%, 40%);">- {</span><br><span style="color: hsl(0, 100%, 40%);">-+ pj_status_t status;</span><br><span style="color: hsl(0, 100%, 40%);">-+</span><br><span style="color: hsl(0, 100%, 40%);">- PJ_CHECK_STACK();</span><br><span style="color: hsl(0, 100%, 40%);">-+ PJ_ASSERT_ON_FAIL(atomic_var, return);</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">- #if PJ_HAS_THREADS</span><br><span style="color: hsl(0, 100%, 40%);">-- pj_mutex_lock( atomic_var->mutex );</span><br><span style="color: hsl(0, 100%, 40%);">-+ status = pj_mutex_lock( atomic_var->mutex );</span><br><span style="color: hsl(0, 100%, 40%);">-+ if (status != PJ_SUCCESS) {</span><br><span style="color: hsl(0, 100%, 40%);">-+ return;</span><br><span style="color: hsl(0, 100%, 40%);">-+ }</span><br><span style="color: hsl(0, 100%, 40%);">- #endif</span><br><span style="color: hsl(0, 100%, 40%);">- atomic_var->value = value;</span><br><span style="color: hsl(0, 100%, 40%);">- #if PJ_HAS_THREADS</span><br><span style="color: hsl(0, 100%, 40%);">-@@ -946,6 +959,7 @@ PJ_DEF(pj_atomic_value_t) pj_atomic_inc_and_get(pj_atomic_t *atomic_var)</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">- PJ_DEF(void) pj_atomic_inc(pj_atomic_t *atomic_var)</span><br><span style="color: hsl(0, 100%, 40%);">- {</span><br><span style="color: hsl(0, 100%, 40%);">-+ PJ_ASSERT_ON_FAIL(atomic_var, return);</span><br><span style="color: hsl(0, 100%, 40%);">- pj_atomic_inc_and_get(atomic_var);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">-@@ -974,6 +988,7 @@ PJ_DEF(pj_atomic_value_t) pj_atomic_dec_and_get(pj_atomic_t *atomic_var)</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">- PJ_DEF(void) pj_atomic_dec(pj_atomic_t *atomic_var)</span><br><span style="color: hsl(0, 100%, 40%);">- {</span><br><span style="color: hsl(0, 100%, 40%);">-+ PJ_ASSERT_ON_FAIL(atomic_var, return);</span><br><span style="color: hsl(0, 100%, 40%);">- pj_atomic_dec_and_get(atomic_var);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">-@@ -1005,6 +1020,7 @@ PJ_DEF(pj_atomic_value_t) pj_atomic_add_and_get( pj_atomic_t *atomic_var,</span><br><span style="color: hsl(0, 100%, 40%);">- PJ_DEF(void) pj_atomic_add( pj_atomic_t *atomic_var,</span><br><span style="color: hsl(0, 100%, 40%);">- pj_atomic_value_t value )</span><br><span style="color: hsl(0, 100%, 40%);">- {</span><br><span style="color: hsl(0, 100%, 40%);">-+ PJ_ASSERT_ON_FAIL(atomic_var, return);</span><br><span style="color: hsl(0, 100%, 40%);">- pj_atomic_add_and_get(atomic_var, value);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">-diff --git a/pjlib/src/pj/os_core_win32.c b/pjlib/src/pj/os_core_win32.c</span><br><span style="color: hsl(0, 100%, 40%);">-index 1cb6004d3..8c934b34d 100644</span><br><span>---- a/pjlib/src/pj/os_core_win32.c</span><br><span style="color: hsl(0, 100%, 40%);">-+++ b/pjlib/src/pj/os_core_win32.c</span><br><span style="color: hsl(0, 100%, 40%);">-@@ -750,6 +750,7 @@ PJ_DEF(pj_status_t) pj_atomic_destroy( pj_atomic_t *var )</span><br><span style="color: hsl(0, 100%, 40%);">- PJ_DEF(void) pj_atomic_set( pj_atomic_t *atomic_var, pj_atomic_value_t value)</span><br><span style="color: hsl(0, 100%, 40%);">- {</span><br><span style="color: hsl(0, 100%, 40%);">- PJ_CHECK_STACK();</span><br><span style="color: hsl(0, 100%, 40%);">-+ PJ_ASSERT_ON_FAIL(atomic_var, return);</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">- InterlockedExchange(&atomic_var->value, value);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-@@ -784,6 +785,7 @@ PJ_DEF(pj_atomic_value_t) pj_atomic_inc_and_get(pj_atomic_t *atomic_var)</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">- PJ_DEF(void) pj_atomic_inc(pj_atomic_t *atomic_var)</span><br><span style="color: hsl(0, 100%, 40%);">- {</span><br><span style="color: hsl(0, 100%, 40%);">-+ PJ_ASSERT_ON_FAIL(atomic_var, return);</span><br><span style="color: hsl(0, 100%, 40%);">- pj_atomic_inc_and_get(atomic_var);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">-@@ -806,6 +808,7 @@ PJ_DEF(pj_atomic_value_t) pj_atomic_dec_and_get(pj_atomic_t *atomic_var)</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">- PJ_DEF(void) pj_atomic_dec(pj_atomic_t *atomic_var)</span><br><span style="color: hsl(0, 100%, 40%);">- {</span><br><span style="color: hsl(0, 100%, 40%);">-+ PJ_ASSERT_ON_FAIL(atomic_var, return);</span><br><span style="color: hsl(0, 100%, 40%);">- pj_atomic_dec_and_get(atomic_var);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">-@@ -815,6 +818,7 @@ PJ_DEF(void) pj_atomic_dec(pj_atomic_t *atomic_var)</span><br><span style="color: hsl(0, 100%, 40%);">- PJ_DEF(void) pj_atomic_add( pj_atomic_t *atomic_var,</span><br><span style="color: hsl(0, 100%, 40%);">- pj_atomic_value_t value )</span><br><span style="color: hsl(0, 100%, 40%);">- {</span><br><span style="color: hsl(0, 100%, 40%);">-+ PJ_ASSERT_ON_FAIL(atomic_var, return);</span><br><span style="color: hsl(0, 100%, 40%);">- #if defined(PJ_WIN32_WINNT) && PJ_WIN32_WINNT >= 0x0400</span><br><span style="color: hsl(0, 100%, 40%);">- InterlockedExchangeAdd( &atomic_var->value, value );</span><br><span style="color: hsl(0, 100%, 40%);">- #else</span><br><span>--- </span><br><span style="color: hsl(0, 100%, 40%);">-2.14.3</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span>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</span><br><span>deleted file mode 100644</span><br><span>index 12df346..0000000</span><br><span>--- a/third-party/pjproject/patches/0090-sip_transaction-In-tsx_timer_callback-check-if-tsx-i.patch</span><br><span>+++ /dev/null</span><br><span>@@ -1,31 +0,0 @@</span><br><span style="color: hsl(0, 100%, 40%);">-From beaa7874ff8e3b1d2951218c94e7e6bbba9c0531 Mon Sep 17 00:00:00 2001</span><br><span style="color: hsl(0, 100%, 40%);">-From: George Joseph <gjoseph@digium.com></span><br><span style="color: hsl(0, 100%, 40%);">-Date: Sun, 25 Mar 2018 12:30:05 -0600</span><br><span style="color: hsl(0, 100%, 40%);">-Subject: [PATCH] sip_transaction: In tsx_timer_callback, check if tsx is</span><br><span style="color: hsl(0, 100%, 40%);">- already gone</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-There have been cases that when the transaction timer callback is called</span><br><span style="color: hsl(0, 100%, 40%);">-the tsx is already destroyed. This causes a crash. We now check the</span><br><span style="color: hsl(0, 100%, 40%);">-tsx state and return if the tsx is already destroyed.</span><br><span>----</span><br><span style="color: hsl(0, 100%, 40%);">- pjsip/src/pjsip/sip_transaction.c | 4 ++++</span><br><span style="color: hsl(0, 100%, 40%);">- 1 file changed, 4 insertions(+)</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-diff --git a/pjsip/src/pjsip/sip_transaction.c b/pjsip/src/pjsip/sip_transaction.c</span><br><span style="color: hsl(0, 100%, 40%);">-index d52b12a72..6d4cdc65f 100644</span><br><span>---- a/pjsip/src/pjsip/sip_transaction.c</span><br><span style="color: hsl(0, 100%, 40%);">-+++ b/pjsip/src/pjsip/sip_transaction.c</span><br><span style="color: hsl(0, 100%, 40%);">-@@ -1119,6 +1119,10 @@ static void tsx_timer_callback( pj_timer_heap_t *theap, pj_timer_entry *entry)</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">- PJ_UNUSED_ARG(theap);</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">-+ if (tsx->state >= PJSIP_TSX_STATE_DESTROYED) {</span><br><span style="color: hsl(0, 100%, 40%);">-+ return;</span><br><span style="color: hsl(0, 100%, 40%);">-+ }</span><br><span style="color: hsl(0, 100%, 40%);">-+</span><br><span style="color: hsl(0, 100%, 40%);">- if (entry->id == TRANSPORT_ERR_TIMER) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* Posted transport error event */</span><br><span style="color: hsl(0, 100%, 40%);">- entry->id = 0;</span><br><span>--- </span><br><span style="color: hsl(0, 100%, 40%);">-2.14.3</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span>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</span><br><span>deleted file mode 100644</span><br><span>index cfcc9e8..0000000</span><br><span>--- a/third-party/pjproject/patches/0100-sip_inv-Add-option-to-accept-updated-SDP-on-same-To-.patch</span><br><span>+++ /dev/null</span><br><span>@@ -1,215 +0,0 @@</span><br><span style="color: hsl(0, 100%, 40%);">-From 13e20772cd3c8735a6b78e30391a33f3eba4c023 Mon Sep 17 00:00:00 2001</span><br><span style="color: hsl(0, 100%, 40%);">-From: George Joseph <gjoseph@digium.com></span><br><span style="color: hsl(0, 100%, 40%);">-Date: Fri, 22 Jun 2018 09:33:34 -0600</span><br><span style="color: hsl(0, 100%, 40%);">-Subject: [PATCH] sip_inv: Add option to accept updated SDP on same To tag</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-Currently, setting pjsip_cfg()->endpt.follow_early_media_fork allows</span><br><span style="color: hsl(0, 100%, 40%);">-sip_inv to process media updates when the To tag is different. There</span><br><span style="color: hsl(0, 100%, 40%);">-are some cases where media updates need to be processed when the tags</span><br><span style="color: hsl(0, 100%, 40%);">-are the same. Since removing the requirement for different tags would</span><br><span style="color: hsl(0, 100%, 40%);">-change default behavior, a new option "accept_multiple_sdp_answers"</span><br><span style="color: hsl(0, 100%, 40%);">-has been added along with a new pjsip_inv_session flag</span><br><span style="color: hsl(0, 100%, 40%);">-"updated_sdp_answer" to indicate under which condition we're</span><br><span style="color: hsl(0, 100%, 40%);">-updating.</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-The logic was also updated to more closely follow RFC6337 in that</span><br><span style="color: hsl(0, 100%, 40%);">-if 100rel is efffect, do not accept updated SDPs.</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-See</span><br><span style="color: hsl(0, 100%, 40%);">-https://tools.ietf.org/html/rfc6337#section-3.1.1</span><br><span style="color: hsl(0, 100%, 40%);">-for more information.</span><br><span>----</span><br><span style="color: hsl(0, 100%, 40%);">- pjsip/include/pjsip-ua/sip_inv.h | 2 ++</span><br><span style="color: hsl(0, 100%, 40%);">- pjsip/include/pjsip/sip_config.h | 25 ++++++++++++++++</span><br><span style="color: hsl(0, 100%, 40%);">- pjsip/src/pjsip-ua/sip_inv.c | 62 +++++++++++++++++++++++++---------------</span><br><span style="color: hsl(0, 100%, 40%);">- pjsip/src/pjsip/sip_config.c | 3 +-</span><br><span style="color: hsl(0, 100%, 40%);">- 4 files changed, 68 insertions(+), 24 deletions(-)</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-diff --git a/pjsip/include/pjsip-ua/sip_inv.h b/pjsip/include/pjsip-ua/sip_inv.h</span><br><span style="color: hsl(0, 100%, 40%);">-index 1bb7b8adc..77ef070c3 100644</span><br><span>---- a/pjsip/include/pjsip-ua/sip_inv.h</span><br><span style="color: hsl(0, 100%, 40%);">-+++ b/pjsip/include/pjsip-ua/sip_inv.h</span><br><span style="color: hsl(0, 100%, 40%);">-@@ -442,6 +442,8 @@ struct pjsip_inv_session</span><br><span style="color: hsl(0, 100%, 40%);">- pj_bool_t following_fork; /**< Internal, following</span><br><span style="color: hsl(0, 100%, 40%);">- forked media? */</span><br><span style="color: hsl(0, 100%, 40%);">- pj_atomic_t *ref_cnt; /**< Reference counter. */</span><br><span style="color: hsl(0, 100%, 40%);">-+ pj_bool_t updated_sdp_answer; /**< SDP answer just been</span><br><span style="color: hsl(0, 100%, 40%);">-+ updated? */</span><br><span style="color: hsl(0, 100%, 40%);">- };</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">-diff --git a/pjsip/include/pjsip/sip_config.h b/pjsip/include/pjsip/sip_config.h</span><br><span style="color: hsl(0, 100%, 40%);">-index b3a9468e2..b7cf6feed 100644</span><br><span>---- a/pjsip/include/pjsip/sip_config.h</span><br><span style="color: hsl(0, 100%, 40%);">-+++ b/pjsip/include/pjsip/sip_config.h</span><br><span style="color: hsl(0, 100%, 40%);">-@@ -157,6 +157,17 @@ typedef struct pjsip_cfg_t</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">- pj_bool_t disable_secure_dlg_check;</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">-+ /**</span><br><span style="color: hsl(0, 100%, 40%);">-+ * Accept multiple SDP answers on non-reliable 18X responses and the 2XX</span><br><span style="color: hsl(0, 100%, 40%);">-+ * response when they are all received from the same source (same To tag).</span><br><span style="color: hsl(0, 100%, 40%);">-+ *</span><br><span style="color: hsl(0, 100%, 40%);">-+ * See also:</span><br><span style="color: hsl(0, 100%, 40%);">-+ * https://tools.ietf.org/html/rfc6337#section-3.1.1</span><br><span style="color: hsl(0, 100%, 40%);">-+ *</span><br><span style="color: hsl(0, 100%, 40%);">-+ * Default is PJSIP_ACCEPT_MULTIPLE_SDP_ANSWERS.</span><br><span style="color: hsl(0, 100%, 40%);">-+ */</span><br><span style="color: hsl(0, 100%, 40%);">-+ pj_bool_t accept_multiple_sdp_answers;</span><br><span style="color: hsl(0, 100%, 40%);">-+</span><br><span style="color: hsl(0, 100%, 40%);">- } endpt;</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">- /** Transaction layer settings. */</span><br><span style="color: hsl(0, 100%, 40%);">-@@ -402,6 +413,20 @@ PJ_INLINE(pjsip_cfg_t*) pjsip_cfg(void)</span><br><span style="color: hsl(0, 100%, 40%);">- #endif</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">-+/**</span><br><span style="color: hsl(0, 100%, 40%);">-+ * Accept multiple SDP answers on non-reliable 18X responses and the 2XX</span><br><span style="color: hsl(0, 100%, 40%);">-+ * response when they are all received from the same source (same To tag).</span><br><span style="color: hsl(0, 100%, 40%);">-+ *</span><br><span style="color: hsl(0, 100%, 40%);">-+ * This option can also be controlled at run-time by the</span><br><span style="color: hsl(0, 100%, 40%);">-+ * \a accept_multiple_sdp_answers setting in pjsip_cfg_t.</span><br><span style="color: hsl(0, 100%, 40%);">-+ *</span><br><span style="color: hsl(0, 100%, 40%);">-+ * Default is PJ_FALSE.</span><br><span style="color: hsl(0, 100%, 40%);">-+ */</span><br><span style="color: hsl(0, 100%, 40%);">-+#ifndef PJSIP_ACCEPT_MULTIPLE_SDP_ANSWERS</span><br><span style="color: hsl(0, 100%, 40%);">-+# define PJSIP_ACCEPT_MULTIPLE_SDP_ANSWERS PJ_TRUE</span><br><span style="color: hsl(0, 100%, 40%);">-+#endif</span><br><span style="color: hsl(0, 100%, 40%);">-+</span><br><span style="color: hsl(0, 100%, 40%);">-+</span><br><span style="color: hsl(0, 100%, 40%);">- /**</span><br><span style="color: hsl(0, 100%, 40%);">- * Specify whether "alias" param should be added to the Via header</span><br><span style="color: hsl(0, 100%, 40%);">- * in any outgoing request with connection oriented transport.</span><br><span style="color: hsl(0, 100%, 40%);">-diff --git a/pjsip/src/pjsip-ua/sip_inv.c b/pjsip/src/pjsip-ua/sip_inv.c</span><br><span style="color: hsl(0, 100%, 40%);">-index c9686a088..c22726bad 100644</span><br><span>---- a/pjsip/src/pjsip-ua/sip_inv.c</span><br><span style="color: hsl(0, 100%, 40%);">-+++ b/pjsip/src/pjsip-ua/sip_inv.c</span><br><span style="color: hsl(0, 100%, 40%);">-@@ -162,6 +162,7 @@ struct tsx_inv_data</span><br><span style="color: hsl(0, 100%, 40%);">- pj_bool_t retrying; /* Resend (e.g. due to 401/407) */</span><br><span style="color: hsl(0, 100%, 40%);">- pj_str_t done_tag; /* To tag in RX response with answer */</span><br><span style="color: hsl(0, 100%, 40%);">- pj_bool_t done_early;/* Negotiation was done for early med? */</span><br><span style="color: hsl(0, 100%, 40%);">-+ pj_bool_t done_early_rel;/* Early med was realiable? */</span><br><span style="color: hsl(0, 100%, 40%);">- pj_bool_t has_sdp; /* Message with SDP? */</span><br><span style="color: hsl(0, 100%, 40%);">- };</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">-@@ -2000,18 +2001,20 @@ static pj_status_t inv_check_sdp_in_incoming_msg( pjsip_inv_session *inv,</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">- /* Initialize info that we are following forked media */</span><br><span style="color: hsl(0, 100%, 40%);">- inv->following_fork = PJ_FALSE;</span><br><span style="color: hsl(0, 100%, 40%);">-+ inv->updated_sdp_answer = PJ_FALSE;</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">- /* MUST NOT do multiple SDP offer/answer in a single transaction,</span><br><span style="color: hsl(0, 100%, 40%);">-- * EXCEPT if:</span><br><span style="color: hsl(0, 100%, 40%);">-- * - this is an initial UAC INVITE transaction (i.e. not re-INVITE), and</span><br><span style="color: hsl(0, 100%, 40%);">-- * - the previous negotiation was done on an early media (18x) and</span><br><span style="color: hsl(0, 100%, 40%);">-- * this response is a final/2xx response, and</span><br><span style="color: hsl(0, 100%, 40%);">-- * - the 2xx response has different To tag than the 18x response</span><br><span style="color: hsl(0, 100%, 40%);">-- * (i.e. the request has forked).</span><br><span style="color: hsl(0, 100%, 40%);">-+ * EXCEPT previous nego was in 18x (early media) and any of the following</span><br><span style="color: hsl(0, 100%, 40%);">-+ * condition is met:</span><br><span style="color: hsl(0, 100%, 40%);">-+ * - Non-forking scenario:</span><br><span style="color: hsl(0, 100%, 40%);">-+ * - 'accept_multiple_sdp_answers' is set, and</span><br><span style="color: hsl(0, 100%, 40%);">-+ * - previous early response was not reliable (rfc6337 section 3.1.1).</span><br><span style="color: hsl(0, 100%, 40%);">-+ * - Forking scenario:</span><br><span style="color: hsl(0, 100%, 40%);">-+ * - This response has different To tag than the previous response, and</span><br><span style="color: hsl(0, 100%, 40%);">-+ * - This response is 18x/2xx (early or final). If this is 18x,</span><br><span style="color: hsl(0, 100%, 40%);">-+ * only do multiple SDP nego if 'follow_early_media_fork' is set.</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">-- * The exception above is to add a rudimentary support for early media</span><br><span style="color: hsl(0, 100%, 40%);">-- * forking (sample case: custom ringback). See this ticket for more</span><br><span style="color: hsl(0, 100%, 40%);">-- * info: http://trac.pjsip.org/repos/ticket/657</span><br><span style="color: hsl(0, 100%, 40%);">-+ * See also ticket #657, #1644, #1764 for more info.</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">- if (tsx_inv_data->sdp_done) {</span><br><span style="color: hsl(0, 100%, 40%);">- pj_str_t res_tag;</span><br><span style="color: hsl(0, 100%, 40%);">-@@ -2020,21 +2023,29 @@ static pj_status_t inv_check_sdp_in_incoming_msg( pjsip_inv_session *inv,</span><br><span style="color: hsl(0, 100%, 40%);">- res_tag = rdata->msg_info.to->tag;</span><br><span style="color: hsl(0, 100%, 40%);">- st_code = rdata->msg_info.msg->line.status.code;</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">-- /* Allow final/early response after SDP has been negotiated in early</span><br><span style="color: hsl(0, 100%, 40%);">-- * media, IF this response is a final/early response with different</span><br><span style="color: hsl(0, 100%, 40%);">-- * tag.</span><br><span style="color: hsl(0, 100%, 40%);">-- * See ticket #1644 and #1764 for forked early media case.</span><br><span style="color: hsl(0, 100%, 40%);">-- */</span><br><span style="color: hsl(0, 100%, 40%);">-- if (tsx->role == PJSIP_ROLE_UAC &&</span><br><span style="color: hsl(0, 100%, 40%);">-- (st_code/100 == 2 ||</span><br><span style="color: hsl(0, 100%, 40%);">-- (st_code/10 == 18 /* st_code == 18x */</span><br><span style="color: hsl(0, 100%, 40%);">-- && pjsip_cfg()->endpt.follow_early_media_fork)) &&</span><br><span style="color: hsl(0, 100%, 40%);">-- tsx_inv_data->done_early &&</span><br><span style="color: hsl(0, 100%, 40%);">-- pj_stricmp(&tsx_inv_data->done_tag, &res_tag))</span><br><span style="color: hsl(0, 100%, 40%);">-+ if (tsx->role == PJSIP_ROLE_UAC && tsx_inv_data->done_early &&</span><br><span style="color: hsl(0, 100%, 40%);">-+ (</span><br><span style="color: hsl(0, 100%, 40%);">-+ /* Non-forking scenario */</span><br><span style="color: hsl(0, 100%, 40%);">-+ (</span><br><span style="color: hsl(0, 100%, 40%);">-+ !tsx_inv_data->done_early_rel &&</span><br><span style="color: hsl(0, 100%, 40%);">-+ (st_code/100 == 2 || st_code/10 == 18) &&</span><br><span style="color: hsl(0, 100%, 40%);">-+ pjsip_cfg()->endpt.accept_multiple_sdp_answers &&</span><br><span style="color: hsl(0, 100%, 40%);">-+ !pj_stricmp(&tsx_inv_data->done_tag, &res_tag)</span><br><span style="color: hsl(0, 100%, 40%);">-+ )</span><br><span style="color: hsl(0, 100%, 40%);">-+ ||</span><br><span style="color: hsl(0, 100%, 40%);">-+ /* Forking scenario */</span><br><span style="color: hsl(0, 100%, 40%);">-+ (</span><br><span style="color: hsl(0, 100%, 40%);">-+ (st_code/100 == 2 ||</span><br><span style="color: hsl(0, 100%, 40%);">-+ (st_code/10 == 18 &&</span><br><span style="color: hsl(0, 100%, 40%);">-+ pjsip_cfg()->endpt.follow_early_media_fork)) &&</span><br><span style="color: hsl(0, 100%, 40%);">-+ pj_stricmp(&tsx_inv_data->done_tag, &res_tag)</span><br><span style="color: hsl(0, 100%, 40%);">-+ )</span><br><span style="color: hsl(0, 100%, 40%);">-+ )</span><br><span style="color: hsl(0, 100%, 40%);">-+ )</span><br><span style="color: hsl(0, 100%, 40%);">- {</span><br><span style="color: hsl(0, 100%, 40%);">- const pjmedia_sdp_session *reoffer_sdp = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">-- PJ_LOG(4,(inv->obj_name, "Received forked %s response "</span><br><span style="color: hsl(0, 100%, 40%);">-+ PJ_LOG(4,(inv->obj_name, "Received %s response "</span><br><span style="color: hsl(0, 100%, 40%);">- "after SDP negotiation has been done in early "</span><br><span style="color: hsl(0, 100%, 40%);">- "media. Renegotiating SDP..",</span><br><span style="color: hsl(0, 100%, 40%);">- (st_code/10==18? "early" : "final" )));</span><br><span style="color: hsl(0, 100%, 40%);">-@@ -2054,7 +2065,9 @@ static pj_status_t inv_check_sdp_in_incoming_msg( pjsip_inv_session *inv,</span><br><span style="color: hsl(0, 100%, 40%);">- return status;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">-- inv->following_fork = PJ_TRUE;</span><br><span style="color: hsl(0, 100%, 40%);">-+ inv->following_fork = !!pj_stricmp(&tsx_inv_data->done_tag,</span><br><span style="color: hsl(0, 100%, 40%);">-+ &res_tag);</span><br><span style="color: hsl(0, 100%, 40%);">-+ inv->updated_sdp_answer = PJ_TRUE;</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">-@@ -2135,6 +2148,7 @@ static pj_status_t inv_check_sdp_in_incoming_msg( pjsip_inv_session *inv,</span><br><span style="color: hsl(0, 100%, 40%);">- PJMEDIA_SDP_NEG_STATE_LOCAL_OFFER) </span><br><span style="color: hsl(0, 100%, 40%);">- {</span><br><span style="color: hsl(0, 100%, 40%);">- int status_code;</span><br><span style="color: hsl(0, 100%, 40%);">-+ pjsip_msg *msg = rdata->msg_info.msg;</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">- /* This is an answer. </span><br><span style="color: hsl(0, 100%, 40%);">- * Process and negotiate remote answer.</span><br><span style="color: hsl(0, 100%, 40%);">-@@ -2161,8 +2175,10 @@ static pj_status_t inv_check_sdp_in_incoming_msg( pjsip_inv_session *inv,</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">- tsx_inv_data->sdp_done = 1;</span><br><span style="color: hsl(0, 100%, 40%);">-- status_code = rdata->msg_info.msg->line.status.code;</span><br><span style="color: hsl(0, 100%, 40%);">-+ status_code = msg->line.status.code;</span><br><span style="color: hsl(0, 100%, 40%);">- tsx_inv_data->done_early = (status_code/100==1);</span><br><span style="color: hsl(0, 100%, 40%);">-+ tsx_inv_data->done_early_rel = tsx_inv_data->done_early &&</span><br><span style="color: hsl(0, 100%, 40%);">-+ pjsip_100rel_is_reliable(rdata);</span><br><span style="color: hsl(0, 100%, 40%);">- pj_strdup(tsx->pool, &tsx_inv_data->done_tag, </span><br><span style="color: hsl(0, 100%, 40%);">- &rdata->msg_info.to->tag);</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">-diff --git a/pjsip/src/pjsip/sip_config.c b/pjsip/src/pjsip/sip_config.c</span><br><span style="color: hsl(0, 100%, 40%);">-index 3576f351e..316824a00 100644</span><br><span>---- a/pjsip/src/pjsip/sip_config.c</span><br><span style="color: hsl(0, 100%, 40%);">-+++ b/pjsip/src/pjsip/sip_config.c</span><br><span style="color: hsl(0, 100%, 40%);">-@@ -34,7 +34,8 @@ pjsip_cfg_t pjsip_sip_cfg_var =</span><br><span style="color: hsl(0, 100%, 40%);">- PJSIP_FOLLOW_EARLY_MEDIA_FORK,</span><br><span style="color: hsl(0, 100%, 40%);">- PJSIP_REQ_HAS_VIA_ALIAS,</span><br><span style="color: hsl(0, 100%, 40%);">- PJSIP_RESOLVE_HOSTNAME_TO_GET_INTERFACE,</span><br><span style="color: hsl(0, 100%, 40%);">-- 0</span><br><span style="color: hsl(0, 100%, 40%);">-+ 0,</span><br><span style="color: hsl(0, 100%, 40%);">-+ PJSIP_ACCEPT_MULTIPLE_SDP_ANSWERS</span><br><span style="color: hsl(0, 100%, 40%);">- },</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">- /* Transaction settings */</span><br><span>--- </span><br><span style="color: hsl(0, 100%, 40%);">-2.14.4</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span>diff --git a/third-party/pjproject/patches/0110_fix_tdata_rexmit_deadlock.patch b/third-party/pjproject/patches/0110_fix_tdata_rexmit_deadlock.patch</span><br><span>deleted file mode 100644</span><br><span>index a9aca5b..0000000</span><br><span>--- a/third-party/pjproject/patches/0110_fix_tdata_rexmit_deadlock.patch</span><br><span>+++ /dev/null</span><br><span>@@ -1,203 +0,0 @@</span><br><span style="color: hsl(0, 100%, 40%);">-From 3c9ad14b32ddb881559c05ea742aba3153a8cb8f Mon Sep 17 00:00:00 2001</span><br><span style="color: hsl(0, 100%, 40%);">-From: Riza Sulistyo <riza@teluu.com></span><br><span style="color: hsl(0, 100%, 40%);">-Date: Wed, 1 Aug 2018 10:49:51 -0500</span><br><span style="color: hsl(0, 100%, 40%);">-Subject: [PATCH] r5851 svn backport sip_inv.c: Fix race condition in 183</span><br><span style="color: hsl(0, 100%, 40%);">- re-transmission deadlock</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-Fixed #2137: Race condition in 183 re-transmission can result in a deadlock.</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-The tdata containing the response can be shared by both the dialog</span><br><span style="color: hsl(0, 100%, 40%);">-object and the tsx object. In order to prevent the race condition</span><br><span style="color: hsl(0, 100%, 40%);">-between the tsx retransmission and the dialog sending a response,</span><br><span style="color: hsl(0, 100%, 40%);">-clone the tdata before modifying it for the dialog send response.</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-ASTERISK-27966</span><br><span>----</span><br><span style="color: hsl(0, 100%, 40%);">- pjsip/include/pjsip/sip_transport.h | 16 +++++++++++++</span><br><span style="color: hsl(0, 100%, 40%);">- pjsip/src/pjsip-ua/sip_100rel.c | 43 +--------------------------------</span><br><span style="color: hsl(0, 100%, 40%);">- pjsip/src/pjsip-ua/sip_inv.c | 14 ++++++++++-</span><br><span style="color: hsl(0, 100%, 40%);">- pjsip/src/pjsip/sip_transport.c | 47 +++++++++++++++++++++++++++++++++++++</span><br><span style="color: hsl(0, 100%, 40%);">- 4 files changed, 77 insertions(+), 43 deletions(-)</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-diff --git a/pjsip/include/pjsip/sip_transport.h b/pjsip/include/pjsip/sip_transport.h</span><br><span style="color: hsl(0, 100%, 40%);">-index 10a50ef..36581dc 100644</span><br><span>---- a/pjsip/include/pjsip/sip_transport.h</span><br><span style="color: hsl(0, 100%, 40%);">-+++ b/pjsip/include/pjsip/sip_transport.h</span><br><span style="color: hsl(0, 100%, 40%);">-@@ -721,6 +721,22 @@ PJ_DECL(char*) pjsip_tx_data_get_info( pjsip_tx_data *tdata );</span><br><span style="color: hsl(0, 100%, 40%);">- PJ_DECL(pj_status_t) pjsip_tx_data_set_transport(pjsip_tx_data *tdata,</span><br><span style="color: hsl(0, 100%, 40%);">- const pjsip_tpselector *sel);</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">-+/**</span><br><span style="color: hsl(0, 100%, 40%);">-+ * Clone pjsip_tx_data. This will duplicate the message contents of</span><br><span style="color: hsl(0, 100%, 40%);">-+ * pjsip_tx_data (pjsip_tx_data.msg) and add reference count to the tdata.</span><br><span style="color: hsl(0, 100%, 40%);">-+ * Once application has finished using the cloned pjsip_tx_data,</span><br><span style="color: hsl(0, 100%, 40%);">-+ * it must release it by calling #pjsip_tx_data_dec_ref().</span><br><span style="color: hsl(0, 100%, 40%);">-+ * Currently, this will only clone response message.</span><br><span style="color: hsl(0, 100%, 40%);">-+ *</span><br><span style="color: hsl(0, 100%, 40%);">-+ * @param src The source to be cloned.</span><br><span style="color: hsl(0, 100%, 40%);">-+ * @param flags Optional flags. Must be zero for now.</span><br><span style="color: hsl(0, 100%, 40%);">-+ * @param p_rdata Pointer to receive the cloned tdata.</span><br><span style="color: hsl(0, 100%, 40%);">-+ *</span><br><span style="color: hsl(0, 100%, 40%);">-+ * @return PJ_SUCCESS on success or the appropriate error.</span><br><span style="color: hsl(0, 100%, 40%);">-+ */</span><br><span style="color: hsl(0, 100%, 40%);">-+PJ_DECL(pj_status_t) pjsip_tx_data_clone(const pjsip_tx_data *src,</span><br><span style="color: hsl(0, 100%, 40%);">-+ unsigned flags,</span><br><span style="color: hsl(0, 100%, 40%);">-+ pjsip_tx_data **p_rdata);</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">- /*****************************************************************************</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">-diff --git a/pjsip/src/pjsip-ua/sip_100rel.c b/pjsip/src/pjsip-ua/sip_100rel.c</span><br><span style="color: hsl(0, 100%, 40%);">-index eb9e587..7bf0ad1 100644</span><br><span>---- a/pjsip/src/pjsip-ua/sip_100rel.c</span><br><span style="color: hsl(0, 100%, 40%);">-+++ b/pjsip/src/pjsip-ua/sip_100rel.c</span><br><span style="color: hsl(0, 100%, 40%);">-@@ -634,47 +634,6 @@ static void on_retransmit(pj_timer_heap_t *timer_heap,</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">--/* Clone response. */</span><br><span style="color: hsl(0, 100%, 40%);">--static pjsip_tx_data *clone_tdata(dlg_data *dd,</span><br><span style="color: hsl(0, 100%, 40%);">-- const pjsip_tx_data *src)</span><br><span style="color: hsl(0, 100%, 40%);">--{</span><br><span style="color: hsl(0, 100%, 40%);">-- pjsip_tx_data *dst;</span><br><span style="color: hsl(0, 100%, 40%);">-- const pjsip_hdr *hsrc;</span><br><span style="color: hsl(0, 100%, 40%);">-- pjsip_msg *msg;</span><br><span style="color: hsl(0, 100%, 40%);">-- pj_status_t status;</span><br><span style="color: hsl(0, 100%, 40%);">--</span><br><span style="color: hsl(0, 100%, 40%);">-- status = pjsip_endpt_create_tdata(dd->inv->dlg->endpt, &dst);</span><br><span style="color: hsl(0, 100%, 40%);">-- if (status != PJ_SUCCESS)</span><br><span style="color: hsl(0, 100%, 40%);">-- return NULL;</span><br><span style="color: hsl(0, 100%, 40%);">--</span><br><span style="color: hsl(0, 100%, 40%);">-- msg = pjsip_msg_create(dst->pool, PJSIP_RESPONSE_MSG);</span><br><span style="color: hsl(0, 100%, 40%);">-- dst->msg = msg;</span><br><span style="color: hsl(0, 100%, 40%);">-- pjsip_tx_data_add_ref(dst);</span><br><span style="color: hsl(0, 100%, 40%);">--</span><br><span style="color: hsl(0, 100%, 40%);">-- /* Duplicate status line */</span><br><span style="color: hsl(0, 100%, 40%);">-- msg->line.status.code = src->msg->line.status.code;</span><br><span style="color: hsl(0, 100%, 40%);">-- pj_strdup(dst->pool, &msg->line.status.reason, </span><br><span style="color: hsl(0, 100%, 40%);">-- &src->msg->line.status.reason);</span><br><span style="color: hsl(0, 100%, 40%);">--</span><br><span style="color: hsl(0, 100%, 40%);">-- /* Duplicate all headers */</span><br><span style="color: hsl(0, 100%, 40%);">-- hsrc = src->msg->hdr.next;</span><br><span style="color: hsl(0, 100%, 40%);">-- while (hsrc != &src->msg->hdr) {</span><br><span style="color: hsl(0, 100%, 40%);">-- pjsip_hdr *h = (pjsip_hdr*) pjsip_hdr_clone(dst->pool, hsrc);</span><br><span style="color: hsl(0, 100%, 40%);">-- pjsip_msg_add_hdr(msg, h);</span><br><span style="color: hsl(0, 100%, 40%);">-- hsrc = hsrc->next;</span><br><span style="color: hsl(0, 100%, 40%);">-- }</span><br><span style="color: hsl(0, 100%, 40%);">--</span><br><span style="color: hsl(0, 100%, 40%);">-- /* Duplicate message body */</span><br><span style="color: hsl(0, 100%, 40%);">-- if (src->msg->body)</span><br><span style="color: hsl(0, 100%, 40%);">-- msg->body = pjsip_msg_body_clone(dst->pool, src->msg->body);</span><br><span style="color: hsl(0, 100%, 40%);">--</span><br><span style="color: hsl(0, 100%, 40%);">-- PJ_LOG(5,(dd->inv->dlg->obj_name,</span><br><span style="color: hsl(0, 100%, 40%);">-- "Reliable response %s created",</span><br><span style="color: hsl(0, 100%, 40%);">-- pjsip_tx_data_get_info(dst)));</span><br><span style="color: hsl(0, 100%, 40%);">--</span><br><span style="color: hsl(0, 100%, 40%);">-- return dst;</span><br><span style="color: hsl(0, 100%, 40%);">--}</span><br><span style="color: hsl(0, 100%, 40%);">--</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">- /* Check if any pending response in transmission list has SDP */</span><br><span style="color: hsl(0, 100%, 40%);">- static pj_bool_t has_sdp(dlg_data *dd)</span><br><span style="color: hsl(0, 100%, 40%);">-@@ -725,7 +684,7 @@ PJ_DEF(pj_status_t) pjsip_100rel_tx_response(pjsip_inv_session *inv,</span><br><span style="color: hsl(0, 100%, 40%);">- * if it wants to send another response.</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">- old_tdata = tdata;</span><br><span style="color: hsl(0, 100%, 40%);">-- tdata = clone_tdata(dd, old_tdata);</span><br><span style="color: hsl(0, 100%, 40%);">-+ pjsip_tx_data_clone(old_tdata, 0, &tdata);</span><br><span style="color: hsl(0, 100%, 40%);">- pjsip_tx_data_dec_ref(old_tdata);</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">-diff --git a/pjsip/src/pjsip-ua/sip_inv.c b/pjsip/src/pjsip-ua/sip_inv.c</span><br><span style="color: hsl(0, 100%, 40%);">-index 16a0e17..da28903 100644</span><br><span>---- a/pjsip/src/pjsip-ua/sip_inv.c</span><br><span style="color: hsl(0, 100%, 40%);">-+++ b/pjsip/src/pjsip-ua/sip_inv.c</span><br><span style="color: hsl(0, 100%, 40%);">-@@ -2382,6 +2382,7 @@ PJ_DEF(pj_status_t) pjsip_inv_answer( pjsip_inv_session *inv,</span><br><span style="color: hsl(0, 100%, 40%);">- pjsip_tx_data **p_tdata )</span><br><span style="color: hsl(0, 100%, 40%);">- {</span><br><span style="color: hsl(0, 100%, 40%);">- pjsip_tx_data *last_res;</span><br><span style="color: hsl(0, 100%, 40%);">-+ pjsip_tx_data *old_res;</span><br><span style="color: hsl(0, 100%, 40%);">- pj_status_t status;</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">- /* Verify arguments. */</span><br><span style="color: hsl(0, 100%, 40%);">-@@ -2397,8 +2398,19 @@ PJ_DEF(pj_status_t) pjsip_inv_answer( pjsip_inv_session *inv,</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">- pjsip_dlg_inc_lock(inv->dlg);</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">-+ /* Clone last response.</span><br><span style="color: hsl(0, 100%, 40%);">-+ * The tdata (last_answer) is a shared object used by the transaction.</span><br><span style="color: hsl(0, 100%, 40%);">-+ * Modifying a shared object might lead to a deadlock.</span><br><span style="color: hsl(0, 100%, 40%);">-+ * Refer to ticket #2137 for more detail.</span><br><span style="color: hsl(0, 100%, 40%);">-+ */</span><br><span style="color: hsl(0, 100%, 40%);">-+ status = pjsip_tx_data_clone(inv->last_answer, 0, &last_res);</span><br><span style="color: hsl(0, 100%, 40%);">-+ if (status != PJ_SUCCESS)</span><br><span style="color: hsl(0, 100%, 40%);">-+ goto on_return;</span><br><span style="color: hsl(0, 100%, 40%);">-+ old_res = inv->last_answer;</span><br><span style="color: hsl(0, 100%, 40%);">-+ inv->last_answer = last_res;</span><br><span style="color: hsl(0, 100%, 40%);">-+ pjsip_tx_data_dec_ref(old_res);</span><br><span style="color: hsl(0, 100%, 40%);">-+</span><br><span style="color: hsl(0, 100%, 40%);">- /* Modify last response. */</span><br><span style="color: hsl(0, 100%, 40%);">-- last_res = inv->last_answer;</span><br><span style="color: hsl(0, 100%, 40%);">- status = pjsip_dlg_modify_response(inv->dlg, last_res, st_code, st_text);</span><br><span style="color: hsl(0, 100%, 40%);">- if (status != PJ_SUCCESS)</span><br><span style="color: hsl(0, 100%, 40%);">- goto on_return;</span><br><span style="color: hsl(0, 100%, 40%);">-diff --git a/pjsip/src/pjsip/sip_transport.c b/pjsip/src/pjsip/sip_transport.c</span><br><span style="color: hsl(0, 100%, 40%);">-index f350fe7..3a8baca 100644</span><br><span>---- a/pjsip/src/pjsip/sip_transport.c</span><br><span style="color: hsl(0, 100%, 40%);">-+++ b/pjsip/src/pjsip/sip_transport.c</span><br><span style="color: hsl(0, 100%, 40%);">-@@ -643,6 +643,53 @@ PJ_DEF(pj_status_t) pjsip_tx_data_set_transport(pjsip_tx_data *tdata,</span><br><span style="color: hsl(0, 100%, 40%);">- return PJ_SUCCESS;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">-+/* Clone pjsip_tx_data. */</span><br><span style="color: hsl(0, 100%, 40%);">-+PJ_DEF(pj_status_t) pjsip_tx_data_clone(const pjsip_tx_data *src,</span><br><span style="color: hsl(0, 100%, 40%);">-+ unsigned flags,</span><br><span style="color: hsl(0, 100%, 40%);">-+ pjsip_tx_data ** p_tdata)</span><br><span style="color: hsl(0, 100%, 40%);">-+{</span><br><span style="color: hsl(0, 100%, 40%);">-+ pjsip_tx_data *dst;</span><br><span style="color: hsl(0, 100%, 40%);">-+ const pjsip_hdr *hsrc;</span><br><span style="color: hsl(0, 100%, 40%);">-+ pjsip_msg *msg;</span><br><span style="color: hsl(0, 100%, 40%);">-+ pj_status_t status;</span><br><span style="color: hsl(0, 100%, 40%);">-+</span><br><span style="color: hsl(0, 100%, 40%);">-+ PJ_UNUSED_ARG(flags);</span><br><span style="color: hsl(0, 100%, 40%);">-+</span><br><span style="color: hsl(0, 100%, 40%);">-+ status = pjsip_tx_data_create(src->mgr, p_tdata);</span><br><span style="color: hsl(0, 100%, 40%);">-+ if (status != PJ_SUCCESS)</span><br><span style="color: hsl(0, 100%, 40%);">-+ return status;</span><br><span style="color: hsl(0, 100%, 40%);">-+</span><br><span style="color: hsl(0, 100%, 40%);">-+ dst = *p_tdata;</span><br><span style="color: hsl(0, 100%, 40%);">-+</span><br><span style="color: hsl(0, 100%, 40%);">-+ msg = pjsip_msg_create(dst->pool, PJSIP_RESPONSE_MSG);</span><br><span style="color: hsl(0, 100%, 40%);">-+ dst->msg = msg;</span><br><span style="color: hsl(0, 100%, 40%);">-+ pjsip_tx_data_add_ref(dst);</span><br><span style="color: hsl(0, 100%, 40%);">-+</span><br><span style="color: hsl(0, 100%, 40%);">-+ /* Duplicate status line */</span><br><span style="color: hsl(0, 100%, 40%);">-+ msg->line.status.code = src->msg->line.status.code;</span><br><span style="color: hsl(0, 100%, 40%);">-+ pj_strdup(dst->pool, &msg->line.status.reason,</span><br><span style="color: hsl(0, 100%, 40%);">-+ &src->msg->line.status.reason);</span><br><span style="color: hsl(0, 100%, 40%);">-+</span><br><span style="color: hsl(0, 100%, 40%);">-+ /* Duplicate all headers */</span><br><span style="color: hsl(0, 100%, 40%);">-+ hsrc = src->msg->hdr.next;</span><br><span style="color: hsl(0, 100%, 40%);">-+ while (hsrc != &src->msg->hdr) {</span><br><span style="color: hsl(0, 100%, 40%);">-+ pjsip_hdr *h = (pjsip_hdr*) pjsip_hdr_clone(dst->pool, hsrc);</span><br><span style="color: hsl(0, 100%, 40%);">-+ pjsip_msg_add_hdr(msg, h);</span><br><span style="color: hsl(0, 100%, 40%);">-+ hsrc = hsrc->next;</span><br><span style="color: hsl(0, 100%, 40%);">-+ }</span><br><span style="color: hsl(0, 100%, 40%);">-+</span><br><span style="color: hsl(0, 100%, 40%);">-+ /* Duplicate message body */</span><br><span style="color: hsl(0, 100%, 40%);">-+ if (src->msg->body)</span><br><span style="color: hsl(0, 100%, 40%);">-+ msg->body = pjsip_msg_body_clone(dst->pool, src->msg->body);</span><br><span style="color: hsl(0, 100%, 40%);">-+</span><br><span style="color: hsl(0, 100%, 40%);">-+ dst->is_pending = src->is_pending;</span><br><span style="color: hsl(0, 100%, 40%);">-+</span><br><span style="color: hsl(0, 100%, 40%);">-+ PJ_LOG(5,(THIS_FILE,</span><br><span style="color: hsl(0, 100%, 40%);">-+ "Tx data %s cloned",</span><br><span style="color: hsl(0, 100%, 40%);">-+ pjsip_tx_data_get_info(dst)));</span><br><span style="color: hsl(0, 100%, 40%);">-+</span><br><span style="color: hsl(0, 100%, 40%);">-+ return PJ_SUCCESS;</span><br><span style="color: hsl(0, 100%, 40%);">-+}</span><br><span style="color: hsl(0, 100%, 40%);">- </span><br><span style="color: hsl(0, 100%, 40%);">- PJ_DEF(char*) pjsip_rx_data_get_info(pjsip_rx_data *rdata)</span><br><span style="color: hsl(0, 100%, 40%);">- {</span><br><span>--- </span><br><span style="color: hsl(0, 100%, 40%);">-2.7.4</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span>diff --git a/third-party/pjproject/pjproject-2.7.2.tar.bz2.md5 b/third-party/pjproject/pjproject-2.7.2.tar.bz2.md5</span><br><span>deleted file mode 100644</span><br><span>index 2ea6b42..0000000</span><br><span>--- a/third-party/pjproject/pjproject-2.7.2.tar.bz2.md5</span><br><span>+++ /dev/null</span><br><span>@@ -1,2 +0,0 @@</span><br><span style="color: hsl(0, 100%, 40%);">-8119f0d91a00b6f553099e6ee5358ade *pjproject-2.7.2.zip</span><br><span style="color: hsl(0, 100%, 40%);">-fa3f0bc098c4bff48ddd92db1c016a7a pjproject-2.7.2.tar.bz2</span><br><span>diff --git a/third-party/pjproject/pjproject-2.8.tar.bz2.md5 b/third-party/pjproject/pjproject-2.8.tar.bz2.md5</span><br><span>new file mode 100644</span><br><span>index 0000000..5e3e7f6</span><br><span>--- /dev/null</span><br><span>+++ b/third-party/pjproject/pjproject-2.8.tar.bz2.md5</span><br><span>@@ -0,0 +1,2 @@</span><br><span style="color: hsl(120, 100%, 40%);">+1d3cb8fd2752c724dc8798900f102e75 *pjproject-2.8.zip</span><br><span style="color: hsl(120, 100%, 40%);">+6487d54213f270d307eaa60efc9f56f3 pjproject-2.8.tar.bz2</span><br><span>\ No newline at end of file</span><br><span>diff --git a/third-party/versions.mak b/third-party/versions.mak</span><br><span>index faf7aec..052e6b4 100644</span><br><span>--- a/third-party/versions.mak</span><br><span>+++ b/third-party/versions.mak</span><br><span>@@ -1,2 +1,2 @@</span><br><span> JANSSON_VERSION = 2.11</span><br><span style="color: hsl(0, 100%, 40%);">-PJPROJECT_VERSION = 2.7.2</span><br><span style="color: hsl(120, 100%, 40%);">+PJPROJECT_VERSION = 2.8</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/10169">change 10169</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/10169"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I5097772b11b0f95c3c1f52df6400158666f0a189 </div>
<div style="display:none"> Gerrit-Change-Number: 10169 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Joshua Colp <jcolp@digium.com> </div>