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