]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Don't do a DNS lookup on an outbound REGISTER host if there is an outbound proxy...
authorMark Michelson <mmichelson@digium.com>
Tue, 24 Jan 2012 22:17:46 +0000 (22:17 +0000)
committerMark Michelson <mmichelson@digium.com>
Tue, 24 Jan 2012 22:17:46 +0000 (22:17 +0000)
(closes issue ASTERISK-16550)
reported by: Olle Johansson

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

channels/chan_sip.c

index 911596c3efe11d100e37dd5f57a64f9d63d96863..6a19c423de2102c583130f75ec6c8a41623dbab2 100644 (file)
@@ -13069,7 +13069,14 @@ static int transmit_register(struct sip_registry *r, int sipmethod, const char *
                peer = 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 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 = unref_peer(peer, "removing peer ref for dnsmgr_lookup");
                }