]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add recieved param to contact ala MODENDP-104
authorAnthony Minessale <anthony.minessale@gmail.com>
Tue, 20 May 2008 17:44:55 +0000 (17:44 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Tue, 20 May 2008 17:44:55 +0000 (17:44 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8493 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/sofia_reg.c

index 0e5fdcbb2566ccbcf392a93f16c45db69d71d2ca..aba7935d8249b8b467ecf52de62eea58db509510 100644 (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)),