]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Commit 140417 had a logic flaw in it which
authorMark Michelson <mmichelson@digium.com>
Fri, 5 Sep 2008 16:00:24 +0000 (16:00 +0000)
committerMark Michelson <mmichelson@digium.com>
Fri, 5 Sep 2008 16:00:24 +0000 (16:00 +0000)
caused port 5060 to always be used when dialing
a peer if no explicit port was specified. This
broke the behavior of implicitly using the port
from which the peer registered if no port is
specified. This commit fixes the logic flaw.

(closes issue #13424)
Reported by: mdu113
Patches:
      13424.patch uploaded by putnopvut (license 60)
Tested by: mdu113

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

channels/chan_sip.c

index a99428774cdfd9f564224741f92c9b7c69b6cd3c..6e9d135a852b1193df96cc54c07cc12cc1c405a7 100644 (file)
@@ -2903,18 +2903,18 @@ static int create_addr(struct sip_pvt *dialog, const char *opeer)
        dialog->sa.sin_family = AF_INET;
        dialog->timer_t1 = 500; /* Default SIP retransmission timer T1 (RFC 3261) */
        p = find_peer(peer, NULL, 1, 0);
-       
-       portno = port ? atoi(port) : STANDARD_SIP_PORT;
 
        if (p) {
                int res = create_addr_from_peer(dialog, p);
-               if (portno) {
+               if (port) {
+                       portno = atoi(port);
                        dialog->sa.sin_port = dialog->recv.sin_port = htons(portno);
                }
                ASTOBJ_UNREF(p, sip_destroy_peer);
                return res;
        }
        hostn = peer;
+       portno = port ? atoi(port) : STANDARD_SIP_PORT;
        if (srvlookup) {
                char service[MAXHOSTNAMELEN];
                int tportno;