summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Donald2025-12-03 22:53:48 +0000
committerJiri Slachta2025-12-04 12:06:45 +0000
commite8e89793f39117733a7cc7862713ba2a9f9bf7f6 (patch)
tree7a057e0296c403da7e7b8128b5c93685c44a9789
parent6a075d6e81972fa5eeedf441c0ee97662e50839f (diff)
downloadtelephony-e8e89793f39117733a7cc7862713ba2a9f9bf7f6.tar.gz
pjproject: bump to match asterisk 23.1.0
This matches the version and patches bundled with asterisk 23.1.0. Signed-off-by: Andre Heider <a.heider@gmail.com> Signed-off-by: Paul Donald <newtwen+github@gmail.com>
-rw-r--r--libs/pjproject/Makefile4
-rw-r--r--libs/pjproject/patches/0004-config_site.patch6
-rw-r--r--libs/pjproject/patches/0006-fix-pkg_config-file.patch2
-rw-r--r--libs/pjproject/patches/0010-Avoid_deadlock_between_transport_and_transaction.patch154
4 files changed, 160 insertions, 6 deletions
diff --git a/libs/pjproject/Makefile b/libs/pjproject/Makefile
index 4ab736c..b2cfa67 100644
--- a/libs/pjproject/Makefile
+++ b/libs/pjproject/Makefile
@@ -10,7 +10,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=pjproject
-PKG_VERSION:=2.14.1
+PKG_VERSION:=2.15.1
PKG_RELEASE:=1
PKG_CPE_ID:=cpe:/a:pjsip:pjsip
@@ -18,7 +18,7 @@ PKG_CPE_ID:=cpe:/a:pjsip:pjsip
PKG_SOURCE_URL_FILE:=$(PKG_VERSION).tar.gz
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_URL_FILE)
PKG_SOURCE_URL:=https://github.com/pjsip/$(PKG_NAME)/archive/refs/tags
-PKG_HASH:=6140f7a97e318caa89c17e8d5468599671c6eed12d64a7c160dac879ba004c68
+PKG_HASH:=8f3bd99caf003f96ed8038b8a36031eb9d8cd9eaea1eaff7e01c2eef6bd55706
PKG_INSTALL:=1
PKG_LICENSE:=GPL-2.0
diff --git a/libs/pjproject/patches/0004-config_site.patch b/libs/pjproject/patches/0004-config_site.patch
index 4b5c373..ead141d 100644
--- a/libs/pjproject/patches/0004-config_site.patch
+++ b/libs/pjproject/patches/0004-config_site.patch
@@ -77,9 +77,9 @@
+#define PJ_ICE_MAX_CHECKS (PJ_ICE_MAX_CAND * PJ_ICE_MAX_CAND)
+
+/* Increase limits to allow more formats */
-+#define PJMEDIA_MAX_SDP_FMT 64
++#define PJMEDIA_MAX_SDP_FMT 72
+#define PJMEDIA_MAX_SDP_BANDW 4
-+#define PJMEDIA_MAX_SDP_ATTR (PJMEDIA_MAX_SDP_FMT*3 + 4)
++#define PJMEDIA_MAX_SDP_ATTR (PJMEDIA_MAX_SDP_FMT*6 + 4)
+#define PJMEDIA_MAX_SDP_MEDIA 16
+
+/*
@@ -92,7 +92,7 @@
+
+#define PJSIP_TSX_UAS_CONTINUE_ON_TP_ERROR 0
+#define PJ_SSL_SOCK_OSSL_USE_THREAD_CB 0
-+#define PJSIP_AUTH_ALLOW_MULTIPLE_AUTH_HEADER 1
++#define PJSIP_AUTH_ALLOW_MULTIPLE_AUTH_HEADER 0
+
+/*
+ * The default is 32 with 8 being used by pjproject itself.
diff --git a/libs/pjproject/patches/0006-fix-pkg_config-file.patch b/libs/pjproject/patches/0006-fix-pkg_config-file.patch
index f352ac8..90f1d22 100644
--- a/libs/pjproject/patches/0006-fix-pkg_config-file.patch
+++ b/libs/pjproject/patches/0006-fix-pkg_config-file.patch
@@ -13,7 +13,7 @@
Description: Multimedia communication library
--- a/build.mak.in
+++ b/build.mak.in
-@@ -351,6 +351,6 @@ export PJ_LIBXX_FILES := $(APP_LIBXX_FIL
+@@ -352,6 +352,6 @@ export PJ_LIBXX_FILES := $(APP_LIBXX_FIL
export PJ_INSTALL_DIR := @prefix@
export PJ_INSTALL_INC_DIR := @includedir@
export PJ_INSTALL_LIB_DIR := @libdir@
diff --git a/libs/pjproject/patches/0010-Avoid_deadlock_between_transport_and_transaction.patch b/libs/pjproject/patches/0010-Avoid_deadlock_between_transport_and_transaction.patch
new file mode 100644
index 0000000..834e5d5
--- /dev/null
+++ b/libs/pjproject/patches/0010-Avoid_deadlock_between_transport_and_transaction.patch
@@ -0,0 +1,154 @@
+From edde06f261ac807a89a6086b7f03460867675f95 Mon Sep 17 00:00:00 2001
+From: Nanang Izzuddin <nanang@teluu.com>
+Date: Tue, 1 Jul 2025 15:13:36 +0700
+Subject: [PATCH] Avoid deadlock between transport and transaction (#4453)
+
+---
+ pjsip/include/pjsip/sip_transaction.h | 1 +
+ pjsip/src/pjsip/sip_transaction.c | 101 ++++++++++++++++++++++----
+ 2 files changed, 88 insertions(+), 14 deletions(-)
+
+--- a/pjsip/include/pjsip/sip_transaction.h
++++ b/pjsip/include/pjsip/sip_transaction.h
+@@ -141,6 +141,7 @@ struct pjsip_transaction
+ int retransmit_count;/**< Retransmission count. */
+ pj_timer_entry retransmit_timer;/**< Retransmit timer. */
+ pj_timer_entry timeout_timer; /**< Timeout timer. */
++ pj_timer_entry misc_timer; /**< Miscellaneous timer. */
+
+ /** Module specific data. */
+ void *mod_data[PJSIP_MAX_MODULE];
+--- a/pjsip/src/pjsip/sip_transaction.c
++++ b/pjsip/src/pjsip/sip_transaction.c
+@@ -140,6 +140,7 @@ static int max_retrans_count = -1;
+ #define TRANSPORT_ERR_TIMER 3
+ #define TRANSPORT_DISC_TIMER 4
+ #define TERMINATE_TIMER 5
++#define TRANSPORT_CB_TIMER 6
+
+ /* Flags for tsx_set_state() */
+ enum
+@@ -2265,23 +2266,21 @@ static void send_msg_callback( pjsip_sen
+ }
+
+
+-/* Transport callback. */
+-static void transport_callback(void *token, pjsip_tx_data *tdata,
+- pj_ssize_t sent)
+-{
+- pjsip_transaction *tsx = (pjsip_transaction*) token;
++/* Transport callback parameter. */
++struct tp_cb_param {
++ pjsip_transaction* tsx;
++ pjsip_tx_data* tdata;
++ pj_ssize_t sent;
++};
+
+- /* Check if the transaction layer has been shutdown. */
+- if (mod_tsx_layer.mod.id < 0)
+- return;
+
+- /* In other circumstances, locking tsx->grp_lock AFTER transport mutex
+- * will introduce deadlock if another thread is currently sending a
+- * SIP message to the transport. But this should be safe as there should
+- * be no way this callback could be called while another thread is
+- * sending a message.
+- */
++/* Transport callback actual implementation. */
++static void transport_callback_impl(pjsip_transaction *tsx,
++ pjsip_tx_data* tdata,
++ pj_ssize_t sent)
++{
+ pj_grp_lock_acquire(tsx->grp_lock);
++
+ tsx->transport_flag &= ~(TSX_HAS_PENDING_TRANSPORT);
+
+ if (sent > 0 || tsx->role == PJSIP_ROLE_UAS) {
+@@ -2299,6 +2298,7 @@ static void transport_callback(void *tok
+ tsx_set_state( tsx, PJSIP_TSX_STATE_DESTROYED,
+ PJSIP_EVENT_UNKNOWN, NULL, 0 );
+ pj_grp_lock_release(tsx->grp_lock);
++ pj_grp_lock_dec_ref(tsx->grp_lock);
+ return;
+ }
+
+@@ -2354,6 +2354,79 @@ static void transport_callback(void *tok
+ }
+
+
++/* Timer callback for transport callback.
++ * This is currently only used to avoid deadlock due to inversed locking order
++ * between transport and transaction.
++ */
++static void tsx_misc_timer_callback(pj_timer_heap_t *theap,
++ pj_timer_entry *entry)
++{
++ PJ_UNUSED_ARG(theap);
++
++ if (entry->id == TRANSPORT_CB_TIMER) {
++ struct tp_cb_param* param = (struct tp_cb_param*)entry->user_data;
++
++ /* Check if the transaction layer has been shutdown. */
++ if (mod_tsx_layer.mod.id >= 0) {
++ /* Call transport callback implementation */
++ transport_callback_impl(param->tsx, param->tdata, param->sent);
++ }
++
++ /* Release tdata */
++ pjsip_tx_data_dec_ref(param->tdata);
++ }
++}
++
++
++/* Transport callback. */
++static void transport_callback(void *token, pjsip_tx_data *tdata,
++ pj_ssize_t sent)
++{
++ pjsip_transaction *tsx = (pjsip_transaction*) token;
++ pj_status_t status;
++
++ /* Check if the transaction layer has been shutdown. */
++ if (mod_tsx_layer.mod.id < 0)
++ return;
++
++ /* In other circumstances, locking tsx->grp_lock AFTER transport mutex
++ * will introduce deadlock if another thread is currently sending a
++ * SIP message to the transport. But this should be safe as there should
++ * be no way this callback could be called while another thread is
++ * sending a message.
++ */
++ // Deadlock does happen, see #4453.
++ // So now, to avoid deadlock, we'll try to acquire the group lock first,
++ // and if it fails, we'll schedule the processing via timer.
++ status = pj_grp_lock_tryacquire(tsx->grp_lock);
++ if (status != PJ_SUCCESS) {
++ pj_time_val delay = { 0, 0 };
++ struct tp_cb_param *param = NULL;
++
++ lock_timer(tsx);
++ tsx_cancel_timer(tsx, &tsx->misc_timer);
++
++ /* Increment tdata ref count to avoid premature destruction.
++ * Note that tsx ref count is already handled by tsx_schedule_timer().
++ */
++ pjsip_tx_data_add_ref(tdata);
++
++ param = PJ_POOL_ZALLOC_T(tsx->pool, struct tp_cb_param);
++ param->sent = sent;
++ param->tdata = tdata;
++ param->tsx = tsx;
++ pj_timer_entry_init(&tsx->misc_timer, TIMER_INACTIVE, param,
++ &tsx_misc_timer_callback);
++ tsx_schedule_timer(tsx, &tsx->misc_timer, &delay, TRANSPORT_CB_TIMER);
++ unlock_timer(tsx);
++ return;
++ }
++
++ transport_callback_impl(tsx, tdata, sent);
++ pj_grp_lock_release(tsx->grp_lock);
++}
++
++
+ /*
+ * Callback when transport state changes.
+ */