[Pkg-voip-commits] [kamailio] 01/02: update upstream patches from 4.4 branch

Victor Seva vseva at moszumanska.debian.org
Mon Apr 25 09:23:06 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 80d8989363d8c13dc4e7673319b15a596f2593f2
Author: Victor Seva <vseva at debian.org>
Date:   Mon Apr 25 09:50:33 2016 +0200

    update upstream patches from 4.4 branch
---
 ..._client-Clarify-DNS-resolver-use-for-CURL.patch |  50 ++
 ...0043-dialog-Document-shortest-ka_interval.patch |  42 ++
 ...te-README-with-explanation-of-in-dialog-r.patch |  49 ++
 ...-erlang-fix-uninitialized-member-variable.patch |  27 +
 ...046-erlang-fix-memory-leak-in-debug-macro.patch |  27 +
 .../0047-erlang-fix-parsing-function-params.patch  | 708 +++++++++++++++++++++
 ...ed-use-of-obsolete-function-json_object_o.patch |  55 ++
 ...eplaced-use-of-obsolete-function-json_obj.patch |  92 +++
 ...ove-ending-parenthesis-in-ifdef-condition.patch |  32 +
 ...fs-detect-kfreebsd-OS-and-set-its-default.patch |  83 +++
 10 files changed, 1165 insertions(+)

