diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index b0cab240e5..ab3cd8dc76 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -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);