]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-5265 --resolve
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 4 Apr 2013 17:35:18 +0000 (12:35 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 4 Apr 2013 17:35:22 +0000 (12:35 -0500)
src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia_glue.c
src/mod/endpoints/mod_sofia/sofia_presence.c

index d79013b4d288b0a5d91453678557991b5d03d20a..a3a08740ed1dde44aed6ac7a8fe3845e3226e862 100644 (file)
@@ -932,6 +932,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);
index cf07ffebaf5947f3167fc113946cc0bcef517b5c..8b9982ccc84f6fb83c71f3e91474ca1cf079b7dc 100644 (file)
@@ -1467,6 +1467,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;
index 2a7bed1eef8d96a86e935afe9c43c6ed46410e6a..8cc93b52b502d40431a3f6e59cacf6b8efa3889d 100644 (file)
@@ -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),