diff --git a/debian/patches/upstream/0042-http_client-Clarify-DNS-resolver-use-for-CURL.patch b/debian/patches/upstream/0042-http_client-Clarify-DNS-resolver-use-for-CURL.patch
new file mode 100644
index 0000000..d84d0f7
--- /dev/null
+++ b/debian/patches/upstream/0042-http_client-Clarify-DNS-resolver-use-for-CURL.patch
@@ -0,0 +1,50 @@
+From 22003d5cba54b5c0d0f0af06f62be24190bef231 Mon Sep 17 00:00:00 2001
+From: "Olle E. Johansson" <oej at edvina.net>
+Date: Mon, 18 Apr 2016 13:43:15 +0200
+Subject: [PATCH] http_client Clarify DNS resolver use for CURL
+
+(cherry picked from commit e85706b549e691404e3caf401fa4cf86c5ab90de)
+---
+ modules/http_client/README                    | 6 ++++++
+ modules/http_client/doc/http_client_admin.xml | 8 ++++++++
+ 2 files changed, 14 insertions(+)
+
+diff --git a/modules/http_client/README b/modules/http_client/README
+index 45449ef..5d503e9 100644
+--- a/modules/http_client/README
++++ b/modules/http_client/README
+@@ -171,6 +171,12 @@ Chapter 1. Admin Guide
+    and get access to parts of the reply. This function has been ported
+    from the utils module and now use the same libcurl functions.
+ 
++   The http_client module use the CURL library setting up connections. The
++   CURL library by default use the system configured DNS resolvers, not
++   the Kamailio resolver.
++
++   The module is limited to using HTTP and HTTPS protocols.
++
+ 2. Dependencies
+ 
+    2.1. Kamailio Modules
+diff --git a/modules/http_client/doc/http_client_admin.xml b/modules/http_client/doc/http_client_admin.xml
+index 07b2d02..e2c32f5 100644
+--- a/modules/http_client/doc/http_client_admin.xml
++++ b/modules/http_client/doc/http_client_admin.xml
+@@ -43,6 +43,14 @@
+ 	been ported from the utils module and now use the same libcurl
+ 	functions.
+ 	</para>
++	<para>
++	The http_client module use the CURL library setting up connections.
++	The CURL library by default use the system configured DNS resolvers,
++	not the Kamailio resolver.
++	</para>
++	<para>
++	The module is limited to using HTTP and HTTPS protocols.
++	</para>
+ 	</section>
+ 	<section>
+ 	<title>Dependencies</title>
+-- 
+2.8.0.rc3
+
diff --git a/debian/patches/upstream/0043-dialog-Document-shortest-ka_interval.patch b/debian/patches/upstream/0043-dialog-Document-shortest-ka_interval.patch
new file mode 100644
index 0000000..3090382
--- /dev/null
+++ b/debian/patches/upstream/0043-dialog-Document-shortest-ka_interval.patch
@@ -0,0 +1,42 @@
+From 19d4d3f5a1a49335377c9befd238b729b957f42b Mon Sep 17 00:00:00 2001
+From: "Olle E. Johansson" <oej at edvina.net>
+Date: Tue, 19 Apr 2016 14:11:33 +0200
+Subject: [PATCH] dialog Document shortest ka_interval
+
+(cherry picked from commit 9710f1c92baee8ec379d64b75531bed5cf7695fb)
+---
+ modules/dialog/README               | 3 ++-
+ modules/dialog/doc/dialog_admin.xml | 3 ++-
+ 2 files changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/modules/dialog/README b/modules/dialog/README
+index 1774a7f..83206bc 100644
+--- a/modules/dialog/README
++++ b/modules/dialog/README
+@@ -1147,7 +1147,8 @@ modparam("dialog", "ka_timer", 10)
+    dialog setup or previous keep-alive. The value represents the number of
+    seconds.
+ 
+-   Default value is "0" (no keep alive).
++   Default value is "0" (no keep alive). The lowest settable interval is
++   30 seconds.
+ 
+    Example 1.49. Set ka_interval parameter
+ ...
+diff --git a/modules/dialog/doc/dialog_admin.xml b/modules/dialog/doc/dialog_admin.xml
+index 50dffa7..b02826a 100644
+--- a/modules/dialog/doc/dialog_admin.xml
++++ b/modules/dialog/doc/dialog_admin.xml
+@@ -1249,7 +1249,8 @@ modparam("dialog", "ka_timer", 10)
+ 		</para>
+ 		<para>
+ 		<emphasis>
+-			Default value is <quote>0</quote> (no keep alive).
++			Default value is <quote>0</quote> (no keep alive). The lowest
++			settable interval is 30 seconds.
+ 		</emphasis>
+ 		</para>
+ 		<example>
+-- 
+2.8.0.rc3
+
diff --git a/debian/patches/upstream/0044-dialog-Update-README-with-explanation-of-in-dialog-r.patch b/debian/patches/upstream/0044-dialog-Update-README-with-explanation-of-in-dialog-r.patch
new file mode 100644
index 0000000..aaa1a99
--- /dev/null
+++ b/debian/patches/upstream/0044-dialog-Update-README-with-explanation-of-in-dialog-r.patch
@@ -0,0 +1,49 @@
+From c302b9e920342869721342c42f9014bd079fb456 Mon Sep 17 00:00:00 2001
+From: "Olle E. Johansson" <oej at edvina.net>
+Date: Tue, 19 Apr 2016 21:24:31 +0200
+Subject: [PATCH] dialog Update README with explanation of in-dialog request
+ behaviour
+
+(cherry picked from commit 19ef4f6ec8c22848eb4386f5f4996d5091c65688)
+---
+ modules/dialog/README               | 5 +++++
+ modules/dialog/doc/dialog_admin.xml | 7 +++++++
+ 2 files changed, 12 insertions(+)
+
+diff --git a/modules/dialog/README b/modules/dialog/README
+index 83206bc..97c2602 100644
+--- a/modules/dialog/README
++++ b/modules/dialog/README
+@@ -1147,6 +1147,11 @@ modparam("dialog", "ka_timer", 10)
+    dialog setup or previous keep-alive. The value represents the number of
+    seconds.
+ 
++   If the requests times out (generating a 408) or if the UA responds with
++   481 the lifetime is set to 10 seconds. When lifetime expires the dialog
++   will be terminated. Any other response (including error responses) will
++   reset the timers.
++
+    Default value is "0" (no keep alive). The lowest settable interval is
+    30 seconds.
+ 
+diff --git a/modules/dialog/doc/dialog_admin.xml b/modules/dialog/doc/dialog_admin.xml
+index b02826a..3fff0fe 100644
+--- a/modules/dialog/doc/dialog_admin.xml
++++ b/modules/dialog/doc/dialog_admin.xml
+@@ -1248,6 +1248,13 @@ modparam("dialog", "ka_timer", 10)
+ 			The value represents the number of seconds.
+ 		</para>
+ 		<para>
++			If the requests times out (generating a 408) or if the
++			UA responds with 481 the lifetime is set to 10 seconds.
++			When lifetime expires the dialog will be terminated.
++			Any other response (including error responses) will
++			reset the timers.
++		</para>
++		<para>
+ 		<emphasis>
+ 			Default value is <quote>0</quote> (no keep alive). The lowest
+ 			settable interval is 30 seconds.
+-- 
+2.8.0.rc3
+
diff --git a/debian/patches/upstream/0045-erlang-fix-uninitialized-member-variable.patch b/debian/patches/upstream/0045-erlang-fix-uninitialized-member-variable.patch
new file mode 100644
index 0000000..9bd9b46
--- /dev/null
+++ b/debian/patches/upstream/0045-erlang-fix-uninitialized-member-variable.patch
@@ -0,0 +1,27 @@
+From 8d07ef72e8280b4367e430bf081d54e0a0b5f4c1 Mon Sep 17 00:00:00 2001
+From: Seudin Kasumovic <seudin.kasumovic at gmail.com>
+Date: Mon, 18 Apr 2016 11:30:23 +0200
+Subject: [PATCH] erlang: fix uninitialized member variable
+
+- avoid conditional jump on uninitialized value
+
+(cherry picked from commit 0e3b19f4b99ea0b9e4eff2decb641e5da2488573)
+---
+ modules/erlang/worker.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/modules/erlang/worker.c b/modules/erlang/worker.c
+index 0bf1be8..86ad3f9 100644
+--- a/modules/erlang/worker.c
++++ b/modules/erlang/worker.c
+@@ -44,6 +44,7 @@ int worker_init(worker_handler_t *phandler, int fd, const ei_cnode *ec)
+ 	phandler->sockfd = fd;
+ 	phandler->ec = *ec;
+ 	phandler->next = NULL;
++	phandler->new = NULL;
+ 
+ 	return 0;
+ }
+-- 
+2.8.0.rc3
+
diff --git a/debian/patches/upstream/0046-erlang-fix-memory-leak-in-debug-macro.patch b/debian/patches/upstream/0046-erlang-fix-memory-leak-in-debug-macro.patch
new file mode 100644
index 0000000..55c6136
--- /dev/null
+++ b/debian/patches/upstream/0046-erlang-fix-memory-leak-in-debug-macro.patch
@@ -0,0 +1,27 @@
+From 2c650622cf7cd37dc1c5177ad314681113ac324d Mon Sep 17 00:00:00 2001
+From: Seudin Kasumovic <seudin.kasumovic at gmail.com>
+Date: Wed, 20 Apr 2016 11:10:39 +0200
+Subject: [PATCH] erlang: fix memory leak in debug macro
+
+- free temporary used encoding buffer
+
+(cherry picked from commit 2b11990929ae1d097bfb66848136bd247130263b)
+---
+ modules/erlang/erl_helpers.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/modules/erlang/erl_helpers.h b/modules/erlang/erl_helpers.h
+index 2aed063..fa8fdc5 100644
+--- a/modules/erlang/erl_helpers.h
++++ b/modules/erlang/erl_helpers.h
+@@ -141,6 +141,7 @@ do { \
+ 	ei_s_print_term(&pbuf, pidbuf.buff, &i); \
+ 	ei_x_print_reg_msg(buf, pbuf, send); \
+ 	free(pbuf); \
++	ei_x_free(&pidbuf); \
+ } while(0)
+ 
+ int ei_decode_strorbin(char *buf, int *index, int maxlen, char *dst);
+-- 
+2.8.0.rc3
+
diff --git a/debian/patches/upstream/0047-erlang-fix-parsing-function-params.patch b/debian/patches/upstream/0047-erlang-fix-parsing-function-params.patch
new file mode 100644
index 0000000..847914c
--- /dev/null
+++ b/debian/patches/upstream/0047-erlang-fix-parsing-function-params.patch
@@ -0,0 +1,708 @@
+From bf76f94e939c0d96ca25a2d75623e7fcff78c01e Mon Sep 17 00:00:00 2001
+From: Seudin Kasumovic <seudin.kasumovic at gmail.com>
+Date: Wed, 20 Apr 2016 11:36:40 +0200
+Subject: [PATCH] erlang: fix parsing function params
+
+- remove double parsing function params
+- free memory used in parsing params
+
+(cherry picked from commit 28b320088fcad8b8875f0528873a49cba9c74619)
+---
+ modules/erlang/mod_erlang.c | 310 +++++++++++++++++++++++++-------------------
+ modules/erlang/mod_erlang.h |   2 +-
+ 2 files changed, 180 insertions(+), 132 deletions(-)
+
+diff --git a/modules/erlang/mod_erlang.c b/modules/erlang/mod_erlang.c
+index 032a037..b8ab98b 100644
+--- a/modules/erlang/mod_erlang.c
++++ b/modules/erlang/mod_erlang.c
+@@ -72,6 +72,11 @@ static int fixup_send(void** param, int param_no);
+ static int fixup_reg(void** param, int param_no);
+ static int fixup_reply(void** param, int param_no);
+ 
++int fixup_free_rpc(void** param, int param_no);
++int fixup_free_reg(void** param, int param_no);
++int fixup_free_send(void** param, int param_no);
++int fixup_free_reply(void** param, int param_no);
++
+ /* initialize common vars */
+ str cookie = STR_NULL;
+ int trace_level = 0;
+@@ -176,10 +181,10 @@ static param_export_t parameters[] =
+ 
+ static cmd_export_t commands[] =
+ {
+-		{"erl_rpc", (cmd_function)erl_rpc, 4, fixup_rpc, 0, ANY_ROUTE},
+-		{"erl_send", (cmd_function)erl_send_k, 2, fixup_send, 0, ANY_ROUTE},
+-		{"erl_reg_send", (cmd_function)erl_reg_send_k, 2, fixup_reg, 0, ANY_ROUTE},
+-		{"erl_reply", (cmd_function)erl_reply_k, 1, fixup_reply, 0, EVENT_ROUTE},
++		{"erl_rpc", (cmd_function)erl_rpc, 4, fixup_rpc, fixup_free_rpc, ANY_ROUTE},
++		{"erl_send", (cmd_function)erl_send_k, 2, fixup_send, fixup_free_send, ANY_ROUTE},
++		{"erl_reg_send", (cmd_function)erl_reg_send_k, 2, fixup_reg, fixup_free_reg, ANY_ROUTE},
++		{"erl_reply", (cmd_function)erl_reply_k, 1, fixup_reply, fixup_free_reply, EVENT_ROUTE},
+ 		{"load_erl",(cmd_function)load_erl,0, 0,         0,         0}, /* API loader */
+ 		{ 0, 0, 0, 0, 0, 0 }
+ };
+@@ -434,7 +439,7 @@ static int erl_rpc(struct sip_msg *msg, char *_m, char *_f, char *_a, char *_r)
+ 	sr_xavp_t *xreq=NULL;
+ 	sr_xavp_t *xrepl=NULL;
+ 	pv_spec_t sp;
+-	pv_spec_t *nsp = NULL;
++	pv_spec_t *nsp;
+ 	pv_param_t  pvp;
+ 	pv_name_t *pvn;
+ 	pv_index_t *pvi;
+@@ -446,7 +451,7 @@ static int erl_rpc(struct sip_msg *msg, char *_m, char *_f, char *_a, char *_r)
+ 
+ 	switch (m->type) {
+ 	case ERL_PARAM_FPARAM:
+-		if(get_str_fparam(&module,msg,&m->value.fp)) {
++		if(get_str_fparam(&module,msg,m->value.fp)) {
+ 			LM_ERR("can't get module name\n");
+ 		}
+ 		break;
+@@ -457,7 +462,7 @@ static int erl_rpc(struct sip_msg *msg, char *_m, char *_f, char *_a, char *_r)
+ 
+ 	switch (f->type) {
+ 	case ERL_PARAM_FPARAM:
+-		if(get_str_fparam(&function,msg,&f->value.fp)) {
++		if(get_str_fparam(&function,msg,f->value.fp)) {
+ 			LM_ERR("can't get function name\n");
+ 		}
+ 		break;
+@@ -468,7 +473,7 @@ static int erl_rpc(struct sip_msg *msg, char *_m, char *_f, char *_a, char *_r)
+ 
+ 	switch(a->type){
+ 	case ERL_PARAM_FPARAM:
+-		if(get_str_fparam(&vname,msg,&a->value.fp)){
++		if(get_str_fparam(&vname,msg,a->value.fp)){
+ 			LM_ERR("can't get name of arguments parameter\n");
+ 			return -1;
+ 		}
+@@ -482,13 +487,8 @@ static int erl_rpc(struct sip_msg *msg, char *_m, char *_f, char *_a, char *_r)
+ 		}
+ 		break;
+ 	case ERL_PARAM_XBUFF_SPEC:
+-		sp = a->value.sp;
+-		pvp = sp.pvp; /* work on copy */
+-
+-		if (pvp.pvn.type != PV_NAME_INTSTR || !(pvp.pvn.u.isname.type & AVP_NAME_STR)) {
+-			LM_ERR("unsupported name of list\n");
+-			return -1;
+-		}
++		nsp = NULL;
++		pvp = a->value.sp.pvp; /* work on copy */
+ 
+ 		if( pvp.pvn.type == PV_NAME_PVAR) {
+ 			nsp = pvp.pvn.u.dname;
+@@ -497,9 +497,11 @@ static int erl_rpc(struct sip_msg *msg, char *_m, char *_f, char *_a, char *_r)
+ 		if (nsp) {
+ 			pvi = &nsp->pvp.pvi;
+ 			pvn = &nsp->pvp.pvn;
++			sp = *nsp;
+ 		} else {
+ 			pvi = &pvp.pvi;
+ 			pvn = &pvp.pvn;
++			sp = a->value.sp;
+ 		}
+ 
+ 		if (sp.setf == pv_list_set ) {
+@@ -512,7 +514,6 @@ static int erl_rpc(struct sip_msg *msg, char *_m, char *_f, char *_a, char *_r)
+ 
+ 		/* fix index */
+ 		attr = xbuff_get_attr_flags(pvi->type);
+-		pvi->type = xbuff_fix_index(pvi->type);
+ 
+ 		/* get the index */
+ 		if(pv_get_spec_index(msg, &pvp, &idx, &idxf))
+@@ -553,20 +554,15 @@ static int erl_rpc(struct sip_msg *msg, char *_m, char *_f, char *_a, char *_r)
+ 
+ 	switch(r->type){
+ 	case ERL_PARAM_FPARAM:
+-		if(get_str_fparam(&vname,msg,&r->value.fp)){
++		if(get_str_fparam(&vname,msg,r->value.fp)){
+ 			LM_ERR("can't get name of arguments parameter\n");
+ 			return -1;
+ 		}
+ 		xrepl = pv_xbuff_get_xbuff(&vname);
+ 		break;
+ 	case ERL_PARAM_XBUFF_SPEC:
+-		sp = r->value.sp;
+-		pvp = sp.pvp; /* work on copy */
+-
+-		if (pvp.pvn.type != PV_NAME_INTSTR || !(pvp.pvn.u.isname.type & AVP_NAME_STR)) {
+-			LM_ERR("unsupported name of xbuff\n");
+-			return -1;
+-		}
++		nsp = NULL;
++		pvp = r->value.sp.pvp; /* work on copy */
+ 
+ 		if( pvp.pvn.type == PV_NAME_PVAR) {
+ 			nsp = pvp.pvn.u.dname;
+@@ -575,9 +571,11 @@ static int erl_rpc(struct sip_msg *msg, char *_m, char *_f, char *_a, char *_r)
+ 		if (nsp) {
+ 			pvi = &nsp->pvp.pvi;
+ 			pvn = &nsp->pvp.pvn;
++			sp = *nsp;
+ 		} else {
+ 			pvi = &pvp.pvi;
+ 			pvn = &pvp.pvn;
++			sp = a->value.sp;
+ 		}
+ 
+ 		if (sp.setf == pv_xbuff_set ) {
+@@ -589,7 +587,6 @@ static int erl_rpc(struct sip_msg *msg, char *_m, char *_f, char *_a, char *_r)
+ 
+ 		/* fix index */
+ 		attr = xbuff_get_attr_flags(pvi->type);
+-		pvi->type = xbuff_fix_index(pvi->type);
+ 
+ 		/* get the index */
+ 		if(pv_get_spec_index(msg, &pvp, &idx, &idxf))
+@@ -653,6 +650,7 @@ static int erl_rpc(struct sip_msg *msg, char *_m, char *_f, char *_a, char *_r)
+ static int fixup_rpc(void** param, int param_no)
+ {
+ 	erl_param_t *erl_param;
++	pv_spec_p psp;
+ 
+ 	str s;
+ 
+@@ -669,7 +667,7 @@ static int fixup_rpc(void** param, int param_no)
+ 			return -1;
+ 		}
+ 		erl_param->type = ERL_PARAM_FPARAM;
+-		erl_param->value.fp = *(fparam_t*)*param;
++		erl_param->value.fp = (fparam_t*)*param;
+ 	}
+ 
+ 	if (param_no==3 || param_no==4) {
+@@ -689,22 +687,19 @@ static int fixup_rpc(void** param, int param_no)
+ 				return E_UNSPEC;
+ 			}
+ 			erl_param->type = ERL_PARAM_FPARAM;
+-			erl_param->value.fp = *(fparam_t*)*param;
+-		} else if(pv_parse_spec( &s, &erl_param->value.sp)==NULL || erl_param->value.sp.type!=PVT_OTHER) {
+-
+-			/* only XBUFF is accepted for args and reply */
+-			LM_ERR("wrong parameter #%d: accepted types are list of xbuff\n",param_no);
+-			pv_spec_free(&erl_param->value.sp);
+-			pkg_free((void*)erl_param);
+-			return E_UNSPEC;
++			erl_param->value.fp = (fparam_t*)*param;
+ 		} else {
+ 			/* lets check what is acceptable */
+-			if (erl_param->value.sp.setf != pv_list_set && erl_param->value.sp.setf != pv_xbuff_set) {
+-				LM_ERR("wrong parameter #%d: accepted types are list of xbuff\n",param_no);
++			psp = (pv_spec_p)erl_param->value.sp.pvp.pvn.u.dname;
++
++			if (psp->setf != pv_list_set && psp->setf != pv_xbuff_set) {
++				LM_ERR("wrong parameter #%d: accepted types are list or xbuff\n",param_no);
++				pv_spec_free(&erl_param->value.sp);
+ 				pkg_free((void*)erl_param);
+ 				return E_UNSPEC;
+ 			}
+ 			erl_param->type = ERL_PARAM_XBUFF_SPEC;
++			LM_ERR("erl_param->value.sp.type=%d\n",erl_param->value.sp.type);
+ 		}
+ 	}
+ 
+@@ -713,6 +708,28 @@ static int fixup_rpc(void** param, int param_no)
+ 	return 0;
+ }
+ 
++int fixup_free_rpc(void** param, int param_no) {
++
++	erl_param_t *erl_param;
++
++	erl_param = (erl_param_t*)*param;
++
++	if(param_no==1 || param_no==2) {
++		return fixup_free_fparam_2((void**)&erl_param->value.fp,param_no);
++	}
++
++	if (param_no==3 || param_no==4) {
++		LM_ERR("erl_param->value.sp.type=%d\n",erl_param->value.sp.type);
++		if (erl_param->value.sp.type == PVT_OTHER) {
++			pv_spec_free((pv_spec_p)erl_param->value.sp.pvp.pvn.u.dname);
++		} else if (erl_param->value.sp.pvp.pvn.type == PV_NAME_INTSTR) {
++			return fixup_free_fparam_2((void**)&erl_param->value.fp,param_no);
++		}
++	}
++
++	return 0;
++}
++
+ static int erl_reg_send_k(struct sip_msg *msg, char *_server, char *_emsg)
+ {
+ 	erl_param_t *param_server=(erl_param_t*)_server;
+@@ -733,7 +750,7 @@ static int erl_reg_send_k(struct sip_msg *msg, char *_server, char *_emsg)
+ 
+ 	switch (param_server->type) {
+ 	case ERL_PARAM_FPARAM:
+-		if(get_str_fparam(&server,msg,&param_server->value.fp)) {
++		if(get_str_fparam(&server,msg,param_server->value.fp)) {
+ 			LM_ERR("can't get server process name\n");
+ 		}
+ 		break;
+@@ -746,7 +763,7 @@ static int erl_reg_send_k(struct sip_msg *msg, char *_server, char *_emsg)
+ 
+ 	switch(param_emsg->type){
+ 	case ERL_PARAM_FPARAM:
+-		if(get_str_fparam(&str_msg,msg,&param_emsg->value.fp)){
++		if(get_str_fparam(&str_msg,msg,param_emsg->value.fp)){
+ 			LM_ERR("can't get emsg parameter\n");
+ 			goto err;
+ 		}
+@@ -755,13 +772,7 @@ static int erl_reg_send_k(struct sip_msg *msg, char *_server, char *_emsg)
+ 
+ 		break;
+ 	case ERL_PARAM_XBUFF_SPEC:
+-		sp = param_emsg->value.sp;
+-		pvp = sp.pvp; /* work on copy */
+-
+-		if (pvp.pvn.type != PV_NAME_INTSTR || !(pvp.pvn.u.isname.type & AVP_NAME_STR)) {
+-			LM_ERR("unsupported name of list\n");
+-			return -1;
+-		}
++		pvp = param_emsg->value.sp.pvp; /* work on copy */
+ 
+ 		if( pvp.pvn.type == PV_NAME_PVAR) {
+ 			nsp = pvp.pvn.u.dname;
+@@ -770,9 +781,11 @@ static int erl_reg_send_k(struct sip_msg *msg, char *_server, char *_emsg)
+ 		if (nsp) {
+ 			pvi = &nsp->pvp.pvi;
+ 			pvn = &nsp->pvp.pvn;
++			sp = *nsp;
+ 		} else {
+ 			pvi = &pvp.pvi;
+ 			pvn = &pvp.pvn;
++			sp = param_emsg->value.sp;
+ 		}
+ 
+ 		if (sp.setf == pv_list_set ) {
+@@ -785,7 +798,6 @@ static int erl_reg_send_k(struct sip_msg *msg, char *_server, char *_emsg)
+ 
+ 		/* fix index */
+ 		attr = xbuff_get_attr_flags(pvi->type);
+-		pvi->type = xbuff_fix_index(pvi->type);
+ 
+ 		/* get the index */
+ 		if(pv_get_spec_index(msg, &pvp, &idx, &idxf))
+@@ -843,6 +855,7 @@ err:
+ static int fixup_reg(void** param, int param_no)
+ {
+ 	erl_param_t *erl_param;
++	pv_spec_p psp;
+ 
+ 	str s;
+ 
+@@ -861,7 +874,7 @@ static int fixup_reg(void** param, int param_no)
+ 			return -1;
+ 		}
+ 		erl_param->type = ERL_PARAM_FPARAM;
+-		erl_param->value.fp = *(fparam_t*)*param;
++		erl_param->value.fp = (fparam_t*)*param;
+ 	}
+ 
+ 	if (param_no==2) {
+@@ -881,30 +894,27 @@ static int fixup_reg(void** param, int param_no)
+ 				return E_UNSPEC;
+ 			}
+ 			erl_param->type = ERL_PARAM_FPARAM;
+-			erl_param->value.fp = *(fparam_t*)*param;
+-		} else if(pv_parse_spec( &s, &erl_param->value.sp)==NULL) {
+-
+-			/* only XBUFF is accepted for emsg and reply */
+-			LM_ERR("wrong parameter #%d\n",param_no);
+-			pv_spec_free(&erl_param->value.sp);
+-			pkg_free((void*)erl_param);
+-			return E_UNSPEC;
++			erl_param->value.fp = (fparam_t*)*param;
+ 		} else {
+-			if (erl_param->value.sp.type ==PVT_XAVP) {
++			if (erl_param->value.sp.type == PVT_XAVP) {
+ 				LM_ERR("XAVP not acceptable for parameter #%d\n",param_no);
+ 				pkg_free((void*)erl_param);
+ 				return E_UNSPEC;
+ 			}
+ 
+-			if (erl_param->value.sp.setf == pv_list_set
+-					|| erl_param->value.sp.setf == pv_xbuff_set
+-					|| erl_param->value.sp.setf == pv_tuple_set
+-					|| erl_param->value.sp.setf == pv_atom_set) {
++			psp = (pv_spec_p)erl_param->value.sp.pvp.pvn.u.dname;
++
++			if (psp->setf == pv_list_set
++					|| psp->setf == pv_xbuff_set
++					|| psp->setf == pv_tuple_set
++					|| psp->setf == pv_atom_set) {
+ 
+ 				erl_param->type = ERL_PARAM_XBUFF_SPEC;
+ 			} else {
+-				erl_param->type = ERL_PARAM_FPARAM;
+-				erl_param->value.fp = *(fparam_t*)*param;
++				LM_ERR("wrong parameter #%d\n",param_no);
++				pv_spec_free(&erl_param->value.sp);
++				pkg_free((void*)erl_param);
++				return E_UNSPEC;
+ 			}
+ 		}
+ 	}
+@@ -914,6 +924,28 @@ static int fixup_reg(void** param, int param_no)
+ 	return 0;
+ }
+ 
++int fixup_free_reg(void** param, int param_no) {
++
++	erl_param_t *erl_param;
++
++	erl_param = (erl_param_t*)*param;
++
++	if(param_no==1) {
++		return fixup_free_fparam_1((void**)&erl_param->value.fp,param_no);
++	}
++
++	if (param_no==2) {
++		LM_ERR("erl_param->value.sp.type=%d\n",erl_param->value.sp.type);
++		if (erl_param->value.sp.type == PVT_OTHER) {
++			pv_spec_free((pv_spec_p)erl_param->value.sp.pvp.pvn.u.dname);
++		} else if (erl_param->value.sp.pvp.pvn.type == PV_NAME_INTSTR) {
++			return fixup_free_fparam_2((void**)&erl_param->value.fp,param_no);
++		}
++	}
++
++	return 0;
++}
++
+ static int erl_reply_k(struct sip_msg *msg, char *_emsg)
+ {
+ 	erl_param_t *param_emsg=(erl_param_t*)_emsg;
+@@ -934,7 +966,7 @@ static int erl_reply_k(struct sip_msg *msg, char *_emsg)
+ 
+ 	switch(param_emsg->type){
+ 	case ERL_PARAM_FPARAM:
+-		if(get_str_fparam(&str_msg,msg,&param_emsg->value.fp)){
++		if(get_str_fparam(&str_msg,msg,param_emsg->value.fp)){
+ 			LM_ERR("can't get emsg parameter\n");
+ 			goto err;
+ 		}
+@@ -943,13 +975,7 @@ static int erl_reply_k(struct sip_msg *msg, char *_emsg)
+ 
+ 		break;
+ 	case ERL_PARAM_XBUFF_SPEC:
+-		sp = param_emsg->value.sp;
+-		pvp = sp.pvp; /* work on copy */
+-
+-		if (pvp.pvn.type != PV_NAME_INTSTR || !(pvp.pvn.u.isname.type & AVP_NAME_STR)) {
+-			LM_ERR("unsupported name of list\n");
+-			return -1;
+-		}
++		pvp = param_emsg->value.sp.pvp; /* work on copy */
+ 
+ 		if( pvp.pvn.type == PV_NAME_PVAR) {
+ 			nsp = pvp.pvn.u.dname;
+@@ -958,9 +984,11 @@ static int erl_reply_k(struct sip_msg *msg, char *_emsg)
+ 		if (nsp) {
+ 			pvi = &nsp->pvp.pvi;
+ 			pvn = &nsp->pvp.pvn;
++			sp = *nsp;
+ 		} else {
+ 			pvi = &pvp.pvi;
+ 			pvn = &pvp.pvn;
++			sp = param_emsg->value.sp;
+ 		}
+ 
+ 		if (sp.setf == pv_list_set ) {
+@@ -1031,6 +1059,7 @@ err:
+ static int fixup_reply(void** param, int param_no)
+ {
+ 	erl_param_t *erl_param;
++	pv_spec_p psp;
+ 
+ 	str s;
+ 
+@@ -1060,14 +1089,7 @@ static int fixup_reply(void** param, int param_no)
+ 				return E_UNSPEC;
+ 			}
+ 			erl_param->type = ERL_PARAM_FPARAM;
+-			erl_param->value.fp = *(fparam_t*)*param;
+-		} else if(pv_parse_spec( &s, &erl_param->value.sp)==NULL) {
+-
+-			/* only XBUFF is accepted for emsg and reply */
+-			LM_ERR("wrong parameter #%d\n",param_no);
+-			pv_spec_free(&erl_param->value.sp);
+-			pkg_free((void*)erl_param);
+-			return E_UNSPEC;
++			erl_param->value.fp = (fparam_t*)*param;
+ 		} else {
+ 			if (erl_param->value.sp.type ==PVT_XAVP) {
+ 				LM_ERR("XAVP not acceptable for parameter #%d\n",param_no);
+@@ -1075,15 +1097,19 @@ static int fixup_reply(void** param, int param_no)
+ 				return E_UNSPEC;
+ 			}
+ 
+-			if (erl_param->value.sp.setf == pv_list_set
+-					|| erl_param->value.sp.setf == pv_xbuff_set
+-					|| erl_param->value.sp.setf == pv_tuple_set
+-					|| erl_param->value.sp.setf == pv_atom_set) {
++			psp = (pv_spec_p)erl_param->value.sp.pvp.pvn.u.dname;
++
++			if (psp->setf == pv_list_set
++					|| psp->setf == pv_xbuff_set
++					|| psp->setf == pv_tuple_set
++					|| psp->setf == pv_atom_set) {
+ 
+ 				erl_param->type = ERL_PARAM_XBUFF_SPEC;
+ 			} else {
+-				erl_param->type = ERL_PARAM_FPARAM;
+-				erl_param->value.fp = *(fparam_t*)*param;
++				LM_ERR("wrong parameter #%d\n",param_no);
++				pv_spec_free(&erl_param->value.sp);
++				pkg_free((void*)erl_param);
++				return E_UNSPEC;
+ 			}
+ 		}
+ 	}
+@@ -1093,6 +1119,24 @@ static int fixup_reply(void** param, int param_no)
+ 	return 0;
+ }
+ 
++int fixup_free_reply(void** param, int param_no) {
++
++	erl_param_t *erl_param;
++
++	erl_param = (erl_param_t*)*param;
++
++	if (param_no==1) {
++		LM_ERR("erl_param->value.sp.type=%d\n",erl_param->value.sp.type);
++		if (erl_param->value.sp.type == PVT_OTHER) {
++			pv_spec_free((pv_spec_p)erl_param->value.sp.pvp.pvn.u.dname);
++		} else if (erl_param->value.sp.pvp.pvn.type == PV_NAME_INTSTR) {
++			return fixup_free_fparam_2((void**)&erl_param->value.fp,param_no);
++		}
++	}
++
++	return 0;
++}
++
+ static int erl_send_k(struct sip_msg *msg, char *_pid, char *_emsg)
+ {
+ 	erl_param_t *param_pid=(erl_param_t*)_pid;
+@@ -1101,7 +1145,7 @@ static int erl_send_k(struct sip_msg *msg, char *_pid, char *_emsg)
+ 	str str_msg;
+ 	sr_xavp_t *xmsg=NULL;
+ 	pv_spec_t sp;
+-	pv_spec_t *nsp = NULL;
++	pv_spec_t *nsp;
+ 	pv_param_t  pvp;
+ 	pv_name_t *pvn;
+ 	pv_index_t *pvi;
+@@ -1113,13 +1157,8 @@ static int erl_send_k(struct sip_msg *msg, char *_pid, char *_emsg)
+ 
+ 	switch (param_pid->type) {
+ 	case ERL_PARAM_XBUFF_SPEC:
+-		sp = param_pid->value.sp;
+-		pvp = sp.pvp; /* work on copy */
+-
+-		if (pvp.pvn.type != PV_NAME_INTSTR || !(pvp.pvn.u.isname.type & AVP_NAME_STR)) {
+-			LM_ERR("unsupported name of pid\n");
+-			return -1;
+-		}
++		nsp = NULL;
++		pvp = param_pid->value.sp.pvp; /* work on copy */
+ 
+ 		if( pvp.pvn.type == PV_NAME_PVAR) {
+ 			nsp = pvp.pvn.u.dname;
+@@ -1128,9 +1167,11 @@ static int erl_send_k(struct sip_msg *msg, char *_pid, char *_emsg)
+ 		if (nsp) {
+ 			pvi = &nsp->pvp.pvi;
+ 			pvn = &nsp->pvp.pvn;
++			sp = *nsp;
+ 		} else {
+ 			pvi = &pvp.pvi;
+ 			pvn = &pvp.pvn;
++			sp = param_pid->value.sp;
+ 		}
+ 
+ 		if (sp.getf == pv_pid_get ) {
+@@ -1144,7 +1185,6 @@ static int erl_send_k(struct sip_msg *msg, char *_pid, char *_emsg)
+ 
+ 		/* fix index */
+ 		attr = xbuff_get_attr_flags(pvi->type);
+-		pvi->type = xbuff_fix_index(pvi->type);
+ 
+ 		/* get the index */
+ 		if(pv_get_spec_index(msg, &pvp, &idx, &idxf))
+@@ -1190,7 +1230,7 @@ static int erl_send_k(struct sip_msg *msg, char *_pid, char *_emsg)
+ 
+ 	switch(param_emsg->type){
+ 	case ERL_PARAM_FPARAM:
+-		if(get_str_fparam(&str_msg,msg,&param_emsg->value.fp)){
++		if(get_str_fparam(&str_msg,msg,param_emsg->value.fp)){
+ 			LM_ERR("can't get emsg parameter\n");
+ 			goto err;
+ 		}
+@@ -1199,13 +1239,8 @@ static int erl_send_k(struct sip_msg *msg, char *_pid, char *_emsg)
+ 
+ 		break;
+ 	case ERL_PARAM_XBUFF_SPEC:
+-		sp = param_emsg->value.sp;
+-		pvp = sp.pvp; /* work on copy */
+-
+-		if (pvp.pvn.type != PV_NAME_INTSTR || !(pvp.pvn.u.isname.type & AVP_NAME_STR)) {
+-			LM_ERR("unsupported name of list\n");
+-			return -1;
+-		}
++		nsp = NULL;
++		pvp = param_emsg->value.sp.pvp; /* work on copy */
+ 
+ 		if( pvp.pvn.type == PV_NAME_PVAR) {
+ 			nsp = pvp.pvn.u.dname;
+@@ -1214,9 +1249,11 @@ static int erl_send_k(struct sip_msg *msg, char *_pid, char *_emsg)
+ 		if (nsp) {
+ 			pvi = &nsp->pvp.pvi;
+ 			pvn = &nsp->pvp.pvn;
++			sp = *nsp;
+ 		} else {
+ 			pvi = &pvp.pvi;
+ 			pvn = &pvp.pvn;
++			sp = param_emsg->value.sp;
+ 		}
+ 
+ 		if (sp.getf == pv_list_get ) {
+@@ -1233,7 +1270,6 @@ static int erl_send_k(struct sip_msg *msg, char *_pid, char *_emsg)
+ 
+ 		/* fix index */
+ 		attr = xbuff_get_attr_flags(pvi->type);
+-		pvi->type = xbuff_fix_index(pvi->type);
+ 
+ 		/* get the index */
+ 		if(pv_get_spec_index(msg, &pvp, &idx, &idxf))
+@@ -1291,6 +1327,7 @@ err:
+ static int fixup_send(void** param, int param_no)
+ {
+ 	erl_param_t *erl_param;
++	pv_spec_p psp;
+ 
+ 	str s;
+ 
+@@ -1320,27 +1357,24 @@ static int fixup_send(void** param, int param_no)
+ 				return E_UNSPEC;
+ 			}
+ 			erl_param->type = ERL_PARAM_FPARAM;
+-			erl_param->value.fp = *(fparam_t*)*param;
+-		} else if(pv_parse_spec( &s, &erl_param->value.sp)==NULL) {
+-
+-			/* only XBUFF is accepted for emsg */
+-			LM_ERR("wrong parameter #%d\n",param_no);
+-			pv_spec_free(&erl_param->value.sp);
+-			pkg_free((void*)erl_param);
+-			return E_UNSPEC;
+-		} else {
+-			if (erl_param->value.sp.type ==PVT_XAVP) {
++			erl_param->value.fp = (fparam_t*)*param;
++		}
++		else {
++			if (erl_param->value.sp.type == PVT_XAVP) {
+ 				LM_ERR("XAVP not acceptable for parameter #%d\n",param_no);
+ 				pkg_free((void*)erl_param);
+ 				return E_UNSPEC;
+ 			}
+ 
+-			if (erl_param->value.sp.getf == pv_pid_get
+-					|| erl_param->value.sp.getf == pv_xbuff_get) {
++			psp = (pv_spec_p)erl_param->value.sp.pvp.pvn.u.dname;
++
++			if (psp->getf == pv_pid_get || psp->getf == pv_xbuff_get) {
+ 				erl_param->type = ERL_PARAM_XBUFF_SPEC;
+ 			} else {
+-				erl_param->type = ERL_PARAM_FPARAM;
+-				erl_param->value.fp = *(fparam_t*)*param;
++				LM_ERR("wrong parameter #%d\n",param_no);
++				pv_spec_free(&erl_param->value.sp);
++				pkg_free((void*)erl_param);
++				return E_UNSPEC;
+ 			}
+ 		}
+ 	}
+@@ -1362,14 +1396,7 @@ static int fixup_send(void** param, int param_no)
+ 				return E_UNSPEC;
+ 			}
+ 			erl_param->type = ERL_PARAM_FPARAM;
+-			erl_param->value.fp = *(fparam_t*)*param;
+-		} else if(pv_parse_spec( &s, &erl_param->value.sp)==NULL) {
+-
+-			/* only XBUFF is accepted for emsg */
+-			LM_ERR("wrong parameter #%d\n",param_no);
+-			pv_spec_free(&erl_param->value.sp);
+-			pkg_free((void*)erl_param);
+-			return E_UNSPEC;
++			erl_param->value.fp = (fparam_t*)*param;
+ 		} else {
+ 			if (erl_param->value.sp.type ==PVT_XAVP) {
+ 				LM_ERR("XAVP not acceptable for parameter #%d\n",param_no);
+@@ -1377,16 +1404,20 @@ static int fixup_send(void** param, int param_no)
+ 				return E_UNSPEC;
+ 			}
+ 
+-			if (erl_param->value.sp.getf == pv_list_get
+-					|| erl_param->value.sp.getf == pv_xbuff_get
+-					|| erl_param->value.sp.getf == pv_tuple_get
+-					|| erl_param->value.sp.getf == pv_atom_get
+-					|| erl_param->value.sp.getf == pv_pid_get) {
++			psp = (pv_spec_p)erl_param->value.sp.pvp.pvn.u.dname;
++
++			if (psp->getf == pv_list_get
++					|| psp->getf == pv_xbuff_get
++					|| psp->getf == pv_tuple_get
++					|| psp->getf == pv_atom_get
++					|| psp->getf == pv_pid_get) {
+ 
+ 				erl_param->type = ERL_PARAM_XBUFF_SPEC;
+ 			} else {
+-				erl_param->type = ERL_PARAM_FPARAM;
+-				erl_param->value.fp = *(fparam_t*)*param;
++				LM_ERR("wrong parameter #%d\n",param_no);
++				pv_spec_free(&erl_param->value.sp);
++				pkg_free((void*)erl_param);
++				return E_UNSPEC;
+ 			}
+ 		}
+ 	}
+@@ -1395,3 +1426,20 @@ static int fixup_send(void** param, int param_no)
+ 
+ 	return 0;
+ }
++
++int fixup_free_send(void** param, int param_no) {
++
++	erl_param_t *erl_param;
++
++	erl_param = (erl_param_t*)*param;
++
++	if (param_no==1 || param_no==2) {
++		if (erl_param->value.sp.type == PVT_OTHER) {
++			pv_spec_free((pv_spec_p)erl_param->value.sp.pvp.pvn.u.dname);
++		} else if (erl_param->value.sp.pvp.pvn.type == PV_NAME_INTSTR) {
++			return fixup_free_fparam_2((void**)&erl_param->value.fp,param_no);
++		}
++	}
++
++	return 0;
++}
+diff --git a/modules/erlang/mod_erlang.h b/modules/erlang/mod_erlang.h
+index 34b06a6..3e06e39 100644
+--- a/modules/erlang/mod_erlang.h
++++ b/modules/erlang/mod_erlang.h
+@@ -63,7 +63,7 @@ typedef enum {
+ typedef struct erl_param_s {
+ 	erl_param_type type;
+ 	union {
+-		fparam_t fp;
++		fparam_t *fp;
+ 		pv_spec_t sp;
+ 	} value;
+ } erl_param_t;
+-- 
+2.8.0.rc3
+
diff --git a/debian/patches/upstream/0048-json-replaced-use-of-obsolete-function-json_object_o.patch b/debian/patches/upstream/0048-json-replaced-use-of-obsolete-function-json_object_o.patch
new file mode 100644
index 0000000..4f619a6
--- /dev/null
+++ b/debian/patches/upstream/0048-json-replaced-use-of-obsolete-function-json_object_o.patch
@@ -0,0 +1,55 @@
+From 2700d7b8df738f9e5db82dca87cbab5549f2e0d1 Mon Sep 17 00:00:00 2001
+From: Daniel-Constantin Mierla <miconda at gmail.com>
+Date: Mon, 25 Apr 2016 08:54:45 +0200
+Subject: [PATCH] json: replaced use of obsolete function
+ json_object_object_get()
+
+- reported by Olle E. Johansson, GH #579
+
+(cherry picked from commit 8b9fd4fa40abfc40ecd537948036aa91b908615d)
+---
+ modules/json/json_funcs.c | 21 ++++++++++++++-------
+ 1 file changed, 14 insertions(+), 7 deletions(-)
+
+diff --git a/modules/json/json_funcs.c b/modules/json/json_funcs.c
+index 106eef1..4d73c73 100644
+--- a/modules/json/json_funcs.c
++++ b/modules/json/json_funcs.c
+@@ -39,6 +39,8 @@ int json_get_field(struct sip_msg* msg, char* json, char* field, char* dst)
+ 	pv_value_t dst_val;
+ 	char *value;
+ 	struct json_object *j = NULL;
++	struct json_object *oj = NULL;
++	int ret;
+ 
+ 	if (fixup_get_svalue(msg, (gparam_p)json, &json_s) != 0) {
+ 		LM_ERR("cannot get json string value\n");
+@@ -61,13 +63,18 @@ int json_get_field(struct sip_msg* msg, char* json, char* field, char* dst)
+ 		return -1;
+ 	}
+ 
+-	value = (char*)json_object_to_json_string(json_object_object_get(j, field_s.s));
+-
+-	dst_val.rs.s = value;
+-	dst_val.rs.len = strlen(value);
+-	dst_val.flags = PV_VAL_STR;
+-	dst_pv->setf(msg, &dst_pv->pvp, (int)EQ_T, &dst_val);
++	json_object_object_get_ex(j, field_s.s, &oj);
++	if(oj!=NULL) {
++		value = (char*)json_object_to_json_string(oj);
++		dst_val.rs.s = value;
++		dst_val.rs.len = strlen(value);
++		dst_val.flags = PV_VAL_STR;
++		dst_pv->setf(msg, &dst_pv->pvp, (int)EQ_T, &dst_val);
++		ret = 1;
++	} else {
++		ret = -1;
++	}
+ 
+ 	if(j!=NULL) json_object_put(j);
+-	return 1;
++	return ret;
+ }
+-- 
+2.8.0.rc3
+
diff --git a/debian/patches/upstream/0049-jsonrpc-c-replaced-use-of-obsolete-function-json_obj.patch b/debian/patches/upstream/0049-jsonrpc-c-replaced-use-of-obsolete-function-json_obj.patch
new file mode 100644
index 0000000..783a6cf
--- /dev/null
+++ b/debian/patches/upstream/0049-jsonrpc-c-replaced-use-of-obsolete-function-json_obj.patch
@@ -0,0 +1,92 @@
+From 528842d4dfea3d6785e6cee0cd3fb6411ee3dc7d Mon Sep 17 00:00:00 2001
+From: Daniel-Constantin Mierla <miconda at gmail.com>
+Date: Mon, 25 Apr 2016 08:56:00 +0200
+Subject: [PATCH] jsonrpc-c: replaced use of obsolete function
+ json_object_object_get()
+
+(cherry picked from commit be02b3f11c269d3eeeb52e1cd0056d7d77be2e4c)
+---
+ modules/jsonrpc-c/jsonrpc.c | 28 ++++++++++++++++------------
+ 1 file changed, 16 insertions(+), 12 deletions(-)
+
+diff --git a/modules/jsonrpc-c/jsonrpc.c b/modules/jsonrpc-c/jsonrpc.c
+index 7baed54..834a7dd 100644
+--- a/modules/jsonrpc-c/jsonrpc.c
++++ b/modules/jsonrpc-c/jsonrpc.c
+@@ -70,34 +70,38 @@ jsonrpc_request_t* build_jsonrpc_request(char *method, json_object *params, char
+ 	return req;
+ }
+ 
+-json_object* build_jsonrpc_notification(char *method, json_object *params) 
++json_object* build_jsonrpc_notification(char *method, json_object *params)
+ {
+ 	json_object *req = json_object_new_object();
+ 	json_object_object_add(req, "jsonrpc", json_object_new_string("2.0"));
+ 	json_object_object_add(req, "method", json_object_new_string(method));
+ 	json_object_object_add(req, "params", params);
+ 
+-	return req; 
++	return req;
+ }
+ 
+ 
+ int handle_jsonrpc_response(json_object *response)
+ {
+-	jsonrpc_request_t *req;	
+-	json_object *_id = json_object_object_get(response, "id");
+-	int id = json_object_get_int(_id);
+-	
++	jsonrpc_request_t *req;
++	json_object *_id = NULL;
++	int id = 0;
++	json_object *result = NULL;
++
++	json_object_object_get_ex(response, "id", &_id);
++	id = json_object_get_int(_id);
+ 	if (!(req = get_request(id))) {
+ 		json_object_put(response);
+ 		return -1;
+ 	}
+ 
+-	json_object *result = json_object_object_get(response, "result");
+-	
++	json_object_object_get_ex(response, "result", &result);
++
+ 	if (result) {
+ 		req->cbfunc(result, req->cbdata, 0);
+ 	} else {
+-		json_object *error = json_object_object_get(response, "error");
++		json_object *error = NULL;
++		json_object_object_get_ex(response, "error", &error);
+ 		if (error) {
+ 			req->cbfunc(error, req->cbdata, 1);
+ 		} else {
+@@ -105,7 +109,7 @@ int handle_jsonrpc_response(json_object *response)
+ 			return -1;
+ 		}
+ 	}
+-	
++
+ 	if (req->timer_ev) {
+ 		close(req->timerfd);
+ 		event_del(req->timer_ev);
+@@ -125,14 +129,14 @@ jsonrpc_request_t* get_request(int id) {
+ 	int key = id_hash(id);
+ 	jsonrpc_request_t *req, *prev_req = NULL;
+ 	req = request_table[key];
+-	
++
+ 	while (req && req->id != id) {
+ 		prev_req = req;
+ 		if (!(req = req->next)) {
+ 			break;
+ 		};
+ 	}
+-	
++
+ 	if (req && req->id == id) {
+ 		if (prev_req != NULL) {
+ 			prev_req-> next = req->next;
+-- 
+2.8.0.rc3
+
diff --git a/debian/patches/upstream/0050-core-remove-ending-parenthesis-in-ifdef-condition.patch b/debian/patches/upstream/0050-core-remove-ending-parenthesis-in-ifdef-condition.patch
new file mode 100644
index 0000000..415350b
--- /dev/null
+++ b/debian/patches/upstream/0050-core-remove-ending-parenthesis-in-ifdef-condition.patch
@@ -0,0 +1,32 @@
+From 71f329c971d6ad18f7eda16a2b50b25e9efd3236 Mon Sep 17 00:00:00 2001
+From: Daniel-Constantin Mierla <miconda at gmail.com>
+Date: Wed, 20 Apr 2016 11:59:25 +0200
+Subject: [PATCH] core: remove ending parenthesis in ifdef condition
+
+warning: ISO C99 requires whitespace after the macro name
+sched_yield.h:34:20: warning: extra tokens at end of #ifndef directive
+ #ifndef sched_yield()
+
+- reported by Victore Seva, GH #576
+
+(cherry picked from commit 34b67125424da7ce86b5cac77e30af0711fafac1)
+---
+ sched_yield.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/sched_yield.h b/sched_yield.h
+index 1f8546d..b63f90e 100644
+--- a/sched_yield.h
++++ b/sched_yield.h
+@@ -31,7 +31,7 @@
+ #else
+ #include <unistd.h>
+ 	/* fake sched_yield */
+-#ifndef sched_yield()
++#ifndef sched_yield
+ 	#define sched_yield()	sleep(0)
+ #endif
+ #endif
+-- 
+2.8.0.rc3
+
diff --git a/debian/patches/upstream/0051-Makefile.defs-detect-kfreebsd-OS-and-set-its-default.patch b/debian/patches/upstream/0051-Makefile.defs-detect-kfreebsd-OS-and-set-its-default.patch
new file mode 100644
index 0000000..9afe79d
--- /dev/null
+++ b/debian/patches/upstream/0051-Makefile.defs-detect-kfreebsd-OS-and-set-its-default.patch
@@ -0,0 +1,83 @@
+From 615b252510cee01dc6f24ac7d12f07dcb6b50366 Mon Sep 17 00:00:00 2001
+From: Daniel-Constantin Mierla <miconda at gmail.com>
+Date: Wed, 20 Apr 2016 12:02:09 +0200
+Subject: [PATCH] Makefile.defs: detect kfreebsd OS and set its default compile
+ flags
+
+- combine the options of Linux with FreeBSD to use kqueue if available
+- reported by Victor Seva, GH #576
+
+(cherry picked from commit 4c6f879563adbbdee7c730549533a0d852e6cbef)
+---
+ Makefile.defs | 41 ++++++++++++++++++++++++++++++++++++++++-
+ 1 file changed, 40 insertions(+), 1 deletion(-)
+
+diff --git a/Makefile.defs b/Makefile.defs
+index 245f9b4..1814caf 100644
+--- a/Makefile.defs
++++ b/Makefile.defs
+@@ -113,7 +113,7 @@ SER_VER = $(shell expr $(VERSION) \* 1000000 + $(PATCHLEVEL) \* 1000 + \
+ 			$(SUBLEVEL) )
+ RELEASE:=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
+ OS := $(shell uname -s | sed -e s/SunOS/solaris/ -e s/CYGWIN.*/cygwin/ \
+-		 | tr "[A-Z]" "[a-z]")
++		 | tr "[A-Z]" "[a-z]" | tr "/" "_")
+ 
+ ifeq ($(OS),solaris)
+ 	GETARCH=isainfo -n
+@@ -392,6 +392,13 @@ ifeq ($(OS), linux)
+ 	LOCALBASE ?= /usr/local
+ endif
+ 
++ifeq ($(OS), gnu_kfreebsd)
++	doc_dir = share/doc/$(MAIN_NAME)/
++	man_dir = share/man/
++	data_dir = share/$(MAIN_NAME)/
++	LOCALBASE ?= /usr/local
++endif
++
+ ifeq ($(OS), freebsd)
+ 	doc_dir = share/doc/$(MAIN_NAME)/
+ 	man_dir = man/
+@@ -1745,6 +1752,38 @@ ifeq ($(OS), linux)
+ 	endif
+ endif
+ 
++ifeq ($(OS), gnu_kfreebsd)
++# by default use futexes if available
++	use_futex= yes
++	C_DEFS+=-DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD \
++			-DHAVE_MSG_NOSIGNAL -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H \
++			-DHAVE_TIMEGM -DHAVE_SCHED_SETSCHEDULER -DUSE_RAW_SOCKS
++	ifneq ($(found_lock_method), yes)
++		#C_DEFS+= -DUSE_POSIX_SEM
++		C_DEFS+=-DUSE_PTHREAD_MUTEX
++		LIBS+= -lpthread
++		#C_DEFS+= -DUSE_SYSV_SEM  # try posix sems
++		found_lock_method=yes
++	else
++		ifneq (,$(findstring -DUSE_POSIX_SEM, $(C_DEFS)))
++			LIBS+=-lpthread
++		endif
++		ifneq (,$(findstring -DUSE_PTHREAD_MUTEX, $(C_DEFS)))
++			LIBS+=-lpthread
++		endif
++	endif
++
++	# check for ver >= 4.1
++	ifeq ($(shell [ $(OSREL_N) -gt 4001 ] && echo has_kqueue), has_kqueue)
++		ifeq ($(NO_KQUEUE),)
++			C_DEFS+=-DHAVE_KQUEUE
++		endif
++	endif
++	ifeq ($(NO_SELECT),)
++		C_DEFS+=-DHAVE_SELECT
++	endif
++endif
++
+ ifeq  ($(OS), solaris)
+ 	C_DEFS+= -DHAVE_GETIPNODEBYNAME -DHAVE_SYS_SOCKIO_H -DHAVE_SCHED_YIELD \
+ 			-DHAVE_ALLOCA_H -DUSE_SIGACTION
+-- 
+2.8.0.rc3
+

-- 
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