[asterisk-bugs] [JIRA] (ASTERISK-25387) res_pjsip_nat: Malformed REGISTER request causes NAT'd Contact header to not be rewritten

Matt Jordan (JIRA) noreply at issues.asterisk.org
Thu Sep 10 08:38:33 CDT 2015


Matt Jordan created ASTERISK-25387:
--------------------------------------

             Summary: res_pjsip_nat: Malformed REGISTER request causes NAT'd Contact header to not be rewritten
                 Key: ASTERISK-25387
                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-25387
             Project: Asterisk
          Issue Type: Bug
      Security Level: None
          Components: Resources/res_pjsip_nat
    Affects Versions: 13.5.0
            Reporter: Matt Jordan
            Severity: Minor


Consider the following REGISTER request:

{code}
<--- Received SIP request (699 bytes) from UDP:127.0.0.1:5060 --->
REGISTER sip:127.0.0.1:5061 SIP/2.0
Record-Route: <sip:127.0.0.1;lr>
Via: SIP/2.0/UDP 127.0.0.1;branch=z9hG4bK007b.2356f13f445725767aee5ecd1028fc69.0
Via: SIP/2.0/UDP 127.0.0.1:5070;received=127.0.0.1;rport=5070;branch=z9hG4bKPj454b6886-a832-48b2-aae1-694be8ccbf5b
Route: <sip:127.0.0.1:5060;lr>
From: <sip:foo at 127.0.0.1>;tag=8e2a25cb-8999-4397-9bb4-d204622ba14f
To: <sip:foo at 127.0.0.1>
Call-ID: 1ba5c0a5-4bb4-4d76-a0d1-416f0cae63ba
CSeq: 59033 REGISTER
Contact: <sip:foo at 127.0.0.1:5070>
Expires: 3600
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REGISTER, REFER
Max-Forwards: 69
User-Agent: bar
Content-Length:  0


{code}

For some sad reason, this REGISTER request contains a Record-Route header, which is clearly shouldn't:

{quote}
   A REGISTER request does not establish a dialog.  A UAC MAY include a
   Route header field in a REGISTER request based on a pre-existing
   route set as described in Section 8.1.  The Record-Route header field
   has no meaning in REGISTER requests or responses, and MUST be ignored
   if present.  In particular, the UAC MUST NOT create a new route set
   based on the presence or absence of a Record-Route header field in
   any response to a REGISTER request.
{quote}

Unfortunately, we don't ignore the Record-Route header in {{res_pjsip_nat}} if the request is a REGISTER request. As a result, this REGISTER request will cause the Contact to stay at {{127.0.0.1:5070}} instead of being rewritten to the received IP/port of {{127.0.0.1:5060}}.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list