summaryrefslogtreecommitdiff
path: root/res/res_pjsip_nat.c
diff options
context:
space:
mode:
authorKinsey Moore <kmoore@digium.com>2014-10-01 12:15:12 +0000
committerKinsey Moore <kmoore@digium.com>2014-10-01 12:15:12 +0000
commitac095304e6ad65b38c1e15e49ffe2ed09f15ce17 (patch)
tree9d0b93ee2879073bfd3540875fe8a6ddcade12e2 /res/res_pjsip_nat.c
parent303547231e19ba13269c362cc720d7a7a7c0c7fc (diff)
PJSIP: Force transport on contact rewrite
If contact rewriting is enabled but the contact differs in transport from what is actually being used, messages after the initial INVITE transaction can be sent to an incorrect transport/port combination. In the case where this bug occurred the remote party never received a BYE since it was sent to the remote party's TCP port over UDP. Review: https://reviewboard.asterisk.org/r/4032/ ........ Merged revisions 424244 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@424245 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_pjsip_nat.c')
-rw-r--r--res/res_pjsip_nat.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/res/res_pjsip_nat.c b/res/res_pjsip_nat.c
index 38d0ddd3c..4ba56ab4c 100644
--- a/res/res_pjsip_nat.c
+++ b/res/res_pjsip_nat.c
@@ -46,6 +46,11 @@ static pj_bool_t handle_rx_message(struct ast_sip_endpoint *endpoint, pjsip_rx_d
pjsip_dialog *dlg = pjsip_rdata_get_dlg(rdata);
pj_cstr(&uri->host, rdata->pkt_info.src_name);
+ if (strcasecmp("udp", rdata->tp_info.transport->type_name)) {
+ uri->transport_param = pj_str(rdata->tp_info.transport->type_name);
+ } else {
+ uri->transport_param.slen = 0;
+ }
uri->port = rdata->pkt_info.src_port;
/* rewrite the session target since it may have already been pulled from the contact header */