[Asterisk-code-review] pjproject bundled: Move to pjproject 2.5 (asterisk[master])

George Joseph asteriskteam at digium.com
Mon May 30 18:20:35 CDT 2016


George Joseph has uploaded a new change for review.

  https://gerrit.asterisk.org/2920

Change subject: pjproject_bundled:  Move to pjproject 2.5
......................................................................

pjproject_bundled:  Move to pjproject 2.5

Although all the patches we had against 2.4.5 were applied by Teluu,
a new bug was introduced preventing re-use of tcp and tls transports
This patch removes all the previous patches against 2.4.5, updates
the version to 2.5, and adds a new patch to correct the transport
re-use problem.

Change-Id: I0dc6c438c3910f7887418a5832ca186aea23d068
---
D third-party/pjproject/patches/0001-2.4.5-fix-for-tls-async-ops.patch
D third-party/pjproject/patches/0001-Bump-tcp-tls-and-transaction-log-levels-from-1-to-3.patch
D third-party/pjproject/patches/0001-ioqueue-Enable-epoll-in-aconfigure.ac.patch
D third-party/pjproject/patches/0001-pjsip-apps-src-python-setup.py-Take-make-from-the-en.patch
D third-party/pjproject/patches/0001-sip_parser.c-Fix-pjsip_VIA_PARAM_SPEC_ESC.patch
D third-party/pjproject/patches/0001-sip_parser.c-Remove-wholesale-strip-from-parse_param.patch
D third-party/pjproject/patches/0001-sip_transport-Search-for-transport-even-if-listener-.patch
A third-party/pjproject/patches/0001-sip_transport_tcp-tls-Set-factory-on-transports-crea.patch
D third-party/pjproject/patches/0002-aconfigure.ac-Fix-autoconf-issue-with-opencore-amrnb.patch
M third-party/versions.mak
10 files changed, 49 insertions(+), 673 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/20/2920/1

