Commit 140417 had a logic flaw in it which

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
This commit is contained in:
Mark Michelson
2008-09-05 16:00:24 +00:00
parent 8f720a0bdf
commit 20d7257914

View 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;