From a21cbf814252428e2ae08f9fae5a6723909cb8bd Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 30 Jan 2014 00:20:21 +0500 Subject: [PATCH] FS-6165 --resolve --- src/mod/endpoints/mod_sofia/sofia_reg.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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);