summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2012-01-24 22:28:08 +0000
committerMark Michelson <mmichelson@digium.com>2012-01-24 22:28:08 +0000
commit0fe90432334fdf6aabf82391f5f2ca83f494a033 (patch)
treeb8d0f1379bf1971a31dbbf8c7bc97c49f6561968 /channels
parentb68b7e55acd5d8065995a8cdeb74cabf6f5b815a (diff)
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 ........ Merged revisions 352430 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@352431 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index a29ca9c55..1889fe4cc 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -13383,7 +13383,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");
}