From db3f7207e08ae5dda7e0cbd146e22cba13db7895 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 20 May 2008 17:44:55 +0000 Subject: [PATCH] add recieved param to contact ala MODENDP-104 git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8493 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/endpoints/mod_sofia/sofia_reg.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 0e5fdcbb25..aba7935d82 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -427,6 +427,7 @@ uint8_t sofia_reg_handle_register(nua_t * nua, sofia_profile_t *profile, nua_han const char *to_user = NULL; const char *to_host = NULL; char contact_str[1024] = ""; + int nat_hack = 0; //char buf[512]; uint8_t stale = 0, forbidden = 0; auth_res_t auth_res; @@ -541,6 +542,7 @@ uint8_t sofia_reg_handle_register(nua_t * nua, sofia_profile_t *profile, nua_han reg_desc = "Registered(NATHACK)"; exptime = 20; } + nat_hack = 1; } else { char *p; switch_copy_string(contact_str, v_contact_str, sizeof(contact_str)); @@ -702,7 +704,11 @@ uint8_t sofia_reg_handle_register(nua_t * nua, sofia_profile_t *profile, nua_han char *new_contact = NULL; if (exptime) { - new_contact = switch_mprintf("%s;expires=%ld", contact_str, (long)exptime); + if (nat_hack) { + new_contact = switch_mprintf("%s;expires=%ld;received=\"%s:%d\"", contact_str, (long)exptime, network_ip, network_port); + } else { + new_contact = switch_mprintf("%s;expires=%ld", contact_str, (long)exptime); + } nua_respond(nh, SIP_200_OK, TAG_IF(sticky, NUTAG_PROXY(sticky)),