From ba32c8c4d5fe0ed939a0368c38383ac0a422a0da Mon Sep 17 00:00:00 2001
From: Brian West <brian@freeswitch.org>
Date: Thu, 4 Jun 2009 05:43:34 +0000
Subject: [PATCH]  check the nat

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13608 d0543943-73ff-0310-b7d9-9358b9ac24b2
---
 src/mod/endpoints/mod_sofia/sofia_reg.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c
index 5d5a93f5b3..7aa06dbbbd 100644
--- a/src/mod/endpoints/mod_sofia/sofia_reg.c
+++ b/src/mod/endpoints/mod_sofia/sofia_reg.c
@@ -311,7 +311,9 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now)
 
 			sofia_reg_new_handle(gateway_ptr, now ? 1 : 0);
 
-			user_via = sofia_glue_create_external_via(NULL, gateway_ptr->profile, gateway_ptr->register_transport);
+			if (sofia_glue_check_nat(gateway_ptr->profile, gateway_ptr->register_proxy)) {
+				user_via = sofia_glue_create_external_via(NULL, gateway_ptr->profile, gateway_ptr->register_transport);
+			}
 
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Registering %s\n", gateway_ptr->name);