[Pkg-voip-commits] [kamailio] 03/04: remove upstream patches already merged

Victor Seva vseva at moszumanska.debian.org
Wed Nov 9 17:01:17 UTC 2016


This is an automated email from the git hooks/post-receive script.

vseva pushed a commit to branch master
in repository kamailio.

commit 5c164a68785839ee0fc70e69fb655283e4972c5c
Author: Victor Seva <vseva at debian.org>
Date:   Wed Nov 9 17:40:14 2016 +0100

    remove upstream patches already merged
---
 debian/patches/series                              |   30 -
 ...st-if-event-is-dialog-for-checking-termin.patch |   79 -
 ...ee-db-result-when-get_dialog_state-retrie.patch |   34 -
 .../0003-presence-Fix-memory-leak-in-DB-code.patch |   31 -
 ...kg-kamailio-deb-add-Ubuntu-Xenial-support.patch | 2044 --------------------
 ...x-crash-when-no-dialog.id-on-dialog-info-.patch |   38 -
 ...proper-selection-of-the-gateway-when-the-.patch |   30 -
 ...p_client-Terminate-exported-commands-list.patch |   29 -
 ...per-defines-for-ref-unref-operations-to-g.patch |   75 -
 ...eed-to-release-the-dialog-when-refreshing.patch |   31 -
 .../0010-core-allow-_-in-event-route-name.patch    |   28 -
 ...pire-value-kept-and-printed-in-logs-as-un.patch |  408 ----
 ...misleading-indentation-for-return-stateme.patch |   42 -
 ...-code-block-when-saving-chosen-naptr-reco.patch |   78 -
 ...-fix-misleading-indentation-for-IF-blocks.patch |  129 --
 ...identity-fix-misleading-indentation-level.patch |   72 -
 ...xed-rpc-command-to-get-counter-by-group-a.patch |  135 --
 ...s-coherent-indentation-for-xcap-functions.patch |  946 ---------
 ...n-msg-last_header-to-get-the-anchor-insid.patch |   41 -
 ...sip-message-on-error-related-to-missing-b.patch |   36 -
 ...andle-CRLF-received-inside-a-frame-as-SIP.patch |   95 -
 ...1-presence-fix-crush-if-dialog-id-is-NULL.patch |   28 -
 .../0022-core-defined-macro-for-CRLFCRLF.patch     |   37 -
 ...atch-CRLFCRLF-pings-over-websocket-connec.patch |   31 -
 ...condition-for-private-copy-of-the-message.patch |  156 --
 ...5-modules-tmx-fix-mi-command-t_uac_cancel.patch |   25 -
 ...ty-switched-to-use-pointer-of-X509_STORE_.patch |   79 -
 ...ty-still-use-ASN1_STRING_data-for-libssl-.patch |   34 -
 ...ted-to-be-compatible-with-api-from-libssl.patch |  193 --
 ...s-for-compatibilty-with-libssl-v1.1.0-api.patch |  398 ----
 ...-bio-functions-to-support-libssl-v1.1.0-a.patch |  146 --
 31 files changed, 5558 deletions(-)

diff --git a/debian/patches/series b/debian/patches/series
index 2c3d163..9de40e1 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,33 +1,3 @@
-upstream/0001-presence-test-if-event-is-dialog-for-checking-termin.patch
-upstream/0002-presence-free-db-result-when-get_dialog_state-retrie.patch
-upstream/0003-presence-Fix-memory-leak-in-DB-code.patch
-upstream/0004-pkg-kamailio-deb-add-Ubuntu-Xenial-support.patch
-upstream/0005-presence-fix-crash-when-no-dialog.id-on-dialog-info-.patch
-upstream/0006-dispatcher-proper-selection-of-the-gateway-when-the-.patch
-upstream/0007-http_client-Terminate-exported-commands-list.patch
-upstream/0008-dialog-wrapper-defines-for-ref-unref-operations-to-g.patch
-upstream/0009-dialog-no-need-to-release-the-dialog-when-refreshing.patch
-upstream/0010-core-allow-_-in-event-route-name.patch
-upstream/0011-presence-expire-value-kept-and-printed-in-logs-as-un.patch
-upstream/0012-core-fixed-misleading-indentation-for-return-stateme.patch
-upstream/0013-core-proper-code-block-when-saving-chosen-naptr-reco.patch
-upstream/0014-core-ut-fix-misleading-indentation-for-IF-blocks.patch
-upstream/0015-auth_identity-fix-misleading-indentation-level.patch
-upstream/0016-counters-fixed-rpc-command-to-get-counter-by-group-a.patch
-upstream/0017-utils-coherent-indentation-for-xcap-functions.patch
-upstream/0018-core-rely-on-msg-last_header-to-get-the-anchor-insid.patch
-upstream/0019-core-print-sip-message-on-error-related-to-missing-b.patch
-upstream/0020-websocket-handle-CRLF-received-inside-a-frame-as-SIP.patch
-upstream/0021-presence-fix-crush-if-dialog-id-is-NULL.patch
-upstream/0022-core-defined-macro-for-CRLFCRLF.patch
-upstream/0023-websocket-catch-CRLFCRLF-pings-over-websocket-connec.patch
-upstream/0024-tmx-fix-condition-for-private-copy-of-the-message.patch
-upstream/0025-modules-tmx-fix-mi-command-t_uac_cancel.patch
-upstream/0026-auth_identity-switched-to-use-pointer-of-X509_STORE_.patch
-upstream/0027-auth_identity-still-use-ASN1_STRING_data-for-libssl-.patch
-upstream/0028-crypto-updated-to-be-compatible-with-api-from-libssl.patch
-upstream/0029-tls-updates-for-compatibilty-with-libssl-v1.1.0-api.patch
-upstream/0030-tls-updated-bio-functions-to-support-libssl-v1.1.0-a.patch
 no_lib64_on_64_bits.patch
 no_INSTALL_file.patch
 fix_export.patch
