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);
}
}
+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;
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");
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);
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),