]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Support ;rport when we're supposed to support ;rport. Issue #7473.
authorOlle Johansson <oej@edvina.net>
Tue, 31 Oct 2006 10:26:16 +0000 (10:26 +0000)
committerOlle Johansson <oej@edvina.net>
Tue, 31 Oct 2006 10:26:16 +0000 (10:26 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@46628 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c
configs/sip.conf.sample

index b5f15cff4912d0dfcdd50ce2e316e25644db3c2d..0b1d7d1e9779a760fa43eed531f972062ef44da7 100644 (file)
@@ -5265,7 +5265,8 @@ static int copy_via_headers(struct sip_pvt *p, struct sip_request *req, const st
                        if (rport && *(rport+6) == '=') 
                                rport = NULL;           /* We already have a parameter to rport */
 
-                       if (rport && ast_test_flag(&p->flags[0], SIP_NAT) == SIP_NAT_ALWAYS) {
+                       /* Check rport if NAT=yes or NAT=rfc3581 (which is the default setting)  */
+                       if (rport && ((ast_test_flag(&p->flags[0], SIP_NAT) == SIP_NAT_ALWAYS) || (ast_test_flag(&p->flags[0], SIP_NAT) == SIP_NAT_RFC3581))) {
                                /* We need to add received port - rport */
                                char tmp[256], *end;
 
@@ -5282,9 +5283,6 @@ static int copy_via_headers(struct sip_pvt *p, struct sip_request *req, const st
                                }
 
                                /* Add rport to first VIA header if requested */
-                               /* Whoo hoo!  Now we can indicate port address translation too!  Just
-                                  another RFC (RFC3581). I'll leave the original comments in for
-                                  posterity.  */
                                snprintf(new, sizeof(new), "%s;received=%s;rport=%d",
                                        tmp, ast_inet_ntoa(p->recv.sin_addr),
                                        ntohs(p->recv.sin_port));
index ef4fa2cda71db0033fce8678a10c608a28002a0c..eb5334693191e63cdf5d015e02e1d2a88d1dad0e 100644 (file)
@@ -243,7 +243,7 @@ srvlookup=yes                       ; Enable DNS SRV lookups on outbound calls
 ;
 ;nat=no                                ; Global NAT settings  (Affects all peers and users)
                                 ; yes = Always ignore info and assume NAT
-                                ; no = Use NAT mode only according to RFC3581 
+                                ; no = Use NAT mode only according to RFC3581 (;rport)
                                 ; never = Never attempt NAT mode or RFC3581 support
                                ; route = Assume NAT, don't send rport 
                                ; (work around more UNIDEN bugs)