[sr-dev] git:master:14a3bd9e: sipdump: write proto and af for each sip message

Daniel-Constantin Mierla miconda at gmail.com
Sun Oct 15 10:02:37 CEST 2017


Module: kamailio
Branch: master
Commit: 14a3bd9eae7f3cb6af9d4b6e4250ab6c468c8b9f
URL: https://github.com/kamailio/kamailio/commit/14a3bd9eae7f3cb6af9d4b6e4250ab6c468c8b9f

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2017-10-15T10:01:25+02:00

sipdump: write proto and af for each sip message

---

Modified: src/modules/sipdump/sipdump_mod.c

---

Diff:  https://github.com/kamailio/kamailio/commit/14a3bd9eae7f3cb6af9d4b6e4250ab6c468c8b9f.diff
Patch: https://github.com/kamailio/kamailio/commit/14a3bd9eae7f3cb6af9d4b6e4250ab6c468c8b9f.patch

---

diff --git a/src/modules/sipdump/sipdump_mod.c b/src/modules/sipdump/sipdump_mod.c
index 5971322971..cb8651e0b0 100644
--- a/src/modules/sipdump/sipdump_mod.c
+++ b/src/modules/sipdump/sipdump_mod.c
@@ -152,7 +152,6 @@ typedef struct sipdump_info {
 	str buf;
 	str af;
 	str proto;
-	str subproto;
 	str src_ip;
 	int src_port;
 	str dst_ip;
@@ -177,6 +176,7 @@ int sipdump_buffer_write(sipdump_info_t *sdi, str *obuf)
 		"process: %d\n"
 		"time: %lu.%06lu\n"
 		"date: %s"
+		"proto: %.*s %.*s\n"
 		"srcip: %.*s\n"
 		"srcport: %d\n"
 		"dstip: %.*s\n"
@@ -189,6 +189,7 @@ int sipdump_buffer_write(sipdump_info_t *sdi, str *obuf)
 		process_no,
 		(unsigned long)tv.tv_sec, (unsigned long)tv.tv_usec,
 		asctime(ti),
+		sdi->proto.len, sdi->proto.s, sdi->af.len, sdi->af.s,
 		sdi->src_ip.len, sdi->src_ip.s, sdi->src_port,
 		sdi->dst_ip.len, sdi->dst_ip.s, sdi->dst_port,
 		sdi->buf.len, sdi->buf.s
@@ -229,6 +230,16 @@ int ki_sipdump_send(sip_msg_t *msg, str *stag)
 		sdi.dst_port = (int)msg->rcv.bind_address->port_no;
 	}
 
+	sdi.af.len = 4;
+	if(msg->rcv.bind_address->address.af==AF_INET6) {
+		sdi.af.s = "ipv6";
+	} else {
+		sdi.af.s = "ipv4";
+	}
+	sdi.proto.s = "none";
+	sdi.proto.len = 4;
+	get_valid_proto_string(msg->rcv.proto, 0, 0, &sdi.proto);
+
 	if(sipdump_buffer_write(&sdi, &wdata)<0) {
 		LM_ERR("failed to write to buffer\n");
 		return -1;
@@ -288,6 +299,15 @@ int sipdump_msg_received(sr_event_param_t *evp)
 		sdi.dst_ip = evp->rcv->bind_address->address_str;
 		sdi.dst_port = (int)evp->rcv->bind_address->port_no;
 	}
+	sdi.af.len = 4;
+	if(evp->rcv->bind_address->address.af==AF_INET6) {
+		sdi.af.s = "ipv6";
+	} else {
+		sdi.af.s = "ipv4";
+	}
+	sdi.proto.s = "none";
+	sdi.proto.len = 4;
+	get_valid_proto_string(evp->rcv->proto, 0, 0, &sdi.proto);
 	if(sipdump_buffer_write(&sdi, &wdata)<0) {
 		LM_ERR("failed to write to buffer\n");
 		return -1;
@@ -326,6 +346,16 @@ int sipdump_msg_sent(sr_event_param_t *evp)
 	sdi.dst_ip.s = dstip_buf;
 	sdi.dst_port = (int)su_getport(&evp->dst->to);
 
+	sdi.af.len = 4;
+	if(evp->dst->send_sock->address.af==AF_INET6) {
+		sdi.af.s = "ipv6";
+	} else {
+		sdi.af.s = "ipv4";
+	}
+	sdi.proto.s = "none";
+	sdi.proto.len = 4;
+	get_valid_proto_string(evp->dst->proto, 0, 0, &sdi.proto);
+
 	if(sipdump_buffer_write(&sdi, &wdata)<0) {
 		LM_ERR("failed to write to buffer\n");
 		return -1;




More information about the sr-dev mailing list