[asterisk-commits] jpeeler: branch jpeeler/sip-dnsmgr r111959 - /team/jpeeler/sip-dnsmgr/channels/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Mar 30 00:39:28 CDT 2008


Author: jpeeler
Date: Sun Mar 30 00:39:26 2008
New Revision: 111959

URL: http://svn.digium.com/view/asterisk?view=rev&rev=111959
Log:
honor global_srvlookup setting and properly fix dnsmgr for peers, although i can't test right now

Modified:
    team/jpeeler/sip-dnsmgr/channels/chan_sip.c

Modified: team/jpeeler/sip-dnsmgr/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/jpeeler/sip-dnsmgr/channels/chan_sip.c?view=diff&rev=111959&r1=111958&r2=111959
==============================================================================
--- team/jpeeler/sip-dnsmgr/channels/chan_sip.c (original)
+++ team/jpeeler/sip-dnsmgr/channels/chan_sip.c Sun Mar 30 00:39:26 2008
@@ -4133,8 +4133,6 @@
 
 	dialog->sa.sin_port = htons(portno);
 	dialog->recv = dialog->sa;
-
-	ast_log(LOG_DEBUG, "Wow... trying again, port=%d\n", ntohs(dialog->sa.sin_port));
 	return 0;
 }
 
@@ -9118,9 +9116,6 @@
 	/* if we are here, we know that we need to reregister. */
 	struct sip_registry *r= registry_addref((struct sip_registry *) data);
 
-	/* jeff: remove */
-	ast_log(LOG_DEBUG, "sip_reregister ******************************************************\n");
-
 	/* if we couldn't get a reference to the registry object, punt */
 	if (!r)
 		return 0;
@@ -9228,11 +9223,10 @@
 
 	if (r->dnsmgr == NULL) {
 		char transport[MAXHOSTNAMELEN];
-		//ast_dnsmgr_lookup(r->hostname, &r->us.sin_addr, &r->dnsmgr);
  
 		snprintf(transport, sizeof(transport), "_sip._%s", get_transport(r->transport)); /* have to use static get_transport function */
 		ast_log(LOG_DEBUG, "hostname: %s portno:%d sin_family:%d\n", r->hostname, r->portno, r->us.sin_family);
-		ast_dnsmgr_lookup(r->hostname, &r->us, &r->dnsmgr, transport);
+		ast_dnsmgr_lookup(r->hostname, &r->us, &r->dnsmgr, global_srvlookup ? transport : NULL);
 		ast_log(LOG_DEBUG, "after dnsmgr lookup port=%d\n", htons(r->us.sin_port));
 	} else {
 		ast_log(LOG_DEBUG, "DNS manager detected, r->us.sin_addr=%s r->us.sin_port=%d r->us.sin_family=%d\n", ast_inet_ntoa(r->us.sin_addr), ntohs(r->us.sin_port), r->us.sin_family);
@@ -19930,13 +19924,6 @@
 				AST_SCHED_DEL(sched, peer->expire);
 				peer->host_dynamic = FALSE;
 				srvlookup = v->value;
-
-				/* TODO: needs to be moved */
-				/*
-				if (peer->dnsmgr == NULL) {
-					ast_dnsmgr_lookup(srvlookup, &peer->addr.sin_addr, &peer->dnsmgr, NULL);
-				}
-				*/
 			}
 		} else if (!strcasecmp(v->name, "defaultip")) {
 			if (ast_get_ip(&peer->defaddr, v->value)) {
@@ -20101,13 +20088,11 @@
 		}
 	}
 
-	if (srvlookup) {
-		if (ast_get_ip_or_srv(&peer->addr, srvlookup, 
-								global_srvlookup ?  
-									((peer->socket.type & SIP_TRANSPORT_UDP) ? "_sip._udp" :
-									 (peer->socket.type & SIP_TRANSPORT_TCP) ? "_sip._tcp" :
-									 "_sip._tls")
-									: NULL)) {
+	if (srvlookup && peer->dnsmgr == NULL) {
+		char transport[MAXHOSTNAMELEN];
+		snprintf(transport, sizeof(transport), "_sip._%s", get_transport(peer->socket.type));
+
+		if (ast_dnsmgr_lookup(srvlookup, &peer->addr, &peer->dnsmgr, global_srvlookup ? transport : NULL)) {
 			unref_peer(peer);
 			return NULL;
 		}




More information about the asterisk-commits mailing list