summaryrefslogtreecommitdiff
path: root/res/res_pjsip_messaging.c
diff options
context:
space:
mode:
authorScott Griepentrog <scott@griepentrog.com>2016-06-21 10:53:05 -0500
committerScott Griepentrog <scott@griepentrog.com>2016-06-21 10:55:24 -0500
commit596d0b0bc39a945490bc00ee90e406f42062a0b9 (patch)
tree2cbf57bada29318a12b4c3076b4d6d7e47f057a2 /res/res_pjsip_messaging.c
parentd22ce6fd3eb2217c8c3506c9ff4a4da0745f9431 (diff)
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
Diffstat (limited to 'res/res_pjsip_messaging.c')
-rw-r--r--res/res_pjsip_messaging.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/res/res_pjsip_messaging.c b/res/res_pjsip_messaging.c
index f72f3f015..b508a2a59 100644
--- a/res/res_pjsip_messaging.c
+++ b/res/res_pjsip_messaging.c
@@ -476,6 +476,24 @@ static enum pjsip_status_code rx_data_to_ast_msg(pjsip_rx_data *rdata, struct as
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);
}