"check whether UPDATE is supported on outgoing calls", commit
5de36abd:
In ASTERISK-27095 an issue had been fixed because of which chan_pjsip was not
trying to send UPDATE messages when connected_line_method was set to invite.
However this only solved the issue for incoming INVITES. For outgoing INVITES
(important when transferring calls) the options variable needs to be updated
at a different place.
"Add patch for double free issue in timer heap", commit
9c11399b:
Fixed #2172: Avoid double reference counter decrements in
timer in the scenario of race condition between
pj_timer_heap_cancel() and pj_timer_heap_poll().
"Add timer patch from pjproject r5934", commit
d4cd2a97.
Signed-off-by: Andre Heider <a.heider@gmail.com>
PKG_NAME:=pjproject
PKG_VERSION:=2.8
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE:=pjproject-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=http://www.pjsip.org/release/$(PKG_VERSION)
--- /dev/null
+--- a/pjsip/src/pjsip-ua/sip_inv.c
++++ b/pjsip/src/pjsip-ua/sip_inv.c
+@@ -4185,6 +4185,29 @@ static void inv_on_state_calling( pjsip_
+
+ if (tsx->status_code != 100) {
+
++ if (inv->role == PJSIP_ROLE_UAC) {
++ pjsip_rx_data *rdata = e->body.tsx_state.src.rdata;
++ pjsip_allow_hdr *allow = NULL;
++ pjsip_msg *msg = rdata->msg_info.msg;
++
++ if (msg) {
++ allow = (pjsip_allow_hdr*) pjsip_msg_find_hdr(msg, PJSIP_H_ALLOW,
++ NULL);
++ }
++ if (allow) {
++ unsigned i;
++ const pj_str_t STR_UPDATE = { "UPDATE", 6 };
++
++ for (i=0; i<allow->count; ++i) {
++ if (pj_stricmp(&allow->values[i], &STR_UPDATE)==0) {
++ /* UPDATE is present in Allow */
++ inv->options |= PJSIP_INV_SUPPORT_UPDATE;
++ break;
++ }
++ }
++ }
++ }
++
+ if (dlg->remote.info->tag.slen)
+ inv_set_state(inv, PJSIP_INV_STATE_EARLY, e);
+
--- /dev/null
+From 1fed39fe1488abd654a5488b5e6ad59b4b973331 Mon Sep 17 00:00:00 2001
+From: nanang <nanang@localhost>
+Date: Tue, 8 Jan 2019 09:07:47 +0000
+Subject: [PATCH 1/5] Fixed #2172: Avoid double reference counter decrements in
+ timer in the scenario of race condition between pj_timer_heap_cancel() and
+ pj_timer_heap_poll().
+
+---
+ pjlib/src/pj/timer.c | 17 ++++++++++-------
+ 1 file changed, 10 insertions(+), 7 deletions(-)
+
+--- a/pjlib/src/pj/timer.c
++++ b/pjlib/src/pj/timer.c
+@@ -580,13 +580,16 @@ static int cancel_timer(pj_timer_heap_t
+
+ lock_timer_heap(ht);
+ count = cancel(ht, entry, flags | F_DONT_CALL);
+- if (flags & F_SET_ID) {
+- entry->id = id_val;
+- }
+- if (entry->_grp_lock) {
+- pj_grp_lock_t *grp_lock = entry->_grp_lock;
+- entry->_grp_lock = NULL;
+- pj_grp_lock_dec_ref(grp_lock);
++ if (count > 0) {
++ /* Timer entry found & cancelled */
++ if (flags & F_SET_ID) {
++ entry->id = id_val;
++ }
++ if (entry->_grp_lock) {
++ pj_grp_lock_t *grp_lock = entry->_grp_lock;
++ entry->_grp_lock = NULL;
++ pj_grp_lock_dec_ref(grp_lock);
++ }
+ }
+ unlock_timer_heap(ht);
+
--- /dev/null
+From 9f57a5728aaec1949908bf7bbd15768fce74e315 Mon Sep 17 00:00:00 2001
+From: Nanang Izzuddin <nanang@teluu.com>
+Date: Wed, 13 Feb 2019 06:51:09 +0000
+Subject: [PATCH] Re #2176: Removed pop_freelist() + push_freelist() after
+ remove_node() as they are not only unnecessary, they cause problem.
+
+git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@5934 74dad513-b988-da41-8d7b-12977e46ad98
+---
+ pjlib/src/pj/timer.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- a/pjlib/src/pj/timer.c
++++ b/pjlib/src/pj/timer.c
+@@ -633,7 +633,8 @@ PJ_DEF(unsigned) pj_timer_heap_poll( pj_
+ {
+ pj_timer_entry *node = remove_node(ht, 0);
+ /* Avoid re-use of this timer until the callback is done. */
+- pj_timer_id_t node_timer_id = pop_freelist(ht);
++ ///Not necessary, even causes problem (see also #2176).
++ ///pj_timer_id_t node_timer_id = pop_freelist(ht);
+ pj_grp_lock_t *grp_lock;
+
+ ++count;
+@@ -653,7 +654,7 @@ PJ_DEF(unsigned) pj_timer_heap_poll( pj_
+
+ lock_timer_heap(ht);
+ /* Now, the timer is really free for re-use. */
+- push_freelist(ht, node_timer_id);
++ ///push_freelist(ht, node_timer_id);
+ }
+ if (ht->cur_size && next_delay) {
+ *next_delay = ht->heap[0]->_timer_value;