[sr-dev] git:master:6173ef7b: Merge pull request #365 from kamailio/lazedo-patch-1

lazedo luis.azedo at factorlusitano.com
Thu Oct 8 18:54:39 CEST 2015


Module: kamailio
Branch: master
Commit: 6173ef7ba8a9d8eb566f1a192e5915ef74cfc159
URL: https://github.com/kamailio/kamailio/commit/6173ef7ba8a9d8eb566f1a192e5915ef74cfc159

Author: lazedo <luis.azedo at factorlusitano.com>
Committer: lazedo <luis.azedo at factorlusitano.com>
Date: 2015-10-08T09:54:32-07:00

Merge pull request #365 from kamailio/lazedo-patch-1

presence: use advertised ip for local contact

---

Modified: modules/presence/utils_func.h

---

Diff:  https://github.com/kamailio/kamailio/commit/6173ef7ba8a9d8eb566f1a192e5915ef74cfc159.diff
Patch: https://github.com/kamailio/kamailio/commit/6173ef7ba8a9d8eb566f1a192e5915ef74cfc159.patch

---

diff --git a/modules/presence/utils_func.h b/modules/presence/utils_func.h
index 866df1b..6592375 100644
--- a/modules/presence/utils_func.h
+++ b/modules/presence/utils_func.h
@@ -124,15 +124,18 @@ static inline int ps_fill_local_contact(struct sip_msg* msg, str *contact)
 		goto error;
 	}	
 	
-	ip.s= ip_addr2a(&msg->rcv.dst_ip);
-	if(ip.s== NULL)
-	{
-		LM_ERR("transforming ip_addr to ascii\n");
-		goto error;
+	if(msg->rcv.bind_address->useinfo.name.len>0) {
+		ip = msg->rcv.bind_address->useinfo.name;
+	} else {
+		ip = msg->rcv.bind_address->address_str;
 	}
-	ip.len= strlen(ip.s);
-	port = msg->rcv.dst_port;
 
+	if(msg->rcv.bind_address->useinfo.port_no>0) {
+		port = msg->rcv.bind_address->useinfo.port_no;
+	} else {
+		port = msg->rcv.bind_address->port_no;
+	}
+	
 	if(strncmp(ip.s, "sip:", 4)!=0)
 	{
 		strncpy(contact->s, "sip:", 4);




More information about the sr-dev mailing list