diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index de32b2c7c3..a9c00cb4fb 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -1042,6 +1042,7 @@ extern switch_endpoint_interface_t *sofia_endpoint_interface; void sofia_presence_set_chat_hash(private_object_t *tech_pvt, sip_t const *sip); switch_status_t sofia_on_hangup(switch_core_session_t *session); char *sofia_glue_get_url_from_contact(char *buf, uint8_t to_dup); +char *sofia_glue_get_path_from_contact(char *buf); void sofia_presence_set_hash_key(char *hash_key, int32_t len, sip_t const *sip); void sofia_glue_sql_close(sofia_profile_t *profile, time_t prune); int sofia_glue_init_sql(sofia_profile_t *profile); diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 6e3dde6407..416c0c033b 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -5506,6 +5506,37 @@ void sofia_glue_pass_sdp(private_object_t *tech_pvt, char *sdp) } } +char *sofia_glue_get_path_from_contact(char *buf) +{ + char *p, *e, *path = NULL, *contact = NULL; + + if (!buf) return NULL; + + contact = sofia_glue_get_url_from_contact(buf, SWITCH_TRUE); + + if (!contact) return NULL; + + if ((p = strstr(contact, "fs_path="))) { + p += 8; + + if (!zstr(p)) { + path = strdup(p); + } + } + + if (!path) return NULL; + + if ((e = strrchr(path, ';'))) { + *e = '\0'; + } + + switch_url_decode(path); + + free(contact); + + return path; +} + char *sofia_glue_get_url_from_contact(char *buf, uint8_t to_dup) { char *url = NULL, *e; diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 6232671817..7caa716a54 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -2091,6 +2091,7 @@ static void _send_presence_notify(sofia_profile_t *profile, char *route_uri = NULL, *o_contact_dup = NULL, *tmp, *to_uri, *dcs = NULL; const char *tp; char *cparams = NULL; + char *path = NULL; if (zstr(full_to) || zstr(full_from) || zstr(o_contact)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "MISSING DATA TO SEND NOTIFY.\n"); @@ -2101,8 +2102,7 @@ static void _send_presence_notify(sofia_profile_t *profile, cparams += 3; } - - + path = sofia_glue_get_path_from_contact((char *) o_contact); tmp = (char *)o_contact; o_contact_dup = sofia_glue_get_url_from_contact(tmp, 1); @@ -2253,7 +2253,7 @@ static void _send_presence_notify(sofia_profile_t *profile, TAG_IF(route_uri, NUTAG_PROXY(route_uri)), TAG_IF(dst->route, SIPTAG_ROUTE_STR(dst->route)), TAG_IF(user_via, SIPTAG_VIA_STR(user_via)), - + TAG_IF(path, SIPTAG_RECORD_ROUTE_STR(path)), SIPTAG_FROM_STR(full_to), SIPTAG_TO_STR(full_from),