]> 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:36:11 +0000 (12:36 -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 de32b2c7c3bfcb201e97f23faa138dcb97f3c666..a9c00cb4fb9d5d54b1561dfb7c4ec65856360c79 100644 (file)
@@ -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);
index 6e3dde6407658c069f43cab89fc37b795d4e48a4..416c0c033b0c9eb8c9d107b223f3303561f4c6a2 100644 (file)
@@ -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;
index 6232671817530bf6c071113e12a4590ccf3256a1..7caa716a545b7dac325e77730148c0f4b37ecf58 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),