]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 376835 via svnmerge from
authorAutomerge script <automerge@asterisk.org>
Thu, 29 Nov 2012 22:28:06 +0000 (22:28 +0000)
committerAutomerge script <automerge@asterisk.org>
Thu, 29 Nov 2012 22:28:06 +0000 (22:28 +0000)
file:///srv/subversion/repos/asterisk/branches/10

................
  r376835 | elguero | 2012-11-29 15:51:50 -0600 (Thu, 29 Nov 2012) | 19 lines

  Improve Code Readability And Fix Setting natdetected Flag

  For 1.8, 10, 11 and trunk we are are improving the code readability.

  For 11 and trunk, auto nat detection was added.  The natdetected flag was being
  set to 1 when the host address in the VIA header did not specifiy a port.  This
  patch fixes this by setting the port on the temporary sock address used to
  SIP_STANDARD_PORT in order for the sock address comparison to work properly.

  (closes issue ASTERISK-20724)
  Reported by: Michael L. Young
  Patches:
      asterisk-20724-set-port-v2.diff uploaded by Michael L. Young (license 5026)

  Review: https://reviewboard.asterisk.org/r/2206/
  ........

  Merged revisions 376834 from http://svn.asterisk.org/svn/asterisk/branches/1.8
................

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

channels/chan_sip.c

index 335d63bb2efd1b54e0c90fd94f649a9632bb49ca..6a726a9c60e36b693de097fae872e368f2f68b16 100644 (file)
@@ -16929,10 +16929,12 @@ static void check_via(struct sip_pvt *p, struct sip_request *req)
 
                if (ast_sockaddr_resolve_first(&tmp, c, 0)) {
                        ast_log(LOG_WARNING, "Could not resolve socket address for '%s'\n", c);
+                       port = STANDARD_SIP_PORT;
+               } else if (!(port = ast_sockaddr_port(&tmp)) {
+                       port = STANDARD_SIP_PORT;
                }
-               port = ast_sockaddr_port(&tmp);
-               ast_sockaddr_set_port(&p->sa,
-                                     port != 0 ? port : STANDARD_SIP_PORT);
+
+               ast_sockaddr_set_port(&p->sa, port);
 
                if (sip_debug_test_pvt(p)) {
                        ast_verbose("Sending to %s (%s)\n",