aboutsummaryrefslogtreecommitdiffstats
path: root/main/asterisk
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2017-04-12 11:21:55 +0000
committerTimo Teräs <timo.teras@iki.fi>2017-04-12 11:21:55 +0000
commit951d0ba989d14443d62d48801ffc8e2698669f2b (patch)
treeb307420a11bf11c227e41a3ea0459331f007c3ea /main/asterisk
parent173944778faf584cfafd21de25bd31b75498ec92 (diff)
downloadaports-951d0ba989d14443d62d48801ffc8e2698669f2b.tar.bz2
aports-951d0ba989d14443d62d48801ffc8e2698669f2b.tar.xz
main/asterisk: upgrade to 14.4.0
Diffstat (limited to 'main/asterisk')
-rw-r--r--main/asterisk/APKBUILD6
-rw-r--r--main/asterisk/ASTERISK-24517.patch192
2 files changed, 85 insertions, 113 deletions
diff --git a/main/asterisk/APKBUILD b/main/asterisk/APKBUILD
index 528c74fc1c..2d9f7274da 100644
--- a/main/asterisk/APKBUILD
+++ b/main/asterisk/APKBUILD
@@ -2,7 +2,7 @@
# Contributor: Timo Teras <timo.teras@iki.fi>
# Maintainer: Timo Teras <timo.teras@iki.fi>
pkgname=asterisk
-pkgver=14.3.1
+pkgver=14.4.0
pkgrel=0
pkgdesc="Asterisk: A Module Open Source PBX System"
pkgusers="asterisk"
@@ -226,9 +226,9 @@ sound_en() {
chown -R asterisk:asterisk "$subpkgdir"/var/*/asterisk
}
-sha512sums="4d3daeee9f068886d0d563a3792b856d542bd8abf8f98a10777ebb0227c457c77241ac6bec2f4efb0535eb5c9d35f4b1e1b87c6b529bc4b279b0a14229cc9ad3 asterisk-14.3.1.tar.gz
+sha512sums="4aa3b4e4cfdb1cc7d603557ecb7feb26fc7b2251843d44659dfdaf69857241d664d0ef7f3521b0b3eba8af379ea21484a259c7915fdcd973a98bdb048c63edc3 asterisk-14.4.0.tar.gz
aacef3f4796fb1abd33266998b53909cb4b36e7cc5ad2f7bac68bdc43e9a9072d9a4e2e7e681bddfa31f3d04575eb248afe6ea95da780c67e4829c1e22adfe1b asterisk-addon-mp3-r201.patch.gz
-d9156e8a1d9848a8a65ad6cb91f23bcfb47b0e18f92a22f4ec8ae5aedbf8dd3a169ac151ff3aa1b7d595a687ade7ebb598d87cc575a0dd9b46549ede97064c2e ASTERISK-24517.patch
+0edbee56000b06aa1d3ea89f27559ca55d26bcdb714685d4fcc16ee0e5776b6946357e871fb80ffeeab5083303cfc5d29888f2fd326ee85a253092c0e5d10fe6 ASTERISK-24517.patch
f72c2e04de80d3ed9ce841308101383a1655e6da7a3c888ad31fffe63d1280993e08aefcf8e638316d439c68b38ee05362c87503fca1f36343976a01af9d6eb1 musl-mutex-init.patch
935c25c7b1cdbd376056e20232a0e8c38dd32c344f50306d99930bf7cb37685c31329ead273b08ac9ab76daa9386adfb05b57440e46a39cb80e5542d65e8e3ed restore-multihomed-module.patch
cd5bd1c1d7db0a44b14eb10e6d098af0c6474c8fe1a57395090d6795ac00e9243d004b7d24eba2cfd5bd6d6407c271913e794551a8dfcf3cf93e89fc91349e12 asterisk.initd
diff --git a/main/asterisk/ASTERISK-24517.patch b/main/asterisk/ASTERISK-24517.patch
index e621d08d07..25d752a892 100644
--- a/main/asterisk/ASTERISK-24517.patch
+++ b/main/asterisk/ASTERISK-24517.patch
@@ -1,4 +1,4 @@
-From c61dd986239710223d5e59d265ab4589c598e4ac Mon Sep 17 00:00:00 2001
+From 2dd17aa5306636e9b400590eb172cbc5bd87eb74 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
Date: Thu, 2 Jun 2016 22:10:06 +0300
Subject: [PATCH] Implement internal abstraction for iostreams
@@ -21,15 +21,15 @@ Change-Id: Id916aef418b665ced6a7489aef74908b6e376e85
configure.ac | 4 -
include/asterisk/iostream.h | 118 ++++++++
include/asterisk/tcptls.h | 92 +-----
- main/http.c | 105 +++----
+ main/http.c | 93 +++---
main/iostream.c | 553 ++++++++++++++++++++++++++++++++++
- main/manager.c | 142 ++++-----
+ main/manager.c | 131 ++++----
main/tcptls.c | 717 ++++++--------------------------------------
main/utils.c | 68 -----
res/res_http_post.c | 10 +-
res/res_http_websocket.c | 116 ++++---
res/res_phoneprov.c | 2 +-
- 13 files changed, 997 insertions(+), 1110 deletions(-)
+ 13 files changed, 994 insertions(+), 1090 deletions(-)
create mode 100644 include/asterisk/iostream.h
create mode 100644 main/iostream.c
@@ -255,10 +255,10 @@ index 2bb1d8b535..129f29b924 100644
static int unload_module(void)
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
-index 709d5ab45c..dd660a5d71 100644
+index 86c4bea982..1691285227 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
-@@ -2545,7 +2545,7 @@ static struct sip_threadinfo *sip_threadinfo_create(struct ast_tcptls_session_in
+@@ -2546,7 +2546,7 @@ static struct sip_threadinfo *sip_threadinfo_create(struct ast_tcptls_session_in
}
ao2_t_ref(tcptls_session, +1, "tcptls_session ref for sip_threadinfo object");
th->tcptls_session = tcptls_session;
@@ -267,7 +267,7 @@ index 709d5ab45c..dd660a5d71 100644
ao2_t_link(threadt, th, "Adding new tcptls helper thread");
ao2_t_ref(th, -1, "Decrementing threadinfo ref from alloc, only table ref remains");
return th;
-@@ -2568,8 +2568,7 @@ static int sip_tcptls_write(struct ast_tcptls_session_instance *tcptls_session,
+@@ -2569,8 +2569,7 @@ static int sip_tcptls_write(struct ast_tcptls_session_instance *tcptls_session,
ao2_lock(tcptls_session);
@@ -277,7 +277,7 @@ index 709d5ab45c..dd660a5d71 100644
!(packet = ao2_alloc(sizeof(*packet), tcptls_packet_destructor)) ||
!(packet->data = ast_str_create(len))) {
goto tcptls_write_setup_error;
-@@ -2882,7 +2881,7 @@ static int sip_tcptls_read(struct sip_request *req, struct ast_tcptls_session_in
+@@ -2883,7 +2882,7 @@ static int sip_tcptls_read(struct sip_request *req, struct ast_tcptls_session_in
} else {
timeout = -1;
}
@@ -286,7 +286,7 @@ index 709d5ab45c..dd660a5d71 100644
if (res < 0) {
ast_debug(2, "SIP TCP/TLS server :: ast_wait_for_input returned %d\n", res);
return -1;
-@@ -2891,7 +2890,7 @@ static int sip_tcptls_read(struct sip_request *req, struct ast_tcptls_session_in
+@@ -2892,7 +2891,7 @@ static int sip_tcptls_read(struct sip_request *req, struct ast_tcptls_session_in
return -1;
}
@@ -295,7 +295,7 @@ index 709d5ab45c..dd660a5d71 100644
if (res < 0) {
if (errno == EAGAIN || errno == EINTR) {
continue;
-@@ -2952,18 +2951,8 @@ static void *_sip_tcp_helper_thread(struct ast_tcptls_session_instance *tcptls_s
+@@ -2953,18 +2952,8 @@ static void *_sip_tcp_helper_thread(struct ast_tcptls_session_instance *tcptls_s
goto cleanup;
}
@@ -316,7 +316,7 @@ index 709d5ab45c..dd660a5d71 100644
goto cleanup;
}
me->threadid = pthread_self();
-@@ -2986,15 +2975,15 @@ static void *_sip_tcp_helper_thread(struct ast_tcptls_session_instance *tcptls_s
+@@ -2987,15 +2976,15 @@ static void *_sip_tcp_helper_thread(struct ast_tcptls_session_instance *tcptls_s
}
flags = 1;
@@ -335,7 +335,7 @@ index 709d5ab45c..dd660a5d71 100644
fds[1].fd = me->alert_pipe[0];
fds[0].events = fds[1].events = POLLIN | POLLPRI;
-@@ -3014,9 +3003,9 @@ static void *_sip_tcp_helper_thread(struct ast_tcptls_session_instance *tcptls_s
+@@ -3015,9 +3004,9 @@ static void *_sip_tcp_helper_thread(struct ast_tcptls_session_instance *tcptls_s
* We cannot let the stream exclusively wait for data to arrive.
* We have to wake up the task to send outgoing messages.
*/
@@ -347,7 +347,7 @@ index 709d5ab45c..dd660a5d71 100644
tcptls_session->client ? -1 : (authtimeout * 1000));
for (;;) {
-@@ -3024,7 +3013,7 @@ static void *_sip_tcp_helper_thread(struct ast_tcptls_session_instance *tcptls_s
+@@ -3025,7 +3014,7 @@ static void *_sip_tcp_helper_thread(struct ast_tcptls_session_instance *tcptls_s
if (!tcptls_session->client && req.authenticated && !authenticated) {
authenticated = 1;
@@ -356,7 +356,7 @@ index 709d5ab45c..dd660a5d71 100644
ast_atomic_fetchadd_int(&unauth_sessions, -1);
}
-@@ -3035,7 +3024,7 @@ static void *_sip_tcp_helper_thread(struct ast_tcptls_session_instance *tcptls_s
+@@ -3036,7 +3025,7 @@ static void *_sip_tcp_helper_thread(struct ast_tcptls_session_instance *tcptls_s
}
if (timeout == 0) {
@@ -365,7 +365,7 @@ index 709d5ab45c..dd660a5d71 100644
goto cleanup;
}
} else {
-@@ -3045,11 +3034,11 @@ static void *_sip_tcp_helper_thread(struct ast_tcptls_session_instance *tcptls_s
+@@ -3046,11 +3035,11 @@ static void *_sip_tcp_helper_thread(struct ast_tcptls_session_instance *tcptls_s
if (ast_str_strlen(tcptls_session->overflow_buf) == 0) {
res = ast_poll(fds, 2, timeout); /* polls for both socket and alert_pipe */
if (res < 0) {
@@ -379,7 +379,7 @@ index 709d5ab45c..dd660a5d71 100644
goto cleanup;
}
}
-@@ -3074,14 +3063,14 @@ static void *_sip_tcp_helper_thread(struct ast_tcptls_session_instance *tcptls_s
+@@ -3075,14 +3064,14 @@ static void *_sip_tcp_helper_thread(struct ast_tcptls_session_instance *tcptls_s
memset(buf, 0, sizeof(buf));
@@ -396,7 +396,7 @@ index 709d5ab45c..dd660a5d71 100644
res = sip_tcptls_read(&req, tcptls_session, authenticated, start);
if (res < 0) {
-@@ -3115,7 +3104,7 @@ static void *_sip_tcp_helper_thread(struct ast_tcptls_session_instance *tcptls_s
+@@ -3116,7 +3105,7 @@ static void *_sip_tcp_helper_thread(struct ast_tcptls_session_instance *tcptls_s
ao2_unlock(me);
if (packet) {
@@ -405,7 +405,7 @@ index 709d5ab45c..dd660a5d71 100644
ast_log(LOG_WARNING, "Failure to write to tcp/tls socket\n");
}
ao2_t_ref(packet, -1, "tcptls packet sent, this is no longer needed");
-@@ -3127,7 +3116,7 @@ static void *_sip_tcp_helper_thread(struct ast_tcptls_session_instance *tcptls_s
+@@ -3128,7 +3117,7 @@ static void *_sip_tcp_helper_thread(struct ast_tcptls_session_instance *tcptls_s
}
}
@@ -414,7 +414,7 @@ index 709d5ab45c..dd660a5d71 100644
cleanup:
if (tcptls_session && !tcptls_session->client && !authenticated) {
-@@ -29101,9 +29090,8 @@ static int sip_prepare_socket(struct sip_pvt *p)
+@@ -29202,9 +29191,8 @@ static int sip_prepare_socket(struct sip_pvt *p)
return s->fd;
}
if ((s->type & (AST_TRANSPORT_TCP | AST_TRANSPORT_TLS)) &&
@@ -426,7 +426,7 @@ index 709d5ab45c..dd660a5d71 100644
}
if ((s->type & (AST_TRANSPORT_WS | AST_TRANSPORT_WSS))) {
return s->ws_session ? ast_websocket_fd(s->ws_session) : -1;
-@@ -29133,7 +29121,7 @@ static int sip_prepare_socket(struct sip_pvt *p)
+@@ -29234,7 +29222,7 @@ static int sip_prepare_socket(struct sip_pvt *p)
/* 1. check for existing threads */
ast_sockaddr_copy(&sa_tmp, sip_real_dst(p));
if ((tcptls_session = sip_tcp_locate(&sa_tmp))) {
@@ -435,7 +435,7 @@ index 709d5ab45c..dd660a5d71 100644
if (s->tcptls_session) {
ao2_ref(s->tcptls_session, -1);
s->tcptls_session = NULL;
-@@ -29180,7 +29168,7 @@ static int sip_prepare_socket(struct sip_pvt *p)
+@@ -29281,7 +29269,7 @@ static int sip_prepare_socket(struct sip_pvt *p)
goto create_tcptls_session_fail;
}
@@ -444,7 +444,7 @@ index 709d5ab45c..dd660a5d71 100644
/* client connections need to have the sip_threadinfo object created before
* the thread is detached. This ensures the alert_pipe is up before it will
-@@ -29982,8 +29970,7 @@ static int sip_send_keepalive(const void *data)
+@@ -30083,8 +30071,7 @@ static int sip_send_keepalive(const void *data)
if ((peer->socket.fd != -1) && (peer->socket.type == AST_TRANSPORT_UDP)) {
res = ast_sendto(peer->socket.fd, keepalive, sizeof(keepalive), 0, &peer->addr);
} else if ((peer->socket.type & (AST_TRANSPORT_TCP | AST_TRANSPORT_TLS)) &&
@@ -455,10 +455,10 @@ index 709d5ab45c..dd660a5d71 100644
} else if (peer->socket.type == AST_TRANSPORT_UDP) {
res = ast_sendto(sipsock, keepalive, sizeof(keepalive), 0, &peer->addr);
diff --git a/configure.ac b/configure.ac
-index 53bede497d..c30a89b0b1 100644
+index bc54de7591..e0b0b85ec5 100644
--- a/configure.ac
+++ b/configure.ac
-@@ -821,10 +821,6 @@ AC_ARG_ENABLE([asteriskssl],
+@@ -822,10 +822,6 @@ AC_ARG_ENABLE([asteriskssl],
esac], [AST_ASTERISKSSL=yes])
AC_SUBST(AST_ASTERISKSSL)
@@ -724,7 +724,7 @@ index d19ec529a9..1e3a7524bf 100644
-
#endif /* _ASTERISK_TCPTLS_H */
diff --git a/main/http.c b/main/http.c
-index da564da203..8cb1c2f7ad 100644
+index 7565523deb..74dfdb9ef6 100644
--- a/main/http.c
+++ b/main/http.c
@@ -451,11 +451,13 @@ void ast_http_send(struct ast_tcptls_session_instance *ser,
@@ -872,37 +872,23 @@ index da564da203..8cb1c2f7ad 100644
return -1;
}
-@@ -1915,11 +1904,10 @@ static int httpd_process_request(struct ast_tcptls_session_instance *ser)
- static void *httpd_helper_thread(void *data)
- {
- struct ast_tcptls_session_instance *ser = data;
-- struct protoent *p;
-- int flags;
+@@ -1918,7 +1907,7 @@ static void *httpd_helper_thread(void *data)
+ int flags = 1;
int timeout;
-+ int arg = 1;
- if (!ser || !ser->f) {
+ if (!ser) {
ao2_cleanup(ser);
return NULL;
}
-@@ -1936,23 +1924,11 @@ static void *httpd_helper_thread(void *data)
+@@ -1935,14 +1924,11 @@ static void *httpd_helper_thread(void *data)
* This is necessary to prevent delays (caused by buffering) as we
* write to the socket in bits and pieces.
*/
-- p = getprotobyname("tcp");
-- if (p) {
-- int arg = 1;
--
-- if (setsockopt(ser->fd, p->p_proto, TCP_NODELAY, (char *) &arg, sizeof(arg) ) < 0) {
-- ast_log(LOG_WARNING, "Failed to set TCP_NODELAY on HTTP connection: %s\n", strerror(errno));
-- ast_log(LOG_WARNING, "Some HTTP requests may be slow to respond.\n");
-- }
-- } else {
-- ast_log(LOG_WARNING, "Failed to set TCP_NODELAY on HTTP connection, getprotobyname(\"tcp\") failed\n");
-+ if (setsockopt(ast_iostream_get_fd(ser->stream), IPPROTO_TCP, TCP_NODELAY, (char *) &arg, sizeof(arg) ) < 0) {
-+ ast_log(LOG_WARNING, "Failed to set TCP_NODELAY on HTTP connection: %s\n", strerror(errno));
- ast_log(LOG_WARNING, "Some HTTP requests may be slow to respond.\n");
+- if (setsockopt(ser->fd, IPPROTO_TCP, TCP_NODELAY, (char *) &flags, sizeof(flags)) < 0) {
++ if (setsockopt(ast_iostream_get_fd(ser->stream), IPPROTO_TCP, TCP_NODELAY, (char *) &flags, sizeof(flags)) < 0) {
+ ast_log(LOG_WARNING, "Failed to set TCP_NODELAY on HTTP connection: %s\n", strerror(errno));
++ ast_log(LOG_WARNING, "Some HTTP requests may be slow to respond.\n");
}
-
- /* make sure socket is non-blocking */
@@ -913,7 +899,7 @@ index da564da203..8cb1c2f7ad 100644
/* Setup HTTP worker private data to keep track of request body reading. */
ao2_cleanup(ser->private_data);
-@@ -1975,23 +1951,17 @@ static void *httpd_helper_thread(void *data)
+@@ -1965,23 +1951,17 @@ static void *httpd_helper_thread(void *data)
}
/* We can let the stream wait for data to arrive. */
@@ -943,7 +929,7 @@ index da564da203..8cb1c2f7ad 100644
break;
}
-@@ -2005,10 +1975,9 @@ static void *httpd_helper_thread(void *data)
+@@ -1995,10 +1975,9 @@ static void *httpd_helper_thread(void *data)
done:
ast_atomic_fetchadd_int(&session_count, -1);
@@ -1517,7 +1503,7 @@ index 0000000000..46abc18a5c
+#endif
+}
diff --git a/main/manager.c b/main/manager.c
-index 9a7f4c80fc..e31e348d6a 100644
+index c7f4092ac0..e7067f5c07 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -1551,8 +1551,7 @@ static void acl_change_stasis_unsubscribe(void)
@@ -1625,7 +1611,7 @@ index 9a7f4c80fc..e31e348d6a 100644
break;
}
} else { /* HTTP session */
-@@ -5930,7 +5926,7 @@ static int process_events(struct mansession *s)
+@@ -5940,7 +5936,7 @@ static int process_events(struct mansession *s)
int ret = 0;
ao2_lock(s->session);
@@ -1634,7 +1620,7 @@ index 9a7f4c80fc..e31e348d6a 100644
struct eventqent *eqe = s->session->last_ev;
while ((eqe = advance_event(eqe))) {
-@@ -6472,7 +6468,7 @@ static int get_input(struct mansession *s, char *output)
+@@ -6482,7 +6478,7 @@ static int get_input(struct mansession *s, char *output)
s->session->waiting_thread = pthread_self();
ao2_unlock(s->session);
@@ -1643,7 +1629,7 @@ index 9a7f4c80fc..e31e348d6a 100644
ao2_lock(s->session);
s->session->waiting_thread = AST_PTHREADT_NULL;
-@@ -6490,7 +6486,7 @@ static int get_input(struct mansession *s, char *output)
+@@ -6500,7 +6496,7 @@ static int get_input(struct mansession *s, char *output)
}
ao2_lock(s->session);
@@ -1652,15 +1638,8 @@ index 9a7f4c80fc..e31e348d6a 100644
if (res < 1) {
res = -1; /* error return */
} else {
-@@ -6623,13 +6619,12 @@ static void *session_do(void *data)
- struct mansession s = {
- .tcptls_session = data,
- };
-- int flags;
- int res;
-+ int arg = 1;
+@@ -6638,7 +6634,7 @@ static void *session_do(void *data)
struct ast_sockaddr ser_remote_address_tmp;
-- struct protoent *p;
if (ast_atomic_fetchadd_int(&unauth_sessions, +1) >= authlimit) {
- fclose(ser->f);
@@ -1668,7 +1647,7 @@ index 9a7f4c80fc..e31e348d6a 100644
ast_atomic_fetchadd_int(&unauth_sessions, -1);
goto done;
}
-@@ -6638,7 +6633,7 @@ static void *session_do(void *data)
+@@ -6647,7 +6643,7 @@ static void *session_do(void *data)
session = build_mansession(&ser_remote_address_tmp);
if (session == NULL) {
@@ -1677,20 +1656,13 @@ index 9a7f4c80fc..e31e348d6a 100644
ast_atomic_fetchadd_int(&unauth_sessions, -1);
goto done;
}
-@@ -6646,20 +6641,10 @@ static void *session_do(void *data)
+@@ -6655,14 +6651,10 @@ static void *session_do(void *data)
/* here we set TCP_NODELAY on the socket to disable Nagle's algorithm.
* This is necessary to prevent delays (caused by buffering) as we
* write to the socket in bits and pieces. */
-- p = getprotobyname("tcp");
-- if (p) {
-- int arg = 1;
-- if( setsockopt(ser->fd, p->p_proto, TCP_NODELAY, (char *)&arg, sizeof(arg) ) < 0 ) {
-- ast_log(LOG_WARNING, "Failed to set manager tcp connection to TCP_NODELAY mode: %s\nSome manager actions may be slow to respond.\n", strerror(errno));
-- }
-- } else {
-- ast_log(LOG_WARNING, "Failed to set manager tcp connection to TCP_NODELAY, getprotobyname(\"tcp\") failed\nSome manager actions may be slow to respond.\n");
-+ if (setsockopt(ast_iostream_get_fd(ser->stream), IPPROTO_TCP, TCP_NODELAY, (char *)&arg, sizeof(arg) ) < 0) {
-+ ast_log(LOG_WARNING, "Failed to set manager tcp connection to TCP_NODELAY mode: %s\nSome manager actions may be slow to respond.\n", strerror(errno));
+- if (setsockopt(ser->fd, IPPROTO_TCP, TCP_NODELAY, (char *) &flags, sizeof(flags)) < 0) {
++ if (setsockopt(ast_iostream_get_fd(ser->stream), IPPROTO_TCP, TCP_NODELAY, (char *) &flags, sizeof(flags)) < 0) {
+ ast_log(LOG_WARNING, "Failed to set TCP_NODELAY on manager connection: %s\n", strerror(errno));
}
-
- /* make sure socket is non-blocking */
@@ -1701,7 +1673,7 @@ index 9a7f4c80fc..e31e348d6a 100644
ao2_lock(session);
/* Hook to the tail of the event queue */
-@@ -6668,8 +6653,7 @@ static void *session_do(void *data)
+@@ -6671,8 +6663,7 @@ static void *session_do(void *data)
ast_mutex_init(&s.lock);
/* these fields duplicate those in the 'ser' structure */
@@ -1711,7 +1683,7 @@ index 9a7f4c80fc..e31e348d6a 100644
ast_sockaddr_copy(&session->addr, &ser_remote_address_tmp);
s.session = session;
-@@ -6688,9 +6672,9 @@ static void *session_do(void *data)
+@@ -6691,9 +6682,9 @@ static void *session_do(void *data)
* We cannot let the stream exclusively wait for data to arrive.
* We have to wake up the task to send async events.
*/
@@ -1723,7 +1695,7 @@ index 9a7f4c80fc..e31e348d6a 100644
ast_tvnow(), authtimeout * 1000);
astman_append(&s, "Asterisk Call Manager/%s\r\n", AMI_VERSION); /* welcome prompt */
-@@ -6699,7 +6683,7 @@ static void *session_do(void *data)
+@@ -6702,7 +6693,7 @@ static void *session_do(void *data)
break;
}
if (session->authenticated) {
@@ -1732,7 +1704,7 @@ index 9a7f4c80fc..e31e348d6a 100644
}
}
/* session is over, explain why and terminate */
-@@ -7558,23 +7542,9 @@ static void xml_translate(struct ast_str **out, char *in, struct ast_variable *g
+@@ -7562,23 +7553,9 @@ static void xml_translate(struct ast_str **out, char *in, struct ast_variable *g
static void close_mansession_file(struct mansession *s)
{
@@ -1759,7 +1731,7 @@ index 9a7f4c80fc..e31e348d6a 100644
} else {
ast_log(LOG_ERROR, "Attempted to close file/file descriptor on mansession without a valid file or file descriptor.\n");
}
-@@ -7583,17 +7553,20 @@ static void close_mansession_file(struct mansession *s)
+@@ -7587,17 +7564,20 @@ static void close_mansession_file(struct mansession *s)
static void process_output(struct mansession *s, struct ast_str **out, struct ast_variable *params, enum output_format format)
{
char *buf;
@@ -1775,18 +1747,18 @@ index 9a7f4c80fc..e31e348d6a 100644
- fprintf(s->f, "%c", 0);
- fflush(s->f);
+ ast_iostream_write(s->stream, "", 1);
-+
-+ fd = ast_iostream_get_fd(s->stream);
- if ((l = ftell(s->f)) > 0) {
- if (MAP_FAILED == (buf = mmap(NULL, l, PROT_READ | PROT_WRITE, MAP_PRIVATE, s->fd, 0))) {
++ fd = ast_iostream_get_fd(s->stream);
++
+ l = lseek(fd, SEEK_CUR, 0);
+ if (l > 0) {
+ if (MAP_FAILED == (buf = mmap(NULL, l, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0))) {
ast_log(LOG_WARNING, "mmap failed. Manager output was not processed\n");
} else {
if (format == FORMAT_XML || format == FORMAT_HTML) {
-@@ -7620,6 +7593,7 @@ static int generic_http_callback(struct ast_tcptls_session_instance *ser,
+@@ -7624,6 +7604,7 @@ static int generic_http_callback(struct ast_tcptls_session_instance *ser,
struct mansession s = { .session = NULL, .tcptls_session = ser };
struct mansession_session *session = NULL;
uint32_t ident;
@@ -1794,7 +1766,7 @@ index 9a7f4c80fc..e31e348d6a 100644
int blastaway = 0;
struct ast_variable *v;
struct ast_variable *params = get_params;
-@@ -7675,17 +7649,17 @@ static int generic_http_callback(struct ast_tcptls_session_instance *ser,
+@@ -7679,17 +7660,17 @@ static int generic_http_callback(struct ast_tcptls_session_instance *ser,
}
s.session = session;
@@ -1817,7 +1789,7 @@ index 9a7f4c80fc..e31e348d6a 100644
goto generic_callback_out;
}
-@@ -7825,9 +7799,9 @@ generic_callback_out:
+@@ -7829,9 +7810,9 @@ generic_callback_out:
if (blastaway) {
session_destroy(session);
} else {
@@ -1830,7 +1802,7 @@ index 9a7f4c80fc..e31e348d6a 100644
}
unref_mansession(session);
}
-@@ -7852,6 +7826,7 @@ static int auth_http_callback(struct ast_tcptls_session_instance *ser,
+@@ -7856,6 +7837,7 @@ static int auth_http_callback(struct ast_tcptls_session_instance *ser,
struct message m = { 0 };
unsigned int idx;
size_t hdrlen;
@@ -1838,7 +1810,7 @@ index 9a7f4c80fc..e31e348d6a 100644
time_t time_now = time(NULL);
unsigned long nonce = 0, nc;
-@@ -8030,17 +8005,17 @@ static int auth_http_callback(struct ast_tcptls_session_instance *ser,
+@@ -8034,17 +8016,17 @@ static int auth_http_callback(struct ast_tcptls_session_instance *ser,
ast_mutex_init(&s.lock);
s.session = session;
@@ -1861,7 +1833,7 @@ index 9a7f4c80fc..e31e348d6a 100644
goto auth_callback_out;
}
-@@ -8091,7 +8066,7 @@ static int auth_http_callback(struct ast_tcptls_session_instance *ser,
+@@ -8095,7 +8077,7 @@ static int auth_http_callback(struct ast_tcptls_session_instance *ser,
m.headers[idx] = NULL;
}
@@ -1870,7 +1842,7 @@ index 9a7f4c80fc..e31e348d6a 100644
http_header = ast_str_create(80);
out = ast_str_create(result_size * 2 + 512);
-@@ -8143,11 +8118,10 @@ auth_callback_out:
+@@ -8147,11 +8129,10 @@ auth_callback_out:
ast_free(out);
ao2_lock(session);
@@ -1886,7 +1858,7 @@ index 9a7f4c80fc..e31e348d6a 100644
if (session->needdestroy) {
diff --git a/main/tcptls.c b/main/tcptls.c
-index 513676c926..6530d87ca1 100644
+index 5abaa4cb99..86bb262469 100644
--- a/main/tcptls.c
+++ b/main/tcptls.c
@@ -51,512 +51,13 @@ ASTERISK_REGISTER_FILE()
@@ -2241,19 +2213,19 @@ index 513676c926..6530d87ca1 100644
- SSL_get_error(stream->ssl, res));
- }
-
--#if defined(OPENSSL_API_COMPAT) && OPENSSL_API_COMPAT >= 0x10100000L
+-#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x10100000L
- if (!SSL_is_server(stream->ssl)) {
-#else
- if (!stream->ssl->server) {
-#endif
- /* For client threads, ensure that the error stack is cleared */
--#if !defined(OPENSSL_API_COMPAT) || OPENSSL_API_COMPAT < 0x10100000L
--#if OPENSSL_VERSION_NUMBER >= 0x10000000L
+-#if !defined(OPENSSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER < 0x10100000L
+-#if !defined(OPENSSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER >= 0x10000000L
- ERR_remove_thread_state(NULL);
-#else
- ERR_remove_state(0);
--#endif /* OPENSSL_VERSION_NUMBER >= 0x10000000L */
--#endif /* !defined(OPENSSL_API_COMPAT) || OPENSSL_API_COMPAT < 0x10100000L */
+-#endif /* openssl = 1.0 */
+-#endif /* openssl < 1.1 */
- }
-
- SSL_free(stream->ssl);
@@ -2609,8 +2581,8 @@ index 513676c926..6530d87ca1 100644
}
if (tcptls_session->parent->worker_fn) {
-@@ -782,7 +252,13 @@ void *ast_tcptls_server_root(void *data)
- tcptls_session->overflow_buf = ast_str_create(128);
+@@ -784,7 +254,13 @@ void *ast_tcptls_server_root(void *data)
+ }
flags = fcntl(fd, F_GETFL);
fcntl(fd, F_SETFL, flags & ~O_NONBLOCK);
- tcptls_session->fd = fd;
@@ -2624,7 +2596,7 @@ index 513676c926..6530d87ca1 100644
tcptls_session->parent = desc;
ast_sockaddr_copy(&tcptls_session->remote_address, &addr);
-@@ -1046,7 +522,7 @@ client_start_error:
+@@ -1052,7 +528,7 @@ client_start_error:
struct ast_tcptls_session_instance *ast_tcptls_client_create(struct ast_tcptls_session_args *desc)
{
@@ -2633,7 +2605,7 @@ index 513676c926..6530d87ca1 100644
struct ast_tcptls_session_instance *tcptls_session = NULL;
/* Do nothing if nothing has changed */
-@@ -1062,8 +538,8 @@ struct ast_tcptls_session_instance *ast_tcptls_client_create(struct ast_tcptls_s
+@@ -1068,8 +544,8 @@ struct ast_tcptls_session_instance *ast_tcptls_client_create(struct ast_tcptls_s
close(desc->accept_fd);
}
@@ -2644,9 +2616,9 @@ index 513676c926..6530d87ca1 100644
if (desc->accept_fd < 0) {
ast_log(LOG_ERROR, "Unable to allocate socket for %s: %s\n",
desc->name, strerror(errno));
-@@ -1089,7 +565,11 @@ struct ast_tcptls_session_instance *ast_tcptls_client_create(struct ast_tcptls_s
-
- tcptls_session->overflow_buf = ast_str_create(128);
+@@ -1099,7 +575,11 @@ struct ast_tcptls_session_instance *ast_tcptls_client_create(struct ast_tcptls_s
+ goto error;
+ }
tcptls_session->client = 1;
- tcptls_session->fd = desc->accept_fd;
+ tcptls_session->stream = ast_iostream_from_fd(&fd);
@@ -2657,7 +2629,7 @@ index 513676c926..6530d87ca1 100644
tcptls_session->parent = desc;
tcptls_session->parent->worker_fn = NULL;
ast_sockaddr_copy(&tcptls_session->remote_address,
-@@ -1251,24 +731,9 @@ error:
+@@ -1259,24 +739,9 @@ error:
void ast_tcptls_close_session_file(struct ast_tcptls_session_instance *tcptls_session)
{
@@ -3107,10 +3079,10 @@ index 2e4f873623..1b77b9f48b 100644
} else {
struct extension *exten_iter;
--
-2.11.1
+2.12.2
-From b7469e205ee301966df8ec3d3ab3365ce874f3e5 Mon Sep 17 00:00:00 2001
+From 4719882b6ab4bcfff54c36a2b4d48424b65d3a6f Mon Sep 17 00:00:00 2001
From: Joshua Colp <jcolp@digium.com>
Date: Mon, 28 Nov 2016 13:36:18 +0000
Subject: [PATCH] iostream: Move include of asterisk.h
@@ -3143,10 +3115,10 @@ index 46abc18a5c..008888142b 100644
#include "asterisk/astobj2.h"
#include "asterisk/iostream.h"
--
-2.11.1
+2.12.2
-From e2ea88b2ea33f012b52df2afc4114375032caee7 Mon Sep 17 00:00:00 2001
+From ce5b51c6366021d44b2aabc3c0ffd4e4c7d25b77 Mon Sep 17 00:00:00 2001
From: Mark Michelson <mmichelson@digium.com>
Date: Tue, 6 Dec 2016 10:56:06 -0600
Subject: [PATCH] Iostreams: Correct off-by-one error.
@@ -3209,10 +3181,10 @@ index 008888142b..9fa39cce59 100644
}
}
--
-2.11.1
+2.12.2
-From 817d7d426ca8d6efb5b4e5dac25e8beabc5f8475 Mon Sep 17 00:00:00 2001
+From 942c9de5be6f36271acbddc661047095fecb7130 Mon Sep 17 00:00:00 2001
From: Mark Michelson <mmichelson@digium.com>
Date: Thu, 1 Dec 2016 16:49:03 -0600
Subject: [PATCH] http: Send headers and body in one write.
@@ -3243,7 +3215,7 @@ Change-Id: Idc2d2fb3d9b3db14b8631a1e302244fa18b0e518
1 file changed, 12 insertions(+), 17 deletions(-)
diff --git a/main/http.c b/main/http.c
-index 8cb1c2f7ad..4db81b5363 100644
+index 74dfdb9ef6..c4c6747751 100644
--- a/main/http.c
+++ b/main/http.c
@@ -456,6 +456,7 @@ void ast_http_send(struct ast_tcptls_session_instance *ser,
@@ -3307,10 +3279,10 @@ index 8cb1c2f7ad..4db81b5363 100644
}
}
--
-2.11.1
+2.12.2
-From 2ff54904f63da2bcfafd101aa233614a099a722b Mon Sep 17 00:00:00 2001
+From 926637ce05e5ad5d9f775049d03d133f84506a59 Mon Sep 17 00:00:00 2001
From: Badalyan Vyacheslav <v.badalyan@open-bs.ru>
Date: Thu, 8 Dec 2016 18:34:28 +0000
Subject: [PATCH] Fix IO conversion bug
@@ -3337,5 +3309,5 @@ index ce6430ff1d..80f965ec05 100644
char *rbuf = buf;
int sanity = 10;
--
-2.11.1
+2.12.2