]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix SIP's parsing so that if a port is specified
authorMark Michelson <mmichelson@digium.com>
Fri, 29 Aug 2008 15:26:52 +0000 (15:26 +0000)
committerMark Michelson <mmichelson@digium.com>
Fri, 29 Aug 2008 15:26:52 +0000 (15:26 +0000)
in a string to Dial(), it is not ignored.

(closes issue #13355)
Reported by: acunningham
Patches:
      13355v2.patch uploaded by putnopvut (license 60)
Tested by: acunningham

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

channels/chan_sip.c

index e873a162f161a789ad9c2dd497bb1b494b66bb2c..a99428774cdfd9f564224741f92c9b7c69b6cd3c 100644 (file)
@@ -2903,14 +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) {
+                       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;