aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2009-02-09 17:20:55 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2009-02-09 17:20:55 +0000
commita610dee8ab88ecb0f7bd8a87f0300436ca675807 (patch)
tree7890e35b9b5373ef5bceaabd23e1edfe9eda8d41 /channels
parentcdb08bd41966149a706425f7ee4edd60e47dd9ef (diff)
Merged revisions 174282 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r174282 | mmichelson | 2009-02-09 11:11:05 -0600 (Mon, 09 Feb 2009) | 12 lines Don't do an SRV lookup if a port is specified RFC 3263 says to do A record lookups on a hostname if a port has been specified, so that's what we're going to do. See section 4.2. (closes issue #14419) Reported by: klaus3000 Patches: patch_chan_sip_nosrvifport_1.4.23.txt uploaded by klaus3000 (license 65) ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@174301 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index a6d9c2c0a..eea6d026f 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -4818,7 +4818,7 @@ static int create_addr(struct sip_pvt *dialog, const char *opeer, struct sockadd
struct ast_hostent ahp;
struct sip_peer *peer;
char *port;
- int portno;
+ int portno = 0;
char host[MAXHOSTNAMELEN], *hostn;
char peername[256];
int srv_ret = 0;
@@ -4873,8 +4873,10 @@ static int create_addr(struct sip_pvt *dialog, const char *opeer, struct sockadd
In the future, we should first check NAPTR to find out transport preference
*/
hostn = peername;
- portno = port ? atoi(port) : (dialog->socket.type & SIP_TRANSPORT_TLS) ? STANDARD_TLS_PORT : STANDARD_SIP_PORT;
- if (sip_cfg.srvlookup) {
+ /* Section 4.2 of RFC 3263 specifies that if a port number is specified, then
+ * an A record lookup should be used instead of SRV.
+ */
+ if (!port && sip_cfg.srvlookup) {
char service[MAXHOSTNAMELEN];
int tportno;
@@ -4885,7 +4887,8 @@ static int create_addr(struct sip_pvt *dialog, const char *opeer, struct sockadd
portno = tportno;
}
}
-
+ if (!portno)
+ portno = port ? atoi(port) : STANDARD_SIP_PORT;
hp = ast_gethostbyname(hostn, &ahp);
if (!hp) {
ast_log(LOG_WARNING, "No such host: %s\n", peername);