From 88579699481971d429b02f957c7a99f22f4786c9 Mon Sep 17 00:00:00 2001 From: Brian West Date: Tue, 14 Jul 2009 23:39:57 +0000 Subject: [PATCH] Issue #2 of SFSIP-164, must set local-network-acl for this to work. git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14255 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/endpoints/mod_sofia/sofia_reg.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index a4d9b59bd5..ae50493fc8 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -269,6 +269,10 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now) nua_handle_t *nh = nua_handle(profile->nua, NULL, NUTAG_URL(gateway_ptr->register_url), TAG_END()); sofia_private_t *pvt; + 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); + } + pvt = malloc(sizeof(*pvt)); switch_assert(pvt); memset(pvt, 0, sizeof(*pvt)); @@ -280,10 +284,14 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now) gateway_ptr->pinging = 1; nua_options(nh, TAG_IF(gateway_ptr->register_sticky_proxy, NUTAG_PROXY(gateway_ptr->register_sticky_proxy)), + TAG_IF(user_via, SIPTAG_VIA_STR(user_via)), SIPTAG_TO_STR(gateway_ptr->register_from), SIPTAG_CONTACT_STR(gateway_ptr->register_contact), SIPTAG_FROM_STR(gateway_ptr->register_from), TAG_END()); + + switch_safe_free(user_via); + user_via = NULL; } switch (ostate) { @@ -348,6 +356,8 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now) } gateway_ptr->retry = now + gateway_ptr->retry_seconds; gateway_ptr->state = REG_STATE_TRYING; + switch_safe_free(user_via); + user_via = NULL; break; case REG_STATE_FAILED: @@ -376,7 +386,6 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now) if (ostate != gateway_ptr->state) { sofia_reg_fire_custom_gateway_state_event(gateway_ptr); } - switch_safe_free(user_via); } }