]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
PJSIP: Force transport on contact rewrite
authorKinsey Moore <kmoore@digium.com>
Wed, 1 Oct 2014 12:13:20 +0000 (12:13 +0000)
committerKinsey Moore <kmoore@digium.com>
Wed, 1 Oct 2014 12:13:20 +0000 (12:13 +0000)
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/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@424244 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/res_pjsip_nat.c

index 30dae2b2930977305b762052b611da613c40faa5..d0c8f17f3a9a9c4cd3bf81d22459da14449b4893 100644 (file)
@@ -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 */