Revision
16801
Author
anthm
Date
2010-02-24 12:13:28 -0600 (Wed, 24 Feb 2010)

Log Message

add force_local_ip_v4 and force_local_ip_v6 global vars to override the core funcs to always discover the same ip

Modified Paths

Diff

Modified: freeswitch/trunk/src/switch_utils.c (16800 => 16801)


--- freeswitch/trunk/src/switch_utils.c	2010-02-24 15:55:06 UTC (rev 16800)
+++ freeswitch/trunk/src/switch_utils.c	2010-02-24 18:13:28 UTC (rev 16801)
@@ -980,6 +980,8 @@
 {
 	switch_status_t status = SWITCH_STATUS_FALSE;
 	char *base;
+	const char *force_local_ip_v4 = switch_core_get_variable("force_local_ip_v4");
+	const char *force_local_ip_v6 = switch_core_get_variable("force_local_ip_v6");
 
 #ifdef WIN32
 	SOCKET tmp_socket;
@@ -996,6 +998,22 @@
 	char abuf[25] = "";
 #endif
 
+	switch (family) {
+	case AF_INET:
+		if (force_local_ip_v4) {
+			switch_copy_string(buf, force_local_ip_v4, len);
+		}
+		return SWITCH_STATUS_SUCCESS;
+	case AF_INET6:
+		if (force_local_ip_v6) {
+			switch_copy_string(buf, force_local_ip_v6, len);
+		}
+		return SWITCH_STATUS_SUCCESS;
+	default:
+		break;
+	}
+
+
 	if (len < 16) {
 		return status;
 	}