From: Mark Michelson Date: Tue, 24 Jan 2012 22:22:57 +0000 (+0000) Subject: Don't do a DNS lookup on an outbound REGISTER host if there is an outbound proxy... X-Git-Tag: 10.2.0-rc1~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6a8768cfce49f84071af060d26c40fba0eddb452;p=thirdparty%2Fasterisk.git Don't do a DNS lookup on an outbound REGISTER host if there is an outbound proxy configured. (closes issue ASTERISK-16550) reported by: Olle Johansson ........ Merged revisions 352424 from http://svn.asterisk.org/svn/asterisk/branches/1.8 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/10@352430 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 94236331c4..3013bc6525 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -13348,7 +13348,14 @@ static int transmit_register(struct sip_registry *r, int sipmethod, const char * peer = sip_find_peer(r->hostname, NULL, TRUE, FINDPEERS, FALSE, 0); snprintf(transport, sizeof(transport), "_%s._%s",get_srv_service(r->transport), get_srv_protocol(r->transport)); /* have to use static sip_get_transport function */ r->us.ss.ss_family = get_address_family_filter(&bindaddr); /* Filter address family */ - ast_dnsmgr_lookup(peer ? peer->tohost : r->hostname, &r->us, &r->dnsmgr, sip_cfg.srvlookup ? transport : NULL); + + /* No point in doing a DNS lookup of the register hostname if we're just going to + * end up using an outbound proxy. obproxy_get is safe to call with either of r->call + * or peer NULL. Since we're only concerned with its existence, we're not going to + * bother getting a ref to the proxy*/ + if (!obproxy_get(r->call, peer)) { + ast_dnsmgr_lookup(peer ? peer->tohost : r->hostname, &r->us, &r->dnsmgr, sip_cfg.srvlookup ? transport : NULL); + } if (peer) { peer = sip_unref_peer(peer, "removing peer ref for dnsmgr_lookup"); }