diff --git a/debian/patches/upstream/0001-presence-test-if-event-is-dialog-for-checking-termin.patch b/debian/patches/upstream/0001-presence-test-if-event-is-dialog-for-checking-termin.patch
deleted file mode 100644
index 1b507e7..0000000
--- a/debian/patches/upstream/0001-presence-test-if-event-is-dialog-for-checking-termin.patch
+++ /dev/null
@@ -1,79 +0,0 @@
-From ce3d1dd8360567fdf2c8e36fbb4a4238dab8f036 Mon Sep 17 00:00:00 2001
-From: Daniel-Constantin Mierla <miconda at gmail.com>
-Date: Fri, 16 Sep 2016 22:22:57 +0200
-Subject: [PATCH] presence: test if event is dialog for checking terminated
- state in presentity update
-
-- reported by Juha Heinanen
-
-(cherry picked from commit f2ef2a9016f41e97d3466b34b4039e66505d53a1)
----
- modules/presence/presentity.c | 35 +++++++++++++++++++----------------
- 1 file changed, 19 insertions(+), 16 deletions(-)
-
-diff --git a/modules/presence/presentity.c b/modules/presence/presentity.c
-index b78f84a..b5d7b65 100644
---- a/modules/presence/presentity.c
-+++ b/modules/presence/presentity.c
-@@ -494,7 +494,7 @@ int get_dialog_state(presentity_t* presentity, char** state)
- 	}
- 
- 	if (pa_dbf.query (pa_db, query_cols, query_ops, query_vals,
--	 result_cols, n_query_cols, n_result_cols, 0, &result) < 0)
-+				result_cols, n_query_cols, n_result_cols, 0, &result) < 0)
- 	{
- 		LM_ERR("unsuccessful sql query\n");
- 		return -2;
-@@ -515,7 +515,8 @@ int get_dialog_state(presentity_t* presentity, char** state)
- 		tmp_db_body.s = (char*)row_vals[rez_body_col].val.string_val;
- 		tmp_db_body.len = strlen(tmp_db_body.s);
- 
--		parse_state_result = parse_dialog_state_from_body(tmp_db_body, &db_is_dialog, state);
-+		parse_state_result = parse_dialog_state_from_body(tmp_db_body,
-+				&db_is_dialog, state);
- 
- 		pa_dbf.free_result(pa_db, result);
- 		result = NULL;
-@@ -966,23 +967,25 @@ after_dialog_check:
- 		else
- 			cur_etag= presentity->etag;
- 
--		if (is_dialog_terminated(presentity))
--		{
--			LM_WARN("Trying to update an already terminated state. Skipping update.\n");
--
--			/* send 200OK */
--			if (publ_send200ok(msg, presentity->expires, cur_etag)< 0)
-+		if (presentity->event->evp->type==EVENT_DIALOG) {
-+			if(is_dialog_terminated(presentity))
- 			{
--				LM_ERR("sending 200OK reply\n");
--				goto error;
--			}
--			if (sent_reply) *sent_reply= 1;
-+				LM_WARN("Trying to update an already terminated state."
-+						" Skipping update.\n");
- 
--			if(etag.s)
--				pkg_free(etag.s);
--			etag.s= NULL;
-+				/* send 200OK */
-+				if (publ_send200ok(msg, presentity->expires, cur_etag)< 0) {
-+					LM_ERR("sending 200OK reply\n");
-+					goto error;
-+				}
-+				if (sent_reply) *sent_reply= 1;
- 
--			goto done;
-+				if(etag.s)
-+					pkg_free(etag.s);
-+				etag.s= NULL;
-+
-+				goto done;
-+			}
- 		}
- 
- 		update_keys[n_update_cols] = &str_expires_col;
--- 
-2.9.3
-
diff --git a/debian/patches/upstream/0002-presence-free-db-result-when-get_dialog_state-retrie.patch b/debian/patches/upstream/0002-presence-free-db-result-when-get_dialog_state-retrie.patch
deleted file mode 100644
index 611a8a4..0000000
--- a/debian/patches/upstream/0002-presence-free-db-result-when-get_dialog_state-retrie.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From 1c740e85cabe62dec9314589dd0cb0141ffd1010 Mon Sep 17 00:00:00 2001
-From: Daniel-Constantin Mierla <miconda at gmail.com>
-Date: Mon, 19 Sep 2016 20:57:42 +0200
-Subject: [PATCH] presence: free db result when get_dialog_state() retrieves no
- rows
-
-- db result and columns in the query are allocated
-
-(cherry picked from commit 7289417c39939f61ea116fe8dc8d23cdea6401be)
----
- modules/presence/presentity.c | 6 ++++--
- 1 file changed, 4 insertions(+), 2 deletions(-)
-
-diff --git a/modules/presence/presentity.c b/modules/presence/presentity.c
-index b5d7b65..d81b90e 100644
---- a/modules/presence/presentity.c
-+++ b/modules/presence/presentity.c
-@@ -503,9 +503,11 @@ int get_dialog_state(presentity_t* presentity, char** state)
- 	if(result == NULL)
- 		return -3;
- 
--	// No results from query definitely means no dialog exists
--	if (result->n <= 0)
-+	/* no results from query definitely means no dialog exists */
-+	if (result->n <= 0) {
-+		pa_dbf.free_result(pa_db, result);
- 		return 0;
-+	}
- 
- 	// Loop the rows returned from the DB
- 	for (i=0; i < result->n; i++)
--- 
-2.9.3
-
diff --git a/debian/patches/upstream/0003-presence-Fix-memory-leak-in-DB-code.patch b/debian/patches/upstream/0003-presence-Fix-memory-leak-in-DB-code.patch
deleted file mode 100644
index b97ebc9..0000000
--- a/debian/patches/upstream/0003-presence-Fix-memory-leak-in-DB-code.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From 659b912231d81dff8eac2b486f39919f0b7c45cb Mon Sep 17 00:00:00 2001
-From: Phil Lavin <phil at lavin.me.uk>
-Date: Mon, 19 Sep 2016 21:27:54 +0100
-Subject: [PATCH] presence: Fix memory leak in DB code
-
-(cherry picked from commit 0c36c1b62efef176ae6e9322f14096e3a63ed348)
----
- modules/presence/presentity.c | 6 ++++--
- 1 file changed, 4 insertions(+), 2 deletions(-)
-
-diff --git a/modules/presence/presentity.c b/modules/presence/presentity.c
-index d81b90e..e601153 100644
---- a/modules/presence/presentity.c
-+++ b/modules/presence/presentity.c
-@@ -396,9 +396,11 @@ int delete_presentity_if_dialog_id_exists(presentity_t* presentity, char* dialog
- 	if(result == NULL)
- 		return -3;
- 
--	// No results from query definitely means no dialog exists
--	if (result->n <= 0)
-+	/* no results from query definitely means no dialog exists */
-+	if (result->n <= 0) {
-+		pa_dbf.free_result(pa_db, result);
- 		return 0;
-+	}
- 
- 	// Loop the rows returned from the DB
- 	for (i=0; i < result->n; i++)
--- 
-2.9.3
-
diff --git a/debian/patches/upstream/0004-pkg-kamailio-deb-add-Ubuntu-Xenial-support.patch b/debian/patches/upstream/0004-pkg-kamailio-deb-add-Ubuntu-Xenial-support.patch
deleted file mode 100644
index 45c0876..0000000
--- a/debian/patches/upstream/0004-pkg-kamailio-deb-add-Ubuntu-Xenial-support.patch
+++ /dev/null
@@ -1,2044 +0,0 @@
-From ae2b64d90d0e4652e50afb7d06342f6f6b7bcedb Mon Sep 17 00:00:00 2001
-From: Victor Seva <linuxmaniac at torreviejawireless.org>
-Date: Tue, 20 Sep 2016 10:44:19 +0200
-Subject: [PATCH] pkg/kamailio/deb: add Ubuntu Xenial support
-
----
- pkg/kamailio/deb/debian/backports/xenial           |  16 +
- pkg/kamailio/deb/xenial/changelog                  | 307 ++++++++++
- pkg/kamailio/deb/xenial/compat                     |   1 +
- pkg/kamailio/deb/xenial/control                    | 680 +++++++++++++++++++++
- pkg/kamailio/deb/xenial/copyright                  | 335 ++++++++++
- .../kamailio-autheph-modules.lintian-overrides     |   1 +
- pkg/kamailio/deb/xenial/kamailio-berkeley-bin.dirs |   1 +
- .../kamailio-dnssec-modules.lintian-overrides      |   1 +
- .../kamailio-outbound-modules.lintian-overrides    |   1 +
- .../xenial/kamailio-tls-modules.lintian-overrides  |   1 +
- .../kamailio-websocket-modules.lintian-overrides   |   1 +
- pkg/kamailio/deb/xenial/kamailio.README.Debian     |  39 ++
- pkg/kamailio/deb/xenial/kamailio.default           |  28 +
- pkg/kamailio/deb/xenial/kamailio.examples          |   1 +
- pkg/kamailio/deb/xenial/kamailio.init              | 163 +++++
- pkg/kamailio/deb/xenial/kamailio.lintian-overrides |   2 +
- pkg/kamailio/deb/xenial/kamailio.postinst          |  24 +
- pkg/kamailio/deb/xenial/kamailio.service           |  21 +
- pkg/kamailio/deb/xenial/rules                      | 229 +++++++
- pkg/kamailio/deb/xenial/source.lintian-overrides   |   1 +
- pkg/kamailio/deb/xenial/source/format              |   1 +
- pkg/kamailio/deb/xenial/watch                      |   3 +
- 22 files changed, 1857 insertions(+)
- create mode 100755 pkg/kamailio/deb/debian/backports/xenial
- create mode 100644 pkg/kamailio/deb/xenial/changelog
- create mode 100644 pkg/kamailio/deb/xenial/compat
- create mode 100644 pkg/kamailio/deb/xenial/control
- create mode 100644 pkg/kamailio/deb/xenial/copyright
- create mode 100644 pkg/kamailio/deb/xenial/kamailio-autheph-modules.lintian-overrides
- create mode 100644 pkg/kamailio/deb/xenial/kamailio-berkeley-bin.dirs
- create mode 100644 pkg/kamailio/deb/xenial/kamailio-dnssec-modules.lintian-overrides
- create mode 100644 pkg/kamailio/deb/xenial/kamailio-outbound-modules.lintian-overrides
- create mode 100644 pkg/kamailio/deb/xenial/kamailio-tls-modules.lintian-overrides
- create mode 100644 pkg/kamailio/deb/xenial/kamailio-websocket-modules.lintian-overrides
- create mode 100644 pkg/kamailio/deb/xenial/kamailio.README.Debian
- create mode 100644 pkg/kamailio/deb/xenial/kamailio.default
- create mode 100644 pkg/kamailio/deb/xenial/kamailio.examples
- create mode 100644 pkg/kamailio/deb/xenial/kamailio.init
- create mode 100644 pkg/kamailio/deb/xenial/kamailio.lintian-overrides
- create mode 100644 pkg/kamailio/deb/xenial/kamailio.postinst
- create mode 100644 pkg/kamailio/deb/xenial/kamailio.service
- create mode 100755 pkg/kamailio/deb/xenial/rules
- create mode 100644 pkg/kamailio/deb/xenial/source.lintian-overrides
- create mode 100644 pkg/kamailio/deb/xenial/source/format
- create mode 100644 pkg/kamailio/deb/xenial/watch
-
-diff --git a/pkg/kamailio/deb/debian/backports/xenial b/pkg/kamailio/deb/debian/backports/xenial
-new file mode 100755
-index 0000000..df824b0
---- /dev/null
-+++ b/pkg/kamailio/deb/debian/backports/xenial
-@@ -0,0 +1,16 @@
-+#!/bin/bash
-+#
-+# Hook for automatic backports at buildserver.net
-+#
-+# Target dist: Ubuntu xenial
-+DIST=xenial
-+
-+rm -rf ${DIST}
-+cp -r debian ${DIST}
-+
-+# mi_xmlrpc module
-+sed -i 's/libxmlrpc-c3-dev/libxmlrpc-core-c3-dev/' ${DIST}/control
-+
-+# clean backports scripts
-+rm -rf ${DIST}/backports
-+exit 0
-diff --git a/pkg/kamailio/deb/xenial/changelog b/pkg/kamailio/deb/xenial/changelog
-new file mode 100644
-index 0000000..cc5cb73
---- /dev/null
-+++ b/pkg/kamailio/deb/xenial/changelog
-@@ -0,0 +1,307 @@
-+kamailio (4.4.3) unstable; urgency=medium
-+
-+  * version set to 4.4.3
-+
-+ -- Victor Seva <vseva at debian.org>  Wed, 14 Sep 2016 15:27:24 +0200
-+
-+kamailio (4.4.2) unstable; urgency=medium
-+
-+  * version set to 4.4.2
-+
-+ -- Victor Seva <vseva at debian.org>  Tue, 28 Jun 2016 14:22:03 +0200
-+
-+kamailio (4.4.1) unstable; urgency=medium
-+
-+  * version set to 4.4.1
-+
-+ -- Victor Seva <vseva at debian.org>  Tue, 10 May 2016 12:07:19 +0200
-+
-+kamailio (4.4.0) unstable; urgency=medium
-+
-+  * version set to 4.4.0
-+
-+ -- Victor Seva <vseva at debian.org>  Wed, 30 Mar 2016 14:20:42 +0100
-+
-+kamailio (4.4.0~rc1) unstable; urgency=medium
-+
-+  * version set to 4.4.0-rc1
-+
-+ -- Victor Seva <vseva at debian.org>  Mon, 21 Mar 2016 22:22:22 +0100
-+
-+kamailio (4.4.0~rc0) unstable; urgency=medium
-+
-+  * version set to 4.4.0-rc0
-+
-+ -- Victor Seva <vseva at debian.org>  Fri, 11 Mar 2016 09:20:14 +0100
-+
-+kamailio (4.4.0~pre3) unstable; urgency=medium
-+
-+  * version set to 4.4.0-pre3
-+
-+ -- Victor Seva <vseva at debian.org>  Fri, 11 Mar 2016 09:18:29 +0100
-+
-+kamailio (4.4.0~pre2) unstable; urgency=medium
-+
-+  * version set to 4.4.0-pre2
-+
-+ -- Victor Seva <vseva at debian.org>  Thu, 10 Mar 2016 12:38:56 +0100
-+
-+kamailio (4.4.0~pre1) unstable; urgency=medium
-+
-+  * version set to 4.4.0-pre1
-+
-+ -- Victor Seva <linuxmaniac at torreviejawireless.org>  Tue, 23 Feb 2016 08:53:36 +0100
-+
-+kamailio (4.4.0~pre0) unstable; urgency=medium
-+
-+  * version set to 4.4.0-pre0
-+
-+ -- Victor Seva <linuxmaniac at torreviejawireless.org>  Thu, 04 Feb 2016 11:51:56 +0100
-+
-+kamailio (4.4.0~dev9) unstable; urgency=medium
-+
-+  * update version to 4.4.0~dev9
-+
-+ -- Victor Seva <linuxmaniac at torreviejawireless.org>  Wed, 03 Feb 2016 18:29:09 +0100
-+
-+kamailio (4.4.0~dev8) unstable; urgency=medium
-+
-+  * update version to 4.4.0~dev8
-+
-+ -- Victor Seva <linuxmaniac at torreviejawireless.org>  Fri, 18 Dec 2015 11:42:59 +0100
-+
-+kamailio (4.4.0~dev6) unstable; urgency=medium
-+
-+  * update version to 4.4.0~dev6
-+
-+ -- Victor Seva <linuxmaniac at torreviejawireless.org>  Thu, 05 Nov 2015 09:16:36 +0100
-+
-+kamailio (4.4.0~dev5) unstable; urgency=medium
-+
-+  * update version to 4.4.0~dev5
-+
-+ -- Victor Seva <linuxmaniac at torreviejawireless.org>  Fri, 02 Oct 2015 14:15:56 +0200
-+
-+kamailio (4.4.0~dev3) unstable; urgency=medium
-+
-+  * update version to 4.4.0~dev3
-+
-+ -- Victor Seva <linuxmaniac at torreviejawireless.org>  Thu, 10 Sep 2015 09:27:22 +0200
-+
-+kamailio (4.4.0~dev2) unstable; urgency=medium
-+
-+  * update version to 4.4.0~dev2
-+
-+ -- Victor Seva <linuxmaniac at torreviejawireless.org>  Tue, 14 Jul 2015 16:21:03 +0200
-+
-+kamailio (4.4.0~dev0) unstable; urgency=medium
-+
-+  * update version to 4.4.0~dev0
-+
-+ -- Victor Seva <linuxmaniac at torreviejawireless.org>  Tue, 26 May 2015 10:18:42 +0200
-+
-+kamailio (4.3.0~pre2) unstable; urgency=medium
-+
-+  * update version to 4.3.0~pre2
-+
-+ -- Victor Seva <linuxmaniac at torreviejawireless.org>  Mon, 18 May 2015 11:18:45 +0200
-+
-+kamailio (4.3.0~pre1) unstable; urgency=medium
-+
-+  * update version to 4.3.0~pre1
-+
-+ -- Victor Seva <linuxmaniac at torreviejawireless.org>  Tue, 05 May 2015 10:52:12 +0200
-+
-+kamailio (4.3.0~pre0) unstable; urgency=medium
-+
-+  * update version to 4.3.0~pre0
-+
-+ -- Victor Seva <linuxmaniac at torreviejawireless.org>  Thu, 23 Apr 2015 09:58:06 +0200
-+
-+kamailio (4.3.0~dev5) unstable; urgency=medium
-+
-+  * update version to 4.3.0~dev5
-+
-+ -- Victor Seva <linuxmaniac at torreviejawireless.org>  Thu, 12 Mar 2015 15:20:01 +0100
-+
-+kamailio (4.3.0~dev4) unstable; urgency=medium
-+
-+  * update version to 4.3.0~dev4
-+
-+ -- Victor Seva <linuxmaniac at torreviejawireless.org>  Sat, 07 Feb 2015 09:53:08 +0100
-+
-+kamailio (4.3.0~dev3) unstable; urgency=medium
-+
-+  * update version to 4.3.0~dev3
-+
-+ -- Victor Seva <linuxmaniac at torreviejawireless.org>  Sat, 03 Jan 2015 23:21:53 +0100
-+
-+kamailio (4.3.0~dev1) unstable; urgency=medium
-+
-+  * update version to 4.3.0~dev1
-+
-+ -- Victor Seva <linuxmaniac at torreviejawireless.org>  Mon, 13 Oct 2014 14:33:16 +0200
-+
-+kamailio (4.3.0~dev0) unstable; urgency=medium
-+
-+  * update version to 4.3.0~dev0
-+
-+ -- Victor Seva <linuxmaniac at torreviejawireless.org>  Thu, 09 Oct 2014 09:49:13 +0200
-+
-+kamailio (4.2.0~pre1) UNRELEASED; urgency=medium
-+
-+  * update version to 4.2.0~pre1
-+
-+ -- Victor Seva <linuxmaniac at torreviejawireless.org>  Mon, 29 Sep 2014 10:17:56 +0200
-+
-+kamailio (4.2.0~pre0) UNRELEASED; urgency=medium
-+
-+  * update version to 4.2.0~pre0
-+
-+ -- Victor Seva <linuxmaniac at torreviejawireless.org>  Fri, 12 Sep 2014 02:38:24 +0200
-+
-+kamailio (4.2.0~dev9) unstable; urgency=medium
-+
-+  * update version to 4.2.0~dev9
-+
-+ -- Victor Seva <linuxmaniac at torreviejawireless.org>  Tue, 02 Sep 2014 11:18:12 +0200
-+
-+kamailio (4.2.0~dev8) unstable; urgency=medium
-+
-+  * update version to 4.2.0~dev8
-+
-+ -- Victor Seva <linuxmaniac at torreviejawireless.org>  Sat, 26 Jul 2014 10:03:22 +0200
-+
-+kamailio (4.2.0~dev7) unstable; urgency=medium
-+
-+  * update version to 4.2.0~dev7
-+
-+ -- Victor Seva <linuxmaniac at torreviejawireless.org>  Thu, 12 Jun 2014 12:55:05 +0200
-+
-+kamailio (4.2.0~dev6) unstable; urgency=medium
-+
-+  * update version to 4.2.0~dev6
-+
-+ -- Victor Seva <linuxmaniac at torreviejawireless.org>  Sat, 03 May 2014 21:49:21 +0200
-+
-+kamailio (4.2.0~dev5) unstable; urgency=medium
-+
-+  * update version to 4.2.0~dev5
-+
-+ -- Victor Seva <linuxmaniac at torreviejawireless.org>  Mon, 21 Apr 2014 22:52:17 +0200
-+
-+kamailio (4.2.0~dev4) unstable; urgency=medium
-+
-+  * update version to 4.2.0~dev4
-+
-+ -- Victor Seva <linuxmaniac at torreviejawireless.org>  Tue, 08 Apr 2014 11:56:12 +0200
-+
-+kamailio (4.2.0~dev3) unstable; urgency=medium
-+
-+  * update version to 4.2.0~dev3
-+
-+ -- Victor Seva <linuxmaniac at torreviejawireless.org>  Fri, 21 Feb 2014 22:52:43 +0100
-+
-+kamailio (4.2.0~dev2) unstable; urgency=medium
-+
-+  * update version to 4.2.0~dev2
-+
-+ -- Victor Seva <linuxmaniac at torreviejawireless.org>  Mon, 03 Feb 2014 11:12:36 +0100
-+
-+kamailio (4.2.0~dev1) unstable; urgency=medium
-+
-+  * update version to 4.2.0~dev1
-+
-+ -- Victor Seva <linuxmaniac at torreviejawireless.org>  Wed, 08 Jan 2014 19:13:30 +0100
-+
-+kamailio (4.2.0~dev0) unstable; urgency=low
-+
-+  * Added packages:
-+    - kamailio-autheph-modules
-+    - kamailio-sctp-modules
-+    - kamailio-java-modules
-+
-+ --  Victor Seva <linuxmaniac at torreviejawireless.org>  Tue, 03 Dec 2013 14:26:58 +0100
-+
-+kamailio (4.0.0) unstable; urgency=low
-+
-+  * update to 4.0.0 from upstream
-+
-+ -- Daniel-Constantin Mierla <miconda at gmail.com>  Mon, 11 Mar 2013 10:40:30 +0100
-+
-+kamailio (3.4.0~dev0) unstable; urgency=low
-+
-+  * update version to 3.4.0~dev0
-+
-+ -- Jon Bonilla <manwe at aholab.ehu.es>  Wed, 15 Jun 2012 03:15:00 +0100
-+
-+kamailio (3.2.0) unstable; urgency=low
-+
-+  * update to 3.2.0 from upstream
-+
-+ -- Daniel-Constantin Mierla <miconda at gmail.com>  Fri, 29 Apr 2011 12:25:30 +0100
-+
-+kamailio (3.1.1) unstable; urgency=low
-+
-+  * update to 3.1.1 from upstream
-+
-+ -- Jon Bonilla <manwe at aholab.ehu.es>  Fri, 3 Dec 2010 16:30:00 +0100
-+
-+kamailio (3.1.0) unstable; urgency=low
-+
-+  * update to 3.1.0 from upstream
-+
-+ -- Jon Bonilla <manwe at aholab.ehu.es>  Wed, 6 Oct 2010 17:24:00 +0100
-+
-+kamailio (3.0.2.99) unstable; urgency=low
-+
-+  * update to 3.0.2.99 for development version builds
-+
-+ -- Jon Bonilla <manwe at aholab.ehu.es>  Fri, 28 May 2010 22:26:00 +0100
-+
-+kamailio (3.0.2) unstable; urgency=low
-+
-+  * update to 3.0.2 from upstream
-+
-+ -- Daniel-Constantin Mierla <miconda at gmail.com>  Thu, 27 May 2010 10:27:36 +0100
-+
-+kamailio (3.0.1) unstable; urgency=low
-+
-+  * update to 3.0.1 from upstream
-+
-+ -- Daniel-Constantin Mierla <miconda at gmail.com>  Mon, 08 Mar 2010 20:30:48 +0100
-+
-+kamailio (3.0.0) unstable; urgency=low
-+
-+  * update to 3.0.0 from upstream
-+
-+ -- Daniel-Constantin Mierla <miconda at gmail.com>  Mon, 11 Jan 2010 18:30:42 +0100
-+
-+kamailio (3.0.0-rc3) unstable; urgency=low
-+
-+  * update to 3.0.0-rc3 from upstream
-+  * updated debian/rules to work with the SIP Router style module packaging
-+
-+ -- Daniel-Constantin Mierla <miconda at gmail.com>  Fri, 10 Dec 2009 12:10:02 +0100
-+
-+kamailio (3.0.0-rc2) unstable; urgency=low
-+
-+  * update to 3.0.0-rc2 from upstream
-+  * updated debian/rules to work with the new style module packaging
-+
-+ -- Jonas Bergler <jonas.bergler at staff.snap.net.nz>  Wed, 18 Nov 2009 12:30:02 +1300
-+
-+kamailio (1.5.0-svn1) unstable; urgency=low
-+
-+  * increment debian packaging for trunk
-+
-+ -- Henning Westerholt <henning.westerholt at 1und1.de>  Mon, 02 Mar 2009 17:40:02 +0100
-+
-+kamailio (1.4.0-svn1) unstable; urgency=low
-+
-+  [ Klaus Darilion ]
-+  * first release of Kamailio (after renaming from Openser)
-+
-+ -- Julien BLACHE <jblache at debian.org>  Wed, 12 Dec 2007 17:25:31 +0100
-+
-+
-diff --git a/pkg/kamailio/deb/xenial/compat b/pkg/kamailio/deb/xenial/compat
-new file mode 100644
-index 0000000..ec63514
---- /dev/null
-+++ b/pkg/kamailio/deb/xenial/compat
-@@ -0,0 +1 @@
-+9
-diff --git a/pkg/kamailio/deb/xenial/control b/pkg/kamailio/deb/xenial/control
-new file mode 100644
-index 0000000..7a6d8fc
---- /dev/null
-+++ b/pkg/kamailio/deb/xenial/control
-@@ -0,0 +1,680 @@
-+Source: kamailio
-+Section: net
-+Priority: optional
-+Maintainer: Debian VoIP Team <pkg-voip-maintainers at lists.alioth.debian.org>
-+Uploaders: Victor Seva <linuxmaniac at torreviejawireless.org>,
-+           Tzafrir Cohen <tzafrir at debian.org>
-+Build-Depends: bison,
-+               debhelper (>= 9),
-+               dh-systemd (>= 1.5),
-+               docbook-xml,
-+               dpkg-dev (>= 1.16.1.1),
-+               erlang-dev,
-+               flex,
-+               gcj-jdk,
-+               libconfuse-dev,
-+               libcurl4-openssl-dev,
-+               libdb-dev (>= 4.6.19),
-+               libev-dev,
-+               libevent-dev,
-+               libexpat1-dev,
-+               libgeoip-dev (>= 1.4.5),
-+               libhiredis-dev (>= 0.10.0),
-+               libjansson-dev,
-+               libjson-c-dev,
-+               libldap2-dev,
-+               liblua5.1-0-dev,
-+               libmemcached-dev,
-+               libmono-2.0-dev,
-+               libmysqlclient-dev,
-+               libncurses5-dev,
-+               libpcre3-dev,
-+               libperl-dev,
-+               libpq-dev,
-+               libpurple-dev,
-+               librabbitmq-dev,
-+               libradcli-dev,
-+               libreadline-dev,
-+               libsasl2-dev,
-+               libsctp-dev,
-+               libsnmp-dev,
-+               libsqlite3-dev,
-+               libunistring-dev,
-+               libval-dev,
-+               libxml2-dev,
-+               libxmlrpc-core-c3-dev,
-+               openssl,
-+               pkg-config,
-+               python,
-+               python-dev,
-+               unixodbc-dev,
-+               uuid-dev,
-+               xsltproc,
-+               zlib1g-dev
-+Standards-Version: 3.9.5
-+Homepage: http://www.kamailio.org/
-+Vcs-git: git://anonscm.debian.org/pkg-voip/kamailio.git
-+Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-voip/kamailio.git
-+
-+Package: kamailio
-+Architecture: linux-any
-+Multi-Arch: foreign
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: adduser,
-+         python,
-+         ${misc:Depends},
-+         ${shlibs:Depends}
-+Suggests: kamailio-berkeley-modules,
-+          kamailio-carrierroute-modules,
-+          kamailio-cpl-modules,
-+          kamailio-dbg,
-+          kamailio-ldap-modules,
-+          kamailio-lua-modules,
-+          kamailio-mysql-modules,
-+          kamailio-perl-modules,
-+          kamailio-postgres-modules,
-+          kamailio-presence-modules,
-+          kamailio-python-modules,
-+          kamailio-radius-modules,
-+          kamailio-snmpstats-modules,
-+          kamailio-tls-modules,
-+          kamailio-unixodbc-modules,
-+          kamailio-xml-modules,
-+          kamailio-xmpp-modules
-+Description: very fast and configurable SIP proxy
-+ Kamailio is a very fast and flexible SIP (RFC3261)
-+ proxy server. Written entirely in C, Kamailio can handle thousands calls
-+ per second even on low-budget hardware.
-+ .
-+ C Shell-like scripting language provides full control over the server's
-+ behaviour. Its modular architecture allows only required functionality to be
-+ loaded.
-+ .
-+ Among others, the following modules are available: digest authentication, CPL
-+ scripts, instant messaging, MySQL support, presence agent, RADIUS
-+ authentication, record routing, SMS gateway, Jabber/XMPP gateway, transaction
-+ module, registrar and user location, XML-RPC interface.
-+ .
-+ This package contains the main Kamailio binary along with the principal modules
-+ and support binaries.
-+
-+Package: kamailio-dbg
-+Priority: extra
-+Section: debug
-+Architecture: linux-any
-+Multi-Arch: same
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: kamailio (= ${binary:Version}),
-+         ${misc:Depends}
-+Description: very fast and configurable SIP proxy [debug symbols]
-+ Kamailio is a very fast and flexible SIP (RFC3261)
-+ proxy server. Written entirely in C, Kamailio can handle thousands calls
-+ per second even on low-budget hardware.
-+ .
-+ This package contains the debugging symbols for the Kamailio binaries and
-+ modules. You only need to install it if you need to debug Kamailio.
-+
-+Package: kamailio-geoip-modules
-+Architecture: linux-any
-+Multi-Arch: same
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: kamailio (= ${binary:Version}),
-+         ${misc:Depends},
-+         ${shlibs:Depends}
-+Description: contains the geoip module
-+ Kamailio is a very fast and flexible SIP (RFC3261)
-+ proxy server. Written entirely in C, Kamailio can handle thousands calls
-+ per second even on low-budget hardware.
-+ .
-+ This package provides the geoip module, an extension allowing to
-+ use GeoIP API within configuration file.
-+
-+Package: kamailio-sqlite-modules
-+Architecture: linux-any
-+Multi-Arch: same
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: kamailio (= ${binary:Version}),
-+         ${misc:Depends},
-+         ${shlibs:Depends}
-+Recommends: sqlite3
-+Description: SQLite database connectivity module for Kamailio
-+ Kamailio is a very fast and flexible SIP (RFC3261)
-+ proxy server. Written entirely in C, Kamailio can handle thousands calls
-+ per second even on low-budget hardware.
-+ .
-+ This package provides the SQLite database driver for Kamailio.
-+
-+Package: kamailio-json-modules
-+Architecture: linux-any
-+Multi-Arch: same
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: kamailio (= ${binary:Version}),
-+         ${misc:Depends},
-+         ${shlibs:Depends}
-+Description: Json parser and jsonrpc modules for Kamailio
-+ Kamailio is a very fast and flexible SIP (RFC3261)
-+ proxy server. Written entirely in C, Kamailio can handle thousands calls
-+ per second even on low-budget hardware.
-+ .
-+ This package provides json parser for Kamailio's configuration file
-+ and the JSON-RPC client over netstrings.
-+
-+Package: kamailio-memcached-modules
-+Architecture: linux-any
-+Multi-Arch: same
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: kamailio (= ${binary:Version}),
-+         ${misc:Depends},
-+         ${shlibs:Depends}
-+Replaces: kamailio-memcached-module
-+Description: Provides the memcached module, an interface to the memcached server
-+ Kamailio is a very fast and flexible SIP (RFC3261)
-+ proxy server. Written entirely in C, Kamailio can handle thousands calls
-+ per second even on low-budget hardware.
-+ .
-+ This package provides the memcached module, an interface to the memcached
-+ server, a high-performance, distributed memory object caching system.
-+
-+Package: kamailio-lua-modules
-+Architecture: linux-any
-+Multi-Arch: same
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: kamailio (= ${binary:Version}),
-+         ${misc:Depends},
-+         ${shlibs:Depends}
-+Description: contains the app_lua module
-+ Kamailio is a very fast and flexible SIP (RFC3261)
-+ proxy server. Written entirely in C, Kamailio can handle thousands calls
-+ per second even on low-budget hardware.
-+ .
-+ This package provides the app_lua module, an extension allowing to
-+ execute embedded Lua applications within configuration file.
-+
-+Package: kamailio-mono-modules
-+Architecture: linux-any
-+Multi-Arch: same
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: kamailio (= ${binary:Version}),
-+         ${misc:Depends},
-+         ${shlibs:Depends}
-+Description: contains the app_mono module
-+ Kamailio is a very fast and flexible SIP (RFC3261)
-+ proxy server. Written entirely in C, Kamailio can handle thousands calls
-+ per second even on low-budget hardware.
-+ .
-+ This package provides the app_mono module, an extension allowing to
-+ execute embedded Mono applications within configuration file.
-+
-+Package: kamailio-python-modules
-+Architecture: linux-any
-+Multi-Arch: same
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: kamailio (= ${binary:Version}),
-+         python-dev,
-+         ${misc:Depends},
-+         ${shlibs:Depends}
-+Description: contains the app_python module
-+ Kamailio is a very fast and flexible SIP (RFC3261)
-+ proxy server. Written entirely in C, Kamailio can handle thousands calls
-+ per second even on low-budget hardware.
-+ .
-+ This package provides the app_python module, an extension allowing to
-+ execute embedded Python applications within configuration file.
-+
-+Package: kamailio-redis-modules
-+Architecture: linux-any
-+Multi-Arch: same
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: kamailio (= ${binary:Version}),
-+         ${misc:Depends},
-+         ${shlibs:Depends}
-+Description: Redis database connectivity module for Kamailio
-+ Kamailio is a very fast and flexible SIP (RFC3261)
-+ proxy server. Written entirely in C, Kamailio can handle thousands calls
-+ per second even on low-budget hardware.
-+ .
-+ This package provides the Redis NOSQL database driver for Kamailio.
-+
-+Package: kamailio-mysql-modules
-+Architecture: linux-any
-+Multi-Arch: same
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: kamailio (= ${binary:Version}),
-+         mysql-client | virtual-mysql-client,
-+         ${misc:Depends},
-+         ${shlibs:Depends}
-+Description: MySQL database connectivity module for Kamailio
-+ Kamailio is a very fast and flexible SIP (RFC3261)
-+ proxy server. Written entirely in C, Kamailio can handle thousands calls
-+ per second even on low-budget hardware.
-+ .
-+ This package provides the MySQL database driver for Kamailio.
-+
-+Package: kamailio-postgres-modules
-+Architecture: linux-any
-+Multi-Arch: same
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: kamailio (= ${binary:Version}),
-+         postgresql-client,
-+         ${misc:Depends},
-+         ${shlibs:Depends}
-+Description: PostgreSQL database connectivity module for Kamailio
-+ Kamailio is a very fast and flexible SIP (RFC3261)
-+ proxy server. Written entirely in C, Kamailio can handle thousands calls
-+ per second even on low-budget hardware.
-+ .
-+ This package provides the PostgreSQL database driver for Kamailio.
-+
-+Package: kamailio-cpl-modules
-+Architecture: linux-any
-+Multi-Arch: same
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: kamailio (= ${binary:Version}),
-+         ${misc:Depends},
-+         ${shlibs:Depends}
-+Description: CPL module (CPL interpreter engine) for Kamailio
-+ Kamailio is a very fast and flexible SIP (RFC3261)
-+ proxy server. Written entirely in C, Kamailio can handle thousands calls
-+ per second even on low-budget hardware.
-+ .
-+ This package provides a CPL (Call Processing Language) interpreter for
-+ Kamailio, turning Kamailio into a CPL server (storage and interpreter).
-+
-+Package: kamailio-radius-modules
-+Architecture: linux-any
-+Multi-Arch: same
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: kamailio (= ${binary:Version}),
-+         ${misc:Depends},
-+         ${shlibs:Depends}
-+Description: RADIUS modules for Kamailio
-+ Kamailio is a very fast and flexible SIP (RFC3261)
-+ proxy server. Written entirely in C, Kamailio can handle thousands calls
-+ per second even on low-budget hardware.
-+ .
-+ This package provides a set of RADIUS modules for Kamailio, for
-+ authentication, peering, group membership and messages URIs checking against a
-+ RADIUS server.
-+
-+Package: kamailio-unixodbc-modules
-+Architecture: linux-any
-+Multi-Arch: same
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: kamailio (= ${binary:Version}),
-+         ${misc:Depends},
-+         ${shlibs:Depends}
-+Description: unixODBC database connectivity module for Kamailio
-+ Kamailio is a very fast and flexible SIP (RFC3261)
-+ proxy server. Written entirely in C, Kamailio can handle thousands calls
-+ per second even on low-budget hardware.
-+ .
-+ This package provides the unixODBC database driver for Kamailio.
-+
-+Package: kamailio-presence-modules
-+Architecture: linux-any
-+Multi-Arch: same
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: kamailio (= ${binary:Version}),
-+         ${misc:Depends},
-+         ${shlibs:Depends}
-+Description: SIMPLE presence modules for Kamailio
-+ Kamailio is a very fast and flexible SIP (RFC3261)
-+ proxy server. Written entirely in C, Kamailio can handle thousands calls
-+ per second even on low-budget hardware.
-+ .
-+ This package provides several Kamailio modules for implementing presence
-+ server and presence user agent for RICH presence, registrar-based presence,
-+ external triggered presence and XCAP support.
-+
-+Package: kamailio-perl-modules
-+Architecture: linux-any
-+Multi-Arch: same
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: kamailio (= ${binary:Version}),
-+         ${misc:Depends},
-+         ${shlibs:Depends}
-+Description: Perl extensions and database driver for Kamailio
-+ Kamailio is a very fast and flexible SIP (RFC3261)
-+ proxy server. Written entirely in C, Kamailio can handle thousands calls
-+ per second even on low-budget hardware.
-+ .
-+ This package provides an interface for Kamailio to write Perl extensions and
-+ the perlvdb database driver for Kamailio.
-+
-+Package: kamailio-snmpstats-modules
-+Architecture: linux-any
-+Multi-Arch: same
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: kamailio (= ${binary:Version}),
-+         snmpd,
-+         ${misc:Depends},
-+         ${shlibs:Depends}
-+Description: SNMP AgentX subagent module for Kamailio
-+ Kamailio is a very fast and flexible SIP (RFC3261)
-+ proxy server. Written entirely in C, Kamailio can handle thousands calls
-+ per second even on low-budget hardware.
-+ .
-+ This package provides the snmpstats module for Kamailio. This module acts
-+ as an AgentX subagent which connects to a master agent.
-+
-+Package: kamailio-purple-modules
-+Architecture: linux-any
-+Multi-Arch: same
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: kamailio (= ${binary:Version}),
-+         ${misc:Depends},
-+         ${shlibs:Depends}
-+Description: Provides the purple module, a multi-protocol IM gateway
-+ Kamailio is a very fast and flexible SIP (RFC3261)
-+ proxy server. Written entirely in C, Kamailio can handle thousands calls
-+ per second even on low-budget hardware.
-+ .
-+ This package provides the purple module, a multi-protocol instant
-+ messaging gateway module.
-+
-+Package: kamailio-xmpp-modules
-+Architecture: linux-any
-+Multi-Arch: same
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: kamailio (= ${binary:Version}),
-+         ${misc:Depends},
-+         ${shlibs:Depends}
-+Description: XMPP gateway module for Kamailio
-+ Kamailio is a very fast and flexible SIP (RFC3261)
-+ proxy server. Written entirely in C, Kamailio can handle thousands calls
-+ per second even on low-budget hardware.
-+ .
-+ This package provides the SIP to XMPP IM translator module for Kamailio.
-+
-+Package: kamailio-xml-modules
-+Architecture: linux-any
-+Multi-Arch: same
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: kamailio (= ${binary:Version}),
-+         ${misc:Depends},
-+         ${shlibs:Depends}
-+Replaces: kamailio-xml-module,
-+          kamailio-xmlrpc-module
-+Provides: kamailio-xmlrpc-modules
-+Description: XML based extensions for Kamailio's Management Interface
-+ Kamailio is a very fast and flexible SIP (RFC3261)
-+ proxy server. Written entirely in C, Kamailio can handle thousands calls
-+ per second even on low-budget hardware.
-+ .
-+ This package provides:
-+ - the XMLRPC transport implementations for Kamailio's
-+ Management and Control Interface.
-+ - xmlops module for XPath operations in configuration file
-+
-+Package: kamailio-carrierroute-modules
-+Architecture: linux-any
-+Multi-Arch: same
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: kamailio (= ${binary:Version}),
-+         ${misc:Depends},
-+         ${shlibs:Depends}
-+Description: carrierroute module for Kamailio
-+ Kamailio is a very fast and flexible SIP (RFC3261)
-+ proxy server. Written entirely in C, Kamailio can handle thousands calls
-+ per second even on low-budget hardware.
-+ .
-+ This package provides the carrierroute module for Kamailio, an integrated
-+ solution for routing, balancing and blacklisting.
-+
-+Package: kamailio-berkeley-modules
-+Architecture: linux-any
-+Multi-Arch: same
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: db5.1-util,
-+         kamailio (= ${binary:Version}),
-+         ${misc:Depends},
-+         ${shlibs:Depends}
-+Description: Berkeley database module for Kamailio
-+ Kamailio is a very fast and flexible SIP (RFC3261)
-+ proxy server. Written entirely in C, Kamailio can handle thousands calls
-+ per second even on low-budget hardware.
-+ .
-+ This package provides the Berkeley database module for Kamailio, a
-+ high-performance embedded DB kernel. All database tables are stored
-+ in files, no additional server is necessary.
-+
-+Package: kamailio-berkeley-bin
-+Architecture: linux-any
-+Multi-Arch: foreign
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: ${misc:Depends},
-+         ${shlibs:Depends}
-+Description: Berkeley database module for Kamailio - helper program
-+ Kamailio is a very fast and flexible SIP (RFC3261)
-+ proxy server. Written entirely in C, Kamailio can handle thousands calls
-+ per second even on low-budget hardware.
-+ .
-+ This package provides helper modules for the Berkeley database module for
-+ Kamailio, a high-performance embedded DB kernel. You should normally
-+ install kamailio-berkeley-modules and not this package directly.
-+
-+Package: kamailio-ldap-modules
-+Architecture: linux-any
-+Multi-Arch: same
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: kamailio (= ${binary:Version}),
-+         ${misc:Depends},
-+         ${shlibs:Depends}
-+Description: LDAP modules for Kamailio
-+ Kamailio is a very fast and flexible SIP (RFC3261)
-+ proxy server. Written entirely in C, Kamailio can handle thousands calls
-+ per second even on low-budget hardware.
-+ .
-+ This package provides the ldap and h350 modules for Kamailio, enabling LDAP
-+ queries from the Kamailio config and storage of SIP account data in an LDAP
-+ directory.
-+
-+Package: kamailio-ims-modules
-+Architecture: linux-any
-+Multi-Arch: same
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: kamailio (= ${binary:Version}),
-+         ${misc:Depends},
-+         ${shlibs:Depends}
-+Description: IMS module for Kamailio
-+ Kamailio is a very fast and flexible SIP (RFC3261)
-+ proxy server. Written entirely in C, Kamailio can handle thousands calls
-+ per second even on low-budget hardware.
-+ .
-+ This package contains various Diameter interfaces and modules for Kamailio
-+ to run as an IMS core.
-+
-+Package: kamailio-utils-modules
-+Architecture: linux-any
-+Multi-Arch: same
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: kamailio (= ${binary:Version}),
-+         ${misc:Depends},
-+         ${shlibs:Depends}
-+Description: Provides a set utility functions for Kamailio
-+ Kamailio is a very fast and flexible SIP (RFC3261)
-+ proxy server. Written entirely in C, Kamailio can handle thousands calls
-+ per second even on low-budget hardware.
-+ .
-+ Provides a set of utility functions for Kamailio, which are not related
-+ to the server configuration.
-+ .
-+ Includes http client (http_client) module too
-+
-+Package: kamailio-sctp-modules
-+Architecture: linux-any
-+Multi-Arch: same
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: kamailio (= ${binary:Version}),
-+         ${misc:Depends},
-+         ${shlibs:Depends}
-+Description: sctp module for Kamailio
-+ Kamailio is a very fast and flexible SIP (RFC3261)
-+ proxy server. Written entirely in C, Kamailio can handle thousands calls
-+ per second even on low-budget hardware.
-+ .
-+ This package provides the sctp module for Kamailio.
-+
-+Package: kamailio-java-modules
-+Architecture: linux-any
-+Multi-Arch: same
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: gcj-jre,
-+         kamailio (= ${binary:Version}),
-+         ${misc:Depends},
-+         ${shlibs:Depends}
-+Description: contains the app_java module
-+ Kamailio is a very fast and flexible SIP (RFC3261)
-+ proxy server. Written entirely in C, Kamailio can handle thousands calls
-+ per second even on low-budget hardware.
-+ .
-+ This package provides the app_java module, an extension allowing to
-+ execute embedded Java applications within configuration file.
-+
-+Package: kamailio-tls-modules
-+Architecture: linux-any
-+Multi-Arch: same
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: kamailio (= ${binary:Version}),
-+         ${misc:Depends},
-+         ${shlibs:Depends}
-+Description: contains the TLS kamailio transport module
-+ This has been split out of the main kamailio package, so that kamailio will
-+ not depend on openssl. This module will enable you to use the TLS transport.
-+
-+Package: kamailio-outbound-modules
-+Architecture: linux-any
-+Multi-Arch: same
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: kamailio (= ${binary:Version}),
-+         ${misc:Depends},
-+         ${shlibs:Depends}
-+Description: Outbound module for Kamailio
-+ Kamailio is a very fast and flexible SIP (RFC3261)
-+ proxy server. Written entirely in C, Kamailio can handle thousands calls
-+ per second even on low-budget hardware.
-+ .
-+ This package contains the module implementing SIP outbound extension.
-+
-+Package: kamailio-websocket-modules
-+Architecture: linux-any
-+Multi-Arch: same
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: kamailio (= ${binary:Version}),
-+         ${misc:Depends},
-+         ${shlibs:Depends}
-+Description: Websocket module for kamailio
-+ Kamailio is a very fast and flexible SIP (RFC3261)
-+ proxy server. Written entirely in C, Kamailio can handle thousands calls
-+ per second even on low-budget hardware.
-+ .
-+ This package contains the module implementing WebSocket transport layer.
-+
-+Package: kamailio-dnssec-modules
-+Architecture: linux-any
-+Multi-Arch: same
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: kamailio (= ${binary:Version}),
-+         ${misc:Depends},
-+         ${shlibs:Depends}
-+Description: contains the dnssec module
-+ Kamailio is a very fast and flexible SIP (RFC3261)
-+ proxy server. Written entirely in C, Kamailio can handle thousands calls
-+ per second even on low-budget hardware.
-+ .
-+ This package provides the dnssec module for Kamailio.
-+
-+Package: kamailio-autheph-modules
-+Architecture: linux-any
-+Multi-Arch: same
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: kamailio (= ${binary:Version}),
-+         ${misc:Depends},
-+         ${shlibs:Depends}
-+Description: authentication using ephemeral credentials module for Kamailio
-+ Kamailio is a very fast and flexible SIP (RFC3261)
-+ proxy server. Written entirely in C, Kamailio can handle thousands calls
-+ per second even on low-budget hardware.
-+ .
-+ This package provides the ephemeral module for Kamailio.
-+
-+Package: kamailio-kazoo-modules
-+Architecture: linux-any
-+Multi-Arch: same
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: kamailio (= ${binary:Version}),
-+         ${misc:Depends},
-+         ${shlibs:Depends}
-+Description: kazoo modules for Kamailio
-+ Kamailio is a very fast and flexible SIP (RFC3261)
-+ proxy server. Written entirely in C, Kamailio can handle thousands calls
-+ per second even on low-budget hardware.
-+ .
-+ This package provides the kazoo module for Kamailio.
-+
-+Package: kamailio-cnxcc-modules
-+Architecture: linux-any
-+Multi-Arch: same
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: kamailio (= ${binary:Version}),
-+         ${misc:Depends},
-+         ${shlibs:Depends}
-+Description: cnxcc modules for Kamailio
-+ Kamailio is a very fast and flexible SIP (RFC3261)
-+ proxy server. Written entirely in C, Kamailio can handle thousands calls
-+ per second even on low-budget hardware.
-+ .
-+ This package provides the cnxcc module for Kamailio.
-+
-+Package: kamailio-erlang-modules
-+Architecture: linux-any
-+Multi-Arch: same
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: kamailio (= ${binary:Version}),
-+         ${misc:Depends},
-+         ${shlibs:Depends}
-+Description: erlang modules for Kamailio
-+ Kamailio is a very fast and flexible SIP (RFC3261)
-+ proxy server. Written entirely in C, Kamailio can handle thousands calls
-+ per second even on low-budget hardware.
-+ .
-+ This module provides interact with Erlang node. The module allows sending,
-+ receiving Erlang messages and RPC calls between each other.
-+
-+Package: kamailio-extra-modules
-+Architecture: linux-any
-+Multi-Arch: same
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: kamailio (= ${binary:Version}),
-+         ${misc:Depends},
-+         ${shlibs:Depends}
-+Description: extra modules for Kamailio
-+ Kamailio is a very fast and flexible SIP (RFC3261)
-+ proxy server. Written entirely in C, Kamailio can handle thousands calls
-+ per second even on low-budget hardware.
-+ .
-+ This package provides: gzcompress uuid ev jansson janssonrpc-c
-+
-+Package: kamailio-nth
-+Architecture: any
-+Pre-Depends: ${misc:Pre-Depends}
-+Depends: binutils,
-+         bison,
-+         bvi,
-+         flex,
-+         gcc,
-+         gdb,
-+         iftop,
-+         lsof,
-+         mc,
-+         most,
-+         ngrep,
-+         psmisc,
-+         screen,
-+         sipsak,
-+         tcpdump,
-+         vim,
-+         ${misc:Depends}
-+Description: Kamailio - package for "nice to have" installation
-+ This is a metapackage for easy installation various useful tools that may be
-+ handy on server with Kamailio installed.
-diff --git a/pkg/kamailio/deb/xenial/copyright b/pkg/kamailio/deb/xenial/copyright
-new file mode 100644
-index 0000000..ff31338
---- /dev/null
-+++ b/pkg/kamailio/deb/xenial/copyright
-@@ -0,0 +1,335 @@
-+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
-+Upstream-Name: Kamailio
-+Upstream-Contact: sr-dev at lists.sip-router.org
-+Source: http://www.kamailio.org/pub/kamailio/
-+
-+Files: *
-+Copyright:
-+ 2001-2003 FhG Fokus
-+ 2006-2010 iptelorg GmbH
-+ Various others (see AUTHORS file)
-+License: GPL-2.0+
-+ On Debian systems, the full text of the GNU General Public
-+ License version 2 can be found in the file `/usr/share/common-licenses/GPL-2'.
-+
-+Files: debian/*
-+Copyright: 2012, 2013, 2014 Victor Seva <linuxmaniac at torreviejawireless.org>
-+           2009, 2010, 2011, Daniel-Constantin Mierla <miconda at gmail.com>
-+           2010, Jon Bonilla <manwe at aholab.ehu.es>
-+           2009, Jonas Bergler <jonas.bergler at staff.snap.net.nz>
-+           2009, Henning Westerholt <henning.westerholt at 1und1.de>
-+           2007, Julien BLACHE <jblache at debian.org>
-+License: GPL-2+
-+ On Debian systems, the full text of the GNU General Public
-+ License version 2 can be found in the file `/usr/share/common-licenses/GPL-2'.
-+
-+
-+Files: atomic/* atomic_ops.* basex.* bit_*.c char_msg_val.h compiler_opt.h
-+ core_stats.h counters.* endianness.* futexlock.h hashes.h io_wait.*
-+ kstats_types.h lib/kcore/kstats_wrapper.* lock_ops.c lock_ops_init.h
-+ lvalue.* mem/ll_malloc.* mem/memdbg.h mem/sf_malloc.* mi/*.h mod_fix.*
-+ modules/tm/rpc_uac.* modules/counters/counters.c modules/tls/sbufq.h
-+ modules/tls/tls_bio.* modules/tls/tls_cfg.* modules/tls/tls_cfg.h
-+ modules/tls/tls_ct_wrq.* modules/tls/tls_ct_q.h modules/tls/tls_domain.*
-+ modules/tls/tls_server.h modules/tls/tls_locking.* modules/tls/tls_rpc.*
-+ modules/tls/tls_server.c modules/malloc_test/malloc_test.c modules/blst/blst.c
-+ parser/case_p_* parser/case_reas.h pvapi.h pv_core.* rand/fastrand.* raw_*
-+ rpc_lookup.* rvalue.* sctp_* ser_time.h shm_init.* sip_msg_clone.* sock_ut.*
-+ sr_compat.* str_hash.h switch.* tcp_ev.h tcp_int_send.h tcp_options.*
-+ tcp_read.h tcp_stats.* timer_proc.* tls_hooks.* tls_hooks_init.h ver.*
-+Copyright: 2006-2010 iptelorg GmbH
-+License: ISC
-+
-+Files: modules/tls/tls_select.* modules/tls/tls_dump_vf.*
-+Copyright: 2005-2010 iptelorg GmbH
-+License: GPL-2 + OpenSSL exception
-+ On Debian systems, the full text of the GNU General Public
-+ License version 2 can be found in the file `/usr/share/common-licenses/GPL-2'.
-+ * Exception: permission to copy, modify, propagate, and distribute a work
-+ * formed by combining OpenSSL toolkit software and the code in this file,
-+ * such as linking with software components and libraries released under
-+ * OpenSSL project license.
-+
-+Files: modules/websocket/* modules/outbound/* modules/auth_ephemeral/*
-+Copyright: 2012-2013 Crocodile RCS Ltd
-+License: GPL-2 + OpenSSL exception
-+ On Debian systems, the full text of the GNU General Public
-+ License version 2 can be found in the file `/usr/share/common-licenses/GPL-2'.
-+ * Exception: permission to copy, modify, propagate, and distribute a work
-+ * formed by combining OpenSSL toolkit software and the code in this file,
-+ * such as linking with software components and libraries released under
-+ * OpenSSL project license.
-+
-+Files: daemonize.* fastlock.h lock_ops.h mem/mem.* mem/f_malloc.h
-+ mem/meminfo.h mem/memtest.c mem/shm_mem.c mem/q_malloc.h mem/q_malloc.c
-+ mem/shm_mem.h mem/f_malloc.c modules/tls/tls_rpc.c modules/tls/tls_server.c
-+ modules/tls/tls_domain.c modules/tls/tls_domain.h modules/tls/tls_server.h
-+ modules/tls/tls_rpc.h pt.c pt.h sched_yield.h ut.c ut.h
-+Copyright: 2001-2003 FhG Fokus
-+License: ISC
-+
-+Files: events.* modules/topoh/*
-+Copyright: 2009 SIP-Router.org
-+License: ISC
-+
-+Files: modules/mi_rpc/mi_rpc_mod.c modules/pv/pv_xavp.*
-+ modules/usrloc/ul_rpc.* ppcfg.* xavp.*
-+Copyright: 2009-2010 Daniel-Constantin Mierla (asipto.com)
-+License: ISC
-+
-+Files: obsolete/jabber_k/tree234.*
-+Copyright: 1999, 2000, 2001, Simon Tatham
-+License: Expat
-+ Permission is hereby granted, free of charge, to any person
-+ obtaining a copy of this software and associated documentation
-+ files (the "Software"), to deal in the Software without
-+ restriction, including without limitation the rights to use,
-+ copy, modify, merge, publish, distribute, sublicense, and/or
-+ sell copies of the Software, and to permit persons to whom the
-+ Software is furnished to do so, subject to the following
-+ conditions:
-+ .
-+ The above copyright notice and this permission notice shall be
-+ included in all copies or substantial portions of the Software.
-+ .
-+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-+ NONINFRINGEMENT.  IN NO EVENT SHALL SIMON TATHAM BE LIABLE FOR
-+ ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-+ CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-+ SOFTWARE.
-+
-+Files: modules/xmpp/xsnprintf.c obsolete/jabber_s/xsnprintf.c obsolete/jabber_k/xsnprintf.c
-+Copyright: 1995-1998, The Apache Group
-+License: Apache-1.0
-+ Redistribution and use in source and binary forms, with or without
-+ modification, are permitted provided that the following conditions
-+ are met:
-+ .
-+ 1. Redistributions of source code must retain the above copyright
-+    notice, this list of conditions and the following disclaimer.
-+ .
-+ 2. Redistributions in binary form must reproduce the above copyright
-+    notice, this list of conditions and the following disclaimer in
-+    the documentation and/or other materials provided with the
-+    distribution.
-+ .
-+ 3. All advertising materials mentioning features or use of this
-+    software must display the following acknowledgment:
-+    "This product includes software developed by the Apache Group
-+    for use in the Apache HTTP server project (http://www.apache.org/)."
-+ .
-+ 4. The names "Apache Server" and "Apache Group" must not be used to
-+    endorse or promote products derived from this software without
-+    prior written permission.
-+ .
-+ 5. Redistributions of any form whatsoever must retain the following
-+    acknowledgment:
-+    "This product includes software developed by the Apache Group
-+    for use in the Apache HTTP server project (http://www.apache.org/)."
-+ .
-+ THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
-+ EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-+ PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE APACHE GROUP OR
-+ ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-+ NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-+ OF THE POSSIBILITY OF SUCH DAMAGE.
-+
-+Files: modules/mi_xmlrpc/abyss*
-+Copyright: 2000, Moez Mahfoudh <mmoez at bigfoot.com>
-+License: BSD-3-clause
-+
-+Files: list.h
-+Copyright: 1991, 1993 The Regents of the University of California
-+License: BSD-3-clause
-+
-+Files: modules/tm/t_serial.*
-+Copyright: 2008 Juha Heinanen
-+License: BSD-2-clause
-+
-+Files: parser/sdp/sdp.* parser/sdp/sdp_helpr_funcs.* parser/sdp/sdp_cloner.h
-+Copyright:
-+ 2008-2009 SOMA Networks, INC.
-+ 2010 VoIP Embedded, Inc
-+License: BSD-2-clause
-+
-+Files: modules/tls/fixed_c_zlib.h
-+Copyright:1998-2005 The OpenSSL Project
-+Comment: file copied from OpenSSL 0.9.8, refers to OpenSSL License. Note that
-+ this code will not build by default in the Debian packaging.
-+License: OpenSSL
-+ Redistribution and use in source and binary forms, with or without
-+ modification, are permitted provided that the following conditions
-+ are met:
-+ .
-+ 1. Redistributions of source code must retain the above copyright
-+    notice, this list of conditions and the following disclaimer.
-+ .
-+ 2. Redistributions in binary form must reproduce the above copyright
-+    notice, this list of conditions and the following disclaimer in
-+    the documentation and/or other materials provided with the
-+    distribution.
-+ .
-+ 3. All advertising materials mentioning features or use of this
-+    software must display the following acknowledgment:
-+    "This product includes software developed by the OpenSSL Project
-+    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
-+ .
-+ 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
-+    endorse or promote products derived from this software without
-+    prior written permission. For written permission, please contact
-+    openssl-core at openssl.org.
-+ .
-+ 5. Products derived from this software may not be called "OpenSSL"
-+    nor may "OpenSSL" appear in their names without prior written
-+    permission of the OpenSSL Project.
-+ .
-+ 6. Redistributions of any form whatsoever must retain the following
-+    acknowledgment:
-+    "This product includes software developed by the OpenSSL Project
-+    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
-+ .
-+ THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
-+ EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-+ PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
-+ ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-+ NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-+ OF THE POSSIBILITY OF SUCH DAMAGE.
-+
-+Files: md5.* md5utils.c
-+Copyright: 1991-2, RSA Data Security, Inc
-+Comment: Note that md5.c and md5.h have been replaced in the patches
-+ plum_md5*.patch .
-+ .
-+ As for md5utils.c, according to a mail from Upstream (Daniel-Constantin
-+ Mierla): while the initial commit log for it states that it is derived
-+ from mddriver.c of RFC 1321, it seems that it was, in fact, written from
-+ scratch by Jiri Kuthan (a core developer of SER at that time, working for
-+ FhG Fokus Institute). As you can see it's rather trivial and uses a data
-+ type of SER ("str").  I didn't reimplement it as it's too trivial and
-+ looks like there's no other way to implement it.
-+License: RSA-MD5
-+ License to copy and use this software is granted provided that it
-+ is identified as the "RSA Data Security, Inc. MD5 Message-Digest
-+ Algorithm" in all material mentioning or referencing this software
-+ or this function.
-+ .
-+ License is also granted to make and use derivative works provided
-+ that such works are identified as "derived from the RSA Data
-+ Security, Inc. MD5 Message-Digest Algorithm" in all material
-+ mentioning or referencing the derived work.
-+ .
-+ RSA Data Security, Inc. makes no representations concerning either
-+ the merchantability of this software or the suitability of this
-+ software for any particular purpose. It is provided "as is"
-+ without express or implied warranty of any kind.
-+ .
-+ These notices must be retained in any copies of any part of this
-+ documentation and/or software.
-+
-+Files: mem/dl_*
-+Copyright: n/a
-+License: public-domain
-+ This is a version (aka dlmalloc) of malloc/free/realloc written by
-+ Doug Lea and released to the public domain, as explained at
-+ http://creativecommons.org/licenses/publicdomain.  Send questions,
-+ comments, complaints, performance data, etc to dl at cs.oswego.edu
-+
-+Files: rand/isaac/*
-+Copyright: n/a
-+License: public-domain
-+ By Bob Jenkins.  My random number generator, ISAAC.  Public Domain.
-+
-+License: ISC
-+ Permission to use, copy, modify, and distribute this software for any
-+ purpose with or without fee is hereby granted, provided that the above
-+ copyright notice and this permission notice appear in all copies.
-+ .
-+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-+
-+Files: lib/srutils/srjson.*
-+Copyright: 2009 Dave Gamble
-+License: MIT
-+ Permission is hereby granted, free of charge, to any person obtaining a copy
-+ of this software and associated documentation files (the "Software"), to deal
-+ in the Software without restriction, including without limitation the rights
-+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-+ copies of the Software, and to permit persons to whom the Software is
-+ furnished to do so, subject to the following conditions:
-+ .
-+ The above copyright notice and this permission notice shall be included in
-+ all copies or substantial portions of the Software.
-+ ,
-+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-+ THE SOFTWARE.
-+
-+License: BSD-3-clause
-+ Redistribution and use in source and binary forms, with or without
-+ modification, are permitted provided that the following conditions
-+ are met:
-+ 1. Redistributions of source code must retain the above copyright
-+    notice, this list of conditions and the following disclaimer.
-+ 2. Redistributions in binary form must reproduce the above copyright
-+    notice, this list of conditions and the following disclaimer in the
-+    documentation and/or other materials provided with the distribution.
-+ 4. Neither the name of the University nor the names of its contributors
-+    may be used to endorse or promote products derived from this software
-+    without specific prior written permission.
-+ .
-+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-+ ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-+ SUCH DAMAGE.
-+
-+License: BSD-2-clause
-+ Redistribution and use in source and binary forms, with or without
-+ modification, are permitted provided that the following conditions are met:
-+ .
-+  1. Redistributions of source code must retain the above copyright notice,
-+     this list of conditions and the following disclaimer.
-+  2. Redistributions in binary form must reproduce the above copyright
-+     notice, this list of conditions and the following disclaimer in the
-+     documentation and/or other materials provided with the distribution.
-+ .
-+ THIS SOFTWARE IS PROVIDED BY THE FREEBSD PROJECT ``AS IS'' AND ANY EXPRESS OR
-+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
-+ EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
-+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-diff --git a/pkg/kamailio/deb/xenial/kamailio-autheph-modules.lintian-overrides b/pkg/kamailio/deb/xenial/kamailio-autheph-modules.lintian-overrides
-new file mode 100644
-index 0000000..dcb3d18
---- /dev/null
-+++ b/pkg/kamailio/deb/xenial/kamailio-autheph-modules.lintian-overrides
-@@ -0,0 +1 @@
-+kamailio-autheph-modules binary: possible-gpl-code-linked-with-openssl
-diff --git a/pkg/kamailio/deb/xenial/kamailio-berkeley-bin.dirs b/pkg/kamailio/deb/xenial/kamailio-berkeley-bin.dirs
-new file mode 100644
-index 0000000..236670a
---- /dev/null
-+++ b/pkg/kamailio/deb/xenial/kamailio-berkeley-bin.dirs
-@@ -0,0 +1 @@
-+usr/sbin
-diff --git a/pkg/kamailio/deb/xenial/kamailio-dnssec-modules.lintian-overrides b/pkg/kamailio/deb/xenial/kamailio-dnssec-modules.lintian-overrides
-new file mode 100644
-index 0000000..10165fe
---- /dev/null
-+++ b/pkg/kamailio/deb/xenial/kamailio-dnssec-modules.lintian-overrides
-@@ -0,0 +1 @@
-+kamailio-dnssec-modules binary: possible-gpl-code-linked-with-openssl
-diff --git a/pkg/kamailio/deb/xenial/kamailio-outbound-modules.lintian-overrides b/pkg/kamailio/deb/xenial/kamailio-outbound-modules.lintian-overrides
-new file mode 100644
-index 0000000..3050cfe
---- /dev/null
-+++ b/pkg/kamailio/deb/xenial/kamailio-outbound-modules.lintian-overrides
-@@ -0,0 +1 @@
-+kamailio-outbound-modules binary: possible-gpl-code-linked-with-openssl
-diff --git a/pkg/kamailio/deb/xenial/kamailio-tls-modules.lintian-overrides b/pkg/kamailio/deb/xenial/kamailio-tls-modules.lintian-overrides
-new file mode 100644
-index 0000000..bbe0d37
---- /dev/null
-+++ b/pkg/kamailio/deb/xenial/kamailio-tls-modules.lintian-overrides
-@@ -0,0 +1 @@
-+kamailio-tls-modules binary: possible-gpl-code-linked-with-openssl
-diff --git a/pkg/kamailio/deb/xenial/kamailio-websocket-modules.lintian-overrides b/pkg/kamailio/deb/xenial/kamailio-websocket-modules.lintian-overrides
-new file mode 100644
-index 0000000..8f384fb
---- /dev/null
-+++ b/pkg/kamailio/deb/xenial/kamailio-websocket-modules.lintian-overrides
-@@ -0,0 +1 @@
-+kamailio-websocket-modules binary: possible-gpl-code-linked-with-openssl
-diff --git a/pkg/kamailio/deb/xenial/kamailio.README.Debian b/pkg/kamailio/deb/xenial/kamailio.README.Debian
-new file mode 100644
-index 0000000..d25769a
---- /dev/null
-+++ b/pkg/kamailio/deb/xenial/kamailio.README.Debian
-@@ -0,0 +1,39 @@
-+Kamailio for Debian
-+-------------------
-+
-+* init script check for fork=no
-+-------------------------------
-+
-+The Kamailio init script will not start Kamailio on boot if fork=no is
-+specified in the config file. The check in the initscript will match
-+any occurrence of fork=no in the file, even inside C-style comments.
-+
-+You can disable this check in the init script if you wish; just comment
-+out the calls to the check_fork function in the script. Your changes to
-+the init script will be preserved upon upgrade, as the file is tagged
-+as a conffile.
-+
-+
-+* Kamailio setup
-+----------------
-+
-+To setup Kamailio, you need to:
-+ - configure Kamailio properly to suit your needs
-+ - edit /etc/default/kamailio, adjust the MEMORY parameter and set
-+   RUN_KAMAILIO to "yes"
-+
-+If you are building an HA cluster using heartbeat or similar, you'll want
-+to disable the init script by running:
-+
-+  update-rc.d kamailio remove
-+
-+so that Kamailio will not be launched at system startup. You still need
-+to set RUN_KAMAILIO to "yes" if you want to use the /etc/init.d/kamailio init
-+script.
-+
-+Set the DUMP_CORE parameter in /etc/default/kamailio to "yes" if you want to
-+get a core dump in case Kamailio crashes. The debug symbols for Kamailio are
-+provided by the kamailio-dbg package.
-+
-+
-+ -- Victor Seva <linuxmaniac at torreviejawireless.org>  Wed, 11 Dec 2013 16:07:11 +0100
-diff --git a/pkg/kamailio/deb/xenial/kamailio.default b/pkg/kamailio/deb/xenial/kamailio.default
-new file mode 100644
-index 0000000..8b20fc0
---- /dev/null
-+++ b/pkg/kamailio/deb/xenial/kamailio.default
-@@ -0,0 +1,28 @@
-+#
-+# Kamailio startup options
-+#
-+
-+# Set to yes to enable kamailio, once configured properly.
-+#RUN_KAMAILIO=yes
-+
-+# User to run as
-+#USER=kamailio
-+
-+# Group to run as
-+#GROUP=kamailio
-+
-+# Amount of shared and private memory to allocate
-+# for the running Kamailio server (in Mb)
-+#SHM_MEMORY=64
-+#PKG_MEMORY=8
-+
-+# Config file
-+#CFGFILE=/etc/kamailio/kamailio.cfg
-+
-+# Enable the server to leave a core file when it crashes.
-+# Set this to 'yes' to enable Kamailio to leave a core file when it crashes
-+# or 'no' to disable this feature. This option is case sensitive and only
-+# accepts 'yes' and 'no' and only in lowercase letters.
-+# On some systems it is necessary to specify a directory for the core files
-+# to get a dump. Look into the kamailio init file for an example configuration.
-+#DUMP_CORE=yes
-diff --git a/pkg/kamailio/deb/xenial/kamailio.examples b/pkg/kamailio/deb/xenial/kamailio.examples
-new file mode 100644
-index 0000000..e39721e
---- /dev/null
-+++ b/pkg/kamailio/deb/xenial/kamailio.examples
-@@ -0,0 +1 @@
-+examples/*
-diff --git a/pkg/kamailio/deb/xenial/kamailio.init b/pkg/kamailio/deb/xenial/kamailio.init
-new file mode 100644
-index 0000000..b14f83a
---- /dev/null
-+++ b/pkg/kamailio/deb/xenial/kamailio.init
-@@ -0,0 +1,163 @@
-+#! /bin/sh
-+#
-+### BEGIN INIT INFO
-+# Provides:          kamailio
-+# Required-Start:    $syslog $network $local_fs $remote_fs $time
-+# Should-Start:      $named slapd mysql postgresql snmpd radiusd
-+# Should-Stop:       $named slapd mysql postgresql snmpd radiusd
-+# Required-Stop:     $syslog $network $local_fs $remote_fs
-+# Default-Start:     2 3 4 5
-+# Default-Stop:      0 1 6
-+# Short-Description: Start the Kamailio SIP proxy server
-+# Description:       Start the Kamailio SIP proxy server
-+### END INIT INFO
-+
-+. /lib/lsb/init-functions
-+
-+PATH=/sbin:/bin:/usr/sbin:/usr/bin
-+DAEMON=/usr/sbin/kamailio
-+NAME=`basename "$0"`
-+DESC="Kamailio SIP Server"
-+HOMEDIR=/var/run/$NAME
-+PIDFILE=$HOMEDIR/$NAME.pid
-+DEFAULTS=/etc/default/$NAME
-+CFGFILE=/etc/$NAME/kamailio.cfg
-+RUN_KAMAILIO=no
-+USER=kamailio
-+GROUP=kamailio
-+# Amount of shared and private memory to allocate
-+# for the running Kamailio server (in Mb)
-+SHM_MEMORY=64
-+PKG_MEMORY=8
-+DUMP_CORE=no
-+
-+# Do not start kamailio if fork=no is set in the config file
-+# otherwise the boot process will just stop
-+check_fork ()
-+{
-+    if grep -q "^[[:space:]]*fork[[:space:]]*=[[:space:]]*no.*" $CFGFILE; then
-+	log_failure_msg "Not starting $DESC: fork=no specified in config file; run /etc/init.d/kamailio debug instead"
-+	exit 0
-+    fi
-+}
-+
-+check_kamailio_config ()
-+{
-+	# Check if kamailio configuration is valid before starting the server
-+	set +e
-+	out=$($DAEMON -f $CFGFILE -M $PKG_MEMORY -c 2>&1 > /dev/null)
-+	retcode=$?
-+	set -e
-+	if [ "$retcode" != '0' ]; then
-+	    log_failure_msg "Not starting $DESC: invalid configuration file!"
-+	    log_failure_msg
-+	    log_failure_msg "$out"
-+	    log_failure_msg
-+	    exit 1
-+	fi
-+}
-+
-+create_radius_seqfile ()
-+{
-+    # Create a radius sequence file to be used by the radius client if
-+    # radius accounting is enabled. This is needed to avoid any issue
-+    # with the file not being writable if kamailio first starts as user
-+    # root because DUMP_CORE is enabled and creates this file as user
-+    # root and then later it switches back to user kamailio and cannot
-+    # write to the file. If the file exists before kamailio starts, it
-+    # won't change it's ownership and will be writable for both root
-+    # and kamailio, no matter what options are chosen at install time
-+    RADIUS_SEQ_FILE="$HOMEDIR/kamailio_radius.seq"
-+    if [ -d $HOMEDIR ]; then
-+	chown ${USER}:${GROUP} $HOMEDIR
-+
-+	if [ ! -f $RADIUS_SEQ_FILE ]; then
-+	    touch $RADIUS_SEQ_FILE
-+	fi
-+
-+	chown ${USER}:${GROUP} $RADIUS_SEQ_FILE
-+	chmod 660 $RADIUS_SEQ_FILE
-+    fi
-+}
-+
-+test -f $DAEMON || exit 0
-+
-+# Load startup options if available
-+if [ -f $DEFAULTS ]; then
-+   . $DEFAULTS || true
-+fi
-+
-+if [ "$RUN_KAMAILIO" != "yes" ]; then
-+    log_failure_msg "Kamailio not yet configured. Edit /etc/default/$NAME first."
-+    exit 0
-+fi
-+
-+set -e
-+
-+SHM_MEMORY=$((`echo $SHM_MEMORY | sed -e 's/[^0-9]//g'`))
-+PKG_MEMORY=$((`echo $PKG_MEMORY | sed -e 's/[^0-9]//g'`))
-+[ -z "$USER" ]  && USER=kamailio
-+[ -z "$GROUP" ] && GROUP=kamailio
-+[ $SHM_MEMORY -le 0 ] && SHM_MEMORY=64
-+[ $PKG_MEMORY -le 0 ] && PKG_MEMORY=4
-+
-+if test "$DUMP_CORE" = "yes" ; then
-+    # set proper ulimit
-+    ulimit -c unlimited
-+
-+    # directory for the core dump files
-+    # COREDIR=/home/corefiles
-+    # [ -d $COREDIR ] || mkdir $COREDIR
-+    # chmod 777 $COREDIR
-+    # echo "$COREDIR/core.%e.sig%s.%p" > /proc/sys/kernel/core_pattern
-+fi
-+
-+# /var/run can be a tmpfs
-+if [ ! -d $HOMEDIR ]; then
-+    mkdir -p $HOMEDIR
-+    chown ${USER}:${GROUP} $HOMEDIR
-+fi
-+
-+OPTIONS="-f $CFGFILE -P $PIDFILE -m $SHM_MEMORY -M $PKG_MEMORY -u $USER -g $GROUP"
-+
-+case "$1" in
-+  start|debug)
-+	check_kamailio_config
-+	create_radius_seqfile
-+
-+	if [ "$1" != "debug" ]; then
-+	    check_fork
-+	fi
-+
-+	log_daemon_msg "Starting $DESC: $NAME"
-+	start-stop-daemon --start --quiet --pidfile $PIDFILE \
-+		--exec $DAEMON -- $OPTIONS || log_failure_msg " already running"
-+	log_end_msg 0
-+	;;
-+  stop)
-+	log_daemon_msg "Stopping $DESC: $NAME"
-+	start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE \
-+		--exec $DAEMON
-+	log_end_msg 0
-+	;;
-+  restart|force-reload)
-+	check_kamailio_config
-+	create_radius_seqfile
-+
-+	$0 stop
-+	sleep 1
-+	$0 start
-+	;;
-+  status)
-+	log_daemon_msg "Status of $DESC: "
-+
-+	status_of_proc -p"$PIDFILE" $NAME $NAME
-+	;;
-+  *)
-+	N=/etc/init.d/$NAME
-+	echo "Usage: $N {start|stop|restart|force-reload|status|debug}" >&2
-+	exit 1
-+	;;
-+esac
-+
-+exit 0
-diff --git a/pkg/kamailio/deb/xenial/kamailio.lintian-overrides b/pkg/kamailio/deb/xenial/kamailio.lintian-overrides
-new file mode 100644
-index 0000000..18152ed
---- /dev/null
-+++ b/pkg/kamailio/deb/xenial/kamailio.lintian-overrides
-@@ -0,0 +1,2 @@
-+kamailio binary: example-interpreter-not-absolute usr/share/doc/kamailio/examples/outbound/edge.cfg #!KAMAILIO
-+kamailio binary: example-interpreter-not-absolute usr/share/doc/kamailio/examples/outbound/registrar.cfg #!KAMAILIO
-diff --git a/pkg/kamailio/deb/xenial/kamailio.postinst b/pkg/kamailio/deb/xenial/kamailio.postinst
-new file mode 100644
-index 0000000..4ee38ec
---- /dev/null
-+++ b/pkg/kamailio/deb/xenial/kamailio.postinst
-@@ -0,0 +1,24 @@
-+#! /bin/sh
-+
-+set -e
-+
-+case "$1" in
-+    configure)
-+        adduser --quiet --system --group --disabled-password \
-+                --shell /bin/false --gecos "Kamailio SIP Server" \
-+                --home /var/run/kamailio kamailio || true
-+
-+        ;;
-+
-+    abort-upgrade|abort-remove|abort-deconfigure)
-+
-+        ;;
-+
-+    *)
-+        echo "postinst called with unknown argument \`$1'" >&2
-+        exit 1
-+        ;;
-+esac
-+
-+#DEBHELPER#
-+
-diff --git a/pkg/kamailio/deb/xenial/kamailio.service b/pkg/kamailio/deb/xenial/kamailio.service
-new file mode 100644
-index 0000000..06c3334
---- /dev/null
-+++ b/pkg/kamailio/deb/xenial/kamailio.service
-@@ -0,0 +1,21 @@
-+[Unit]
-+Description=Kamailio (OpenSER) - the Open Source SIP Server
-+After=network.target
-+
-+[Service]
-+Type=forking
-+Environment='CFGFILE=/etc/kamailio/kamailio.cfg'
-+Environment='SHM_MEMORY=64'
-+Environment='PKG_MEMORY=8'
-+Environment='USER=kamailio'
-+Environment='GROUP=kamailio'
-+EnvironmentFile=-/etc/default/kamailio
-+EnvironmentFile=-/etc/default/kamailio.d/*
-+# PIDFile requires a full absolute path
-+PIDFile=/var/run/kamailio/kamailio.pid
-+# ExecStart requires a full absolute path
-+ExecStart=/usr/sbin/kamailio -P /var/run/kamailio/kamailio.pid -f $CFGFILE -m $SHM_MEMORY -M $PKG_MEMORY -u $USER -g $GROUP
-+Restart=on-abort
-+
-+[Install]
-+WantedBy=multi-user.target
-diff --git a/pkg/kamailio/deb/xenial/rules b/pkg/kamailio/deb/xenial/rules
-new file mode 100755
-index 0000000..6cb058b
---- /dev/null
-+++ b/pkg/kamailio/deb/xenial/rules
-@@ -0,0 +1,229 @@
-+#!/usr/bin/make -f
-+# Sample debian/rules that uses debhelper.
-+# GNU copyright 1997 to 1999 by Joey Hess.
-+
-+DEBVERSION:=$(shell head -n 1 debian/changelog \
-+                    | sed -e 's/^[^(]*(\([^)]*\)).*/\1/')
-+UPVERSION:=$(shell dpkg-parsechangelog | sed -ne 's/^Version: \(\([0-9]\+\):\)\?\(.*\)-.*/\3/p')
-+
-+FILENAME := kamailio_$(UPVERSION).orig.tar.gz
-+URL := http://www.kamailio.org/pub/kamailio/$(UPVERSION)/src/kamailio-$(UPVERSION)_src.tar.gz
-+
-+DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
-+
-+export DEB_BUILD_MAINT_OPTIONS = hardening=+all
-+DPKG_EXPORT_BUILDFLAGS = 1
-+include /usr/share/dpkg/buildflags.mk
-+
-+# Uncomment this to turn on verbose mode.
-+#export DH_VERBOSE=1
-+
-+export JAVA_HOME=/usr/lib/jvm/java-gcj
-+export RADCLI=1
-+
-+# modules not in the "main" kamailio package
-+EXCLUDED_MODULES=
-+
-+# extra modules to skip, because they are not compilable now
-+# - regardless if they go to the main kamailio package or to some module package,
-+# they will be excluded from compile and install of all
-+EXTRA_EXCLUDED_MODULES=bdb dbtext oracle pa iptrtpproxy
-+
-+# module groups that are packaged in seperate packages
-+# (with the name kamailio-$(group_name)-modules)
-+# Note: the order is important (should be in dependency order, the one
-+# on which other depend first)
-+PACKAGE_GROUPS=mysql postgres berkeley unixodbc radius presence \
-+			   ldap xml perl utils lua memcached \
-+			   snmpstats carrierroute xmpp cpl redis python geoip\
-+			   sqlite json mono ims sctp java \
-+			   purple tls outbound websocket autheph dnssec kazoo cnxcc \
-+			   erlang
-+
-+# module groups to be packaged onto kamailio-extra-modules
-+EXTRA_GROUPS=gzcompress uuid ev jansson
-+
-+# name of libdir in the path for libraries (e.g., lib for 32b, lib64 for 64b)
-+LIBDIR ?= lib/$(DEB_HOST_MULTIARCH)
-+
-+# directories with possible duplicate libraries (that should be deleted
-+# from current module* packages)
-+DUP_LIBS_DIRS=$(CURDIR)/debian/kamailio/usr/$(LIBDIR)/kamailio \
-+			$(CURDIR)/debian/kamailio-db-modules/usr/$(LIBDIR)/kamailio
-+
-+# "function" to get package short name out of a dir/module_name
-+# it also transforms db_foo into foo
-+mod_name=$(subst db_,,$(lastword $(subst /, ,$(1))))
-+
-+define PACKAGE_GRP_BUILD_template
-+	# package all the modules in PACKAGE_GROUPS in separate packages
-+	$(foreach grp,$(PACKAGE_GROUPS),\
-+		$(MAKE) every-module group_include="k$(grp)"
-+	)
-+endef
-+
-+define PACKAGE_GRP_INSTALL_template
-+	$(foreach grp,$(PACKAGE_GROUPS),\
-+		$(MAKE) install-modules-all LIBDIR=$(LIBDIR) group_include="k$(grp)" \
-+		BASEDIR=$(CURDIR)/debian/kamailio-$(grp)-modules \
-+		cfg_prefix=$(CURDIR)/debian/kamailio-$(grp)-modules \
-+		doc-dir=share/doc/kamailio-$(grp)-modules
-+		# eliminate duplicate libs
-+		-for d in $(DUP_LIBS_DIRS); do \
-+			test "$$d" != "$(CURDIR)/debian/kamailio-$(grp)-modules/usr/$(LIBDIR)/kamailio" &&\
-+			for r in `find $$d -name 'lib*'|xargs`; do \
-+				echo "removing $(grp) lib `basename $$r` present also in $$d";\
-+				rm -f $(CURDIR)/debian/kamailio-$(grp)-modules/usr/$(LIBDIR)/kamailio/`basename "$$r"` ; \
-+			done ; \
-+		done
-+		find $(CURDIR)/debian/kamailio-$(grp)-modules -depth -empty -type d -exec rmdir {} \;
-+	)
-+endef
-+
-+define PACKAGE_EXTRA_BUILD_template
-+	# package all the modules in EXTRA_GROUPS in separate packages
-+	$(foreach grp,$(EXTRA_GROUPS),\
-+		$(MAKE) every-module group_include="k$(grp)"
-+	)
-+endef
-+
-+define PACKAGE_EXTRA_INSTALL_template
-+	$(foreach grp,$(EXTRA_GROUPS),\
-+		$(MAKE) install-modules-all LIBDIR=$(LIBDIR) group_include="k$(grp)" \
-+		BASEDIR=$(CURDIR)/debian/kamailio-extra-modules \
-+		cfg_prefix=$(CURDIR)/debian/kamailio-extra-modules \
-+		doc-dir=share/doc/kamailio-extra-modules
-+	)
-+	# eliminate duplicate libs
-+	-for d in $(DUP_LIBS_DIRS); do \
-+		test "$$d" != "$(CURDIR)/debian/kamailio-extra-modules/usr/$(LIBDIR)/kamailio" &&\
-+		for r in `find $$d -name 'lib*'|xargs`; do \
-+			echo "removing extra lib `basename $$r` present also in $$d";\
-+			rm -f $(CURDIR)/debian/kamailio-extra-modules/usr/$(LIBDIR)/kamailio/`basename "$$r"` ; \
-+		done ; \
-+	done
-+	find $(CURDIR)/debian/kamailio-extra-modules -depth -empty -type d -exec rmdir {} \;
-+endef
-+
-+# CFLAGS + CPPFLAGS -> CC_EXTRA_OPTS
-+CC_EXTRA_OPTS := $(shell dpkg-buildflags --get CPPFLAGS)
-+CC_EXTRA_OPTS += $(shell dpkg-buildflags --get CFLAGS)
-+CXXFLAGS := $(shell dpkg-buildflags --get CXXFLAGS)
-+# LDFLAGS -> LD_EXTRA_OPTS
-+LD_EXTRA_OPTS := $(shell dpkg-buildflags --get LDFLAGS)
-+
-+# https://wiki.debian.org/ReproducibleBuilds/
-+CC_EXTRA_OPTS += -DVERSION_NODATE
-+
-+configure: configure-stamp
-+configure-stamp:
-+	dh_testdir
-+	# Add here commands to configure the package.
-+	$(MAKE) FLAVOUR=kamailio cfg prefix=/usr cfg_prefix=$(CURDIR)/debian/kamailio \
-+			cfg_target=/etc/kamailio/ \
-+			BASEDIR=$(CURDIR)/debian/kamailio \
-+			skip_modules="$(EXCLUDED_MODULES) $(EXTRA_EXCLUDED_MODULES)" \
-+			CC_EXTRA_OPTS="$(CC_EXTRA_OPTS)" \
-+			LD_EXTRA_OPTS="$(LD_EXTRA_OPTS)" \
-+			group_include="kstandard"
-+
-+	touch configure-stamp
-+
-+
-+build: build-stamp
-+build-arch: build-stamp
-+build-indep: build-stamp
-+build-stamp: configure-stamp
-+	dh_testdir
-+	# Add here commands to compile the package.
-+	$(MAKE) all
-+	# make groups
-+	$(call PACKAGE_GRP_BUILD_template)
-+	$(call PACKAGE_EXTRA_BUILD_template)
-+	touch build-stamp
-+
-+clean:
-+	dh_testdir
-+	dh_testroot
-+	rm -f build-stamp configure-stamp
-+	# Add here commands to clean up after the build process.
-+	$(MAKE) maintainer-clean
-+	dh_clean
-+
-+install: build
-+	dh_testdir
-+	dh_testroot
-+	dh_prep
-+	dh_installdirs
-+	# Add here commands to install the package into debian/kamailio
-+	$(MAKE) install LIBDIR=$(LIBDIR) group_include="kstandard"
-+	# make group packages
-+	$(call PACKAGE_GRP_INSTALL_template)
-+	$(call PACKAGE_EXTRA_INSTALL_template)
-+	mv $(CURDIR)/debian/kamailio-berkeley-modules/usr/sbin/kambdb_recover \
-+		$(CURDIR)/debian/kamailio-berkeley-bin/usr/sbin/kambdb_recover
-+	# install /etc/default/kamailio file
-+	mkdir -p $(CURDIR)/debian/kamailio/etc/default
-+	cp -f debian/kamailio.default $(CURDIR)/debian/kamailio/etc/default/kamailio
-+	# delete /var/run/kamailio dir
-+	rm -rf $(CURDIR)/debian/kamailio/usr/local
-+
-+
-+# This single target is used to build all the packages, all at once, or
-+# one at a time. So keep in mind: any options passed to commands here will
-+# affect _all_ packages. Anything you want to only affect one package
-+# should be put in another target, such as the install target.
-+binary-common:
-+	dh_testdir
-+	dh_testroot
-+	dh_installdebconf
-+	dh_installdocs
-+	dh_installexamples -Xobsoleted -Xsr
-+	dh_installmenu
-+	dh_systemd_enable -pkamailio
-+	dh_installinit -pkamailio -- defaults 23
-+	dh_systemd_start -pkamailio
-+	dh_installcron
-+	dh_installman
-+	dh_installinfo
-+	dh_lintian
-+	dh_installchangelogs ChangeLog
-+	dh_link
-+	dh_strip --dbg-package=kamailio-dbg
-+	dh_compress
-+	dh_fixperms
-+	dh_makeshlibs
-+	dh_installdeb
-+	dh_shlibdeps
-+	dh_gencontrol
-+	dh_md5sums
-+	dh_builddeb
-+
-+# Build architecture-independent packages using the common target
-+binary-indep: build install
-+# (Uncomment this next line if you have such packages.)
-+#        $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
-+# We have nothing to do by default.
-+
-+
-+# Build architecture-dependent packages using the common target
-+binary-arch: build install
-+	$(MAKE) -f debian/rules DH_OPTIONS=-a binary-common
-+
-+# Any other binary targets build just one binary package at a time.
-+binary-%: build install
-+	$(MAKE) -f debian/rules binary-common DH_OPTIONS=-p$*
-+
-+print-version:
-+	@@echo "Debian version:          $(DEBVERSION)"
-+	@@echo "Upstream version:        $(UPVERSION)"
-+
-+get-orig-source:
-+	@@dh_testdir
-+	@@[ -d ../tarballs/. ]||mkdir -p ../tarballs
-+	@@echo Downloading $(FILENAME) from $(URL) ...
-+	@@wget -nv -T10 -t3 -O ../tarballs/$(FILENAME) $(URL)
-+
-+binary: binary-indep binary-arch
-+.PHONY: build clean binary-indep binary-arch binary install configure
-+
-diff --git a/pkg/kamailio/deb/xenial/source.lintian-overrides b/pkg/kamailio/deb/xenial/source.lintian-overrides
-new file mode 100644
-index 0000000..620d9ff
---- /dev/null
-+++ b/pkg/kamailio/deb/xenial/source.lintian-overrides
-@@ -0,0 +1 @@
-+kamailio source: debian-watch-file-in-native-package
-diff --git a/pkg/kamailio/deb/xenial/source/format b/pkg/kamailio/deb/xenial/source/format
-new file mode 100644
-index 0000000..89ae9db
---- /dev/null
-+++ b/pkg/kamailio/deb/xenial/source/format
-@@ -0,0 +1 @@
-+3.0 (native)
-diff --git a/pkg/kamailio/deb/xenial/watch b/pkg/kamailio/deb/xenial/watch
-new file mode 100644
-index 0000000..c50f31f
---- /dev/null
-+++ b/pkg/kamailio/deb/xenial/watch
-@@ -0,0 +1,3 @@
-+version=3
-+opts=dversionmangle=s/\~svn([\d]+)//; \
-+http://www.kamailio.org/pub/kamailio/([\d.]+)/src/kamailio-([\d.]+)_src\.tar\.gz
--- 
-2.9.3
-
diff --git a/debian/patches/upstream/0005-presence-fix-crash-when-no-dialog.id-on-dialog-info-.patch b/debian/patches/upstream/0005-presence-fix-crash-when-no-dialog.id-on-dialog-info-.patch
deleted file mode 100644
index d3e63bd..0000000
--- a/debian/patches/upstream/0005-presence-fix-crash-when-no-dialog.id-on-dialog-info-.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From e43d82db89e57a47418d4ccdd283d8b2de82e7e6 Mon Sep 17 00:00:00 2001
-From: Victor Seva <linuxmaniac at torreviejawireless.org>
-Date: Fri, 23 Sep 2016 11:11:56 +0200
-Subject: [PATCH] presence: fix crash when no dialog.id on dialog-info xml
-
-Fix #794
-
-(cherry picked from commit 53b139567cd2c828cf2cf387029396ef55351289)
----
- modules/presence/presentity.c | 10 +++++-----
- 1 file changed, 5 insertions(+), 5 deletions(-)
-
-diff --git a/modules/presence/presentity.c b/modules/presence/presentity.c
-index e601153..00fdbfd 100644
---- a/modules/presence/presentity.c
-+++ b/modules/presence/presentity.c
-@@ -691,13 +691,13 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, str* body,
- 			}
- 
- 			check_if_dialog(*body, &is_dialog, &dialog_id);
-+			if (is_dialog == 1) {
-+				if (delete_presentity_if_dialog_id_exists(presentity, dialog_id) < 0) {
-+					goto error;
-+				}
- 
--			if (delete_presentity_if_dialog_id_exists(presentity, dialog_id) < 0) {
--				goto error;
-+				free(dialog_id);
- 			}
--
--			free(dialog_id);
--
- 			LM_DBG("inserting %d cols into table\n",n_query_cols);
- 
- 			if (pa_dbf.insert(pa_db, query_cols, query_vals, n_query_cols) < 0)
--- 
-2.9.3
-
diff --git a/debian/patches/upstream/0006-dispatcher-proper-selection-of-the-gateway-when-the-.patch b/debian/patches/upstream/0006-dispatcher-proper-selection-of-the-gateway-when-the-.patch
deleted file mode 100644
index 6fdf8db..0000000
--- a/debian/patches/upstream/0006-dispatcher-proper-selection-of-the-gateway-when-the-.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 94ef3dcaa99680cb12897db27d81d39e0e1e2d5e Mon Sep 17 00:00:00 2001
-From: Daniel-Constantin Mierla <miconda at gmail.com>
-Date: Wed, 28 Sep 2016 09:28:02 +0200
-Subject: [PATCH] dispatcher: proper selection of the gateway  when the maxload
- is 0
-
-- reported and patch by Carlos Cruz Luengo, GH #800
-
-(cherry picked from commit a0521f714a29fe205f83cd176f961344c8d9c79d)
----
- modules/dispatcher/dispatch.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/modules/dispatcher/dispatch.c b/modules/dispatcher/dispatch.c
-index c1a831b..d4c6ab8 100644
---- a/modules/dispatcher/dispatch.c
-+++ b/modules/dispatcher/dispatch.c
-@@ -1449,7 +1449,8 @@ int ds_get_leastloaded(ds_set_t *dset)
- 	for(j=0; j<dset->nr; j++)
- 	{
- 		if(!ds_skip_dst(dset->dlist[j].flags)
--				&& dset->dlist[j].dload<dset->dlist[j].attrs.maxload)
-+				&& (dset->dlist[j].attrs.maxload == 0
-+					|| dset->dlist[j].dload<dset->dlist[j].attrs.maxload))
- 		{
- 			if(dset->dlist[j].dload<t)
- 			{
--- 
-2.9.3
-
diff --git a/debian/patches/upstream/0007-http_client-Terminate-exported-commands-list.patch b/debian/patches/upstream/0007-http_client-Terminate-exported-commands-list.patch
deleted file mode 100644
index 894aa70..0000000
--- a/debian/patches/upstream/0007-http_client-Terminate-exported-commands-list.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From a83ca56b8481d7f0a13f6b4ba7aee7f2dbf4bb52 Mon Sep 17 00:00:00 2001
-From: Daniel-Constantin Mierla <miconda at gmail.com>
-Date: Thu, 29 Sep 2016 09:19:37 +0200
-Subject: [PATCH] http_client Terminate exported commands list
-
-The list of exported functions was not terminated, which caused a
-segfault in find_mod_export_record() when reading outside the
-list.
-
-- backport of 166e6d80308adb822c9342cf75ac1ca8158e2f78
----
- modules/http_client/http_client.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/modules/http_client/http_client.c b/modules/http_client/http_client.c
-index d05c346..a5aa800 100644
---- a/modules/http_client/http_client.c
-+++ b/modules/http_client/http_client.c
-@@ -133,6 +133,7 @@ static cmd_export_t cmds[] = {
-      fixup_free_curl_connect_post,
-      REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE},
-     {"bind_http_client",  (cmd_function)bind_httpc_api,  0, 0, 0, 0},
-+    {0,0,0,0,0,0}
- };
- 
- 
--- 
-2.9.3
-
diff --git a/debian/patches/upstream/0008-dialog-wrapper-defines-for-ref-unref-operations-to-g.patch b/debian/patches/upstream/0008-dialog-wrapper-defines-for-ref-unref-operations-to-g.patch
deleted file mode 100644
index 1a14729..0000000
--- a/debian/patches/upstream/0008-dialog-wrapper-defines-for-ref-unref-operations-to-g.patch
+++ /dev/null
@@ -1,75 +0,0 @@
-From 1987a419fbd551b6bc4550fe4f991a2a9d2ed2fb Mon Sep 17 00:00:00 2001
-From: Daniel-Constantin Mierla <miconda at gmail.com>
-Date: Wed, 28 Sep 2016 11:54:32 +0200
-Subject: [PATCH] dialog: wrapper defines for ref/unref operations to get file
- name and line
-
-(cherry picked from commit be77f34091f63042b4df4d5445fc16c1da3ddcd9)
----
- modules/dialog/dlg_hash.c | 8 ++++++--
- modules/dialog/dlg_hash.h | 8 ++++++--
- 2 files changed, 12 insertions(+), 4 deletions(-)
-
-diff --git a/modules/dialog/dlg_hash.c b/modules/dialog/dlg_hash.c
-index 9a96f1b..e0b603d 100644
---- a/modules/dialog/dlg_hash.c
-+++ b/modules/dialog/dlg_hash.c
-@@ -894,10 +894,12 @@ void link_dlg(struct dlg_cell *dlg, int n, int mode)
-  * \param dlg dialog
-  * \param cnt increment for the reference counter
-  */
--void dlg_ref(dlg_cell_t *dlg, unsigned int cnt)
-+void dlg_ref_helper(dlg_cell_t *dlg, unsigned int cnt, const char *fname,
-+		int fline)
- {
- 	dlg_entry_t *d_entry;
- 
-+	LM_DBG("ref op on %p with %d from %s:%d\n", dlg, cnt, fname, fline);
- 	d_entry = &(d_table->entries[dlg->h_entry]);
- 
- 	dlg_lock( d_table, d_entry);
-@@ -912,10 +914,12 @@ void dlg_ref(dlg_cell_t *dlg, unsigned int cnt)
-  * \param dlg dialog
-  * \param cnt decrement for the reference counter
-  */
--void dlg_unref(dlg_cell_t *dlg, unsigned int cnt)
-+void dlg_unref_helper(dlg_cell_t *dlg, unsigned int cnt, const char *fname,
-+		int fline)
- {
- 	dlg_entry_t *d_entry;
- 
-+	LM_DBG("unref op on %p with %d from %s:%d\n", dlg, cnt, fname, fline);
- 	d_entry = &(d_table->entries[dlg->h_entry]);
- 
- 	dlg_lock( d_table, d_entry);
-diff --git a/modules/dialog/dlg_hash.h b/modules/dialog/dlg_hash.h
-index 954a7d4..f276f5c 100644
---- a/modules/dialog/dlg_hash.h
-+++ b/modules/dialog/dlg_hash.h
-@@ -387,8 +387,10 @@ void link_dlg(struct dlg_cell *dlg, int n, int mode);
-  * \param dlg dialog
-  * \param cnt decrement for the reference counter
-  */
--void dlg_unref(dlg_cell_t *dlg, unsigned int cnt);
-+void dlg_unref_helper(dlg_cell_t *dlg, unsigned int cnt, const char *fname,
-+		int fline);
- 
-+#define dlg_unref(dlg, cnt) dlg_unref_helper((dlg), (cnt), __FILE__, __LINE__)
- 
- /*!
-  * \brief Refefence a dialog with locking
-@@ -396,8 +398,10 @@ void dlg_unref(dlg_cell_t *dlg, unsigned int cnt);
-  * \param dlg dialog
-  * \param cnt increment for the reference counter
-  */
--void dlg_ref(dlg_cell_t *dlg, unsigned int cnt);
-+void dlg_ref_helper(dlg_cell_t *dlg, unsigned int cnt, const char *fname,
-+		int fline);
- 
-+#define dlg_ref(dlg, cnt) dlg_ref_helper((dlg), (cnt), __FILE__, __LINE__)
- 
- /*!
-  * \brief Release a dialog from ref counter by 1
--- 
-2.9.3
-
diff --git a/debian/patches/upstream/0009-dialog-no-need-to-release-the-dialog-when-refreshing.patch b/debian/patches/upstream/0009-dialog-no-need-to-release-the-dialog-when-refreshing.patch
deleted file mode 100644
index 564104c..0000000
--- a/debian/patches/upstream/0009-dialog-no-need-to-release-the-dialog-when-refreshing.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From 64a8927bd1f891c757a44fd31265ba4cd3a3d150 Mon Sep 17 00:00:00 2001
-From: Daniel-Constantin Mierla <miconda at gmail.com>
-Date: Wed, 28 Sep 2016 16:41:42 +0200
-Subject: [PATCH] dialog: no need to release the dialog when refreshing cseq
-
-- no direct reference was triggered inside the function
-
-(cherry picked from commit 3f9969d1790dd8d9349c0fa450c589f8038c43cc)
----
- modules/dialog/dlg_cseq.c | 2 --
- 1 file changed, 2 deletions(-)
-
-diff --git a/modules/dialog/dlg_cseq.c b/modules/dialog/dlg_cseq.c
-index 7aaad02..4d60180 100644
---- a/modules/dialog/dlg_cseq.c
-+++ b/modules/dialog/dlg_cseq.c
-@@ -247,11 +247,9 @@ int dlg_cseq_refresh(sip_msg_t *msg, dlg_cell_t *dlg,
- 	sr_hdr_add_zs(msg, "P-K-CSeq-Refresh", &nval);
- 
- done:
--	if(dlg!=NULL) dlg_release(dlg);
- 	return 0;
- 
- error:
--	if(dlg!=NULL) dlg_release(dlg);
- 	return -1;
- }
- 
--- 
-2.9.3
-
diff --git a/debian/patches/upstream/0010-core-allow-_-in-event-route-name.patch b/debian/patches/upstream/0010-core-allow-_-in-event-route-name.patch
deleted file mode 100644
index 36d0ba4..0000000
--- a/debian/patches/upstream/0010-core-allow-_-in-event-route-name.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From d546d5ea8a1ce442dcaad8592df55459666c7da5 Mon Sep 17 00:00:00 2001
-From: Daniel-Constantin Mierla <miconda at gmail.com>
-Date: Fri, 7 Oct 2016 10:08:14 +0200
-Subject: [PATCH] core: allow '_' in event route name
-
-- reported by GH #811
-
-(cherry picked from commit 5806703c1ff72243457ff55758f41c3f557d26fd)
----
- cfg.lex | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/cfg.lex b/cfg.lex
-index 357ff93..e31b5a6 100644
---- a/cfg.lex
-+++ b/cfg.lex
-@@ -496,7 +496,7 @@ COLON		":"
- STAR		\*
- DOT			\.
- CR			\n
--EVENT_RT_NAME [a-zA-Z][0-9a-zA-Z-]*(":"[a-zA-Z][0-9a-zA-Z-]*)+
-+EVENT_RT_NAME [a-zA-Z][0-9a-zA-Z-]*(":"[a-zA-Z][0-9a-zA-Z_-]*)+
- 
- 
- COM_LINE	"#"|"//"
--- 
-2.9.3
-
diff --git a/debian/patches/upstream/0011-presence-expire-value-kept-and-printed-in-logs-as-un.patch b/debian/patches/upstream/0011-presence-expire-value-kept-and-printed-in-logs-as-un.patch
deleted file mode 100644
index d14ee58..0000000
--- a/debian/patches/upstream/0011-presence-expire-value-kept-and-printed-in-logs-as-un.patch
+++ /dev/null
@@ -1,408 +0,0 @@
-From 80bb7f1559017aafcfc0377538e7c9aa79150ff0 Mon Sep 17 00:00:00 2001
-From: Daniel-Constantin Mierla <miconda at gmail.com>
-Date: Thu, 15 Sep 2016 11:16:12 +0200
-Subject: [PATCH] presence: expire value kept and printed in logs as unsigned
- int
-
-- code compacted for extracting subscription data
-
-(cherry picked from commit 770bae3ce1e1f561d575df689df067a7639f64c4)
----
- modules/presence/event_list.h |  30 +++++-----
- modules/presence/subscribe.c  | 128 +++++++++++++++---------------------------
- 2 files changed, 61 insertions(+), 97 deletions(-)
-
-diff --git a/modules/presence/event_list.h b/modules/presence/event_list.h
-index 640e6d5..c74ee10 100644
---- a/modules/presence/event_list.h
-+++ b/modules/presence/event_list.h
-@@ -13,8 +13,8 @@
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  * GNU General Public License for more details.
-  *
-- * You should have received a copy of the GNU General Public License 
-- * along with this program; if not, write to the Free Software 
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
-  *
-  */
-@@ -22,7 +22,7 @@
- /*!
-  * \file
-  * \brief Kamailio presence module :: Events
-- * \ingroup presence 
-+ * \ingroup presence
-  */
- 
- 
-@@ -47,14 +47,14 @@ typedef int (publ_handling_t)(struct sip_msg*);
- typedef int (subs_handling_t)(struct sip_msg*);
- 
- typedef str* (agg_nbody_t)(str* pres_user, str* pres_domain, str** body_array, int n, int off_index);
--/* params for agg_body_t 
-+/* params for agg_body_t
-  *	body_array= an array with all the bodies stored for that resource
-  *	n= the number of bodies
-  *	off_index= the index of the registration(etag) for which a Publish
-  *				with Expires: 0 has just been received
-  *	*/
- typedef str* (aux_body_processing_t)(struct subscription *subs, str* body);
--/* params for agg_body_t 
-+/* params for agg_body_t
-  *	subs= a subscription structure to manipulate the body for a certain watcher
-  *	body= the original body
-  *
-@@ -79,16 +79,16 @@ struct pres_ev
- 	str name;
- 	event_t* evp;
- 	str content_type;
--	int default_expires;
-+	unsigned int default_expires;
- 	int type; /* category type: WINFO_TIPE, PUBL_TYPE, ...*/
- 	int etag_not_new;
- 	/*
- 	 *  0 - the standard mechanism (allocating new etag for each Publish)
--	 *  1 - allocating an etag only for an initial Publish 
-+	 *  1 - allocating an etag only for an initial Publish
- 	 * */
- 	/* fileds that deal with authorization rules*/
- 	/*
--	 *  req_auth -> flag 0  - if not require 
-+	 *  req_auth -> flag 0  - if not require
- 	 *  is_watcher_allowed  - get subscription state from xcap rules
- 	 *  apply_auth_nbody    - alter the body according to authorization rules
- 	 */
-@@ -97,17 +97,17 @@ struct pres_ev
- 	get_pidf_doc_t* get_pidf_doc;
- 	apply_auth_t*  apply_auth_nbody;
- 	is_allowed_t*  get_auth_status;
--	
-+
- 	/* an agg_body_t function should be registered if the event permits having
- 	 * multiple published states and requires an aggregation of the information
--	 * otherwise, this field should be NULL and the last published state is taken 
--	 * when constructing Notify msg 
-+	 * otherwise, this field should be NULL and the last published state is taken
-+	 * when constructing Notify msg
- 	 * */
- 	agg_nbody_t* agg_nbody;
- 	publ_handling_t  * evs_publ_handl;
- 	subs_handling_t  * evs_subs_handl;
- 	free_body_t* free_body;
--	/* sometimes it is necessary that a module make changes for a body for each 
-+	/* sometimes it is necessary that a module make changes for a body for each
- 	 * active watcher (e.g. setting the "version" parameter in an XML document.
- 	 * If a module registers the aux_body_processing callback, it gets called for
- 	 * each watcher. It either gets the body received by the PUBLISH, or the body
-@@ -119,9 +119,9 @@ struct pres_ev
- 	 */
- 	aux_body_processing_t* aux_body_processing;
- 	free_body_t* aux_free_body;
--	struct pres_ev* wipeer;			
-+	struct pres_ev* wipeer;
- 	struct pres_ev* next;
--	
-+
- };
- typedef struct pres_ev pres_ev_t;
- 
-@@ -129,7 +129,7 @@ typedef struct evlist
- {
- 	int ev_count;
- 	pres_ev_t* events;
--}evlist_t;	
-+} evlist_t;
- 
- evlist_t* init_evlist(void);
- 
-diff --git a/modules/presence/subscribe.c b/modules/presence/subscribe.c
-index f3a53c9..5ef1785 100644
---- a/modules/presence/subscribe.c
-+++ b/modules/presence/subscribe.c
-@@ -56,8 +56,8 @@ static str pu_500_rpl  = str_init("Server Internal Error");
- static str pu_489_rpl  = str_init("Bad Event");
- static str pu_423_rpl  = str_init("Interval Too Brief");
- 
--int send_2XX_reply(struct sip_msg * msg, int reply_code, int lexpire,
--		str* local_contact)
-+static int send_2XX_reply(sip_msg_t *msg, int reply_code,
-+		unsigned int lexpire, str *local_contact)
- {
- 	str hdr_append = {0, 0};
- 	str tmp;
-@@ -1335,7 +1335,7 @@ error:
- }
- 
- 
--int extract_sdialog_info_ex(subs_t* subs,struct sip_msg* msg, uint32_t miexp,
-+int extract_sdialog_info_ex(subs_t* subs, struct sip_msg* msg, uint32_t miexp,
- 		uint32_t mexp, int* to_tag_gen, str scontact,
- 		str watcher_user, str watcher_domain,
- 		int* reply_code, str* reply_str)
-@@ -1349,20 +1349,15 @@ int extract_sdialog_info_ex(subs_t* subs,struct sip_msg* msg, uint32_t miexp,
- 	struct sip_uri uri;
- 
- 	/* examine the expire header field */
--	if(msg->expires && msg->expires->body.len > 0)
--	{
--		if (!msg->expires->parsed && (parse_expires(msg->expires) < 0))
--		{
-+	if(msg->expires && msg->expires->body.len > 0) {
-+		if (!msg->expires->parsed && (parse_expires(msg->expires) < 0)) {
- 			LM_ERR("cannot parse Expires header\n");
- 			goto error;
- 		}
- 		lexpire = ((exp_body_t*)msg->expires->parsed)->val;
--		LM_DBG("'Expires' header found, value= %d\n", lexpire);
--
--	}
--	else
--	{
--		LM_DBG("'expires' not found; default=%d\n",subs->event->default_expires);
-+		LM_DBG("'Expires' header found, value= %u\n", lexpire);
-+	} else {
-+		LM_DBG("'expires' not found; default=%u\n",subs->event->default_expires);
- 		lexpire = subs->event->default_expires;
- 	}
- 	if(lexpire > mexp)
-@@ -1370,34 +1365,32 @@ int extract_sdialog_info_ex(subs_t* subs,struct sip_msg* msg, uint32_t miexp,
- 
- 	if (lexpire && miexp && lexpire < miexp) {
- 		if(min_expires_action == 1) {
--			LM_DBG("subscription expiration invalid , requested=%d, minimum=%d, returning error \"423 Interval Too brief\"\n", lexpire, miexp);
-+			LM_DBG("subscription expiration invalid , requested=%u, minimum=%u,"
-+					" returning error \"423 Interval Too brief\"\n",
-+					lexpire, miexp);
- 			*reply_code = INTERVAL_TOO_BRIEF;
- 			*reply_str = pu_423_rpl;
- 			goto error;
- 		} else {
--			LM_DBG("subscription expiration set to minimum (%d) for requested (%d)\n", lexpire, miexp);
-+			LM_DBG("subscription expiration set to minimum (%u) for requested"
-+					" (%u)\n", lexpire, miexp);
- 			lexpire = miexp;
- 		}
- 	}
- 
- 	subs->expires = lexpire;
- 
--	if( msg->to==NULL || msg->to->body.s==NULL)
--	{
-+	if( msg->to==NULL || msg->to->body.s==NULL) {
- 		LM_ERR("cannot parse TO header\n");
- 		goto error;
- 	}
- 	/* examine the to header */
--	if(msg->to->parsed != NULL)
--	{
-+	if(msg->to->parsed != NULL) {
- 		pto = (struct to_body*)msg->to->parsed;
- 		LM_DBG("'To' header ALREADY PARSED: <%.*s>\n",pto->uri.len,pto->uri.s);
--	}
--	else
--	{
-+	} else {
- 		parse_to(msg->to->body.s,msg->to->body.s + msg->to->body.len + 1, &TO);
--		if( TO.uri.len <= 0 )
--		{
-+		if( TO.uri.len <= 0 ) {
- 			LM_DBG("'To' header NOT parsed\n");
- 			goto error;
- 		}
-@@ -1405,15 +1398,11 @@ int extract_sdialog_info_ex(subs_t* subs,struct sip_msg* msg, uint32_t miexp,
- 	}
- 
- 	if( pto->parsed_uri.user.s && pto->parsed_uri.host.s &&
--			pto->parsed_uri.user.len && pto->parsed_uri.host.len)
--	{
-+			pto->parsed_uri.user.len && pto->parsed_uri.host.len) {
- 		subs->to_user = pto->parsed_uri.user;
- 		subs->to_domain = pto->parsed_uri.host;
--	}
--	else
--	{
--		if(parse_uri(pto->uri.s, pto->uri.len, &uri)< 0)
--		{
-+	} else {
-+		if(parse_uri(pto->uri.s, pto->uri.len, &uri)< 0) {
- 			LM_ERR("while parsing uri\n");
- 			goto error;
- 		}
-@@ -1422,13 +1411,11 @@ int extract_sdialog_info_ex(subs_t* subs,struct sip_msg* msg, uint32_t miexp,
- 	}
- 
- 	/* examine the from header */
--	if (!msg->from || !msg->from->body.s)
--	{
-+	if (!msg->from || !msg->from->body.s) {
- 		LM_DBG("cannot find 'from' header!\n");
- 		goto error;
- 	}
--	if (msg->from->parsed == NULL)
--	{
-+	if (msg->from->parsed == NULL) {
- 		LM_DBG("'From' header not parsed\n");
- 		/* parsing from header */
- 		if ( parse_from_header( msg )<0 )
-@@ -1440,15 +1427,11 @@ int extract_sdialog_info_ex(subs_t* subs,struct sip_msg* msg, uint32_t miexp,
- 	pfrom = (struct to_body*)msg->from->parsed;
- 
- 	if( pfrom->parsed_uri.user.s && pfrom->parsed_uri.host.s &&
--			pfrom->parsed_uri.user.len && pfrom->parsed_uri.host.len)
--	{
-+			pfrom->parsed_uri.user.len && pfrom->parsed_uri.host.len) {
- 		subs->from_user = pfrom->parsed_uri.user;
- 		subs->from_domain = pfrom->parsed_uri.host;
--	}
--	else
--	{
--		if(parse_uri(pfrom->uri.s, pfrom->uri.len, &uri)< 0)
--		{
-+	} else {
-+		if(parse_uri(pfrom->uri.s, pfrom->uri.len, &uri)< 0) {
- 			LM_ERR("while parsing uri\n");
- 			goto error;
- 		}
-@@ -1460,61 +1443,50 @@ int extract_sdialog_info_ex(subs_t* subs,struct sip_msg* msg, uint32_t miexp,
- 	subs->watcher_domain = watcher_domain;
- 
- 	/* get to_tag if the message does not have a to_tag*/
--	if (pto->tag_value.s==NULL || pto->tag_value.len==0 )
--	{
-+	if (pto->tag_value.s==NULL || pto->tag_value.len==0 ) {
- 		LM_DBG("generating to_tag\n");
- 		*to_tag_gen = 1;
- 		rtag_value.len = 0;
--		if(slb.get_reply_totag(msg, &rtag_value)<0 || rtag_value.len <= 0)
--		{
-+		if(slb.get_reply_totag(msg, &rtag_value)<0 || rtag_value.len <= 0) {
- 			LM_ERR("while creating to_tag\n");
- 			goto error;
- 		}
--	}
--	else
--	{
-+	} else {
- 		*to_tag_gen = 0;
- 		rtag_value=pto->tag_value;
- 	}
- 	subs->to_tag = rtag_value;
- 
--	if( msg->callid==NULL || msg->callid->body.s==NULL)
--	{
-+	if( msg->callid==NULL || msg->callid->body.s==NULL) {
- 		LM_ERR("cannot parse callid header\n");
- 		goto error;
- 	}
- 	subs->callid = msg->callid->body;
- 
--	if( msg->cseq==NULL || msg->cseq->body.s==NULL)
--	{
-+	if( msg->cseq==NULL || msg->cseq->body.s==NULL) {
- 		LM_ERR("cannot parse cseq header\n");
- 		goto error;
- 	}
--	if (str2int( &(get_cseq(msg)->number), &subs->remote_cseq)!=0 )
--	{
-+	if (str2int( &(get_cseq(msg)->number), &subs->remote_cseq)!=0 ) {
- 		LM_ERR("cannot parse cseq number\n");
- 		goto error;
- 	}
--	if( msg->contact==NULL || msg->contact->body.s==NULL)
--	{
-+	if( msg->contact==NULL || msg->contact->body.s==NULL) {
- 		LM_ERR("cannot parse contact header\n");
- 		goto error;
- 	}
--	if( parse_contact(msg->contact) <0 )
--	{
-+	if( parse_contact(msg->contact) <0 ) {
- 		LM_ERR(" cannot parse contact"
- 				" header\n");
- 		goto error;
- 	}
- 	b= (contact_body_t* )msg->contact->parsed;
- 
--	if(b == NULL)
--	{
-+	if(b == NULL) {
- 		LM_ERR("cannot parse contact header\n");
- 		goto error;
- 	}
--	if(b->star || b->contacts==NULL)
--	{
-+	if(b->star || b->contacts==NULL) {
- 		LM_ERR("Wrong contact header\n");
- 		goto error;
- 	}
-@@ -1524,29 +1496,24 @@ int extract_sdialog_info_ex(subs_t* subs,struct sip_msg* msg, uint32_t miexp,
- 	LM_DBG("subs->contact= %.*s - len = %d\n",subs->contact.len,
- 			subs->contact.s, subs->contact.len);
- 
--	if (EVENT_DIALOG_SLA(subs->event->evp))
--	{
-+	if (EVENT_DIALOG_SLA(subs->event->evp)) {
- 		/* user_contact at from_domain */
--		if(parse_uri(subs->contact.s, subs->contact.len, &uri)< 0)
--		{
-+		if(parse_uri(subs->contact.s, subs->contact.len, &uri)< 0) {
- 			LM_ERR("failed to parse contact uri\n");
- 			goto error;
- 		}
--		if(uandd_to_uri(uri.user, subs->from_domain, &subs->pres_uri)< 0)
--		{
-+		if(uandd_to_uri(uri.user, subs->from_domain, &subs->pres_uri)< 0) {
- 			LM_ERR("failed to construct uri\n");
- 			goto error;
- 		}
--		LM_DBG("&&&&&&&&&&&&&&& dialog pres_uri= %.*s\n",
-+		LM_DBG("dialog pres_uri= %.*s\n",
- 				subs->pres_uri.len, subs->pres_uri.s);
- 	}
- 
- 	/*process record route and add it to a string*/
--	if(*to_tag_gen && msg->record_route!=NULL)
--	{
-+	if(*to_tag_gen && msg->record_route!=NULL) {
- 		rt = print_rr_body(msg->record_route, &rec_route, 0, 0);
--		if(rt != 0)
--		{
-+		if(rt != 0) {
- 			LM_ERR("processing the record route [%d]\n", rt);
- 			rec_route.s=NULL;
- 			rec_route.len=0;
-@@ -1557,8 +1524,7 @@ int extract_sdialog_info_ex(subs_t* subs,struct sip_msg* msg, uint32_t miexp,
- 
- 	subs->sockinfo_str= msg->rcv.bind_address->sock_str;
- 
--	if( pfrom->tag_value.s ==NULL || pfrom->tag_value.len == 0)
--	{
-+	if( pfrom->tag_value.s ==NULL || pfrom->tag_value.len == 0) {
- 		LM_ERR("no from tag value present\n");
- 		goto error;
- 	}
-@@ -1566,16 +1532,14 @@ int extract_sdialog_info_ex(subs_t* subs,struct sip_msg* msg, uint32_t miexp,
- 
- 	subs->version = 1;
- 
--	if((!scontact.s) || (scontact.len== 0))
--	{
--		if(ps_fill_local_contact(msg, &subs->local_contact)<0)
--		{
-+	if((!scontact.s) || (scontact.len== 0)) {
-+		if(ps_fill_local_contact(msg, &subs->local_contact)<0) {
- 			LM_ERR("cannot get local contact address\n");
- 			goto error;
- 		}
--	}
--	else
-+	} else {
- 		subs->local_contact= scontact;
-+	}
- 
- 	if (parse_headers(msg, HDR_USERAGENT_F, 0) != -1 && msg->user_agent &&
- 			msg->user_agent->body.len>0 && msg->user_agent->body.len<MAX_UA_SIZE) {
--- 
-2.9.3
-
diff --git a/debian/patches/upstream/0012-core-fixed-misleading-indentation-for-return-stateme.patch b/debian/patches/upstream/0012-core-fixed-misleading-indentation-for-return-stateme.patch
deleted file mode 100644
index a94a0d7..0000000
--- a/debian/patches/upstream/0012-core-fixed-misleading-indentation-for-return-stateme.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From 7790adcfcd97540aeceb73a8ef556ae827007902 Mon Sep 17 00:00:00 2001
-From: Daniel-Constantin Mierla <miconda at gmail.com>
-Date: Thu, 15 Sep 2016 15:19:37 +0200
-Subject: [PATCH] core: fixed misleading indentation for return statement
-
-(cherry picked from commit fc65a118d15e7942adccd332996701cdb6f1b0c7)
----
- tls_hooks.c | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/tls_hooks.c b/tls_hooks.c
-index b46a429..62ddda2 100644
---- a/tls_hooks.c
-+++ b/tls_hooks.c
-@@ -1,5 +1,5 @@
- /*
-- * Copyright (C) 2007 iptelorg GmbH 
-+ * Copyright (C) 2007 iptelorg GmbH
-  *
-  * Permission to use, copy, modify, and distribute this software for any
-  * purpose with or without fee is hereby granted, provided that the above
-@@ -34,7 +34,7 @@ static int tls_hooks_loaded=0;
- 
- int register_tls_hooks(struct tls_hooks* h)
- {
--	if (!tls_disable){
-+	if (!tls_disable) {
- 		tls_hook=*h;
- 		tls_hooks_loaded++;
- 		return 0;
-@@ -47,7 +47,7 @@ int tls_init(struct socket_info* si)
- {
- 	if (tls_hook.init_si)
- 		return tls_hook.init_si(si);
--		return -1;
-+	return -1;
- }
- 
- int tls_has_init_si()
--- 
-2.9.3
-
diff --git a/debian/patches/upstream/0013-core-proper-code-block-when-saving-chosen-naptr-reco.patch b/debian/patches/upstream/0013-core-proper-code-block-when-saving-chosen-naptr-reco.patch
deleted file mode 100644
index f1c6fb2..0000000
--- a/debian/patches/upstream/0013-core-proper-code-block-when-saving-chosen-naptr-reco.patch
+++ /dev/null
@@ -1,78 +0,0 @@
-From 11971cbb21f9e7cface65251e7a991ffe8c9efc5 Mon Sep 17 00:00:00 2001
-From: Daniel-Constantin Mierla <miconda at gmail.com>
-Date: Thu, 15 Sep 2016 15:26:39 +0200
-Subject: [PATCH] core: proper code block when saving chosen naptr record
-
-(cherry picked from commit a4b43f962a4493defb3fd608d1d2fad3ee58794a)
----
- resolve.c | 15 ++++++++-------
- 1 file changed, 8 insertions(+), 7 deletions(-)
-
-diff --git a/resolve.c b/resolve.c
-index 0af1be3..3d57418 100644
---- a/resolve.c
-+++ b/resolve.c
-@@ -1335,7 +1335,7 @@ end:
- 
- 
- 
--#ifdef USE_NAPTR 
-+#ifdef USE_NAPTR
- 
- 
- /** iterates over a naptr rr list, returning each time a "good" naptr record
-@@ -1343,7 +1343,7 @@ end:
-  * params:
-  *         naptr_head - naptr rr list head
-  *         tried      - bitmap used to keep track of the already tried records
-- *                      (no more then sizeof(tried)*8 valid records are 
-+ *                      (no more then sizeof(tried)*8 valid records are
-  *                      ever walked
-  *         srv_name   - if succesfull, it will be set to the selected record
-  *                      srv name (naptr repl.)
-@@ -1351,10 +1351,10 @@ end:
-  *                      protocol
-  * returns  0 if no more records found or a pointer to the selected record
-  *  and sets  protocol and srv_name
-- * WARNING: when calling first time make sure you run first 
-+ * WARNING: when calling first time make sure you run first
-  *           naptr_iterate_init(&tried)
-  */
--struct rdata* naptr_sip_iterate(struct rdata* naptr_head, 
-+struct rdata* naptr_sip_iterate(struct rdata* naptr_head,
- 										naptr_bmp_t* tried,
- 										str* srv_name, char* proto)
- {
-@@ -1373,7 +1373,7 @@ struct rdata* naptr_sip_iterate(struct rdata* naptr_head,
- 	saved_proto=0;
- 	i=0;
- 	for(l=naptr_head; l && (i<MAX_NAPTR_RRS); l=l->next){
--		if (l->type!=T_NAPTR) continue; 
-+		if (l->type!=T_NAPTR) continue;
- 		naptr=(struct naptr_rdata*) l->rdata;
- 		if (naptr==0){
- 			LM_CRIT("null rdata\n");
-@@ -1391,17 +1391,18 @@ struct rdata* naptr_sip_iterate(struct rdata* naptr_head,
- #endif
- 		if ((naptr_proto_supported(naptr_proto))){
- 			if (naptr_choose(&naptr_saved, &saved_proto,
--								naptr, naptr_proto))
-+								naptr, naptr_proto)) {
- 				idx=i;
- 				l_saved=l;
- 			}
-+		}
- 		i++;
- 	}
- 	if (naptr_saved){
- 		/* found something */
- #ifdef NAPTR_DBG
- 		LM_DBG("choosed NAPTR rr %.*s, proto %d tried: 0x%x\n",
--					naptr_saved->repl_len, 
-+					naptr_saved->repl_len,
- 					naptr_saved->repl, (int)saved_proto, *tried);
- #endif
- 		*tried|=1<<idx;
--- 
-2.9.3
-
diff --git a/debian/patches/upstream/0014-core-ut-fix-misleading-indentation-for-IF-blocks.patch b/debian/patches/upstream/0014-core-ut-fix-misleading-indentation-for-IF-blocks.patch
deleted file mode 100644
index 29b072f..0000000
--- a/debian/patches/upstream/0014-core-ut-fix-misleading-indentation-for-IF-blocks.patch
+++ /dev/null
@@ -1,129 +0,0 @@
-From c0f428406a8ccc7fbbd910150e4d45a6addbae49 Mon Sep 17 00:00:00 2001
-From: Daniel-Constantin Mierla <miconda at gmail.com>
-Date: Thu, 15 Sep 2016 15:30:13 +0200
-Subject: [PATCH] core: ut - fix misleading indentation for IF blocks
-
-- reported by latest gcc on debian sid
-
-(cherry picked from commit b7aa4b2cac495397f36fecb2e5bd5a0b80844346)
----
- ut.c | 26 +++++++++++++-------------
- 1 file changed, 13 insertions(+), 13 deletions(-)
-
-diff --git a/ut.c b/ut.c
-index 71907b4..9856b72 100644
---- a/ut.c
-+++ b/ut.c
-@@ -47,7 +47,7 @@ int user2uid(int* uid, int* gid, char* user)
- {
- 	char* tmp;
- 	struct passwd *pw_entry;
--	
-+
- 	if (user){
- 		*uid=strtol(user, &tmp, 10);
- 		if ((tmp==0) ||(*tmp)){
-@@ -73,7 +73,7 @@ int group2gid(int* gid, char* group)
- {
- 	char* tmp;
- 	struct group  *gr_entry;
--	
-+
- 	if (group){
- 		*gid=strtol(group, &tmp, 10);
- 		if ((tmp==0) ||(*tmp)){
-@@ -93,7 +93,7 @@ int group2gid(int* gid, char* group)
- 
- /*
-  * Replacement of timegm (does not exists on all platforms
-- * Taken from 
-+ * Taken from
-  * http://lists.samba.org/archive/samba-technical/2002-November/025737.html
-  */
- time_t _timegm(struct tm* t)
-@@ -111,7 +111,7 @@ time_t _timegm(struct tm* t)
- 		}
- 		tl += 3600;
- 	}
--	
-+
- 	tg = gmtime(&tl);
- 	tg->tm_isdst = 0;
- 	tb = mktime(tg);
-@@ -173,7 +173,7 @@ char* as_asciiz(str* s)
- /* return system version (major.minor.minor2) as
-  *  (major<<16)|(minor)<<8|(minor2)
-  * (if some of them are missing, they are set to 0)
-- * if the parameters are not null they are set to the coresp. part 
-+ * if the parameters are not null they are set to the coresp. part
-  */
- unsigned int get_sys_version(int* major, int* minor, int* minor2)
- {
-@@ -182,7 +182,7 @@ unsigned int get_sys_version(int* major, int* minor, int* minor2)
- 	int m2;
- 	int m3;
- 	char* p;
--	
-+
- 	memset (&un, 0, sizeof(un));
- 	m1=m2=m3=0;
- 	/* get sys version */
-@@ -218,24 +218,24 @@ char* get_abs_pathname(str* base, str* file)
- 	str ser_cfg;
- 	char* buf, *dir, *res;
- 	int len;
--  	
-+
- 	if (base == NULL) {
- 		ser_cfg.s = cfg_file;
- 		ser_cfg.len = strlen(cfg_file);
- 		base = &ser_cfg;
- 	}
--	
-+
- 	if (!base->s || base->len <= 0 || base->s[0] != '/') {
- 		BUG("get_abs_pathname: Base file must be absolute pathname: "
- 			"'%.*s'\n", STR_FMT(base));
- 		return NULL;
- 	}
--	
-+
- 	if (!file || !file->s || file->len <= 0) {
- 		BUG("get_abs_pathname: Invalid 'file' parameter\n");
- 		return NULL;
- 	}
--	
-+
- 	if (file->s[0] == '/') {
- 		/* This is an absolute pathname, make a zero terminated
- 		 * copy and use it as it is */
-@@ -257,7 +257,7 @@ char* get_abs_pathname(str* base, str* file)
- 		memcpy(buf, base->s, base->len);
- 		buf[base->len]=0;
- 		dir = dirname(buf);
--		
-+
- 		len = strlen(dir);
- 		if ((res = pkg_malloc(len + 1 + file->len + 1)) == NULL) {
- 			ERR("get_abs_pathname: No memory left (pkg_malloc failed)\n");
-@@ -321,7 +321,7 @@ void * ser_memmem(const void *b1, const void *b2, size_t len1, size_t len2)
- 			if (memcmp(sp, pp, len2) == 0)
- 				return sp;
- 
--			sp++;
-+		sp++;
- 	}
- 
- 	return NULL;
-@@ -352,7 +352,7 @@ void * ser_memrmem(const void *b1, const void *b2, size_t len1, size_t len2)
- 			if (memcmp(sp, pp, len2) == 0)
- 				return sp;
- 
--			sp--;
-+		sp--;
- 	}
- 
- 	return NULL;
--- 
-2.9.3
-
diff --git a/debian/patches/upstream/0015-auth_identity-fix-misleading-indentation-level.patch b/debian/patches/upstream/0015-auth_identity-fix-misleading-indentation-level.patch
deleted file mode 100644
index 649e24a..0000000
--- a/debian/patches/upstream/0015-auth_identity-fix-misleading-indentation-level.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From 2372150f292363fd8c1705dfd69184e9a898f86a Mon Sep 17 00:00:00 2001
-From: Daniel-Constantin Mierla <miconda at gmail.com>
-Date: Thu, 15 Sep 2016 16:26:43 +0200
-Subject: [PATCH] auth_identity: fix misleading indentation level
-
-(cherry picked from commit e5532f05d7b2b6b8d90d01fd9e934a412c7168e0)
----
- modules/auth_identity/auth_hdrs.c | 20 +++++++++++---------
- 1 file changed, 11 insertions(+), 9 deletions(-)
-
-diff --git a/modules/auth_identity/auth_hdrs.c b/modules/auth_identity/auth_hdrs.c
-index 06a773b..a5099b6 100644
---- a/modules/auth_identity/auth_hdrs.c
-+++ b/modules/auth_identity/auth_hdrs.c
-@@ -449,7 +449,7 @@ int digeststr_asm(dynstr *sout, struct sip_msg *msg, str *sdate, int iflags)
- 
- 		/* there was an error or the required header is missing */
- 		if (iRes==AUTH_ERROR
--		    || (iRes==AUTH_NOTFOUND && (pactpart[i1].iflag & DS_REQUIRED)))
-+				|| (iRes==AUTH_NOTFOUND && (pactpart[i1].iflag & DS_REQUIRED)))
- 			return -1;
- 
- 		switch (pactpart[i1].itype) {
-@@ -569,10 +569,12 @@ int append_date(str *sdate, int idatesize, time_t *tout, struct sip_msg *msg)
- 	if (sdate && idatesize >= ilen) {
- 		memcpy(sdate->s, date_str, ilen);
- 		sdate->len=ilen;
--	} else
-+	} else {
- 		return -5;
--		if (tout)
--			*tout=tdate_now;
-+	}
-+
-+	if (tout)
-+		*tout=tdate_now;
- 
- 	return 0;
- }
-@@ -667,24 +669,24 @@ dc_end:
- 		goto other;
- 	} else {
- 		return (p + 1);
-- 	}
-+	}
- 
- 	/* Unknown header type */
- other:
- 	p = q_memchr(p, ':', end - p);
-- 	if (!p) {        /* No double colon found, error.. */
-+	if (!p) {        /* No double colon found, error.. */
- 		*type = HDR_ERROR_T;
- 		return 0;
-- 	} else {
-+	} else {
- 		*type = HDR_OTHER_T;
- 		return (p + 1);
-- 	}
-+	}
- 
- 	return p;
- }
- 
- /* parses buffer that contains a SIP message header, looks for "Contact"
--   header field and returns the value of that */
-+ * header field and returns the value of that */
- static int get_contact_body(char *buf, unsigned int len, str *sout)
- {
- 	char *end, *s, *tmp, *match;
--- 
-2.9.3
-
diff --git a/debian/patches/upstream/0016-counters-fixed-rpc-command-to-get-counter-by-group-a.patch b/debian/patches/upstream/0016-counters-fixed-rpc-command-to-get-counter-by-group-a.patch
deleted file mode 100644
index 0307265..0000000
--- a/debian/patches/upstream/0016-counters-fixed-rpc-command-to-get-counter-by-group-a.patch
+++ /dev/null
@@ -1,135 +0,0 @@
-From 3a32d65bbe103ea0caae418b946168ce774948c5 Mon Sep 17 00:00:00 2001
-From: Daniel-Constantin Mierla <miconda at gmail.com>
-Date: Sat, 17 Sep 2016 11:17:44 +0200
-Subject: [PATCH] counters: fixed rpc command to get counter by group and name
-
-(cherry picked from commit f8e47835950fa472ef313b7f303b0989b76f9dbe)
----
- modules/counters/counters.c | 29 +++++++++++++++--------------
- 1 file changed, 15 insertions(+), 14 deletions(-)
-
-diff --git a/modules/counters/counters.c b/modules/counters/counters.c
-index d90ead1..5fd8739 100644
---- a/modules/counters/counters.c
-+++ b/modules/counters/counters.c
-@@ -24,9 +24,9 @@
- 
- /*!
-  * \defgroup counters Counters/statistics
-- * 
-+ *
-  */
-- 
-+
- #include "../../modparam.h"
- #include "../../dprint.h"
- #include "../../compiler_opt.h"
-@@ -239,7 +239,7 @@ static int cnt_int_fixup(void** param, int param_no)
- static int cnt_inc_f(struct sip_msg* msg, char* handle, char* bar)
- {
- 	counter_handle_t h;
--	
-+
- 	h.id = (long)(void*)handle;
- 	counter_inc(h);
- 	return 1;
-@@ -251,7 +251,7 @@ static int cnt_add_f(struct sip_msg* msg, char* handle, char* val)
- {
- 	counter_handle_t h;
- 	int v;
--	
-+
- 	h.id = (long)(void*)handle;
- 	if (unlikely(get_int_fparam(&v, msg, (fparam_t*)val) < 0)) {
- 		ERR("non integer parameter\n");
-@@ -266,7 +266,7 @@ static int cnt_add_f(struct sip_msg* msg, char* handle, char* val)
- static int cnt_reset_f(struct sip_msg* msg, char* handle, char* bar)
- {
- 	counter_handle_t h;
--	
-+
- 	h.id = (long)(void*)handle;
- 	counter_reset(h);
- 	return 1;
-@@ -284,12 +284,13 @@ static void cnt_get_rpc(rpc_t* rpc, void* c)
- 	char* name;
- 	counter_val_t v;
- 	counter_handle_t h;
--	
-+
- 	if (rpc->scan(c, "s", &group) < 1)
- 		return;
--	if (rpc->scan(c, "*s", &name) < 1)
-+	if (rpc->scan(c, "*s", &name) < 1) {
- 		cnt_grp_get_all(rpc, c, group);
- 		return;
-+	}
- 	/* group & name read */
- 	if (counter_lookup(&h, group, name) < 0) {
- 		rpc->fault(c, 400, "non-existent counter %s.%s\n", group, name);
-@@ -308,7 +309,7 @@ static void cnt_get_raw_rpc(rpc_t* rpc, void* c)
- 	char* name;
- 	counter_val_t v;
- 	counter_handle_t h;
--	
-+
- 	if (rpc->scan(c, "ss", &group, &name) < 2) {
- 		/* rpc->fault(c, 400, "group and counter name required"); */
- 		return;
-@@ -329,7 +330,7 @@ static void cnt_reset_rpc(rpc_t* rpc, void* c)
- 	char* group;
- 	char* name;
- 	counter_handle_t h;
--	
-+
- 	if (rpc->scan(c, "ss", &group, &name) < 2) {
- 		/* rpc->fault(c, 400, "group and counter name required"); */
- 		return;
-@@ -383,7 +384,7 @@ static  void rpc_print_name_val(void* param, str* g, str* n,
- static void cnt_grps_list_rpc(rpc_t* rpc, void* c)
- {
- 	struct rpc_list_params packed_params;
--	
-+
- 	packed_params.rpc = rpc;
- 	packed_params.ctx = c;
- 	counter_iterate_grp_names(rpc_print_name, &packed_params);
-@@ -395,7 +396,7 @@ static void cnt_var_list_rpc(rpc_t* rpc, void* c)
- {
- 	char* group;
- 	struct rpc_list_params packed_params;
--	
-+
- 	if (rpc->scan(c, "s", &group) < 1) {
- 		/* rpc->fault(c, 400, "group name required"); */
- 		return;
-@@ -411,7 +412,7 @@ static void cnt_grp_get_all(rpc_t* rpc, void* c, char* group)
- {
- 	void* s;
- 	struct rpc_list_params packed_params;
--	
-+
- 	if (rpc->add(c, "{", &s) < 0) return;
- 	packed_params.rpc = rpc;
- 	packed_params.ctx = s;
-@@ -423,7 +424,7 @@ static void cnt_grp_get_all(rpc_t* rpc, void* c, char* group)
- static void cnt_grp_get_all_rpc(rpc_t* rpc, void* c)
- {
- 	char* group;
--	
-+
- 	if (rpc->scan(c, "s", &group) < 1) {
- 		/* rpc->fault(c, 400, "group name required"); */
- 		return;
-@@ -439,7 +440,7 @@ static void cnt_help_rpc(rpc_t* rpc, void* ctx)
- 	char* name;
- 	char* desc;
- 	counter_handle_t h;
--	
-+
- 	if (rpc->scan(ctx, "ss", &group, &name) < 2) {
- 		/* rpc->fault(c, 400, "group and counter name required"); */
- 		return;
--- 
-2.9.3
-
diff --git a/debian/patches/upstream/0017-utils-coherent-indentation-for-xcap-functions.patch b/debian/patches/upstream/0017-utils-coherent-indentation-for-xcap-functions.patch
deleted file mode 100644
index c1ca567..0000000
--- a/debian/patches/upstream/0017-utils-coherent-indentation-for-xcap-functions.patch
+++ /dev/null
@@ -1,946 +0,0 @@
-From fad61c4b4e3c3b4430ac9f4d05cb3698f39c1c0c Mon Sep 17 00:00:00 2001
-From: Daniel-Constantin Mierla <miconda at gmail.com>
-Date: Sun, 18 Sep 2016 09:22:58 +0200
-Subject: [PATCH] utils: coherent indentation for xcap functions
-
-- fix for gcc 6.2 misleading blocks warnings
-
-(cherry picked from commit 883629aecc143528396fae0f88d434bfc0a047ca)
----
- modules/utils/xcap_auth.c | 851 +++++++++++++++++++++++-----------------------
- 1 file changed, 426 insertions(+), 425 deletions(-)
-
-diff --git a/modules/utils/xcap_auth.c b/modules/utils/xcap_auth.c
-index 35ef6b0..fd6be40 100644
---- a/modules/utils/xcap_auth.c
-+++ b/modules/utils/xcap_auth.c
-@@ -17,15 +17,15 @@
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  * GNU General Public License for more details.
-  *
-- * You should have received a copy of the GNU General Public License 
-- * along with this program; if not, write to the Free Software 
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
-  *
-  */
- 
- /*!
-  * \file
-- * \brief Kamailio utils :: 
-+ * \brief Kamailio utils ::
-  * \ingroup utils
-  * Module: \ref utils
-  */
-@@ -49,484 +49,485 @@
- 
- xmlNodePtr get_rule_node(subs_t* subs, xmlDocPtr xcap_tree)
- {
--    str w_uri = {0, 0};
--    char* id = NULL, *domain = NULL, *time_cont= NULL;
--    int apply_rule = -1;
--    xmlNodePtr ruleset_node = NULL, node1= NULL, node2= NULL;
--    xmlNodePtr cond_node = NULL, except_node = NULL;
--    xmlNodePtr identity_node = NULL;
--    xmlNodePtr iden_child;
--    xmlNodePtr validity_node, time_node;
--    time_t t_init, t_fin, t;
--    int valid= 0;
--
--    uandd_to_uri(subs->from_user, subs->from_domain, &w_uri);
--    if (w_uri.s == NULL) {
--	LM_ERR("while creating uri\n");
--	return NULL;
--    }
--    ruleset_node = xmlDocGetNodeByName(xcap_tree, "ruleset", NULL);
--    if (ruleset_node == NULL) {
--	LM_DBG("ruleset_node NULL\n");
--	goto error;
--    }	
--    for (node1 = ruleset_node->children; node1; node1 = node1->next) {
--	if (xmlStrcasecmp(node1->name, (unsigned char*)"text") == 0)
--	    continue;
--
--	/* process conditions */
--	LM_DBG("node1->name= %s\n", node1->name);
--	
--	cond_node = xmlNodeGetChildByName(node1, "conditions");
--	if(cond_node == NULL) {
--	    LM_DBG("cond node NULL\n");
--	    goto error;
-+	str w_uri = {0, 0};
-+	char* id = NULL, *domain = NULL, *time_cont= NULL;
-+	int apply_rule = -1;
-+	xmlNodePtr ruleset_node = NULL, node1= NULL, node2= NULL;
-+	xmlNodePtr cond_node = NULL, except_node = NULL;
-+	xmlNodePtr identity_node = NULL;
-+	xmlNodePtr iden_child;
-+	xmlNodePtr validity_node, time_node;
-+	time_t t_init, t_fin, t;
-+	int valid= 0;
-+
-+	uandd_to_uri(subs->from_user, subs->from_domain, &w_uri);
-+	if (w_uri.s == NULL) {
-+		LM_ERR("while creating uri\n");
-+		return NULL;
- 	}
--	LM_DBG("cond_node->name= %s\n", cond_node->name);
--
--	validity_node = xmlNodeGetChildByName(cond_node, "validity");
--	if (validity_node != NULL) {
--	    LM_DBG("found validity tag\n");
--	    
--	    t= time(NULL);
--		
--	    /* search all from-until pair */
--	    for (time_node = validity_node->children; time_node;
--		time_node = time_node->next) {
--		if (xmlStrcasecmp(time_node->name, (unsigned char*)"from")!= 0)
--		    continue;
--
--		time_cont= (char*)xmlNodeGetContent(time_node);
--		t_init= xml_parse_dateTime(time_cont);
--		xmlFree(time_cont);
--		if (t_init< 0) {
--		    LM_ERR("failed to parse xml dateTime\n");
--		    goto error;
--		}
-+	ruleset_node = xmlDocGetNodeByName(xcap_tree, "ruleset", NULL);
-+	if (ruleset_node == NULL) {
-+		LM_DBG("ruleset_node NULL\n");
-+		goto error;
-+	}
-+	for (node1 = ruleset_node->children; node1; node1 = node1->next) {
-+		if (xmlStrcasecmp(node1->name, (unsigned char*)"text") == 0)
-+			continue;
- 
--		if (t< t_init) {
--		    LM_DBG("the lower time limit is not respected\n");
--		    continue;
--		}
--				
--		time_node= time_node->next;
--		while (1) {
--		    if (time_node == NULL) {
--			LM_ERR("bad formatted xml doc:until child not found in"
--			       " validity pair\n");
-+		/* process conditions */
-+		LM_DBG("node1->name= %s\n", node1->name);
-+
-+		cond_node = xmlNodeGetChildByName(node1, "conditions");
-+		if(cond_node == NULL) {
-+			LM_DBG("cond node NULL\n");
- 			goto error;
--		    }
--		    if( xmlStrcasecmp(time_node->name, 
--				      (unsigned char*)"until")== 0)
--			break;
--		    time_node= time_node->next;
--		}
--				
--		time_cont = (char*)xmlNodeGetContent(time_node);
--		t_fin= xml_parse_dateTime(time_cont);
--		xmlFree(time_cont);
--		
--		if (t_fin< 0) {
--		    LM_ERR("failed to parse xml dateTime\n");
--		    goto error;
--		}
--			
--		if (t <= t_fin) {
--		    LM_DBG("the rule is active at this time\n");
--		    valid= 1;
- 		}
--			
--	    }
--		
--	    if (!valid) {
--		LM_DBG("the rule is not active at this time\n");
--		continue;
--	    }
--	    
--	}	
--
--	identity_node = xmlNodeGetChildByName(cond_node, "identity");
--	if (identity_node == NULL) {
--	    LM_ERR("didn't find identity tag\n");
--	    goto error;
--	}	
--		
--	iden_child = xmlNodeGetChildByName(identity_node, "one");
--	if(iden_child) {
--	    for (node2 = identity_node->children; node2; node2 = node2->next) {
--		if(xmlStrcasecmp(node2->name, (unsigned char*)"one")!= 0)
--		    continue;
--				
--		id = xmlNodeGetAttrContentByName(node2, "id");	
--		if(id== NULL) {
--		    LM_ERR("while extracting attribute\n");
--		    goto error;
--		}
--		if ((strlen(id)== w_uri.len && 
--		     (strncmp(id, w_uri.s, w_uri.len)==0))) {
--		    apply_rule = 1;
--		    xmlFree(id);
--		    break;
-+		LM_DBG("cond_node->name= %s\n", cond_node->name);
-+
-+		validity_node = xmlNodeGetChildByName(cond_node, "validity");
-+		if (validity_node != NULL) {
-+			LM_DBG("found validity tag\n");
-+
-+			t= time(NULL);
-+
-+			/* search all from-until pair */
-+			for (time_node = validity_node->children; time_node;
-+					time_node = time_node->next) {
-+				if (xmlStrcasecmp(time_node->name, (unsigned char*)"from")!= 0)
-+					continue;
-+
-+				time_cont= (char*)xmlNodeGetContent(time_node);
-+				t_init= xml_parse_dateTime(time_cont);
-+				xmlFree(time_cont);
-+				if (t_init< 0) {
-+					LM_ERR("failed to parse xml dateTime\n");
-+					goto error;
-+				}
-+
-+				if (t< t_init) {
-+					LM_DBG("the lower time limit is not respected\n");
-+					continue;
-+				}
-+
-+				time_node= time_node->next;
-+				while (1) {
-+					if (time_node == NULL) {
-+						LM_ERR("bad formatted xml doc:until child not found in"
-+								" validity pair\n");
-+						goto error;
-+					}
-+					if( xmlStrcasecmp(time_node->name,
-+								(unsigned char*)"until")== 0)
-+						break;
-+					time_node= time_node->next;
-+				}
-+
-+				time_cont = (char*)xmlNodeGetContent(time_node);
-+				t_fin= xml_parse_dateTime(time_cont);
-+				xmlFree(time_cont);
-+
-+				if (t_fin< 0) {
-+					LM_ERR("failed to parse xml dateTime\n");
-+					goto error;
-+				}
-+
-+				if (t <= t_fin) {
-+					LM_DBG("the rule is active at this time\n");
-+					valid= 1;
-+				}
-+
-+			}
-+
-+			if (!valid) {
-+				LM_DBG("the rule is not active at this time\n");
-+				continue;
-+			}
-+
- 		}
--		xmlFree(id);
--	    }
--	}	
--
--	/* search for many node*/
--	iden_child = xmlNodeGetChildByName(identity_node, "many");
--	if (iden_child)	{
--	    domain = NULL;
--	    for (node2 = identity_node->children; node2; node2 = node2->next) {
--		if (xmlStrcasecmp(node2->name, (unsigned char*)"many") != 0)
--		    continue;
--	
--		domain = xmlNodeGetAttrContentByName(node2, "domain");
--		if(domain == NULL) {
--		    LM_DBG("No domain attribute to many\n");
--		} else	{
--		    LM_DBG("<many domain= %s>\n", domain);
--		    if((strlen(domain)!= subs->from_domain.len && 
--			strncmp(domain, subs->from_domain.s,
--				subs->from_domain.len) )) {
--			xmlFree(domain);
--			continue;
--		    }	
-+
-+		identity_node = xmlNodeGetChildByName(cond_node, "identity");
-+		if (identity_node == NULL) {
-+			LM_ERR("didn't find identity tag\n");
-+			goto error;
- 		}
--		xmlFree(domain);
--		apply_rule = 1;
--		if (node2->children == NULL)       /* there is no exception */
--		    break;
--
--		for (except_node = node2->children; except_node;
--		     except_node= except_node->next) {
--		    if(xmlStrcasecmp(except_node->name,
--				     (unsigned char*)"except"))
--			continue;
- 
--		    id = xmlNodeGetAttrContentByName(except_node, "id");	
--		    if (id != NULL) {
--			if((strlen(id)- 1== w_uri.len && 
--			    (strncmp(id, w_uri.s, w_uri.len)==0))) {
--			    xmlFree(id);
--			    apply_rule = 0;
--			    break;
-+		iden_child = xmlNodeGetChildByName(identity_node, "one");
-+		if(iden_child) {
-+			for (node2 = identity_node->children; node2; node2 = node2->next) {
-+				if(xmlStrcasecmp(node2->name, (unsigned char*)"one")!= 0)
-+					continue;
-+
-+				id = xmlNodeGetAttrContentByName(node2, "id");
-+				if(id== NULL) {
-+					LM_ERR("while extracting attribute\n");
-+					goto error;
-+				}
-+				if ((strlen(id)== w_uri.len &&
-+							(strncmp(id, w_uri.s, w_uri.len)==0))) {
-+					apply_rule = 1;
-+					xmlFree(id);
-+					break;
-+				}
-+				xmlFree(id);
- 			}
--			xmlFree(id);
--		    } else {
-+		}
-+
-+		/* search for many node*/
-+		iden_child = xmlNodeGetChildByName(identity_node, "many");
-+		if (iden_child)	{
- 			domain = NULL;
--			domain = xmlNodeGetAttrContentByName(except_node,
--							     "domain");
--			if(domain!=NULL) {
--			    LM_DBG("Found except domain= %s\n- strlen(domain)= %d\n",
--				   domain, (int)strlen(domain));
--			    if (strlen(domain)==subs->from_domain.len &&
--				(strncmp(domain,subs->from_domain.s ,
--					 subs->from_domain.len)==0)) {
--				LM_DBG("except domain match\n");
-+			for (node2 = identity_node->children; node2; node2 = node2->next) {
-+				if (xmlStrcasecmp(node2->name, (unsigned char*)"many") != 0)
-+					continue;
-+
-+				domain = xmlNodeGetAttrContentByName(node2, "domain");
-+				if(domain == NULL) {
-+					LM_DBG("No domain attribute to many\n");
-+				} else	{
-+					LM_DBG("<many domain= %s>\n", domain);
-+					if((strlen(domain)!= subs->from_domain.len &&
-+								strncmp(domain, subs->from_domain.s,
-+									subs->from_domain.len) )) {
-+						xmlFree(domain);
-+						continue;
-+					}
-+				}
- 				xmlFree(domain);
--				apply_rule = 0;
--				break;
--			    }
--			    xmlFree(domain);
--			}	
--		    }	
-+				apply_rule = 1;
-+				if (node2->children == NULL)       /* there is no exception */
-+					break;
-+
-+				for (except_node = node2->children; except_node;
-+						except_node= except_node->next) {
-+					if(xmlStrcasecmp(except_node->name,
-+								(unsigned char*)"except"))
-+						continue;
-+
-+					id = xmlNodeGetAttrContentByName(except_node, "id");
-+					if (id != NULL) {
-+						if((strlen(id)- 1== w_uri.len &&
-+									(strncmp(id, w_uri.s, w_uri.len)==0))) {
-+							xmlFree(id);
-+							apply_rule = 0;
-+							break;
-+						}
-+						xmlFree(id);
-+					} else {
-+						domain = NULL;
-+						domain = xmlNodeGetAttrContentByName(except_node,
-+								"domain");
-+						if(domain!=NULL) {
-+							LM_DBG("Found except domain= %s\n- strlen(domain)= %d\n",
-+									domain, (int)strlen(domain));
-+							if (strlen(domain)==subs->from_domain.len &&
-+									(strncmp(domain,subs->from_domain.s ,
-+											subs->from_domain.len)==0)) {
-+								LM_DBG("except domain match\n");
-+								xmlFree(domain);
-+								apply_rule = 0;
-+								break;
-+							}
-+							xmlFree(domain);
-+						}
-+					}
-+				}
-+				if (apply_rule == 1)  /* if a match was found no need to keep searching*/
-+					break;
-+			}
- 		}
--		if (apply_rule == 1)  /* if a match was found no need to keep searching*/
--		    break;
--	    }
-+		if (apply_rule ==1)
-+			break;
- 	}
--	if (apply_rule ==1)
--	    break;
--    }
- 
--    LM_DBG("apply_rule= %d\n", apply_rule);
--    if(w_uri.s!=NULL)
--	pkg_free(w_uri.s);
-+	LM_DBG("apply_rule= %d\n", apply_rule);
-+	if(w_uri.s!=NULL)
-+		pkg_free(w_uri.s);
- 
--    if( !apply_rule || !node1)
--	return NULL;
--    
--    return node1;
-+	if( !apply_rule || !node1)
-+		return NULL;
-+
-+	return node1;
- 
-- error:
--    if(w_uri.s)
--	pkg_free(w_uri.s);
--    return NULL;
-+error:
-+	if(w_uri.s)
-+		pkg_free(w_uri.s);
-+	return NULL;
- }
- 
- int pres_watcher_allowed(subs_t* subs)
- {
--    xmlDocPtr xcap_tree= NULL;
--    xmlNodePtr node= NULL,  actions_node = NULL;
--    xmlNodePtr sub_handling_node = NULL;
--    char* sub_handling = NULL;
--	
--    subs->status= PENDING_STATUS;
--    subs->reason.s= NULL;
--    subs->reason.len= 0;
--
--    if (subs->auth_rules_doc== NULL)
--	return 0;
-+	xmlDocPtr xcap_tree= NULL;
-+	xmlNodePtr node= NULL,  actions_node = NULL;
-+	xmlNodePtr sub_handling_node = NULL;
-+	char* sub_handling = NULL;
-+
-+	subs->status= PENDING_STATUS;
-+	subs->reason.s= NULL;
-+	subs->reason.len= 0;
-+
-+	if (subs->auth_rules_doc== NULL)
-+		return 0;
-+
-+	xcap_tree= xmlParseMemory(subs->auth_rules_doc->s,
-+			subs->auth_rules_doc->len);
-+	if (xcap_tree== NULL) {
-+		LM_ERR("parsing xml memory\n");
-+		return -1;
-+	}
- 
--    xcap_tree= xmlParseMemory(subs->auth_rules_doc->s,
--			      subs->auth_rules_doc->len);
--    if (xcap_tree== NULL) {
--	LM_ERR("parsing xml memory\n");
--	return -1;
--    }
-+	node= get_rule_node(subs, xcap_tree);
-+	if (node== NULL) {
-+		xmlFreeDoc(xcap_tree);
-+		return 0;
-+	}
- 
--    node= get_rule_node(subs, xcap_tree);
--    if (node== NULL) {
--	xmlFreeDoc(xcap_tree);
--	return 0;
-+	/* process actions */
-+	actions_node = xmlNodeGetChildByName(node, "actions");
-+	if (actions_node == NULL) {
-+		LM_DBG("actions_node NULL\n");
-+		xmlFreeDoc(xcap_tree);
-+		return 0;
- 	}
-+	LM_DBG("actions_node->name= %s\n", actions_node->name);
- 
--    /* process actions */	
--    actions_node = xmlNodeGetChildByName(node, "actions");
--    if (actions_node == NULL) {
--	LM_DBG("actions_node NULL\n");
--	xmlFreeDoc(xcap_tree);
--	return 0;
--    }
--    LM_DBG("actions_node->name= %s\n", actions_node->name);
--			
--    sub_handling_node = xmlNodeGetChildByName(actions_node, "sub-handling");
--    if (sub_handling_node== NULL) {
--	LM_DBG("sub_handling_node NULL\n");
--	xmlFreeDoc(xcap_tree);
--	return 0;
--    }
--    sub_handling = (char*)xmlNodeGetContent(sub_handling_node);
--    LM_DBG("sub_handling_node->name= %s\n", sub_handling_node->name);
--    LM_DBG("sub_handling_node->content= %s\n", sub_handling);
--	
--    if (sub_handling == NULL) {
--	LM_ERR("Couldn't get sub-handling content\n");
--	xmlFreeDoc(xcap_tree);
--	return -1;
--    }
--    if (strncmp((char*)sub_handling, "block", 5) == 0) {
--	subs->status = TERMINATED_STATUS;;
--	subs->reason.s= "rejected";
--	subs->reason.len = 8;
--    } else	
--	if (strncmp((char*)sub_handling, "confirm", 7) == 0) {
--	    subs->status = PENDING_STATUS;
--	} else
--	    if (strncmp((char*)sub_handling , "polite-block", 12) == 0) {
--		subs->status = ACTIVE_STATUS;
--		subs->reason.s= "polite-block";
--		subs->reason.len = 12;
--	    }
--	else
--	    if (strncmp((char*)sub_handling, "allow", 5) == 0) {
--		subs->status = ACTIVE_STATUS;
--		subs->reason.s = NULL;
--	    }
--	    else {
--		LM_ERR("unknown subscription handling action\n");
-+	sub_handling_node = xmlNodeGetChildByName(actions_node, "sub-handling");
-+	if (sub_handling_node== NULL) {
-+		LM_DBG("sub_handling_node NULL\n");
-+		xmlFreeDoc(xcap_tree);
-+		return 0;
-+	}
-+	sub_handling = (char*)xmlNodeGetContent(sub_handling_node);
-+	LM_DBG("sub_handling_node->name= %s\n", sub_handling_node->name);
-+	LM_DBG("sub_handling_node->content= %s\n", sub_handling);
-+
-+	if (sub_handling == NULL) {
-+		LM_ERR("Couldn't get sub-handling content\n");
- 		xmlFreeDoc(xcap_tree);
--		xmlFree(sub_handling);
- 		return -1;
--	    }
-+	}
-+	if (strncmp((char*)sub_handling, "block", 5) == 0) {
-+		subs->status = TERMINATED_STATUS;
-+		subs->reason.s= "rejected";
-+		subs->reason.len = 8;
-+	} else {
-+		if (strncmp((char*)sub_handling, "confirm", 7) == 0) {
-+			subs->status = PENDING_STATUS;
-+		} else {
-+			if (strncmp((char*)sub_handling , "polite-block", 12) == 0) {
-+				subs->status = ACTIVE_STATUS;
-+				subs->reason.s= "polite-block";
-+				subs->reason.len = 12;
-+			} else {
-+				if (strncmp((char*)sub_handling, "allow", 5) == 0) {
-+					subs->status = ACTIVE_STATUS;
-+					subs->reason.s = NULL;
-+				} else {
-+					LM_ERR("unknown subscription handling action\n");
-+					xmlFreeDoc(xcap_tree);
-+					xmlFree(sub_handling);
-+					return -1;
-+				}
-+			}
-+		}
-+	}
- 
- 	xmlFreeDoc(xcap_tree);
--    xmlFree(sub_handling);
-+	xmlFree(sub_handling);
- 
--    return 0;
-+	return 0;
- 
- }
- 
- int get_rules_doc(str* user, str* domain, int type, str** rules_doc)
- {
--    db_key_t query_cols[5];
--    db_val_t query_vals[5];
--    db_key_t result_cols[3];
--    int n_query_cols = 0;
--    db1_res_t *result = 0;
--    db_row_t *row;
--    db_val_t *row_vals;
--    str body;
--    str* doc= NULL;
--    int n_result_cols= 0, xcap_doc_col;
--    static str tmp1 = str_init("username");
--    static str tmp2 = str_init("domain");
--    static str tmp3 = str_init("doc_type");
--    static str tmp4 = str_init("doc");
--
--    LM_DBG("[user]= %.*s\t[domain]= %.*s", 
--	   user->len, user->s, domain->len, domain->s);
--
--    query_cols[n_query_cols] = &tmp1;
--    query_vals[n_query_cols].type = DB1_STR;
--    query_vals[n_query_cols].nul = 0;
--    query_vals[n_query_cols].val.str_val = *user;
--    n_query_cols++;
--    
--    query_cols[n_query_cols] = &tmp2;
--    query_vals[n_query_cols].type = DB1_STR;
--    query_vals[n_query_cols].nul = 0;
--    query_vals[n_query_cols].val.str_val = *domain;
--    n_query_cols++;
--    
--    query_cols[n_query_cols] = &tmp3;
--    query_vals[n_query_cols].type = DB1_INT;
--    query_vals[n_query_cols].nul = 0;
--    query_vals[n_query_cols].val.int_val= type;
--    n_query_cols++;
--
--    result_cols[xcap_doc_col= n_result_cols++] = &tmp4;
--
--    if (pres_dbf.query(pres_dbh, query_cols, 0 , query_vals, result_cols, 
--		       n_query_cols, 1, 0, &result) < 0) {
--	LM_ERR("while querying table xcap for [user]=%.*s\t[domain]= %.*s\n",
--	       user->len, user->s, domain->len, domain->s);
--	if (result)
--	    pres_dbf.free_result(pres_dbh, result);
--	return -1;
--    }
-+	db_key_t query_cols[5];
-+	db_val_t query_vals[5];
-+	db_key_t result_cols[3];
-+	int n_query_cols = 0;
-+	db1_res_t *result = 0;
-+	db_row_t *row;
-+	db_val_t *row_vals;
-+	str body;
-+	str* doc= NULL;
-+	int n_result_cols= 0, xcap_doc_col;
-+	static str tmp1 = str_init("username");
-+	static str tmp2 = str_init("domain");
-+	static str tmp3 = str_init("doc_type");
-+	static str tmp4 = str_init("doc");
-+
-+	LM_DBG("[user]= %.*s\t[domain]= %.*s",
-+			user->len, user->s, domain->len, domain->s);
-+
-+	query_cols[n_query_cols] = &tmp1;
-+	query_vals[n_query_cols].type = DB1_STR;
-+	query_vals[n_query_cols].nul = 0;
-+	query_vals[n_query_cols].val.str_val = *user;
-+	n_query_cols++;
-+
-+	query_cols[n_query_cols] = &tmp2;
-+	query_vals[n_query_cols].type = DB1_STR;
-+	query_vals[n_query_cols].nul = 0;
-+	query_vals[n_query_cols].val.str_val = *domain;
-+	n_query_cols++;
-+
-+	query_cols[n_query_cols] = &tmp3;
-+	query_vals[n_query_cols].type = DB1_INT;
-+	query_vals[n_query_cols].nul = 0;
-+	query_vals[n_query_cols].val.int_val= type;
-+	n_query_cols++;
-+
-+	result_cols[xcap_doc_col= n_result_cols++] = &tmp4;
-+
-+	if (pres_dbf.query(pres_dbh, query_cols, 0 , query_vals, result_cols,
-+				n_query_cols, 1, 0, &result) < 0) {
-+		LM_ERR("while querying table xcap for [user]=%.*s\t[domain]= %.*s\n",
-+				user->len, user->s, domain->len, domain->s);
-+		if (result)
-+			pres_dbf.free_result(pres_dbh, result);
-+		return -1;
-+	}
- 
--    if(result == NULL)
--	return -1;
-+	if(result == NULL)
-+		return -1;
-+
-+	if (result->n <= 0) {
-+		LM_DBG("No document found in db table for [user]=%.*s"
-+				"\t[domain]= %.*s\t[doc_type]= %d\n",user->len, user->s,
-+				domain->len, domain->s, type);
-+		pres_dbf.free_result(pres_dbh, result);
-+		return 0;
-+	}
-+
-+	row = &result->rows[xcap_doc_col];
-+	row_vals = ROW_VALUES(row);
-+
-+	body.s = (char*)row_vals[0].val.string_val;
-+	if (body.s== NULL) {
-+		LM_ERR("Xcap doc NULL\n");
-+		goto error;
-+	}
-+	body.len = strlen(body.s);
-+	if (body.len== 0) {
-+		LM_ERR("Xcap doc empty\n");
-+		goto error;
-+	}
-+	LM_DBG("xcap document:\n%.*s", body.len,body.s);
-+
-+	doc= (str*)pkg_malloc(sizeof(str));
-+	if (doc== NULL) {
-+		ERR_MEM(PKG_MEM_STR);
-+	}
-+	doc->s= (char*)pkg_malloc(body.len* sizeof(char));
-+	if (doc->s== NULL) {
-+		pkg_free(doc);
-+		ERR_MEM(PKG_MEM_STR);
-+	}
-+	memcpy(doc->s, body.s, body.len);
-+	doc->len= body.len;
-+
-+	*rules_doc= doc;
-+
-+	if (result)
-+		pres_dbf.free_result(pres_dbh, result);
- 
--    if (result->n <= 0) {
--	LM_DBG("No document found in db table for [user]=%.*s"
--	       "\t[domain]= %.*s\t[doc_type]= %d\n",user->len, user->s,
--	       domain->len, domain->s, type);
--	pres_dbf.free_result(pres_dbh, result);
- 	return 0;
--    }	
--	
--    row = &result->rows[xcap_doc_col];
--    row_vals = ROW_VALUES(row);
--
--    body.s = (char*)row_vals[0].val.string_val;
--    if (body.s== NULL) {
--	LM_ERR("Xcap doc NULL\n");
--	goto error;
--    }	
--    body.len = strlen(body.s);
--    if (body.len== 0) {
--	LM_ERR("Xcap doc empty\n");
--	goto error;
--    }			
--    LM_DBG("xcap document:\n%.*s", body.len,body.s);
--    
--    doc= (str*)pkg_malloc(sizeof(str));
--    if (doc== NULL) {
--	ERR_MEM(PKG_MEM_STR);
--    }
--    doc->s= (char*)pkg_malloc(body.len* sizeof(char));
--    if (doc->s== NULL) {
--	pkg_free(doc);
--	ERR_MEM(PKG_MEM_STR);
--    }
--    memcpy(doc->s, body.s, body.len);
--    doc->len= body.len;
--
--    *rules_doc= doc;
--
--    if (result)
--	pres_dbf.free_result(pres_dbh, result);
--
--    return 0;
- 
- error:
--    if (result)
--	pres_dbf.free_result(pres_dbh, result);
-+	if (result)
-+		pres_dbf.free_result(pres_dbh, result);
- 
--    return -1;
-+	return -1;
- 
- }
- 
- 
--/* 
-+/*
-  * Checks from presence server xcap table if watcher is authorized
-  * to subscribe event 'presence' of presentity.
-  */
- int xcap_auth_status(struct sip_msg* _msg, char* _sp1, char* _sp2)
- {
--    pv_spec_t *sp;
--    pv_value_t pv_val;
--    str watcher_uri, presentity_uri;
--    struct sip_uri uri;
--    str* rules_doc = NULL;
--    subs_t subs;
--    int res;
--
--    if (pres_dbh == 0) {
--	LM_ERR("function is disabled, to enable define pres_db_url\n");
--	return -1;
--    }
-+	pv_spec_t *sp;
-+	pv_value_t pv_val;
-+	str watcher_uri, presentity_uri;
-+	struct sip_uri uri;
-+	str* rules_doc = NULL;
-+	subs_t subs;
-+	int res;
-+
-+	if (pres_dbh == 0) {
-+		LM_ERR("function is disabled, to enable define pres_db_url\n");
-+		return -1;
-+	}
- 
--    sp = (pv_spec_t *)_sp1;
-+	sp = (pv_spec_t *)_sp1;
- 
--    if (sp && (pv_get_spec_value(_msg, sp, &pv_val) == 0)) {
--	if (pv_val.flags & PV_VAL_STR) {
--	    watcher_uri = pv_val.rs;
--	    if (watcher_uri.len == 0 || watcher_uri.s == NULL) {
--		LM_ERR("missing watcher uri\n");
--		return -1;
--	    }
-+	if (sp && (pv_get_spec_value(_msg, sp, &pv_val) == 0)) {
-+		if (pv_val.flags & PV_VAL_STR) {
-+			watcher_uri = pv_val.rs;
-+			if (watcher_uri.len == 0 || watcher_uri.s == NULL) {
-+				LM_ERR("missing watcher uri\n");
-+				return -1;
-+			}
-+		} else {
-+			LM_ERR("watcher pseudo variable value is not string\n");
-+			return -1;
-+		}
- 	} else {
--	    LM_ERR("watcher pseudo variable value is not string\n");
--	    return -1;
-+		LM_ERR("cannot get watcher pseudo variable value\n");
-+		return -1;
- 	}
--    } else {
--	LM_ERR("cannot get watcher pseudo variable value\n");
--	return -1;
--    }
- 
--    sp = (pv_spec_t *)_sp2;
-+	sp = (pv_spec_t *)_sp2;
- 
--    if (sp && (pv_get_spec_value(_msg, sp, &pv_val) == 0)) {
--	if (pv_val.flags & PV_VAL_STR) {
--	    presentity_uri = pv_val.rs;
--	    if (presentity_uri.len == 0 || presentity_uri.s == NULL) {
--		LM_DBG("missing presentity uri\n");
--		return -1;
--	    }
-+	if (sp && (pv_get_spec_value(_msg, sp, &pv_val) == 0)) {
-+		if (pv_val.flags & PV_VAL_STR) {
-+			presentity_uri = pv_val.rs;
-+			if (presentity_uri.len == 0 || presentity_uri.s == NULL) {
-+				LM_DBG("missing presentity uri\n");
-+				return -1;
-+			}
-+		} else {
-+			LM_ERR("presentity pseudo variable value is not string\n");
-+			return -1;
-+		}
- 	} else {
--	    LM_ERR("presentity pseudo variable value is not string\n");
--	    return -1;
-+		LM_ERR("cannot get presentity pseudo variable value\n");
-+		return -1;
- 	}
--    } else {
--	LM_ERR("cannot get presentity pseudo variable value\n");
--	return -1;
--    }
- 
--    if (parse_uri(presentity_uri.s, presentity_uri.len, &uri) < 0) {
--	LM_ERR("failed to parse presentity uri\n");
-+	if (parse_uri(presentity_uri.s, presentity_uri.len, &uri) < 0) {
-+		LM_ERR("failed to parse presentity uri\n");
-+		return -1;
-+	}
-+	res = get_rules_doc(&uri.user, &uri.host, PRES_RULES, &rules_doc);
-+	if ((res < 0) || (rules_doc == NULL) || (rules_doc->s == NULL)) {
-+		LM_DBG("no xcap rules doc found for presentity uri\n");
-+		return PENDING_STATUS;
-+	}
-+
-+	if (parse_uri(watcher_uri.s, watcher_uri.len, &uri) < 0) {
-+		LM_ERR("failed to parse watcher uri\n");
-+		goto err;
-+	}
-+
-+	subs.from_user = uri.user;
-+	subs.from_domain = uri.host;
-+	subs.pres_uri = presentity_uri;
-+	subs.auth_rules_doc = rules_doc;
-+	if (pres_watcher_allowed(&subs) < 0) {
-+		LM_ERR("getting status from rules document\n");
-+		goto err;
-+	}
-+	LM_DBG("auth status of watcher <%.*s> on presentity <%.*s> is %d\n",
-+			watcher_uri.len, watcher_uri.s, presentity_uri.len, presentity_uri.s,
-+			subs.status);
-+	pkg_free(rules_doc->s);
-+	pkg_free(rules_doc);
-+	return subs.status;
-+
-+err:
-+	pkg_free(rules_doc->s);
-+	pkg_free(rules_doc);
- 	return -1;
--    }
--    res = get_rules_doc(&uri.user, &uri.host, PRES_RULES, &rules_doc);
--    if ((res < 0) || (rules_doc == NULL) || (rules_doc->s == NULL)) {
--	LM_DBG("no xcap rules doc found for presentity uri\n");
--	return PENDING_STATUS;
--    }
--
--    if (parse_uri(watcher_uri.s, watcher_uri.len, &uri) < 0) {
--	LM_ERR("failed to parse watcher uri\n");
--	goto err;
--    }
--
--    subs.from_user = uri.user;
--    subs.from_domain = uri.host;
--    subs.pres_uri = presentity_uri;
--    subs.auth_rules_doc = rules_doc;
--    if (pres_watcher_allowed(&subs) < 0) {
--	LM_ERR("getting status from rules document\n");
--	goto err;
--    }
--    LM_DBG("auth status of watcher <%.*s> on presentity <%.*s> is %d\n",
--	   watcher_uri.len, watcher_uri.s, presentity_uri.len, presentity_uri.s,
--	   subs.status);
--    pkg_free(rules_doc->s);
--    pkg_free(rules_doc);
--    return subs.status;
--
-- err:
--    pkg_free(rules_doc->s);
--    pkg_free(rules_doc);
--    return -1;
- }
--- 
-2.9.3
-
diff --git a/debian/patches/upstream/0018-core-rely-on-msg-last_header-to-get-the-anchor-insid.patch b/debian/patches/upstream/0018-core-rely-on-msg-last_header-to-get-the-anchor-insid.patch
deleted file mode 100644
index 04cf315..0000000
--- a/debian/patches/upstream/0018-core-rely-on-msg-last_header-to-get-the-anchor-insid.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From 65cb4a63c572260bcdc96a84a421c66cf3086dcb Mon Sep 17 00:00:00 2001
-From: Daniel-Constantin Mierla <miconda at gmail.com>
-Date: Tue, 20 Sep 2016 11:40:07 +0200
-Subject: [PATCH] core: rely on msg->last_header to get the anchor inside
- sr_hdr_add()
-
-- might fix GH #789
-
-(cherry picked from commit 9483b5491f82dd18bbdaeee72fd43ec6e1fbfb8c)
----
- data_lump.c | 8 +++++++-
- 1 file changed, 7 insertions(+), 1 deletion(-)
-
-diff --git a/data_lump.c b/data_lump.c
-index 5d085ec..5b87b8e 100644
---- a/data_lump.c
-+++ b/data_lump.c
-@@ -743,13 +743,19 @@ int sr_hdr_add(sip_msg_t *msg, str *sname, str *sbody)
- 	struct lump* anchor;
- 	str h;
- 
-+	parse_headers(msg, HDR_EOH_F, 0);
-+	if(msg->last_header == 0) {
-+		LM_ERR("failed to parse headers\n");
-+		return -1;
-+	}
- 	h.len = sname->len + 2 + sbody->len + CRLF_LEN;
- 	h.s = (char*)pkg_malloc(h.len+1);
- 	if(h.s == 0) {
- 		LM_ERR("no more pkg\n");
- 		return -1;
- 	}
--	anchor = anchor_lump(msg, msg->unparsed - msg->buf, 0, 0);
-+	anchor = anchor_lump(msg, msg->last_header->name.s + msg->last_header->len
-+					- msg->buf, 0, 0);
- 	if(anchor == 0)
- 	{
- 		LM_ERR("cannot get the anchor\n");
--- 
-2.9.3
-
diff --git a/debian/patches/upstream/0019-core-print-sip-message-on-error-related-to-missing-b.patch b/debian/patches/upstream/0019-core-print-sip-message-on-error-related-to-missing-b.patch
deleted file mode 100644
index 48c9f8f..0000000
--- a/debian/patches/upstream/0019-core-print-sip-message-on-error-related-to-missing-b.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From 28e622cf15b3fb220b5d02e3ad237417bdaaa66c Mon Sep 17 00:00:00 2001
-From: Daniel-Constantin Mierla <miconda at gmail.com>
-Date: Tue, 20 Sep 2016 13:43:01 +0200
-Subject: [PATCH] core: print sip message on error related to missing body
-
-(cherry picked from commit 1ed9c2712fcfaf378875bc7e478b9481013841d4)
----
- msg_translator.c | 5 +++--
- 1 file changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/msg_translator.c b/msg_translator.c
-index 9441717..7130efe 100644
---- a/msg_translator.c
-+++ b/msg_translator.c
-@@ -400,7 +400,7 @@ char* id_builder(struct sip_msg* msg, unsigned int *id_len)
- 
- 
- 
--char* clen_builder(	struct sip_msg* msg, int *clen_len, int diff, 
-+char* clen_builder(	struct sip_msg* msg, int *clen_len, int diff,
- 					int body_only)
- {
- 	char* buf;
-@@ -414,7 +414,8 @@ char* clen_builder(	struct sip_msg* msg, int *clen_len, int diff,
- 	body=get_body(msg);
- 	if (body==0){
- 		ser_error=E_BAD_REQ;
--		LM_ERR("no message body found (missing crlf?)");
-+		LM_ERR("no message body found (missing crlf?) [[%.*s]]\n",
-+				msg->len, msg->buf);
- 		return 0;
- 	}
- 	value=msg->len-(int)(body-msg->buf)+diff;
--- 
-2.9.3
-
diff --git a/debian/patches/upstream/0020-websocket-handle-CRLF-received-inside-a-frame-as-SIP.patch b/debian/patches/upstream/0020-websocket-handle-CRLF-received-inside-a-frame-as-SIP.patch
deleted file mode 100644
index a6211dc..0000000
--- a/debian/patches/upstream/0020-websocket-handle-CRLF-received-inside-a-frame-as-SIP.patch
+++ /dev/null
@@ -1,95 +0,0 @@
-From a45e9f67482e896ef83c061e3816af2ca0be5896 Mon Sep 17 00:00:00 2001
-From: Daniel-Constantin Mierla <miconda at gmail.com>
-Date: Wed, 5 Oct 2016 17:19:17 +0200
-Subject: [PATCH] websocket: handle CRLF received inside a frame (as SIP layer
- ping)
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-- reported by André Freitas, GH #810
-
-(cherry picked from commit 585c60f2cdbf4199b749f74fe795ec583ae9f99c)
----
- modules/websocket/ws_frame.c | 34 +++++++++++++++++++++++++++++++---
- 1 file changed, 31 insertions(+), 3 deletions(-)
-
-diff --git a/modules/websocket/ws_frame.c b/modules/websocket/ws_frame.c
-index 16f7901..e8653eb 100644
---- a/modules/websocket/ws_frame.c
-+++ b/modules/websocket/ws_frame.c
-@@ -136,6 +136,8 @@ static str str_status_error_closing = str_init("Error closing connection");
- static str str_status_error_sending = str_init("Error sending frame");
- static str str_status_string_error = str_init("Error converting string to int");
- 
-+static int ws_send_crlf(ws_connection_t *wsc, int opcode);
-+
- static int encode_and_send_ws_frame(ws_frame_t *frame, conn_close_t conn_close)
- {
- 	int pos = 0, extended_length;
-@@ -680,10 +682,17 @@ int ws_frame_receive(void *data)
- 	case OPCODE_BINARY_FRAME:
- 		if (likely(frame.wsc->sub_protocol == SUB_PROTOCOL_SIP))
- 		{
--			LM_DBG("Rx SIP message:\n%.*s\n", frame.payload_len,
-+			LM_DBG("Rx SIP (or text) message:\n%.*s\n", frame.payload_len,
- 				frame.payload_data);
- 			update_stat(ws_sip_received_frames, 1);
- 
-+			if(frame.payload_len==CRLF_LEN
-+					&& strncmp(frame.payload_data, CRLF, CRLF_LEN)==0)
-+			{
-+				ws_send_crlf(frame.wsc, opcode);
-+				wsconn_put(frame.wsc);
-+				return 0;
-+			}
- 			if (frame.fin)
- 			{
- 
-@@ -788,7 +797,7 @@ int ws_frame_transmit(void *data)
- 			frame.payload_data);
- 
- 	if (encode_and_send_ws_frame(&frame, CONN_CLOSE_DONT) < 0)
--	{	
-+	{
- 		LM_ERR("sending message\n");
- 
- 		wsconn_put(frame.wsc);
-@@ -813,7 +822,7 @@ static int ping_pong(ws_connection_t *wsc, int opcode)
- 	frame.wsc = wsc;
- 
- 	if (encode_and_send_ws_frame(&frame, CONN_CLOSE_DONT) < 0)
--	{	
-+	{
- 		LM_ERR("sending keepalive\n");
- 		return -1;
- 	}
-@@ -824,6 +833,25 @@ static int ping_pong(ws_connection_t *wsc, int opcode)
- 	return 0;
- }
- 
-+static int ws_send_crlf(ws_connection_t *wsc, int opcode)
-+{
-+	ws_frame_t frame;
-+
-+	memset(&frame, 0, sizeof(frame));
-+	frame.fin = 1;
-+	frame.opcode = opcode;
-+	frame.payload_len = CRLF_LEN;
-+	frame.payload_data = CRLF;
-+	frame.wsc = wsc;
-+
-+	if (encode_and_send_ws_frame(&frame, CONN_CLOSE_DONT) < 0) {
-+		LM_ERR("failed sending CRLF\n");
-+		return -1;
-+	}
-+
-+	return 0;
-+}
-+
- struct mi_root *ws_mi_close(struct mi_root *cmd, void *param)
- {
- 	unsigned int id;
--- 
-2.9.3
-
diff --git a/debian/patches/upstream/0021-presence-fix-crush-if-dialog-id-is-NULL.patch b/debian/patches/upstream/0021-presence-fix-crush-if-dialog-id-is-NULL.patch
deleted file mode 100644
index 022081f..0000000
--- a/debian/patches/upstream/0021-presence-fix-crush-if-dialog-id-is-NULL.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From 41806a15be4dfb99a2b4c708ffe521bc6ea53326 Mon Sep 17 00:00:00 2001
-From: Dmitri Savolainen <savolainen at erinaco.ru>
-Date: Fri, 7 Oct 2016 19:23:41 +0300
-Subject: [PATCH] presence: fix crush if dialog id is NULL
-
-- check dialog_id is not NULL before call delete_presentity_if_dialog_id_exists
-
-(cherry picked from commit d68d01262e59593e7976afea1b1c458815448e7a)
----
- modules/presence/presentity.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/modules/presence/presentity.c b/modules/presence/presentity.c
-index 00fdbfd..cb819cf 100644
---- a/modules/presence/presentity.c
-+++ b/modules/presence/presentity.c
-@@ -691,7 +691,7 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, str* body,
- 			}
- 
- 			check_if_dialog(*body, &is_dialog, &dialog_id);
--			if (is_dialog == 1) {
-+			if ( dialog_id ) {
- 				if (delete_presentity_if_dialog_id_exists(presentity, dialog_id) < 0) {
- 					goto error;
- 				}
--- 
-2.9.3
-
diff --git a/debian/patches/upstream/0022-core-defined-macro-for-CRLFCRLF.patch b/debian/patches/upstream/0022-core-defined-macro-for-CRLFCRLF.patch
deleted file mode 100644
index 1901135..0000000
--- a/debian/patches/upstream/0022-core-defined-macro-for-CRLFCRLF.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From 19b4c38c9612e88cb8664fd21c98d86bb78b71b6 Mon Sep 17 00:00:00 2001
-From: Daniel-Constantin Mierla <miconda at gmail.com>
-Date: Mon, 10 Oct 2016 11:40:41 +0200
-Subject: [PATCH] core: defined macro for CRLFCRLF
-
-- used in pinging over tcp, makes it more coherent to use
-
-(cherry picked from commit 6649cdf51520cfcc366f2839316c8d45c233421b)
----
- config.h | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/config.h b/config.h
-index 4083099..66ba0df 100644
---- a/config.h
-+++ b/config.h
-@@ -90,13 +90,16 @@
- #define SERVER_HDR_LEN (sizeof(SERVER_HDR)-1)
- 
- #define MAX_WARNING_LEN  256
--		
-+
- #define MY_BRANCH ";branch="
- #define MY_BRANCH_LEN (sizeof(MY_BRANCH) - 1)
- 
- #define MAX_PORT_LEN 7 /* ':' + max 5 letters + \0 */
-+
- #define CRLF "\r\n"
- #define CRLF_LEN (sizeof(CRLF) - 1)
-+#define CRLFCRLF "\r\n\r\n"
-+#define CRLFCRLF_LEN (sizeof(CRLFCRLF) - 1)
- 
- #define RECEIVED        ";received="
- #define RECEIVED_LEN (sizeof(RECEIVED) - 1)
--- 
-2.9.3
-
diff --git a/debian/patches/upstream/0023-websocket-catch-CRLFCRLF-pings-over-websocket-connec.patch b/debian/patches/upstream/0023-websocket-catch-CRLFCRLF-pings-over-websocket-connec.patch
deleted file mode 100644
index eaab238..0000000
--- a/debian/patches/upstream/0023-websocket-catch-CRLFCRLF-pings-over-websocket-connec.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From e91aec21e7f7a6f86120d1c9167b04d420369294 Mon Sep 17 00:00:00 2001
-From: Daniel-Constantin Mierla <miconda at gmail.com>
-Date: Mon, 10 Oct 2016 11:41:24 +0200
-Subject: [PATCH] websocket: catch CRLFCRLF pings over websocket connections
-
-- reported by GH #810
-
-(cherry picked from commit 8fa51e52e9cf9dbae45069c9354cfeb36997dff9)
----
- modules/websocket/ws_frame.c | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/modules/websocket/ws_frame.c b/modules/websocket/ws_frame.c
-index e8653eb..833af22 100644
---- a/modules/websocket/ws_frame.c
-+++ b/modules/websocket/ws_frame.c
-@@ -686,8 +686,10 @@ int ws_frame_receive(void *data)
- 				frame.payload_data);
- 			update_stat(ws_sip_received_frames, 1);
- 
--			if(frame.payload_len==CRLF_LEN
-+			if((frame.payload_len==CRLF_LEN
- 					&& strncmp(frame.payload_data, CRLF, CRLF_LEN)==0)
-+					|| (frame.payload_len==CRLFCRLF_LEN
-+					&& strncmp(frame.payload_data, CRLFCRLF, CRLFCRLF_LEN)==0))
- 			{
- 				ws_send_crlf(frame.wsc, opcode);
- 				wsconn_put(frame.wsc);
--- 
-2.9.3
-
diff --git a/debian/patches/upstream/0024-tmx-fix-condition-for-private-copy-of-the-message.patch b/debian/patches/upstream/0024-tmx-fix-condition-for-private-copy-of-the-message.patch
deleted file mode 100644
index 79a44ac..0000000
--- a/debian/patches/upstream/0024-tmx-fix-condition-for-private-copy-of-the-message.patch
+++ /dev/null
@@ -1,156 +0,0 @@
-From df4bba3f82b97fb9dc1b86b681060b8250a9be20 Mon Sep 17 00:00:00 2001
-From: Federico Cabiddu <federico.cabiddu at gmail.com>
-Date: Mon, 17 Oct 2016 09:50:36 +0200
-Subject: [PATCH] tmx: fix condition for private copy of the message
-
-(cherry picked from commit 6913d30ccf2ea5a818180053453ace4b482b8d30)
----
- modules/tmx/t_var.c | 46 +++++++++++++++++++++++-----------------------
- 1 file changed, 23 insertions(+), 23 deletions(-)
-
-diff --git a/modules/tmx/t_var.c b/modules/tmx/t_var.c
-index dd84314..9756d80 100644
---- a/modules/tmx/t_var.c
-+++ b/modules/tmx/t_var.c
-@@ -32,10 +32,10 @@
- #include "t_var.h"
- 
- struct _pv_tmx_data {
--	struct cell *T;
-+	unsigned int index;
-+	unsigned int label;
- 	struct sip_msg msg;
- 	struct sip_msg *tmsgp;
--	unsigned int id;
- 	char *buf;
- 	int buf_size;
- };
-@@ -99,8 +99,7 @@ int pv_t_update_req(struct sip_msg *msg)
- 	if(t->uas.request==NULL)
- 		return 1;
- 
--	if(_pv_treq.T==t && t->uas.request==_pv_treq.tmsgp
--			&& t->uas.request->id==_pv_treq.id)
-+	if (_pv_treq.label == t->label && _pv_treq.index == t->hash_index)  
- 		return 0;
- 
- 	/* make a copy */
-@@ -111,8 +110,8 @@ int pv_t_update_req(struct sip_msg *msg)
- 		if(_pv_treq.tmsgp)
- 			free_sip_msg(&_pv_treq.msg);
- 		_pv_treq.tmsgp = NULL;
--		_pv_treq.id = 0;
--		_pv_treq.T = NULL;
-+		_pv_treq.index = 0;
-+		_pv_treq.label = 0;
- 		_pv_treq.buf_size = t->uas.request->len+1;
- 		_pv_treq.buf = (char*)pkg_malloc(_pv_treq.buf_size*sizeof(char));
- 		if(_pv_treq.buf==NULL)
-@@ -130,8 +129,8 @@ int pv_t_update_req(struct sip_msg *msg)
- 	_pv_treq.msg.len = t->uas.request->len;
- 	_pv_treq.msg.buf = _pv_treq.buf;
- 	_pv_treq.tmsgp = t->uas.request;
--	_pv_treq.id = t->uas.request->id;
--	_pv_treq.T = t;
-+	_pv_treq.index = t->hash_index;
-+	_pv_treq.label = t->label;
- 
- 
- 	if(pv_t_copy_msg(t->uas.request, &_pv_treq.msg)!=0)
-@@ -140,7 +139,8 @@ int pv_t_update_req(struct sip_msg *msg)
- 		_pv_treq.buf_size = 0;
- 		_pv_treq.buf = NULL;
- 		_pv_treq.tmsgp = NULL;
--		_pv_treq.T = NULL;
-+		_pv_treq.index = 0;
-+		_pv_treq.label = 0;
- 		return -1;
- 	}
- 
-@@ -175,8 +175,7 @@ int pv_t_update_rpl(struct sip_msg *msg)
- 	if(t->uac[branch].reply==NULL || t->uac[branch].reply==FAKED_REPLY)
- 		return 1;
- 
--	if(_pv_trpl.T==t && t->uac[branch].reply==_pv_trpl.tmsgp
--			&& t->uac[branch].reply->id==_pv_trpl.id)
-+	if (_pv_trpl.label == t->label && _pv_trpl.index == t->hash_index)  
- 		return 0;
- 
- 	/* make a copy */
-@@ -187,8 +186,8 @@ int pv_t_update_rpl(struct sip_msg *msg)
- 		if(_pv_trpl.tmsgp)
- 			free_sip_msg(&_pv_trpl.msg);
- 		_pv_trpl.tmsgp = NULL;
--		_pv_trpl.id = 0;
--		_pv_trpl.T = NULL;
-+		_pv_trpl.index = 0;
-+		_pv_trpl.label = 0;
- 		_pv_trpl.buf_size = t->uac[branch].reply->len+1;
- 		_pv_trpl.buf = (char*)pkg_malloc(_pv_trpl.buf_size*sizeof(char));
- 		if(_pv_trpl.buf==NULL)
-@@ -206,8 +205,8 @@ int pv_t_update_rpl(struct sip_msg *msg)
- 	_pv_trpl.msg.len = t->uac[branch].reply->len;
- 	_pv_trpl.msg.buf = _pv_trpl.buf;
- 	_pv_trpl.tmsgp = t->uac[branch].reply;
--	_pv_trpl.id = t->uac[branch].reply->id;
--	_pv_trpl.T = t;
-+	_pv_trpl.index = t->hash_index;
-+	_pv_trpl.label = t->label;
- 
- 	if(pv_t_copy_msg(t->uac[branch].reply, &_pv_trpl.msg)!=0)
- 	{
-@@ -215,7 +214,8 @@ int pv_t_update_rpl(struct sip_msg *msg)
- 		_pv_trpl.buf_size = 0;
- 		_pv_trpl.buf = NULL;
- 		_pv_trpl.tmsgp = NULL;
--		_pv_trpl.T = NULL;
-+		_pv_trpl.index = 0;
-+		_pv_trpl.label = 0;
- 		return -1;
- 	}
- 
-@@ -241,8 +241,7 @@ int pv_t_update_inv(struct sip_msg *msg)
- 		return 1;
- 	}
- 
--	if(_pv_tinv.T==t && t->uas.request==_pv_tinv.tmsgp
--			&& t->uas.request->id==_pv_tinv.id)
-+	if (_pv_tinv.label == t->label && _pv_tinv.index == t->hash_index)  
- 		goto done;
- 
- 	/* make a copy */
-@@ -253,8 +252,8 @@ int pv_t_update_inv(struct sip_msg *msg)
- 		if(_pv_tinv.tmsgp)
- 			free_sip_msg(&_pv_tinv.msg);
- 		_pv_tinv.tmsgp = NULL;
--		_pv_tinv.id = 0;
--		_pv_tinv.T = NULL;
-+		_pv_tinv.index = 0;
-+		_pv_tinv.label = 0;
- 		_pv_tinv.buf_size = t->uas.request->len+1;
- 		_pv_tinv.buf = (char*)pkg_malloc(_pv_tinv.buf_size*sizeof(char));
- 		if(_pv_tinv.buf==NULL)
-@@ -272,8 +271,8 @@ int pv_t_update_inv(struct sip_msg *msg)
- 	_pv_tinv.msg.len = t->uas.request->len;
- 	_pv_tinv.msg.buf = _pv_tinv.buf;
- 	_pv_tinv.tmsgp = t->uas.request;
--	_pv_tinv.id = t->uas.request->id;
--	_pv_tinv.T = t;
-+	_pv_tinv.index = t->hash_index;
-+	_pv_tinv.label = t->label;
- 
- 
- 	if(pv_t_copy_msg(t->uas.request, &_pv_tinv.msg)!=0)
-@@ -282,7 +281,8 @@ int pv_t_update_inv(struct sip_msg *msg)
- 		_pv_tinv.buf_size = 0;
- 		_pv_tinv.buf = NULL;
- 		_pv_tinv.tmsgp = NULL;
--		_pv_tinv.T = NULL;
-+		_pv_tinv.index = 0;
-+		_pv_tinv.label = 0;
- 		goto error;
- 	}
- 
--- 
-2.9.3
-
diff --git a/debian/patches/upstream/0025-modules-tmx-fix-mi-command-t_uac_cancel.patch b/debian/patches/upstream/0025-modules-tmx-fix-mi-command-t_uac_cancel.patch
deleted file mode 100644
index 4a1177d..0000000
--- a/debian/patches/upstream/0025-modules-tmx-fix-mi-command-t_uac_cancel.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From 0cd00fc0c84b1d3d80fff9ae809835057bbe6a4e Mon Sep 17 00:00:00 2001
-From: Federico Cabiddu <federico.cabiddu at gmail.com>
-Date: Wed, 19 Oct 2016 11:31:54 +0200
-Subject: [PATCH] modules/tmx: fix mi command t_uac_cancel
-
-(cherry picked from commit 81be737f29cbb9e4fd67a09cf2207150b2649e91)
----
- modules/tmx/t_mi.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/modules/tmx/t_mi.c b/modules/tmx/t_mi.c
-index 485b160..beab1c5 100644
---- a/modules/tmx/t_mi.c
-+++ b/modules/tmx/t_mi.c
-@@ -641,6 +641,7 @@ struct mi_root* mi_tm_cancel(struct mi_root* cmd_tree, void* param)
- 
- 	init_cancel_info(&cancel_data);
- 	cancel_data.cancel_bitmap = ~0; /*all branches*/
-+	_tmx_tmb.prepare_to_cancel(trans, &cancel_data.cancel_bitmap, 0);
- 	_tmx_tmb.cancel_uacs(trans, &cancel_data, 0);
- 
- 	_tmx_tmb.unref_cell(trans);
--- 
-2.9.3
-
diff --git a/debian/patches/upstream/0026-auth_identity-switched-to-use-pointer-of-X509_STORE_.patch b/debian/patches/upstream/0026-auth_identity-switched-to-use-pointer-of-X509_STORE_.patch
deleted file mode 100644
index afc9391..0000000
--- a/debian/patches/upstream/0026-auth_identity-switched-to-use-pointer-of-X509_STORE_.patch
+++ /dev/null
@@ -1,79 +0,0 @@
-From 0f2a129e4f1790f8d6502ac224b480d60126fb09 Mon Sep 17 00:00:00 2001
-From: Daniel-Constantin Mierla <miconda at gmail.com>
-Date: Thu, 15 Sep 2016 16:30:30 +0200
-Subject: [PATCH] auth_identity: switched to use pointer of X509_STORE_CTX
-
-- starting with libssl 1.1.0 the size of X509_STORE_CTX is not known at
-  compile time, throwing error:
-
-error: storage size of 'ca_ctx' isn't known
-   X509_STORE_CTX ca_ctx;
-
-- reported by Victor Seva, GH #685
-
-(cherry picked from commit 46f0f1c0f492c45c1b1bbcfd4a0cc63eb56480ea)
----
- modules/auth_identity/auth_crypt.c | 23 ++++++++++++++++-------
- 1 file changed, 16 insertions(+), 7 deletions(-)
-
-diff --git a/modules/auth_identity/auth_crypt.c b/modules/auth_identity/auth_crypt.c
-index de5b03d..dbb0957 100644
---- a/modules/auth_identity/auth_crypt.c
-+++ b/modules/auth_identity/auth_crypt.c
-@@ -37,6 +37,7 @@
- #include <openssl/sha.h>
- #include <openssl/x509.h>
- #include <openssl/x509v3.h>
-+#include <openssl/crypto.h>
- #include <openssl/x509_vfy.h>
- 
- #include "../../mem/mem.h"
-@@ -115,7 +116,7 @@ int check_x509_subj(X509 *pcert, str* sdom)
- 
- 			if (actname->type == GEN_DNS || actname->type == GEN_URI) {
- 				/* we've found one */
--				altptr = (char *)ASN1_STRING_data(actname->d.ia5);
-+				altptr = (char *)ASN1_STRING_get0_data(actname->d.ia5);
- 				if (actname->type == GEN_URI) {
- 					if (parse_uri(altptr, strlen(altptr), &suri) != 0) {
- 						continue;
-@@ -163,22 +164,30 @@ int check_x509_subj(X509 *pcert, str* sdom)
- 
- int verify_x509(X509 *pcert, X509_STORE *pcacerts)
- {
--	X509_STORE_CTX ca_ctx;
-+	X509_STORE_CTX *ca_ctx = NULL;
- 	char *strerr;
- 
-+	ca_ctx = X509_STORE_CTX_new();
-+	if(ca_ctx==NULL) {
-+		LM_ERR("cannot get a x509 context\n");
-+		return -1;
-+	}
- 
--	if (X509_STORE_CTX_init(&ca_ctx, pcacerts, pcert, NULL) != 1) {
-+	if (X509_STORE_CTX_init(ca_ctx, pcacerts, pcert, NULL) != 1) {
- 		LOG(L_ERR, "AUTH_IDENTITY:verify_x509: Unable to init X509 store ctx\n");
-+		X509_STORE_CTX_free(ca_ctx);
- 		return -1;
- 	}
- 
--	if (X509_verify_cert(&ca_ctx) != 1) {
--		strerr = (char *) X509_verify_cert_error_string(ca_ctx.error);
-+	if (X509_verify_cert(ca_ctx) != 1) {
-+		strerr = (char *)X509_verify_cert_error_string(X509_STORE_CTX_get_error(ca_ctx));
- 		LOG(L_ERR, "AUTH_IDENTITY VERIFIER: Certificate verification error: %s\n", strerr);
--		X509_STORE_CTX_cleanup(&ca_ctx);
-+		X509_STORE_CTX_cleanup(ca_ctx);
-+		X509_STORE_CTX_free(ca_ctx);
- 		return -2;
- 	}
--	X509_STORE_CTX_cleanup(&ca_ctx);
-+	X509_STORE_CTX_cleanup(ca_ctx);
-+	X509_STORE_CTX_free(ca_ctx);
- 
- 	LOG(AUTH_DBG_LEVEL, "AUTH_IDENTITY VERIFIER: Certificate is valid\n");
- 
--- 
-2.9.3
-
diff --git a/debian/patches/upstream/0027-auth_identity-still-use-ASN1_STRING_data-for-libssl-.patch b/debian/patches/upstream/0027-auth_identity-still-use-ASN1_STRING_data-for-libssl-.patch
deleted file mode 100644
index d92fb84..0000000
--- a/debian/patches/upstream/0027-auth_identity-still-use-ASN1_STRING_data-for-libssl-.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From b29217e8036ead0d09c52616000d6b68d4512f86 Mon Sep 17 00:00:00 2001
-From: Daniel-Constantin Mierla <miconda at gmail.com>
-Date: Thu, 15 Sep 2016 19:33:04 +0200
-Subject: [PATCH] auth_identity: still use ASN1_STRING_data() for libssl <
- v1.1.0
-
-- from libssl v1.1.0, ASN1_STRING_data() is deprecated, but before it
-  doesn't exist
-- reported by Victor Seva, GH #685
-
-(cherry picked from commit 8a46f415fb13b76fa3b071eecd7dc0401f99759e)
----
- modules/auth_identity/auth_crypt.c | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/modules/auth_identity/auth_crypt.c b/modules/auth_identity/auth_crypt.c
-index dbb0957..f9b40e6 100644
---- a/modules/auth_identity/auth_crypt.c
-+++ b/modules/auth_identity/auth_crypt.c
-@@ -116,7 +116,11 @@ int check_x509_subj(X509 *pcert, str* sdom)
- 
- 			if (actname->type == GEN_DNS || actname->type == GEN_URI) {
- 				/* we've found one */
-+#if OPENSSL_VERSION_NUMBER >= 0x010100000L
- 				altptr = (char *)ASN1_STRING_get0_data(actname->d.ia5);
-+#else
-+				altptr = (char *)ASN1_STRING_data(actname->d.ia5);
-+#endif
- 				if (actname->type == GEN_URI) {
- 					if (parse_uri(altptr, strlen(altptr), &suri) != 0) {
- 						continue;
--- 
-2.9.3
-
diff --git a/debian/patches/upstream/0028-crypto-updated-to-be-compatible-with-api-from-libssl.patch b/debian/patches/upstream/0028-crypto-updated-to-be-compatible-with-api-from-libssl.patch
deleted file mode 100644
index a347af6..0000000
--- a/debian/patches/upstream/0028-crypto-updated-to-be-compatible-with-api-from-libssl.patch
+++ /dev/null
@@ -1,193 +0,0 @@
-From f97df2e6d4b9c721c97bcbd3b5930530604a127a Mon Sep 17 00:00:00 2001
-From: Daniel-Constantin Mierla <miconda at gmail.com>
-Date: Fri, 16 Sep 2016 12:49:50 +0200
-Subject: [PATCH] crypto: updated to be compatible with api from libssl v1.1.0
-
-(cherry picked from commit 8d83571658471f162e35cb54ba7e3baecbe7970d)
----
- modules/crypto/crypto_mod.c | 63 ++++++++++++++++++++++++++++++++++-----------
- 1 file changed, 48 insertions(+), 15 deletions(-)
-
-diff --git a/modules/crypto/crypto_mod.c b/modules/crypto/crypto_mod.c
-index fe16b6d..54319ee 100644
---- a/modules/crypto/crypto_mod.c
-+++ b/modules/crypto/crypto_mod.c
-@@ -158,7 +158,7 @@ static int w_crypto_aes_encrypt(sip_msg_t* msg, char* inb, char* keyb, char* out
- 	str keys;
- 	pv_spec_t *dst;
- 	pv_value_t val;
--	EVP_CIPHER_CTX en;
-+	EVP_CIPHER_CTX *en = NULL;
- 	str etext;
- 
- 	if (fixup_get_svalue(msg, (gparam_t*)inb, &ins) != 0) {
-@@ -169,17 +169,24 @@ static int w_crypto_aes_encrypt(sip_msg_t* msg, char* inb, char* keyb, char* out
- 		LM_ERR("cannot get key value\n");
- 		return -1;
- 	}
-+	en = EVP_CIPHER_CTX_new();
-+	if(en==NULL) {
-+		LM_ERR("cannot get new cipher context\n");
-+		return -1;
-+	}
- 	dst = (pv_spec_t*)outb;
- 
- 	/* gen key and iv. init the cipher ctx object */
- 	if (crypto_aes_init((unsigned char *)keys.s, keys.len,
--				(unsigned char*)((_crypto_salt_param)?_crypto_salt:0), &en, NULL)) {
-+				(unsigned char*)((_crypto_salt_param)?_crypto_salt:0), en, NULL)) {
-+		EVP_CIPHER_CTX_free(en);
- 		LM_ERR("couldn't initialize AES cipher\n");
- 		return -1;
- 	}
- 	etext.len = ins.len;
--	etext.s = (char *)crypto_aes_encrypt(&en, (unsigned char *)ins.s, &etext.len);
-+	etext.s = (char *)crypto_aes_encrypt(en, (unsigned char *)ins.s, &etext.len);
- 	if(etext.s==NULL) {
-+		EVP_CIPHER_CTX_free(en);
- 		LM_ERR("AES encryption failed\n");
- 		return -1;
- 	}
-@@ -189,6 +196,7 @@ static int w_crypto_aes_encrypt(sip_msg_t* msg, char* inb, char* keyb, char* out
- 	val.rs.len = base64_enc((unsigned char *)etext.s, etext.len,
- 					(unsigned char *)val.rs.s, pv_get_buffer_size()-1);
- 	if (val.rs.len < 0) {
-+		EVP_CIPHER_CTX_free(en);
- 		LM_ERR("base64 output of encrypted value is too large (need %d)\n",
- 				-val.rs.len);
- 		goto error;
-@@ -198,12 +206,14 @@ static int w_crypto_aes_encrypt(sip_msg_t* msg, char* inb, char* keyb, char* out
- 	dst->setf(msg, &dst->pvp, (int)EQ_T, &val);
- 
- 	free(etext.s);
--	EVP_CIPHER_CTX_cleanup(&en);
-+	EVP_CIPHER_CTX_cleanup(en);
-+	EVP_CIPHER_CTX_free(en);
- 	return 1;
- 
- error:
- 	free(etext.s);
--	EVP_CIPHER_CTX_cleanup(&en);
-+	EVP_CIPHER_CTX_cleanup(en);
-+	EVP_CIPHER_CTX_free(en);
- 	return -1;
- }
- 
-@@ -238,7 +248,7 @@ static int w_crypto_aes_decrypt(sip_msg_t* msg, char* inb, char* keyb, char* out
- 	str keys;
- 	pv_spec_t *dst;
- 	pv_value_t val;
--	EVP_CIPHER_CTX de;
-+	EVP_CIPHER_CTX *de=NULL;
- 	str etext;
- 
- 	if (fixup_get_svalue(msg, (gparam_t*)inb, &ins) != 0) {
-@@ -249,11 +259,17 @@ static int w_crypto_aes_decrypt(sip_msg_t* msg, char* inb, char* keyb, char* out
- 		LM_ERR("cannot get key value\n");
- 		return -1;
- 	}
-+	de = EVP_CIPHER_CTX_new();
-+	if(de==NULL) {
-+		LM_ERR("cannot get new cipher context\n");
-+		return -1;
-+	}
- 	dst = (pv_spec_t*)outb;
- 
- 	/* gen key and iv. init the cipher ctx object */
- 	if (crypto_aes_init((unsigned char *)keys.s, keys.len,
--				(unsigned char*)((_crypto_salt_param)?_crypto_salt:0), NULL, &de)) {
-+				(unsigned char*)((_crypto_salt_param)?_crypto_salt:0), NULL, de)) {
-+		EVP_CIPHER_CTX_free(de);
- 		LM_ERR("couldn't initialize AES cipher\n");
- 		return -1;
- 	}
-@@ -263,14 +279,16 @@ static int w_crypto_aes_decrypt(sip_msg_t* msg, char* inb, char* keyb, char* out
- 	etext.len = base64_dec((unsigned char *)ins.s, ins.len,
- 					(unsigned char *)etext.s, pv_get_buffer_size()-1);
- 	if (etext.len < 0) {
-+		EVP_CIPHER_CTX_free(de);
- 		LM_ERR("base64 inpuy with encrypted value is too large (need %d)\n",
- 				-etext.len);
- 		return -1;
- 	}
- 	val.rs.len = etext.len;
--	val.rs.s = (char *)crypto_aes_decrypt(&de, (unsigned char *)etext.s,
-+	val.rs.s = (char *)crypto_aes_decrypt(de, (unsigned char *)etext.s,
- 			&val.rs.len);
- 	if(val.rs.s==NULL) {
-+		EVP_CIPHER_CTX_free(de);
- 		LM_ERR("AES decryption failed\n");
- 		return -1;
- 	}
-@@ -279,7 +297,8 @@ static int w_crypto_aes_decrypt(sip_msg_t* msg, char* inb, char* keyb, char* out
- 	dst->setf(msg, &dst->pvp, (int)EQ_T, &val);
- 
- 	free(val.rs.s);
--	EVP_CIPHER_CTX_cleanup(&de);
-+	EVP_CIPHER_CTX_cleanup(de);
-+	EVP_CIPHER_CTX_free(de);
- 	return 1;
- }
- 
-@@ -433,7 +452,8 @@ int crypto_aes_test(void)
- {
- 	/* "opaque" encryption, decryption ctx structures
- 	 * that libcrypto uses to record status of enc/dec operations */
--	EVP_CIPHER_CTX en, de;
-+	EVP_CIPHER_CTX *en = NULL;
-+	EVP_CIPHER_CTX *de = NULL;
- 
- 
- 	/* The salt paramter is used as a salt in the derivation:
-@@ -448,12 +468,23 @@ int crypto_aes_test(void)
- 		NULL
- 	};
- 
-+	en = EVP_CIPHER_CTX_new();
-+	if(en==NULL) {
-+		LM_ERR("cannot get new cipher context\n");
-+		return -1;
-+	}
-+	de = EVP_CIPHER_CTX_new();
-+	if(de==NULL) {
-+		EVP_CIPHER_CTX_free(en);
-+		LM_ERR("cannot get new cipher context\n");
-+		return -1;
-+	}
- 	/* the key_data for testing */
- 	key_data = (unsigned char *)"kamailio-sip-server";
- 	key_data_len = strlen((const char *)key_data);
- 
- 	/* gen key and iv. init the cipher ctx object */
--	if (crypto_aes_init(key_data, key_data_len, salt, &en, &de)) {
-+	if (crypto_aes_init(key_data, key_data_len, salt, en, de)) {
- 		LM_ERR("couldn't initialize AES cipher\n");
- 		return -1;
- 	}
-@@ -471,8 +502,8 @@ int crypto_aes_test(void)
- 		 * a legal C string */
- 		olen = len = strlen(input[i])+1;
- 
--		ciphertext = crypto_aes_encrypt(&en, (unsigned char *)input[i], &len);
--		plaintext = (char *)crypto_aes_decrypt(&de, ciphertext, &len);
-+		ciphertext = crypto_aes_encrypt(en, (unsigned char *)input[i], &len);
-+		plaintext = (char *)crypto_aes_decrypt(de, ciphertext, &len);
- 
- 		if (strncmp(plaintext, input[i], olen))
- 			LM_ERR("FAIL: enc/dec failed for \"%s\"\n", input[i]);
-@@ -483,8 +514,10 @@ int crypto_aes_test(void)
- 		free(plaintext);
- 	}
- 
--	EVP_CIPHER_CTX_cleanup(&de);
--	EVP_CIPHER_CTX_cleanup(&en);
-+	EVP_CIPHER_CTX_cleanup(de);
-+	EVP_CIPHER_CTX_free(de);
-+	EVP_CIPHER_CTX_cleanup(en);
-+	EVP_CIPHER_CTX_free(en);
- 
- 	return 0;
- }
--- 
-2.9.3
-
diff --git a/debian/patches/upstream/0029-tls-updates-for-compatibilty-with-libssl-v1.1.0-api.patch b/debian/patches/upstream/0029-tls-updates-for-compatibilty-with-libssl-v1.1.0-api.patch
deleted file mode 100644
index e5711e1..0000000
--- a/debian/patches/upstream/0029-tls-updates-for-compatibilty-with-libssl-v1.1.0-api.patch
+++ /dev/null
@@ -1,398 +0,0 @@
-From 58daa3156bd4d22fa18ca00c99a99c426eeb76b1 Mon Sep 17 00:00:00 2001
-From: Daniel-Constantin Mierla <miconda at gmail.com>
-Date: Fri, 16 Sep 2016 14:26:10 +0200
-Subject: [PATCH] tls: updates for compatibilty with libssl v1.1.0 api
-
-(cherry picked from commit ef021552162e281c694a4f4b420aa1c642db5066)
----
- modules/tls/tls_bio.c    | 28 ++++++++++++++++++++++++++--
- modules/tls/tls_domain.c | 44 ++++++++++++++++++++++++++++++--------------
- modules/tls/tls_init.c   | 33 +++++++++++++++++++++++++++++++++
- modules/tls/tls_server.c |  2 ++
- modules/tls/tls_verify.c | 45 ++++++++++++++++++++++++++-------------------
- 5 files changed, 117 insertions(+), 35 deletions(-)
-
-diff --git a/modules/tls/tls_bio.c b/modules/tls/tls_bio.c
-index aee1953..d2c2107 100644
---- a/modules/tls/tls_bio.c
-+++ b/modules/tls/tls_bio.c
-@@ -63,6 +63,7 @@ static int tls_bio_mbuf_puts(BIO* b, const char* s);
- static long tls_bio_mbuf_ctrl(BIO* b, int cmd, long arg1, void* arg2);
- 
- 
-+#if OPENSSL_VERSION_NUMBER < 0x010100000L
- static BIO_METHOD tls_mbuf_method = {
- 	BIO_TYPE_TLS_MBUF,	/* type */
- 	"sr_tls_mbuf",		/* name */
-@@ -75,12 +76,35 @@ static BIO_METHOD tls_mbuf_method = {
- 	tls_bio_mbuf_free,	/* destroy(free) function */
- 	0					/* ctrl callback */
- };
-+#else
-+static BIO_METHOD *tls_mbuf_method = NULL;
-+#endif
- 
- 
- /** returns a custom tls_mbuf BIO. */
- BIO_METHOD* tls_BIO_mbuf(void)
- {
-+#if OPENSSL_VERSION_NUMBER < 0x010100000L
- 	return &tls_mbuf_method;
-+#else
-+	if(tls_mbuf_method != NULL) {
-+		return tls_mbuf_method;
-+	}
-+	tls_mbuf_method = BIO_meth_new(BIO_TYPE_TLS_MBUF, "sr_tls_mbuf");
-+	if(tls_mbuf_method==NULL) {
-+		LM_ERR("cannot get a new bio method structure\n");
-+		return NULL;
-+	}
-+	BIO_meth_set_write(tls_mbuf_method, tls_bio_mbuf_write);
-+	BIO_meth_set_read(tls_mbuf_method, tls_bio_mbuf_read);
-+	BIO_meth_set_puts(tls_mbuf_method, tls_bio_mbuf_puts);
-+	BIO_meth_set_gets(tls_mbuf_method, NULL);
-+	BIO_meth_set_ctrl(tls_mbuf_method, tls_bio_mbuf_ctrl);
-+	BIO_meth_set_create(tls_mbuf_method, tls_bio_mbuf_new);
-+	BIO_meth_set_destroy(tls_mbuf_method, tls_bio_mbuf_free);
-+	BIO_meth_set_callback_ctrl(tls_mbuf_method, NULL);
-+	return tls_mbuf_method;
-+#endif
- }
- 
- 
-@@ -91,7 +115,7 @@ BIO_METHOD* tls_BIO_mbuf(void)
- BIO* tls_BIO_new_mbuf(struct tls_mbuf* rd, struct tls_mbuf* wr)
- {
- 	BIO* ret;
--	
-+
- 	TLS_BIO_DBG("tls_BIO_new_mbuf called (%p, %p)\n", rd, wr);
- 	ret = BIO_new(tls_BIO_mbuf());
- 	if (unlikely(ret == 0))
-@@ -111,7 +135,7 @@ BIO* tls_BIO_new_mbuf(struct tls_mbuf* rd, struct tls_mbuf* wr)
- int tls_BIO_mbuf_set(BIO* b, struct tls_mbuf* rd, struct tls_mbuf* wr)
- {
- 	struct tls_bio_mbuf_data* d;
--	
-+
- 	TLS_BIO_DBG("tls_BIO_mbuf_set called (%p => %p, %p)\n", b, rd, wr);
- 	if (unlikely(b->ptr == 0)){
- 		BUG("null BIO ptr\n");
-diff --git a/modules/tls/tls_domain.c b/modules/tls/tls_domain.c
-index e64e8bd..bf8d0f2 100644
---- a/modules/tls/tls_domain.c
-+++ b/modules/tls/tls_domain.c
-@@ -107,19 +107,31 @@ static unsigned char dh3072_g[] = { 0x02 };
- 
- static void setup_dh(SSL_CTX *ctx)
- {
--   DH *dh;
-+	DH *dh;
-+	BIGNUM *p;
-+	BIGNUM *g;
- 
--   dh = DH_new();
--   if (dh == NULL) {
--      return;
--   }
-+	dh = DH_new();
-+	if (dh == NULL) {
-+		return;
-+	}
-+
-+	p = BN_bin2bn(dh3072_p, sizeof(dh3072_p), NULL);
-+	g = BN_bin2bn(dh3072_g, sizeof(dh3072_g), NULL);
-+
-+	if (p == NULL || g == NULL) {
-+		DH_free(dh);
-+		return;
-+	}
-+
-+#if (OPENSSL_VERSION_NUMBER >= 0x1010000fL)
-+	/* libssl >= v1.1.0 */
-+	DH_set0_pqg(dh, p, NULL, g);
-+#else
-+	dh->p = p;
-+	dh->g = g;
-+#endif
- 
--   dh->p = BN_bin2bn(dh3072_p, sizeof(dh3072_p), NULL);
--   dh->g = BN_bin2bn(dh3072_g, sizeof(dh3072_g), NULL);
--   if (dh->p == NULL || dh->g == NULL) {
--      DH_free(dh);
--      return;
--   }
- 
-    SSL_CTX_set_options(ctx, SSL_OP_SINGLE_DH_USE);
-    SSL_CTX_set_tmp_dh(ctx, dh);
-@@ -713,11 +725,13 @@ static void sr_ssl_ctx_info_callback(const SSL *ssl, int event, int ret)
- 		if(data==0)
- 			data = (struct tls_extra_data*)SSL_get_app_data(ssl);
- 		LOG(tls_dbg, "SSL handshake done\n");
-+#if OPENSSL_VERSION_NUMBER < 0x010100000L
- 		/* CVE-2009-3555 - disable renegotiation */
- 		if (ssl->s3) {
- 			LOG(tls_dbg, "SSL disable renegotiation\n");
- 			ssl->s3->flags |= SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS;
- 		}
-+#endif
- 		data->flags |= F_TLS_CON_HANDSHAKED;
- 	}
- }
-@@ -835,6 +849,7 @@ static int tls_ssl_ctx_mode(SSL_CTX* ctx, long mode, void* clear)
-  */
- static int tls_ssl_ctx_set_freelist(SSL_CTX* ctx, long val, void* unused)
- {
-+#if OPENSSL_VERSION_NUMBER < 0x010100000L
- 	if (val >= 0)
- #if OPENSSL_VERSION_NUMBER >= 0x01000000L
- #ifndef OPENSSL_NO_BUF_FREELISTS
-@@ -844,6 +859,7 @@ static int tls_ssl_ctx_set_freelist(SSL_CTX* ctx, long val, void* unused)
- #if defined (OPENSSL_NO_BUF_FREELISTS) || OPENSSL_VERSION_NUMBER < 0x01000000L
- 		return -1;
- #endif
-+#endif
- 	return 0;
- }
- 
-@@ -927,7 +943,7 @@ static int tls_server_name_cb(SSL *ssl, int *ad, void *private)
- 	/* SSL_set_SSL_CTX only sets the correct certificate parameters, but does
- 	   set the proper verify options. Thus this will be done manually! */
- 
--	SSL_set_options(ssl, SSL_CTX_get_options(ssl->ctx));
-+	SSL_set_options(ssl, SSL_CTX_get_options(SSL_get_SSL_CTX(ssl)));
- 	if ((SSL_get_verify_mode(ssl) == SSL_VERIFY_NONE) ||
- 				(SSL_num_renegotiations(ssl) == 0)) {
- 		/*
-@@ -937,8 +953,8 @@ static int tls_server_name_cb(SSL *ssl, int *ad, void *private)
- 		 * Otherwise, we would possibly reset a per-directory
- 		 * configuration which was put into effect by ssl_hook_access.
- 		 */
--		SSL_set_verify(ssl, SSL_CTX_get_verify_mode(ssl->ctx),
--			SSL_CTX_get_verify_callback(ssl->ctx));
-+		SSL_set_verify(ssl, SSL_CTX_get_verify_mode(SSL_get_SSL_CTX(ssl)),
-+			SSL_CTX_get_verify_callback(SSL_get_SSL_CTX(ssl)));
- 	}
- 
- 	return SSL_TLSEXT_ERR_OK;
-diff --git a/modules/tls/tls_init.c b/modules/tls/tls_init.c
-index ece8863..af2d4c5 100644
---- a/modules/tls/tls_init.c
-+++ b/modules/tls/tls_init.c
-@@ -269,6 +269,7 @@ static void* ser_realloc(void *ptr, size_t size, const char* file, int line)
- 
- #else /*TLS_MALLOC_DBG */
- 
-+#if OPENSSL_VERSION_NUMBER < 0x010100000L
- static void* ser_malloc(size_t size)
- {
- 	return shm_malloc(size);
-@@ -279,9 +280,22 @@ static void* ser_realloc(void *ptr, size_t size)
- {
- 		return shm_realloc(ptr, size);
- }
-+#else
-+static void* ser_malloc(size_t size, const char *fname, int fline)
-+{
-+	return shm_malloc(size);
-+}
-+
- 
-+static void* ser_realloc(void *ptr, size_t size, const char *fname, int fline)
-+{
-+		return shm_realloc(ptr, size);
-+}
- #endif
- 
-+#endif
-+
-+#if OPENSSL_VERSION_NUMBER < 0x010100000L
- static void ser_free(void *ptr)
- {
- 	/* The memory functions provided to openssl needs to behave like standard
-@@ -294,6 +308,14 @@ static void ser_free(void *ptr)
- 		shm_free(ptr);
- 	}
- }
-+#else
-+static void ser_free(void *ptr, const char *fname, int fline)
-+{
-+	if (ptr) {
-+		shm_free(ptr);
-+	}
-+}
-+#endif
- 
- 
- /*
-@@ -338,11 +360,13 @@ static void init_ssl_methods(void)
- 	ssl_methods[TLS_USE_SSLv23 - 1] = SSLv23_method();
- 
- 	/* only specific SSL or TLS version */
-+#if OPENSSL_VERSION_NUMBER < 0x010100000L
- #ifndef OPENSSL_NO_SSL2
- 	ssl_methods[TLS_USE_SSLv2_cli - 1] = SSLv2_client_method();
- 	ssl_methods[TLS_USE_SSLv2_srv - 1] = SSLv2_server_method();
- 	ssl_methods[TLS_USE_SSLv2 - 1] = SSLv2_method();
- #endif
-+#endif
- 
- #ifndef OPENSSL_NO_SSL3_METHOD
- 	ssl_methods[TLS_USE_SSLv3_cli - 1] = SSLv3_client_method();
-@@ -384,6 +408,7 @@ static void init_ssl_methods(void)
-  */
- static int init_tls_compression(void)
- {
-+#if OPENSSL_VERSION_NUMBER < 0x010100000L
- #if OPENSSL_VERSION_NUMBER >= 0x00908000L
- 	int n, r;
- 	STACK_OF(SSL_COMP)* comp_methods;
-@@ -468,6 +493,7 @@ static int init_tls_compression(void)
- 	}
- end:
- #endif /* OPENSSL_VERSION_NUMBER >= 0.9.8 */
-+#endif /* OPENSSL_VERSION_NUMBER < 1.1.0 */
- 	return 0;
- }
- 
-@@ -478,9 +504,16 @@ end:
-  */
- int tls_pre_init(void)
- {
-+#if OPENSSL_VERSION_NUMBER < 0x010100000L
- 	void *(*mf)(size_t) = NULL;
- 	void *(*rf)(void *, size_t) = NULL;
- 	void (*ff)(void *) = NULL;
-+#else
-+	void *(*mf)(size_t, const char *, int) = NULL;
-+	void *(*rf)(void *, size_t, const char *, int) = NULL;
-+	void (*ff)(void *, const char *, int) = NULL;
-+#endif
-+
- 	/*
- 	 * this has to be called before any function calling CRYPTO_malloc,
- 	 * CRYPTO_malloc will set allow_customize in openssl to 0
-diff --git a/modules/tls/tls_server.c b/modules/tls/tls_server.c
-index 880fae2..20faa4f 100644
---- a/modules/tls/tls_server.c
-+++ b/modules/tls/tls_server.c
-@@ -258,6 +258,7 @@ static int tls_complete_init(struct tcp_connection* c)
- 	}
- #endif
- 
-+#if OPENSSL_VERSION_NUMBER < 0x010100000L
- #ifdef TLS_KSSL_WORKARROUND
- 	 /* if needed apply workaround for openssl bug #1467 */
- 	if (data->ssl->kssl_ctx && openssl_kssl_malloc_bug){
-@@ -265,6 +266,7 @@ static int tls_complete_init(struct tcp_connection* c)
- 		data->ssl->kssl_ctx=0;
- 	}
- #endif
-+#endif
- 	SSL_set_bio(data->ssl, data->rwbio, data->rwbio);
- 	c->extra_data = data;
- 
-diff --git a/modules/tls/tls_verify.c b/modules/tls/tls_verify.c
-index 728006d..1da392a 100644
---- a/modules/tls/tls_verify.c
-+++ b/modules/tls/tls_verify.c
-@@ -30,7 +30,7 @@
- /* FIXME: remove this and use the value in domains instead */
- #define VERIFY_DEPTH_S 3
- 
--/* This callback is called during each verification process, 
-+/* This callback is called during each verification process,
- at each step during the chain of certificates (this function
- is not the certificate_verification one!). */
- int verify_callback(int pre_verify_ok, X509_STORE_CTX *ctx) {
-@@ -44,49 +44,54 @@ int verify_callback(int pre_verify_ok, X509_STORE_CTX *ctx) {
- 		LOG(L_NOTICE, "tls_init: verify_callback: cert chain too long ( depth > VERIFY_DEPTH_S)\n");
- 		pre_verify_ok=0;
- 	}
--	
-+
- 	if( pre_verify_ok ) {
- 		LOG(L_NOTICE, "tls_init: verify_callback: preverify is good: verify return: %d\n", pre_verify_ok);
- 		return pre_verify_ok;
- 	}
--	
-+
- 	err_cert = X509_STORE_CTX_get_current_cert(ctx);
--	err = X509_STORE_CTX_get_error(ctx);	
-+	err = X509_STORE_CTX_get_error(ctx);
- 	X509_NAME_oneline(X509_get_subject_name(err_cert),buf,sizeof buf);
--	
-+
- 	LOG(L_NOTICE, "tls_init: verify_callback: subject = %s\n", buf);
--	LOG(L_NOTICE, "tls_init: verify_callback: verify error:num=%d:%s\n", err, X509_verify_cert_error_string(err));	
--	LOG(L_NOTICE, "tls_init: verify_callback: error code is %d\n", ctx->error);
--	
--	switch (ctx->error) {
-+	LOG(L_NOTICE, "tls_init: verify_callback: verify error - num=%d:%s\n", err,
-+			X509_verify_cert_error_string(err));
-+	LOG(L_NOTICE, "tls_init: verify_callback: error code is %d (depth: %d)\n",
-+			err, depth);
-+
-+	switch (err) {
-+		case X509_V_OK:
-+			LOG(L_NOTICE, "tls_init: verify_callback: all ok\n");
-+			break;
- 		case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT:
--			X509_NAME_oneline(X509_get_issuer_name(ctx->current_cert),buf,sizeof buf);
-+			X509_NAME_oneline(X509_get_issuer_name(err_cert),buf,sizeof buf);
- 			LOG(L_NOTICE, "tls_init: verify_callback: issuer= %s\n",buf);
- 			break;
--			
-+
- 		case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD:
- 		case X509_V_ERR_CERT_NOT_YET_VALID:
- 			LOG(L_NOTICE, "tls_init: verify_callback: notBefore\n");
- 			break;
--		
-+
- 		case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD:
- 		case X509_V_ERR_CERT_HAS_EXPIRED:
- 			LOG(L_NOTICE, "tls_init: verify_callback: notAfter\n");
- 			break;
--			
-+
- 		case X509_V_ERR_CERT_SIGNATURE_FAILURE:
- 		case X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE:
- 			LOG(L_NOTICE, "tls_init: verify_callback: unable to decrypt cert signature\n");
- 			break;
--			
-+
- 		case X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY:
- 			LOG(L_NOTICE, "tls_init: verify_callback: unable to decode issuer public key\n");
- 			break;
--			
-+
- 		case X509_V_ERR_OUT_OF_MEM:
- 			ERR("tls_init: verify_callback: Out of memory \n");
- 			break;
--			
-+
- 		case X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT:
- 		case X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN:
- 			LOG(L_NOTICE, "tls_init: verify_callback: Self signed certificate issue\n");
-@@ -110,12 +115,14 @@ int verify_callback(int pre_verify_ok, X509_STORE_CTX *ctx) {
- 		case X509_V_ERR_CERT_REJECTED:
- 			LOG(L_NOTICE, "tls_init: verify_callback: certificate rejected\n");
- 			break;
--		
-+
- 		default:
--			LOG(L_NOTICE, "tls_init: verify_callback: something wrong with the cert ... error code is %d (check x509_vfy.h)\n", ctx->error);
-+			LOG(L_NOTICE, "tls_init: verify_callback: something wrong with the"
-+					" cert ... error code is %d (check x509_vfy.h)\n",
-+					err);
- 			break;
- 	}
--	
-+
- 	LOG(L_NOTICE, "tls_init: verify_callback: verify return:%d\n", pre_verify_ok);
- 	return(pre_verify_ok);
- }
--- 
-2.9.3
-
diff --git a/debian/patches/upstream/0030-tls-updated-bio-functions-to-support-libssl-v1.1.0-a.patch b/debian/patches/upstream/0030-tls-updated-bio-functions-to-support-libssl-v1.1.0-a.patch
deleted file mode 100644
index 6a1538e..0000000
--- a/debian/patches/upstream/0030-tls-updated-bio-functions-to-support-libssl-v1.1.0-a.patch
+++ /dev/null
@@ -1,146 +0,0 @@
-From 81df84b840bcb053400063f5b96d3d84179b11c5 Mon Sep 17 00:00:00 2001
-From: Daniel-Constantin Mierla <miconda at gmail.com>
-Date: Fri, 16 Sep 2016 22:06:06 +0200
-Subject: [PATCH] tls: updated bio functions to support libssl v1.1.0 api
-
-(cherry picked from commit fe99687608929b19be62412c334cf41e84845f81)
----
- modules/tls/tls_bio.c | 59 ++++++++++++++++++++++++++++++++++++++++-----------
- 1 file changed, 47 insertions(+), 12 deletions(-)
-
-diff --git a/modules/tls/tls_bio.c b/modules/tls/tls_bio.c
-index d2c2107..b0aae5b 100644
---- a/modules/tls/tls_bio.c
-+++ b/modules/tls/tls_bio.c
-@@ -1,4 +1,4 @@
--/* 
-+/*
-  * Kamailio TLS module
-  *
-  * Copyright (C) 2010 iptelorg GmbH
-@@ -137,14 +137,22 @@ int tls_BIO_mbuf_set(BIO* b, struct tls_mbuf* rd, struct tls_mbuf* wr)
- 	struct tls_bio_mbuf_data* d;
- 
- 	TLS_BIO_DBG("tls_BIO_mbuf_set called (%p => %p, %p)\n", b, rd, wr);
--	if (unlikely(b->ptr == 0)){
--		BUG("null BIO ptr\n");
-+#if OPENSSL_VERSION_NUMBER < 0x010100000L
-+	d = b->ptr;
-+#else
-+	d = BIO_get_data(b);
-+#endif
-+	if (unlikely(d == 0)){
-+		BUG("null BIO ptr data\n");
- 		return 0;
- 	}
--	d = b->ptr;
- 	d->rd = rd;
- 	d->wr = wr;
-+#if OPENSSL_VERSION_NUMBER < 0x010100000L
- 	b->init = 1;
-+#else
-+	BIO_set_init(b, 1);
-+#endif
- 	return 1;
- }
- 
-@@ -157,8 +165,9 @@ int tls_BIO_mbuf_set(BIO* b, struct tls_mbuf* rd, struct tls_mbuf* wr)
- static int tls_bio_mbuf_new(BIO* b)
- {
- 	struct tls_bio_mbuf_data* d;
--	
-+
- 	TLS_BIO_DBG("tls_bio_mbuf_new called (%p)\n", b);
-+#if OPENSSL_VERSION_NUMBER < 0x010100000L
- 	b->init = 0; /* not initialized yet */
- 	b->num = 0;
- 	b->ptr = 0;
-@@ -169,6 +178,14 @@ static int tls_bio_mbuf_new(BIO* b)
- 	d->rd = 0;
- 	d->wr = 0;
- 	b->ptr = d;
-+#else
-+	BIO_set_init(b, 0);
-+	BIO_set_data(b, NULL);
-+	d = OPENSSL_zalloc(sizeof(*d));
-+	if (unlikely(d == 0))
-+		return 0;
-+	BIO_set_data(b, d);
-+#endif
- 	return 1;
- }
- 
-@@ -183,11 +200,23 @@ static int tls_bio_mbuf_free(BIO* b)
- 	TLS_BIO_DBG("tls_bio_mbuf_free called (%p)\n", b);
- 	if (unlikely( b == 0))
- 			return 0;
-+#if OPENSSL_VERSION_NUMBER < 0x010100000L
- 	if (likely(b->ptr)){
- 		OPENSSL_free(b->ptr);
- 		b->ptr = 0;
- 		b->init = 0;
- 	}
-+#else
-+	do {
-+		struct tls_bio_mbuf_data* d;
-+		d = BIO_get_data(b);
-+		if (likely(d)) {
-+			OPENSSL_free(d);
-+			BIO_set_data(b, NULL);
-+			BIO_set_init(b, 0);
-+		}
-+	} while(0);
-+#endif
- 	return 1;
- }
- 
-@@ -203,10 +232,14 @@ static int tls_bio_mbuf_read(BIO* b, char* dst, int dst_len)
- 	struct tls_bio_mbuf_data* d;
- 	struct tls_mbuf* rd;
- 	int ret;
--	
-+
- 	ret = 0;
- 	if (likely(dst)) {
--		d= b->ptr;
-+#if OPENSSL_VERSION_NUMBER < 0x010100000L
-+		d = b->ptr;
-+#else
-+		d = BIO_get_data(b);
-+#endif
- 		BIO_clear_retry_flags(b);
- 		if (unlikely(d == 0 || d->rd->buf == 0)) {
- 			if (d == 0)
-@@ -256,9 +289,13 @@ static int tls_bio_mbuf_write(BIO* b, const char* src, int src_len)
- 	struct tls_bio_mbuf_data* d;
- 	struct tls_mbuf* wr;
- 	int ret;
--	
-+
- 	ret = 0;
--	d= b->ptr;
-+#if OPENSSL_VERSION_NUMBER < 0x010100000L
-+	d = b->ptr;
-+#else
-+	d = BIO_get_data(b);
-+#endif
- 	BIO_clear_retry_flags(b);
- 	if (unlikely(d == 0 || d->wr->buf == 0)) {
- 		if (d == 0)
-@@ -330,12 +367,10 @@ static long tls_bio_mbuf_ctrl(BIO* b, int cmd, long arg1, void* arg2)
- static int tls_bio_mbuf_puts(BIO* b, const char* s)
- {
- 	int len;
--	
-+
- 	TLS_BIO_DBG("puts called (%p, %s)\n", b, s);
- 	len=strlen(s);
- 	return tls_bio_mbuf_write(b, s, len);
- }
- 
--
--
- /* vi: set ts=4 sw=4 tw=79:ai:cindent: */
--- 
-2.9.3
-

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-voip/kamailio.git



More information about the Pkg-voip-commits mailing list