]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-6165 --resolve
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 29 Jan 2014 19:20:21 +0000 (00:20 +0500)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 29 Jan 2014 19:20:21 +0000 (00:20 +0500)
src/mod/endpoints/mod_sofia/sofia_reg.c

index b0cab240e59140d54077e97ad0a9de67c360cdde..ab3cd8dc760b8989ec03bfc11f1f01a048f95805 100644 (file)
@@ -1336,11 +1336,14 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
 
 
                if (sip->sip_path) {
-                       path_val = sip_header_as_string(nua_handle_home(nh), (void *) sip->sip_path);
-                       path_encoded_len = (int)(strlen(path_val) * 3) + 1;
-                       switch_zmalloc(path_encoded, path_encoded_len);
-                       switch_copy_string(path_encoded, ";fs_path=", 10);
-                       switch_url_encode(path_val, path_encoded + 9, path_encoded_len - 9);
+                       if ((path_val = sip_header_as_string(nua_handle_home(nh), (void *) sip->sip_path))) {
+                               char *path_stripped = sofia_glue_get_url_from_contact(path_val, SWITCH_TRUE);
+                               path_val = path_stripped;
+                               path_encoded_len = (int)(strlen(path_val) * 3) + 1;
+                               switch_zmalloc(path_encoded, path_encoded_len);
+                               switch_copy_string(path_encoded, ";fs_path=", 10);
+                               switch_url_encode(path_val, path_encoded + 9, path_encoded_len - 9);
+                       }
                } else if (is_nat) {
                        char my_contact_str[1024];
                        if (uparams) {
@@ -2039,6 +2042,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
        switch_safe_free(display_m);
        switch_safe_free(dup_mwi_account);
        switch_safe_free(utmp);
+       switch_safe_free(path_val);
 
        if (auth_params) {
                switch_event_destroy(&auth_params);