add recieved param to contact ala MODENDP-104

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8493 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2008-05-20 17:44:55 +00:00
parent a252b74f4d
commit db3f7207e0

View File

@ -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)),