[asterisk-commits] PJSIP: provide transport type with received messages (asterisk[certified/13.8])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Aug 1 06:42:01 CDT 2016


Joshua Colp has submitted this change and it was merged.

Change subject: PJSIP: provide transport type with received messages
......................................................................


PJSIP: provide transport type with received messages

The receipt of a SIP MESSAGE may occur over any transport including TCP
and TLS. When the message is received, the original URI is added to the
message in the field PJSIP_RECVADDR, but this is insufficient to ensure
a reply message can reach the originating endpoint. This patch adds the
PJSIP_TRANSPORT field populated with the transport type.

ASTERISK-26132 #close

Change-Id: I28c4b1e40d573a056c81deb213ecf53e968f725e
(cherry picked from commit 69d58a1e377938e5236f51200e222eb219739441)
---
M res/res_pjsip_messaging.c
1 file changed, 18 insertions(+), 0 deletions(-)

Approvals:
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



diff --git a/res/res_pjsip_messaging.c b/res/res_pjsip_messaging.c
index 5962232..594c0fd 100644
--- a/res/res_pjsip_messaging.c
+++ b/res/res_pjsip_messaging.c
@@ -476,6 +476,24 @@
 	field = pj_sockaddr_print(&rdata->pkt_info.src_addr, buf, sizeof(buf) - 1, 1);
 	res |= ast_msg_set_var(msg, "PJSIP_RECVADDR", field);
 
+	switch (rdata->tp_info.transport->key.type) {
+	case PJSIP_TRANSPORT_UDP:
+	case PJSIP_TRANSPORT_UDP6:
+		field = "udp";
+		break;
+	case PJSIP_TRANSPORT_TCP:
+	case PJSIP_TRANSPORT_TCP6:
+		field = "tcp";
+		break;
+	case PJSIP_TRANSPORT_TLS:
+	case PJSIP_TRANSPORT_TLS6:
+		field = "tls";
+		break;
+	default:
+		field = rdata->tp_info.transport->type_name;
+	}
+	ast_msg_set_var(msg, "PJSIP_TRANSPORT", field);
+
 	if (print_body(rdata, buf, sizeof(buf) - 1) > 0) {
 		res |= ast_msg_set_body(msg, "%s", buf);
 	}

-- 
To view, visit https://gerrit.asterisk.org/3379
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I28c4b1e40d573a056c81deb213ecf53e968f725e
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: certified/13.8
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Scott Griepentrog <sgriepentrog at digium.com>



More information about the asterisk-commits mailing list