Hi,

Could you try the attached patch?

Regards,
Bogdan

vallimamod abdullah wrote:
Hello list,

I am using the mi_datagram module to send MI commands through UDP socket and I 
have noticed that when I send ':pua_publish:' command, the publish is received 
and treated correctly by Opensips but I get no reply for the MI server. I have 
checked with other commands like ':get_statistics:', it works ok. On the logs, 
here is what I see for the answer:

[2010-09-16 19:46:55] debug - /usr/sbin/opensips[4698]: 
DBG:mi_datagram:mi_datagram_write_node: writing the name <> and value <200 OK>.
[2010-09-16 19:46:55] debug - /usr/sbin/opensips[4698]: 
DBG:mi_datagram:mi_datagram_write_node: writing the name <ETag> and value 
<a.1284562316.4696.298.327>.
[2010-09-16 19:46:55] debug - /usr/sbin/opensips[4698]: 
DBG:mi_datagram:mi_datagram_write_node: writing the name <Expires> and value 
<590>.
[2010-09-16 19:46:55] debug - /usr/sbin/opensips[4698]: 
DBG:mi_datagram:datagram_close_async: the response is 200 OK 200 OK ETag:: 
a.1284562316.4696.298.327 Expires:: 590
[2010-09-16 19:46:55] debug - /usr/sbin/opensips[4698]: 
DBG:mi_datagram:mi_send_dgram: response is 200 OK 200 OK ETag:: 
a.1284562316.4696.298.327 Expires:: 590    tolen is 16 and len is 61
[2010-09-16 19:46:55] debug - /usr/sbin/opensips[4698]: 
DBG:mi_datagram:datagram_close_async: the response: 200 OK 200 OK ETag:: 
a.1284562316.4696.298.327 Expires:: 590  has been sent in 61 octets

Is it normal to have "200 OK" twice ?

My initial command is:

:pua_publish:
"sip:*62#[email protected]"
3600
dialog
application/pidf+xml
.
.
<?xml version='1.0'?><dialog-info xmlns='urn:ietf:params:xml:ns:dialog-info' version='1' state='full' 
entity='sip:*62#[email protected]'><dialog id='[email protected]' 
direction='recipient'><state>confirmed</state></dialog></dialog-info>

I am using opensips 1.6.3 svn r7206.

Thank you !

Regards,
-vma
.


_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



--
Bogdan-Andrei Iancu
OpenSIPS Bootcamp
15 - 19 November 2010, Edison, New Jersey, USA
www.voice-system.ro

Index: modules/mi_datagram/datagram_fnc.c
===================================================================
--- modules/mi_datagram/datagram_fnc.c	(revision 7216)
+++ modules/mi_datagram/datagram_fnc.c	(working copy)
@@ -59,10 +59,19 @@
 int flags;
 static char *mi_buf = 0;
 
-static union {
+typedef union {
 	struct sockaddr_un un;
 	struct sockaddr_in in;
-} reply_addr;
+} reply_addr_t;
+
+
+typedef struct{
+	reply_addr_t address;
+	int address_len;
+	int tx_sock;
+}my_socket_address;
+
+static reply_addr_t reply_addr;
 static unsigned int reply_addr_len;
 
 /* Timeout for sending replies in milliseconds */
@@ -379,7 +388,7 @@
 
 
 static inline struct mi_handler* build_async_handler(unsigned int sock_domain,
-								struct sockaddr *reply_addr, 
+								reply_addr_t *reply_addr,
 								unsigned int reply_addr_len, int tx_sock)
 {
 	struct mi_handler *hdl;
@@ -397,24 +406,7 @@
 	p = (void *)((hdl) + 1);
 	repl_address = p;
 
-	switch(sock_domain) {
-		/*we can have either of these types of sockets*/
-		case AF_LOCAL:	LM_DBG("we have an unix socket\n");
-						memcpy(&repl_address->address.unix_deb, 
-								reply_addr, reply_addr_len);
-						break;
-		case AF_INET:	LM_DBG("we have an IPv4 socket\n");
-						memcpy(&repl_address->address.inet_v4, 
-								reply_addr, reply_addr_len);
-						break;
-		case AF_INET6:	LM_DBG("we have an IPv6 socket\n");
-						memcpy(&repl_address->address.inet_v6, 
-								reply_addr, reply_addr_len);
-						break;
-		default:		LM_CRIT("socket_domain has an incorrect value\n");
-						shm_free(hdl);
-						return 0;
-	}
+	memcpy( &repl_address->address, reply_addr, sizeof(reply_addr_t));
 
 	repl_address->address_len  = reply_addr_len;
 	repl_address->tx_sock = tx_sock;
@@ -493,7 +485,7 @@
 		/* 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, tx_sock);
+					&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,
Index: modules/mi_datagram/mi_datagram.h
===================================================================
--- modules/mi_datagram/mi_datagram.h	(revision 7216)
+++ modules/mi_datagram/mi_datagram.h	(working copy)
@@ -51,22 +51,8 @@
 	union sockaddr_union udp_addr;
 	struct sockaddr_un   unix_addr;
 }sockaddr_dtgram;
-/*union because we support 3 types of sockaddr : 
-	UNIX, IPv4 and IPv6*/
 
-typedef union{
-		struct sockaddr_un unix_deb;
-		struct sockaddr_in inet_v4;
-		struct sockaddr_in6 inet_v6;
-}my_sock_address;
 
-typedef struct{
-	my_sock_address address;
-	int address_len;
-	int tx_sock;
-}my_socket_address;
-
-
 #endif /* _MI_DATAGRAM */
 
 
_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to