diff --git a/third-party/pjproject/patches/0001-2.4.5-fix-for-tls-async-ops.patch b/third-party/pjproject/patches/0001-2.4.5-fix-for-tls-async-ops.patch
deleted file mode 100644
index 33fc8ea..0000000
--- a/third-party/pjproject/patches/0001-2.4.5-fix-for-tls-async-ops.patch
+++ /dev/null
@@ -1,224 +0,0 @@
-diff --git a/pjlib/include/pj/ssl_sock.h b/pjlib/include/pj/ssl_sock.h
-index 1682bda..a69af32 100644
---- a/pjlib/include/pj/ssl_sock.h
-+++ b/pjlib/include/pj/ssl_sock.h
-@@ -864,6 +864,18 @@ PJ_DECL(void) pj_ssl_sock_param_default(pj_ssl_sock_param *param);
- 
- 
- /**
-+ * Duplicate pj_ssl_sock_param.
-+ *
-+ * @param pool	Pool to allocate memory.
-+ * @param dst	Destination parameter.
-+ * @param src	Source parameter.
-+ */
-+PJ_DECL(void) pj_ssl_sock_param_copy(pj_pool_t *pool, 
-+				     pj_ssl_sock_param *dst,
-+				     const pj_ssl_sock_param *src);
-+
-+
-+/**
-  * Create secure socket instance.
-  *
-  * @param pool		The pool for allocating secure socket instance.
-@@ -1115,6 +1127,30 @@ PJ_DECL(pj_status_t) pj_ssl_sock_start_accept(pj_ssl_sock_t *ssock,
- 
- 
- /**
-+ * Same as #pj_ssl_sock_start_accept(), but application can provide
-+ * a secure socket parameter, which will be used to create a new secure
-+ * socket reported in \a on_accept_complete() callback when there is
-+ * an incoming connection.
-+ *
-+ * @param ssock		The secure socket.
-+ * @param pool		Pool used to allocate some internal data for the
-+ *			operation.
-+ * @param localaddr	Local address to bind on.
-+ * @param addr_len	Length of buffer containing local address.
-+ * @param newsock_param	Secure socket parameter for new accepted sockets.
-+ *
-+ * @return		PJ_SUCCESS if the operation has been successful,
-+ *			or the appropriate error code on failure.
-+ */
-+PJ_DECL(pj_status_t)
-+pj_ssl_sock_start_accept2(pj_ssl_sock_t *ssock,
-+			  pj_pool_t *pool,
-+			  const pj_sockaddr_t *local_addr,
-+			  int addr_len,
-+			  const pj_ssl_sock_param *newsock_param);
-+
-+
-+/**
-  * Starts asynchronous socket connect() operation and SSL/TLS handshaking 
-  * for this socket. Once the connection is done (either successfully or not),
-  * the \a on_connect_complete() callback will be called.
-diff --git a/pjlib/src/pj/ssl_sock_common.c b/pjlib/src/pj/ssl_sock_common.c
-index 913efee..717ab1d 100644
---- a/pjlib/src/pj/ssl_sock_common.c
-+++ b/pjlib/src/pj/ssl_sock_common.c
-@@ -19,6 +19,7 @@
- #include <pj/ssl_sock.h>
- #include <pj/assert.h>
- #include <pj/errno.h>
-+#include <pj/pool.h>
- #include <pj/string.h>
- 
- /*
-@@ -48,6 +49,31 @@ PJ_DEF(void) pj_ssl_sock_param_default(pj_ssl_sock_param *param)
- }
- 
- 
-+/*
-+ * Duplicate SSL socket parameter.
-+ */
-+PJ_DEF(void) pj_ssl_sock_param_copy( pj_pool_t *pool, 
-+				     pj_ssl_sock_param *dst,
-+				     const pj_ssl_sock_param *src)
-+{
-+    /* Init secure socket param */
-+    pj_memcpy(dst, src, sizeof(*dst));
-+    if (src->ciphers_num > 0) {
-+	unsigned i;
-+	dst->ciphers = (pj_ssl_cipher*)
-+			pj_pool_calloc(pool, src->ciphers_num, 
-+				       sizeof(pj_ssl_cipher));
-+	for (i = 0; i < src->ciphers_num; ++i)
-+	    dst->ciphers[i] = src->ciphers[i];
-+    }
-+
-+    if (src->server_name.slen) {
-+        /* Server name must be null-terminated */
-+        pj_strdup_with_null(pool, &dst->server_name, &src->server_name);
-+    }
-+}
-+
-+
- PJ_DEF(pj_status_t) pj_ssl_cert_get_verify_status_strings(
- 						pj_uint32_t verify_status, 
- 						const char *error_strings[],
-diff --git a/pjlib/src/pj/ssl_sock_ossl.c b/pjlib/src/pj/ssl_sock_ossl.c
-index 40a5a1e..6a701b7 100644
---- a/pjlib/src/pj/ssl_sock_ossl.c
-+++ b/pjlib/src/pj/ssl_sock_ossl.c
-@@ -141,6 +141,7 @@ struct pj_ssl_sock_t
-     pj_pool_t		 *pool;
-     pj_ssl_sock_t	 *parent;
-     pj_ssl_sock_param	  param;
-+    pj_ssl_sock_param	  newsock_param;
-     pj_ssl_cert_t	 *cert;
-     
-     pj_ssl_cert_info	  local_cert_info;
-@@ -1757,11 +1758,9 @@ static pj_bool_t asock_on_accept_complete (pj_activesock_t *asock,
-     unsigned i;
-     pj_status_t status;
- 
--    PJ_UNUSED_ARG(src_addr_len);
--
-     /* Create new SSL socket instance */
--    status = pj_ssl_sock_create(ssock_parent->pool, &ssock_parent->param,
--				&ssock);
-+    status = pj_ssl_sock_create(ssock_parent->pool,
-+    				&ssock_parent->newsock_param, &ssock);
-     if (status != PJ_SUCCESS)
- 	goto on_return;
- 
-@@ -2183,20 +2182,8 @@ PJ_DEF(pj_status_t) pj_ssl_sock_create (pj_pool_t *pool,
- 	return status;
- 
-     /* Init secure socket param */
--    ssock->param = *param;
-+    pj_ssl_sock_param_copy(pool, &ssock->param, param);
-     ssock->param.read_buffer_size = ((ssock->param.read_buffer_size+7)>>3)<<3;
--    if (param->ciphers_num > 0) {
--	unsigned i;
--	ssock->param.ciphers = (pj_ssl_cipher*)
--			       pj_pool_calloc(pool, param->ciphers_num, 
--					      sizeof(pj_ssl_cipher));
--	for (i = 0; i < param->ciphers_num; ++i)
--	    ssock->param.ciphers[i] = param->ciphers[i];
--    }
--
--    /* Server name must be null-terminated */
--    pj_strdup_with_null(pool, &ssock->param.server_name, 
--			&param->server_name);
- 
-     /* Finally */
-     *p_ssock = ssock;
-@@ -2617,12 +2604,36 @@ PJ_DEF(pj_status_t) pj_ssl_sock_start_accept (pj_ssl_sock_t *ssock,
- 					      const pj_sockaddr_t *localaddr,
- 					      int addr_len)
- {
-+    return pj_ssl_sock_start_accept2(ssock, pool, localaddr, addr_len,
-+    				     &ssock->param);
-+}
-+
-+
-+/**
-+ * Same as #pj_ssl_sock_start_accept(), but application provides parameter
-+ * for new accepted secure sockets.
-+ */
-+PJ_DEF(pj_status_t)
-+pj_ssl_sock_start_accept2(pj_ssl_sock_t *ssock,
-+			  pj_pool_t *pool,
-+			  const pj_sockaddr_t *localaddr,
-+			  int addr_len,
-+			  const pj_ssl_sock_param *newsock_param)
-+{
-     pj_activesock_cb asock_cb;
-     pj_activesock_cfg asock_cfg;
-     pj_status_t status;
- 
-     PJ_ASSERT_RETURN(ssock && pool && localaddr && addr_len, PJ_EINVAL);
- 
-+    /* Verify new socket parameters */
-+    if (newsock_param->grp_lock != ssock->param.grp_lock ||
-+        newsock_param->sock_af != ssock->param.sock_af ||
-+        newsock_param->sock_type != ssock->param.sock_type)
-+    {
-+        return PJ_EINVAL;
-+    }
-+
-     /* Create socket */
-     status = pj_sock_socket(ssock->param.sock_af, ssock->param.sock_type, 0, 
- 			    &ssock->sock);
-@@ -2691,6 +2702,7 @@ PJ_DEF(pj_status_t) pj_ssl_sock_start_accept (pj_ssl_sock_t *ssock,
- 	goto on_error;
- 
-     /* Start accepting */
-+    pj_ssl_sock_param_copy(pool, &ssock->newsock_param, newsock_param);
-     status = pj_activesock_start_accept(ssock->asock, pool);
-     if (status != PJ_SUCCESS)
- 	goto on_error;
-diff --git a/pjsip/src/pjsip/sip_transport_tls.c b/pjsip/src/pjsip/sip_transport_tls.c
-index a9e95fb..91d99a7 100644
---- a/pjsip/src/pjsip/sip_transport_tls.c
-+++ b/pjsip/src/pjsip/sip_transport_tls.c
-@@ -314,7 +314,7 @@ PJ_DEF(pj_status_t) pjsip_tls_transport_start2( pjsip_endpoint *endpt,
-     int af, sip_ssl_method;
-     pj_uint32_t sip_ssl_proto;
-     struct tls_listener *listener;
--    pj_ssl_sock_param ssock_param;
-+    pj_ssl_sock_param ssock_param, newsock_param;
-     pj_sockaddr *listener_addr;
-     pj_bool_t has_listener;
-     pj_status_t status;
-@@ -473,9 +473,14 @@ PJ_DEF(pj_status_t) pjsip_tls_transport_start2( pjsip_endpoint *endpt,
-      */
-     has_listener = PJ_FALSE;
- 
--    status = pj_ssl_sock_start_accept(listener->ssock, pool, 
-+    pj_memcpy(&newsock_param, &ssock_param, sizeof(newsock_param));
-+    newsock_param.async_cnt = 1;
-+    newsock_param.cb.on_data_read = &on_data_read;
-+    newsock_param.cb.on_data_sent = &on_data_sent;
-+    status = pj_ssl_sock_start_accept2(listener->ssock, pool, 
- 			  (pj_sockaddr_t*)listener_addr, 
--			  pj_sockaddr_get_len((pj_sockaddr_t*)listener_addr));
-+			  pj_sockaddr_get_len((pj_sockaddr_t*)listener_addr),
-+			  &newsock_param);
-     if (status == PJ_SUCCESS || status == PJ_EPENDING) {
- 	pj_ssl_sock_info info;
- 	has_listener = PJ_TRUE;
--- 
-cgit v0.11.2
-
diff --git a/third-party/pjproject/patches/0001-Bump-tcp-tls-and-transaction-log-levels-from-1-to-3.patch b/third-party/pjproject/patches/0001-Bump-tcp-tls-and-transaction-log-levels-from-1-to-3.patch
deleted file mode 100644
index 9873abf..0000000
--- a/third-party/pjproject/patches/0001-Bump-tcp-tls-and-transaction-log-levels-from-1-to-3.patch
+++ /dev/null
@@ -1,70 +0,0 @@
-From a147b72df1ec150c1d733e882225db86142fb339 Mon Sep 17 00:00:00 2001
-From: George Joseph <george.joseph at fairview5.com>
-Date: Sun, 21 Feb 2016 10:01:53 -0700
-Subject: [PATCH] Bump tcp/tls and transaction log levels from 1 to 3
-
-sip_transport_tcp, sip_transport_tls and sip_transaction are printing messages
-at log level 1 or 2 for things that are transient, recoverable, possibly
-expected, or are handled with return codes. A good example of this is if we're
-trying to send an OPTIONS message to a TCP client that has disappeared.  Both
-sip_transport_tcp and sip_transaction are printing "connection refused"
-messages because the remote client isn't listening.  This is generally expected
-behavior and it should be up to the app caller to determine if an error message
-is warranted.
----
- pjsip/src/pjsip/sip_transaction.c   | 4 ++--
- pjsip/src/pjsip/sip_transport_tcp.c | 2 +-
- pjsip/src/pjsip/sip_transport_tls.c | 2 +-
- 3 files changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/pjsip/src/pjsip/sip_transaction.c b/pjsip/src/pjsip/sip_transaction.c
-index 46bd971..1b4fdb7 100644
---- a/pjsip/src/pjsip/sip_transaction.c
-+++ b/pjsip/src/pjsip/sip_transaction.c
-@@ -1898,7 +1898,7 @@ static void send_msg_callback( pjsip_send_state *send_state,
- 
- 	    err =pj_strerror((pj_status_t)-sent, errmsg, sizeof(errmsg));
- 
--	    PJ_LOG(2,(tsx->obj_name,
-+	    PJ_LOG(3,(tsx->obj_name,
- 		      "Failed to send %s! err=%d (%s)",
- 		      pjsip_tx_data_get_info(send_state->tdata), -sent,
- 		      errmsg));
-@@ -1938,7 +1938,7 @@ static void send_msg_callback( pjsip_send_state *send_state,
- 	    }
- 
- 	} else {
--	    PJ_PERROR(2,(tsx->obj_name, (pj_status_t)-sent,
-+	    PJ_PERROR(3,(tsx->obj_name, (pj_status_t)-sent,
- 		         "Temporary failure in sending %s, "
- 		         "will try next server",
- 		         pjsip_tx_data_get_info(send_state->tdata)));
-diff --git a/pjsip/src/pjsip/sip_transport_tcp.c b/pjsip/src/pjsip/sip_transport_tcp.c
-index 222cb13..1bbb324 100644
---- a/pjsip/src/pjsip/sip_transport_tcp.c
-+++ b/pjsip/src/pjsip/sip_transport_tcp.c
-@@ -164,7 +164,7 @@ static void tcp_perror(const char *sender, const char *title,
- 
-     pj_strerror(status, errmsg, sizeof(errmsg));
- 
--    PJ_LOG(1,(sender, "%s: %s [code=%d]", title, errmsg, status));
-+    PJ_LOG(3,(sender, "%s: %s [code=%d]", title, errmsg, status));
- }
- 
- 
-diff --git a/pjsip/src/pjsip/sip_transport_tls.c b/pjsip/src/pjsip/sip_transport_tls.c
-index 617d7f5..a83ac32 100644
---- a/pjsip/src/pjsip/sip_transport_tls.c
-+++ b/pjsip/src/pjsip/sip_transport_tls.c
-@@ -170,7 +170,7 @@ static void tls_perror(const char *sender, const char *title,
- 
-     pj_strerror(status, errmsg, sizeof(errmsg));
- 
--    PJ_LOG(1,(sender, "%s: %s [code=%d]", title, errmsg, status));
-+    PJ_LOG(3,(sender, "%s: %s [code=%d]", title, errmsg, status));
- }
- 
- 
--- 
-2.5.0
-
diff --git a/third-party/pjproject/patches/0001-ioqueue-Enable-epoll-in-aconfigure.ac.patch b/third-party/pjproject/patches/0001-ioqueue-Enable-epoll-in-aconfigure.ac.patch
deleted file mode 100644
index 36b6c65..0000000
--- a/third-party/pjproject/patches/0001-ioqueue-Enable-epoll-in-aconfigure.ac.patch
+++ /dev/null
@@ -1,80 +0,0 @@
-From b5c0bc905911f75e08987e6833075481fe16dab2 Mon Sep 17 00:00:00 2001
-From: George Joseph <george.joseph at fairview5.com>
-Date: Mon, 22 Feb 2016 13:05:59 -0700
-Subject: [PATCH] ioqueue:  Enable epoll in aconfigure.ac
-
-Although the --enable-epoll option was being accepted, the result
-was always forced to select.  This patch updates aconfigure.ac
-to properly set the value of ac_linux_poll if --enable-epoll is
-specified.
----
- README.txt                           |  1 +
- aconfigure                           | 11 +++++++----
- aconfigure.ac                        |  7 +++++--
- pjlib/include/pj/compat/os_auto.h.in |  3 +++
- 4 files changed, 16 insertions(+), 6 deletions(-)
-
-diff --git a/README.txt b/README.txt
-index bc45da8..48415fd 100644
---- a/README.txt
-+++ b/README.txt
-@@ -463,6 +463,7 @@ Using Default Settings
-    $ ./configure --help
-    ...
-    Optional Features:
-+   --enable-epoll           Use epoll on Linux instead of select
-    --disable-floating-point	Disable floating point where possible
-    --disable-sound 		Exclude sound (i.e. use null sound)
-    --disable-small-filter 	Exclude small filter in resampling
-diff --git a/aconfigure.ac b/aconfigure.ac
-index 2f71abb..3e88124 100644
---- a/aconfigure.ac
-+++ b/aconfigure.ac
-@@ -410,6 +410,7 @@ dnl ######################
- dnl # ioqueue selection
- dnl # 
- AC_SUBST(ac_os_objs)
-+AC_SUBST(ac_linux_poll)
- AC_MSG_CHECKING([ioqueue backend])
- AC_ARG_ENABLE(epoll,
- 	      AC_HELP_STRING([--enable-epoll],
-@@ -417,10 +418,13 @@ AC_ARG_ENABLE(epoll,
- 	      [
- 		ac_os_objs=ioqueue_epoll.o
- 		AC_MSG_RESULT([/dev/epoll])
-+		AC_DEFINE(PJ_HAS_LINUX_EPOLL,1)
-+		ac_linux_poll=epoll
- 	      ],
- 	      [
- 		ac_os_objs=ioqueue_select.o
--	        AC_MSG_RESULT([select()]) 
-+		AC_MSG_RESULT([select()])
-+		ac_linux_poll=select
- 	      ])
- 
- AC_SUBST(ac_shared_libraries)
-@@ -1879,7 +1883,6 @@ esac
- 
- 
- AC_SUBST(target)
--AC_SUBST(ac_linux_poll,select)
- AC_SUBST(ac_host,unix)
- AC_SUBST(ac_main_obj)
- case $target in
-diff --git a/pjlib/include/pj/compat/os_auto.h.in b/pjlib/include/pj/compat/os_auto.h.in
-index 77980d3..c8e73b2 100644
---- a/pjlib/include/pj/compat/os_auto.h.in
-+++ b/pjlib/include/pj/compat/os_auto.h.in
-@@ -128,6 +128,9 @@
-  */
- #undef PJ_SELECT_NEEDS_NFDS
- 
-+/* Was Linux epoll support enabled */
-+#undef PJ_HAS_LINUX_EPOLL
-+
- /* Is errno a good way to retrieve OS errors?
-  */
- #undef PJ_HAS_ERRNO_VAR
--- 
-2.5.0
-
diff --git a/third-party/pjproject/patches/0001-pjsip-apps-src-python-setup.py-Take-make-from-the-en.patch b/third-party/pjproject/patches/0001-pjsip-apps-src-python-setup.py-Take-make-from-the-en.patch
deleted file mode 100644
index 80f8bc0..0000000
--- a/third-party/pjproject/patches/0001-pjsip-apps-src-python-setup.py-Take-make-from-the-en.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-From 61668b8fcaa0f2a8a05100097284c0c427600033 Mon Sep 17 00:00:00 2001
-From: George Joseph <george.joseph at fairview5.com>
-Date: Mon, 2 May 2016 17:08:15 -0600
-Subject: [PATCH] pjsip-apps/src/python/setup.py:  Take "make" from the
- environment
-
-With "make" hard coded in setup.py, it chokes on FreeBSD because the system
-make command isn't GNU compatibile.  This patch allows setup.py to take the
-name of the make command from the MAKE environment variable if it exists.
-If it doesn't, it defaults to "make".
----
- pjsip-apps/src/python/setup.py | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/pjsip-apps/src/python/setup.py b/pjsip-apps/src/python/setup.py
-index 69a9859..ea1427d 100644
---- a/pjsip-apps/src/python/setup.py
-+++ b/pjsip-apps/src/python/setup.py
-@@ -60,25 +60,25 @@ if pj_version_suffix:
- 	pj_version += "-" + pj_version_suffix
- 
- #print 'PJ_VERSION = "'+ pj_version + '"'
--
-+MAKE = os.environ.get('MAKE') or "make"
- 
- # Fill in pj_inc_dirs
- pj_inc_dirs = []
--f = os.popen("make -f helper.mak inc_dir")
-+f = os.popen("%s -f helper.mak inc_dir" % MAKE)
- for line in f:
-     pj_inc_dirs.append(line.rstrip("\r\n"))
- f.close()
- 
- # Fill in pj_lib_dirs
- pj_lib_dirs = []
--f = os.popen("make -f helper.mak lib_dir")
-+f = os.popen("%s -f helper.mak lib_dir" % MAKE)
- for line in f:
-     pj_lib_dirs.append(line.rstrip("\r\n"))
- f.close()
- 
- # Fill in pj_libs
- pj_libs = []
--f = os.popen("make -f helper.mak libs")
-+f = os.popen("%s -f helper.mak libs" % MAKE)
- for line in f:
-     pj_libs.append(line.rstrip("\r\n"))
- f.close()
--- 
-2.5.5
-
diff --git a/third-party/pjproject/patches/0001-sip_parser.c-Fix-pjsip_VIA_PARAM_SPEC_ESC.patch b/third-party/pjproject/patches/0001-sip_parser.c-Fix-pjsip_VIA_PARAM_SPEC_ESC.patch
deleted file mode 100644
index 60c27cb..0000000
--- a/third-party/pjproject/patches/0001-sip_parser.c-Fix-pjsip_VIA_PARAM_SPEC_ESC.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 0fc7ef5f01be9cc74d184c3ca3a973ff1ef44c93 Mon Sep 17 00:00:00 2001
-From: George Joseph <george.joseph at fairview5.com>
-Date: Sun, 10 Apr 2016 12:54:06 -0600
-Subject: [PATCH] sip_parser.c: Fix pjsip_VIA_PARAM_SPEC_ESC
-
-pjsip_VIA_PARAM_SPEC_ESC should have been pjsip_TOKEN_SPEC_ESC + ":" but
-instead of appending ":" to pjsip_VIA_PARAM_SPEC_ESC it was being appended
-to pjsip_VIA_PARAM_SPEC again.  This was causing parsing of Via headers
-to fail when an ipv6 address was in a "received" param and
-PJSIP_UNESCAPE_IN_PLACE was used.  Probably just a copy/paste error.
----
- pjsip/src/pjsip/sip_parser.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/pjsip/src/pjsip/sip_parser.c b/pjsip/src/pjsip/sip_parser.c
-index 378c22f..c18faa3 100644
---- a/pjsip/src/pjsip/sip_parser.c
-+++ b/pjsip/src/pjsip/sip_parser.c
-@@ -327,7 +327,7 @@ static pj_status_t init_parser()
- 
-     status = pj_cis_dup(&pconst.pjsip_VIA_PARAM_SPEC_ESC, &pconst.pjsip_TOKEN_SPEC_ESC);
-     PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
--    pj_cis_add_str(&pconst.pjsip_VIA_PARAM_SPEC, ":");
-+    pj_cis_add_str(&pconst.pjsip_VIA_PARAM_SPEC_ESC, ":");
- 
-     status = pj_cis_dup(&pconst.pjsip_HOST_SPEC, &pconst.pjsip_ALNUM_SPEC);
-     PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);
--- 
-2.5.5
-
diff --git a/third-party/pjproject/patches/0001-sip_parser.c-Remove-wholesale-strip-from-parse_param.patch b/third-party/pjproject/patches/0001-sip_parser.c-Remove-wholesale-strip-from-parse_param.patch
deleted file mode 100644
index e0bd912..0000000
--- a/third-party/pjproject/patches/0001-sip_parser.c-Remove-wholesale-strip-from-parse_param.patch
+++ /dev/null
@@ -1,55 +0,0 @@
-From ce426249ec1270f27560919791f3e13eaeea9152 Mon Sep 17 00:00:00 2001
-From: George Joseph <george.joseph at fairview5.com>
-Date: Tue, 12 Apr 2016 14:09:53 -0600
-Subject: [PATCH] sip_parser.c:  Remove wholesale '[]' strip from
- parse_param_impl
-
-The wholesale stripping of '[]' from header parameters causes issues if
-something (like a port) occurrs after the final ']'.
-
-'[2001:a::b]' will correctly parse to '2001:a::b'
-'[2001:a::b]:8080' will correctly parse to '2001:a::b' but the scanner is left
-with ':8080' and parsing stops with a syntax error.
-
-I can't even find a case where stripping the '[]' is a good thing anyway.  Even
-if you continued to parse and resulted in a string that looks like this...
-'2001:a::b:8080', it's not valid.
-
-This came up in Asterisk because Kamailio sends us a Contact with an alias
-URI parameter that has an IPv6 address in it like this:
-Contact: <sip:1171 at 127.0.0.1:5080;alias=[2001:1:2::3]~43691~6>
-which should be legal but causes a syntax error because of the characters
-after the final ']'.  Even if it didn't, the '[]' should still not be stripped.
-
-I've run the Asterisk Test Suite for PJSIP (252 tests) many of which are IPv6
-enabled.  No issues were caused by removing the code that strips the '[]'.
-
-I tried running 'make pjsip-test' but that fails even without my change. :)
-
-The Asterisk ticket is: https://issues.asterisk.org/jira/browse/ASTERISK-25123
----
- pjsip/src/pjsip/sip_parser.c | 8 --------
- 1 file changed, 8 deletions(-)
-
-diff --git a/pjsip/src/pjsip/sip_parser.c b/pjsip/src/pjsip/sip_parser.c
-index c18faa3..98eb5ea 100644
---- a/pjsip/src/pjsip/sip_parser.c
-+++ b/pjsip/src/pjsip/sip_parser.c
-@@ -1149,14 +1149,6 @@ static void parse_param_imp( pj_scanner *scanner, pj_pool_t *pool,
- 		    pvalue->ptr++;
- 		    pvalue->slen -= 2;
- 		}
--	    } else if (*scanner->curptr == '[') {
--		/* pvalue can be a quoted IPv6; in this case, the
--		 * '[' and ']' quote characters are to be removed
--		 * from the pvalue. 
--		 */
--		pj_scan_get_char(scanner);
--		pj_scan_get_until_ch(scanner, ']', pvalue);
--		pj_scan_get_char(scanner);
- 	    } else if(pj_cis_match(spec, *scanner->curptr)) {
- 		parser_get_and_unescape(scanner, pool, spec, esc_spec, pvalue);
- 	    }
--- 
-2.5.5
-
diff --git a/third-party/pjproject/patches/0001-sip_transport-Search-for-transport-even-if-listener-.patch b/third-party/pjproject/patches/0001-sip_transport-Search-for-transport-even-if-listener-.patch
deleted file mode 100644
index 001912c..0000000
--- a/third-party/pjproject/patches/0001-sip_transport-Search-for-transport-even-if-listener-.patch
+++ /dev/null
@@ -1,114 +0,0 @@
-From 552194179eb6deae8326eb0fef446e69240ea41b Mon Sep 17 00:00:00 2001
-From: George Joseph <george.joseph at fairview5.com>
-Date: Fri, 19 Feb 2016 17:05:53 -0700
-Subject: [PATCH] sip_transport:  Search for transport even if listener was
- specified.
-
-If a listener was specified when calling pjsip_tpmgr_acquire_transport2,
-a new transport was always created instead of using an existing one.  This
-caused several issues mostly related to the remote end not expecting a new
-connection.  I.E.  A TCP client who registered to a server is not going to
-be listening for connections coming back from the server and refuses the
-connection.
-
-Now when pjsip_tpmgr_acquire_transport2 is called with a listener, the
-registry is still searched for an existing transport and the listener
-is used as a factory only if no existing transport can be found.
----
- pjsip/src/pjsip/sip_transport.c | 68 ++++++++++++++++++++---------------------
- 1 file changed, 34 insertions(+), 34 deletions(-)
-
-diff --git a/pjsip/src/pjsip/sip_transport.c b/pjsip/src/pjsip/sip_transport.c
-index 0410324..620b9c0 100644
---- a/pjsip/src/pjsip/sip_transport.c
-+++ b/pjsip/src/pjsip/sip_transport.c
-@@ -1999,29 +1999,11 @@ PJ_DEF(pj_status_t) pjsip_tpmgr_acquire_transport2(pjsip_tpmgr *mgr,
- 
- 	TRACE_((THIS_FILE, "Transport %s acquired", seltp->obj_name));
- 	return PJ_SUCCESS;
--
--
--    } else if (sel && sel->type == PJSIP_TPSELECTOR_LISTENER &&
--	       sel->u.listener)
--    {
--	/* Application has requested that a specific listener is to
--	 * be used. In this case, skip transport hash table lookup.
--	 */
--
--	/* Verify that the listener type matches the destination type */
--	if (sel->u.listener->type != type) {
--	    pj_lock_release(mgr->lock);
--	    return PJSIP_ETPNOTSUITABLE;
--	}
--
--	/* We'll use this listener to create transport */
--	factory = sel->u.listener;
--
-     } else {
- 
- 	/*
- 	 * This is the "normal" flow, where application doesn't specify
--	 * specific transport/listener to be used to send message to.
-+	 * specific transport to be used to send message to.
- 	 * In this case, lookup the transport from the hash table.
- 	 */
- 	pjsip_transport_key key;
-@@ -2081,22 +2063,40 @@ PJ_DEF(pj_status_t) pjsip_tpmgr_acquire_transport2(pjsip_tpmgr *mgr,
- 	    return PJ_SUCCESS;
- 	}
- 
--	/*
--	 * Transport not found!
--	 * Find factory that can create such transport.
--	 */
--	factory = mgr->factory_list.next;
--	while (factory != &mgr->factory_list) {
--	    if (factory->type == type)
--		break;
--	    factory = factory->next;
--	}
-+	if (sel && sel->type == PJSIP_TPSELECTOR_LISTENER &&
-+		sel->u.listener)
-+		{
-+		/* Application has requested that a specific listener is to
-+		 * be used.
-+		 */
-+
-+		/* Verify that the listener type matches the destination type */
-+		if (sel->u.listener->type != type) {
-+			pj_lock_release(mgr->lock);
-+			return PJSIP_ETPNOTSUITABLE;
-+		}
- 
--	if (factory == &mgr->factory_list) {
--	    /* No factory can create the transport! */
--	    pj_lock_release(mgr->lock);
--	    TRACE_((THIS_FILE, "No suitable factory was found either"));
--	    return PJSIP_EUNSUPTRANSPORT;
-+		/* We'll use this listener to create transport */
-+		factory = sel->u.listener;
-+
-+	} else {
-+		/*
-+		 * Transport not found!
-+		 * Find factory that can create such transport.
-+		 */
-+		factory = mgr->factory_list.next;
-+		while (factory != &mgr->factory_list) {
-+			if (factory->type == type)
-+				break;
-+			factory = factory->next;
-+		}
-+
-+		if (factory == &mgr->factory_list) {
-+			/* No factory can create the transport! */
-+			pj_lock_release(mgr->lock);
-+			TRACE_((THIS_FILE, "No suitable factory was found either"));
-+			return PJSIP_EUNSUPTRANSPORT;
-+		}
- 	}
-     }
- 
--- 
-2.5.0
-
diff --git a/third-party/pjproject/patches/0001-sip_transport_tcp-tls-Set-factory-on-transports-crea.patch b/third-party/pjproject/patches/0001-sip_transport_tcp-tls-Set-factory-on-transports-crea.patch
new file mode 100644
index 0000000..d8a9adb
--- /dev/null
+++ b/third-party/pjproject/patches/0001-sip_transport_tcp-tls-Set-factory-on-transports-crea.patch
@@ -0,0 +1,48 @@
+From b7cb93b0e1729589a71e8b30d9a9893f0918e2a2 Mon Sep 17 00:00:00 2001
+From: George Joseph <george.joseph at fairview5.com>
+Date: Mon, 30 May 2016 11:58:22 -0600
+Subject: [PATCH] sip_transport_tcp/tls:  Set factory on transports created
+ from accept
+
+The ability to re-use tcp and tls transports when a factory is
+specified now depends on transport->factory being set which is a new field
+in 2.5.  This was being set only on new outgoing sockets not on
+incoming sockets.  The result was that a client REGISTER created a new
+socket but without the factory set, the next outgoing request to the
+client, OPTIONS, INVITE, etc, would attempt to create another socket
+which the client would refuse.
+
+This patch sets the factory on transports created as a result of an
+accept.
+---
+ pjsip/src/pjsip/sip_transport_tcp.c | 1 +
+ pjsip/src/pjsip/sip_transport_tls.c | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/pjsip/src/pjsip/sip_transport_tcp.c b/pjsip/src/pjsip/sip_transport_tcp.c
+index 1bbb324..00eb8fc 100644
+--- a/pjsip/src/pjsip/sip_transport_tcp.c
++++ b/pjsip/src/pjsip/sip_transport_tcp.c
+@@ -713,6 +713,7 @@ static pj_status_t tcp_create( struct tcp_listener *listener,
+     tcp->base.send_msg = &tcp_send_msg;
+     tcp->base.do_shutdown = &tcp_shutdown;
+     tcp->base.destroy = &tcp_destroy_transport;
++    tcp->base.factory = &listener->factory;
+ 
+     /* Create group lock */
+     status = pj_grp_lock_create(pool, NULL, &tcp->grp_lock);
+diff --git a/pjsip/src/pjsip/sip_transport_tls.c b/pjsip/src/pjsip/sip_transport_tls.c
+index a83ac32..36ee70d 100644
+--- a/pjsip/src/pjsip/sip_transport_tls.c
++++ b/pjsip/src/pjsip/sip_transport_tls.c
+@@ -742,6 +742,7 @@ static pj_status_t tls_create( struct tls_listener *listener,
+     tls->base.send_msg = &tls_send_msg;
+     tls->base.do_shutdown = &tls_shutdown;
+     tls->base.destroy = &tls_destroy_transport;
++    tls->base.factory = &listener->factory;
+ 
+     tls->ssock = ssock;
+ 
+-- 
+2.5.5
+
diff --git a/third-party/pjproject/patches/0002-aconfigure.ac-Fix-autoconf-issue-with-opencore-amrnb.patch b/third-party/pjproject/patches/0002-aconfigure.ac-Fix-autoconf-issue-with-opencore-amrnb.patch
deleted file mode 100644
index 04d1d97..0000000
--- a/third-party/pjproject/patches/0002-aconfigure.ac-Fix-autoconf-issue-with-opencore-amrnb.patch
+++ /dev/null
@@ -1,48 +0,0 @@
-From 1281b60a1807d1285b101b6eb61c6478f29785fe Mon Sep 17 00:00:00 2001
-From: George Joseph <george.joseph at fairview5.com>
-Date: Wed, 23 Mar 2016 07:48:52 -0600
-Subject: [PATCH] aconfigure.ac:  Fix autoconf issue with opencore-amrnb on
- older systems
-
-autoconf 2.63 on CentOS6 produces a bad ./aconfigure file related to
-opencore-amrnb.
-
-./aconfigure: line 15158: syntax error near unexpected token `fi'
-
-To get around this, a 'true;' needed to be added to the Ok case of
-AC_ARG_WITH(opencore-amrnb)
----
- aconfigure    | 3 +++
- aconfigure.ac | 2 +-
- 2 files changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/aconfigure b/aconfigure
-index 33a08f5..4c122c2 100755
---- a/aconfigure
-+++ b/aconfigure
-@@ -7908,6 +7908,9 @@ fi
- # Check whether --with-opencore-amrnb was given.
- if test "${with_opencore_amrnb+set}" = set; then :
-   withval=$with_opencore_amrnb; as_fn_error $? "This option is obsolete and replaced by --with-opencore-amr=DIR" "$LINENO" 5
-+else
-+  true;
-+
- fi
- 
- 
-diff --git a/aconfigure.ac b/aconfigure.ac
-index 3e88124..5d3e833 100644
---- a/aconfigure.ac
-+++ b/aconfigure.ac
-@@ -1631,7 +1631,7 @@ AC_ARG_WITH(opencore-amrnb,
-     AC_HELP_STRING([--with-opencore-amrnb=DIR],
- 		   [This option is obsolete and replaced by --with-opencore-amr=DIR]),
-     [AC_MSG_ERROR(This option is obsolete and replaced by --with-opencore-amr=DIR)],
--    []
-+    [true;]
-     )
- 
- dnl # opencore-amr alt prefix
--- 
-2.5.0
-
diff --git a/third-party/versions.mak b/third-party/versions.mak
index 7b8b59c..ca40531 100644
--- a/third-party/versions.mak
+++ b/third-party/versions.mak
@@ -1,2 +1,2 @@
 
-PJPROJECT_VERSION = 2.4.5
+PJPROJECT_VERSION = 2.5

-- 
To view, visit https://gerrit.asterisk.org/2920
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0dc6c438c3910f7887418a5832ca186aea23d068
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: George Joseph <gjoseph at digium.com>



More information about the asterisk-code-review mailing list