[svn-commits] jpeeler: branch jpeeler/sip-dnsmgr r109712 - /team/jpeeler/sip-dnsmgr/channels/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Mar 18 15:37:31 CDT 2008


Author: jpeeler
Date: Tue Mar 18 15:37:30 2008
New Revision: 109712

URL: http://svn.digium.com/view/asterisk?view=rev&rev=109712
Log:
checkpoint, IP address gets changed for one dialog, but then seems to return to original DNS lookup performed upon initial registration

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=109712&r1=109711&r2=109712
==============================================================================
--- team/jpeeler/sip-dnsmgr/channels/chan_sip.c (original)
+++ team/jpeeler/sip-dnsmgr/channels/chan_sip.c Tue Mar 18 15:37:30 2008
@@ -2530,7 +2530,7 @@
 	int res = 0;
 	const struct sockaddr_in *dst = sip_real_dst(p);
 
-	ast_debug(1, "Trying to put '%.10s' onto %s socket...\n", data->str, get_transport(p->socket.type));
+	ast_debug(1, "Trying to put '%.10s' onto %s socket at %s...\n", data->str, get_transport(p->socket.type), ast_inet_ntoa(dst->sin_addr));
 
 	if (sip_prepare_socket(p) < 0)
 		return XMIT_ERROR;
@@ -9205,7 +9205,7 @@
 
 	if (r->dnsmgr == NULL) {
 		ast_dnsmgr_lookup(r->hostname, &sin, &r->dnsmgr);
-		memcpy(&sin, &r->us.sin_addr, sizeof(sin));
+		memcpy(&r->us.sin_addr, &sin, sizeof(sin));
 		ast_log(LOG_DEBUG, "dnsmgr was NULL\n");
 	} else {
 		changed = ast_dnsmgr_changed(r->dnsmgr);
@@ -9223,12 +9223,6 @@
 			ast_string_field_set(p, theirtag, NULL);	/* forget their old tag, so we don't match tags when getting response */
 		}
 	} else {
-		if (changed) {
-			ast_log(LOG_DEBUG, "IP change detected, cancelling current registration\n");
-			//ast_dnsmgr_get(r->hostname, &sin);
-			//memcpy(&sin, &r->us.sin_addr, sizeof(sin));
-			//r->call = sip_destroy(r->call);
-		}
 
 		/* Build callid for registration if we haven't registered before */
 		if (!r->callid_valid) {
@@ -9294,6 +9288,14 @@
 		/* Set transport and port so the correct contact is built */
 		p->socket.type = r->transport;
 		p->socket.port = htons(r->portno);
+
+		if (changed) {
+			//struct sockaddr_in real;
+			//real = sip_real_dst(r->call);
+			ast_dnsmgr_get(r->hostname, &sin);
+			ast_log(LOG_DEBUG, "IP change detected for hostname=%s, updating to %s...\n", r->hostname, ast_inet_ntoa(sin));
+			memcpy(&r->call->sa.sin_addr, &sin, sizeof(sin));
+	 	}
 		/*
 		  check which address we should use in our contact header 
 		  based on whether the remote host is on the external or




More information about the svn-commits mailing list