]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
patch for SFSIP-104
authorAnthony Minessale <anthony.minessale@gmail.com>
Wed, 26 Nov 2008 19:30:40 +0000 (19:30 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Wed, 26 Nov 2008 19:30:40 +0000 (19:30 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10544 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia.c
src/mod/endpoints/mod_sofia/sofia_presence.c

index 1e2be121f968cfee929e23034129e2e1db58dd3b..beb9f73973d29df18e345fe643dcead9278e5c94 100644 (file)
@@ -367,6 +367,8 @@ struct sofia_profile {
        char *bindurl;
        char *tls_url;
        char *tls_bindurl;
+       char *tcp_contact;
+       char *tls_contact;
        char *sipdomain;
        char *timer_name;
        char *hold_music;
index b99a50d4324f261cfb8668b796078af6d5bbb063..443a5eafeb32daa550e2c0c23ddb679c608a9908 100644 (file)
@@ -2071,11 +2071,15 @@ switch_status_t config_sofia(int reload, char *profile_name)
                                        profile->bindurl = profile->url;
                                }
 
+                               profile->tcp_contact = switch_core_sprintf(profile->pool, "%s;transport=tcp", profile->url);
+                               profile->tls_contact = switch_core_sprintf(profile->pool, "%s;transport=tls", profile->url);
+                               
+                               
                                if (profile->bind_params) {
                                        char *bindurl = profile->bindurl;
                                        profile->bindurl = switch_core_sprintf(profile->pool, "%s;%s", bindurl, profile->bind_params);
                                }
-
+                               
                                /*
                                 * handle TLS params #2
                                 */
index 361ab42f803a9149f5199a35563f206894bb34c8..89d618e0b46b55d6cdcd41af6c07c67cbc0f2642 100644 (file)
@@ -1540,7 +1540,8 @@ void sofia_presence_handle_sip_i_subscribe(int status,
 
                if (status < 200) {
                        char *sticky = NULL;
-
+                       char *contact_str = profile->url;
+                       
                        if (is_nat) {
                                char params[128] = "";
                                if (contact->m_url->url_params) {
@@ -1555,9 +1556,16 @@ void sofia_presence_handle_sip_i_subscribe(int status,
                                                                                network_port,
                                                                                params);
                        }
+                       
+                       if (switch_stristr("port=tcp", contact->m_url->url_params)) {
+                               contact_str = profile->tcp_contact;
+                       } else if (switch_stristr("port=tls", contact->m_url->url_params)) {
+                               contact_str = profile->tls_contact;
+                       }
+
 
-                       nua_respond(nh, SIP_202_ACCEPTED, NUTAG_WITH_THIS(nua), SIPTAG_SUBSCRIPTION_STATE_STR(sstr), TAG_IF(sticky, NUTAG_PROXY(sticky)),
-                                               TAG_END());
+                       nua_respond(nh, SIP_202_ACCEPTED, SIPTAG_CONTACT_STR(contact_str), NUTAG_WITH_THIS(nua), SIPTAG_SUBSCRIPTION_STATE_STR(sstr), 
+                                               TAG_IF(sticky, NUTAG_PROXY(sticky)), TAG_END());
 
                        switch_safe_free(sticky);