diff --git a/modules/mi_datagram/datagram_fnc.c b/modules/mi_datagram/datagram_fnc.c
index 3952580..1c97da9 100644
--- a/modules/mi_datagram/datagram_fnc.c
+++ b/modules/mi_datagram/datagram_fnc.c
@@ -147,19 +147,21 @@ int  mi_init_datagram_server(sockaddr_dtgram *addr, unsigned int socket_domain,
 				LM_ERR("bind: %s\n", strerror(errno));
 				goto err_rx;
 			}
+			socks->tx_sock = socks->rx_sock;
 			break;
 	case AF_INET6: 
 			if(bind(socks->rx_sock, (struct sockaddr*)&addr->udp_addr.sin6, sizeof(addr->udp_addr)) < 0) {
 				LM_ERR("bind: %s\n", strerror(errno));
 				goto err_rx;
 			}
+			socks->tx_sock = socks->rx_sock;
 			break;
 	default:
 			LM_ERR("domain not supported\n");
 			goto err_both;
 
 	}
-	mi_create_dtgram_replysocket(socks->tx_sock,socket_domain, err_both);
+	//mi_create_dtgram_replysocket(socks->tx_sock,socket_domain, err_both);
 
 	return 0;
 err_both:
@@ -325,13 +327,13 @@ static void datagram_close_async(struct mi_root *mi_rpl,struct mi_handler *hdl,
 	datagram_stream dtgram;
 	int ret;
 	my_socket_address *p;
-	int reply_sock, flags;
+	//int reply_sock, flags;
 
 	p = (my_socket_address *)hdl->param;
 
 	LM_DBG("the socket domain is %i and af_local is %i\n", p->domain, AF_LOCAL);
 
-	mi_create_dtgram_replysocket(reply_sock, p->domain, err);
+	//mi_create_dtgram_replysocket(reply_sock, p->domain, err);
 
         memset(&dtgram, 0, sizeof(dtgram));
 
@@ -350,7 +352,8 @@ static void datagram_close_async(struct mi_root *mi_rpl,struct mi_handler *hdl,
 		LM_DBG("the response is %s", dtgram.start);
 
 		/*send the response*/
-		ret = mi_send_dgram(reply_sock, dtgram.start, dtgram.current - dtgram.start, 
+		//ret = mi_send_dgram(reply_sock, dtgram.start, dtgram.current - dtgram.start, 
+		ret = mi_send_dgram(p->tx_sock, dtgram.start, dtgram.current - dtgram.start, 
 			(struct sockaddr *)&p->address, p->address_len, mi_socket_timeout);
 		if (ret>0) {
 			LM_DBG("the response: %s has been sent in %i octets\n", dtgram.start, ret);
@@ -360,25 +363,27 @@ static void datagram_close_async(struct mi_root *mi_rpl,struct mi_handler *hdl,
 		free_mi_tree(mi_rpl);
 		pkg_free(dtgram.start);
 	} else if (done) {
-		mi_send_dgram(reply_sock, MI_COMMAND_FAILED, MI_COMMAND_FAILED_LEN,
+		//mi_send_dgram(reply_sock, MI_COMMAND_FAILED, MI_COMMAND_FAILED_LEN,
+		mi_send_dgram(p->tx_sock, MI_COMMAND_FAILED, MI_COMMAND_FAILED_LEN,
 				(struct sockaddr*)&reply_addr, reply_addr_len, mi_socket_timeout);
 		free_async_handler( hdl );
 	}
 
-	close(reply_sock);
+	//close(reply_sock);
 	return;
 
 err:
 	if(dtgram.start)
 		pkg_free(dtgram.start);
-	close(reply_sock);
+	//close(reply_sock);
 	return;
 }
 
 
 
 static inline struct mi_handler *build_async_handler(unsigned int sock_domain,
-			struct sockaddr *reply_addr, unsigned int reply_addr_len)
+			//struct sockaddr *reply_addr, unsigned int reply_addr_len)
+			struct sockaddr *reply_addr, unsigned int reply_addr_len, int tx_sock)
 {
 	struct mi_handler *hdl;
 	void *p;
@@ -410,6 +415,7 @@ static inline struct mi_handler *build_async_handler(unsigned int sock_domain,
 	}
 	repl_address->domain = sock_domain;
 	repl_address->address_len  = reply_addr_len;
+	repl_address->tx_sock = tx_sock;
 
 	hdl->handler_f = datagram_close_async;
 	hdl->param = (void*)repl_address;
@@ -486,7 +492,8 @@ void mi_datagram_server(int rx_sock, int tx_sock)
 		/* if asyncron cmd, build the async handler */
 		if (f->flags&MI_ASYNC_RPL_FLAG) {
 			hdl = build_async_handler(mi_socket_domain,
-					(struct sockaddr* )&reply_addr, reply_addr_len);
+					//(struct sockaddr* )&reply_addr, reply_addr_len);
+					(struct sockaddr* )&reply_addr, reply_addr_len, tx_sock);
 			if (hdl==0) {
 				LM_ERR("failed to build async handler\n");
 				mi_send_dgram(tx_sock, MI_INTERNAL_ERROR,
diff --git a/modules/mi_datagram/mi_datagram.h b/modules/mi_datagram/mi_datagram.h
index 35a25e4..d9f9f34 100644
--- a/modules/mi_datagram/mi_datagram.h
+++ b/modules/mi_datagram/mi_datagram.h
@@ -65,6 +65,7 @@ typedef struct{
 	my_sock_address address;
 	unsigned int domain;
 	int address_len;
+	int tx_sock;
 } my_socket_address;
 
 
