]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-3794 please try latest and see if you get any more missing hostnames
authorAnthony Minessale <anthm@freeswitch.org>
Tue, 24 Jan 2012 23:38:36 +0000 (17:38 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Tue, 24 Jan 2012 23:38:36 +0000 (17:38 -0600)
src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia.c
src/mod/endpoints/mod_sofia/sofia_glue.c
src/mod/endpoints/mod_sofia/sofia_presence.c
src/mod/endpoints/mod_sofia/sofia_reg.c

index 32f0af7441bd43f7375e5c01a22bb42c3d102c3c..ec036e0aea587c715879b646dc97b2fef624f8cb 100644 (file)
@@ -874,8 +874,6 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session);
 
 uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_sdp);
 
-void sofia_presence_establish_presence(sofia_profile_t *profile);
-
 void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, switch_core_session_t *session, sip_t const *sip,
                                                                sofia_dispatch_event_t *de, tagi_t tags[]);
 
index 00d291f8db15d59de21adc36a2fbf429ab92de7b..3e287248d503b926a473718580637be44844b47d 100644 (file)
@@ -2022,10 +2022,6 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
 
        sofia_glue_add_profile(profile->name, profile);
 
-       if (profile->pres_type) {
-               sofia_presence_establish_presence(profile);
-       }
-       
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Starting thread for %s\n", profile->name);
 
        profile->started = switch_epoch_time_now(NULL);
index d685091e6b4b75be9669c22e349cadf10a06cee2..947eeb1e9f6bddd1b0dacd8a5ebf9e59c3012285 100644 (file)
@@ -6092,11 +6092,11 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
        }
                
 
-       test_sql = switch_mprintf("delete from sip_registrations where (contact like '%%TCP%%' "
+       test_sql = switch_mprintf("delete from sip_registrations where (sub_host is null or contact like '%%TCP%%' "
                                                          "or status like '%%TCP%%' or status like '%%TLS%%') and hostname='%q' "
                                                          "and network_ip like '%%' and network_port like '%%' and sip_username "
                                                          "like '%%' and mwi_user  like '%%' and mwi_host like '%%' "
-                                                         "and orig_server_host like '%%' and orig_hostname like '%%' and sub_host like '%%'", mod_sofia_globals.hostname);
+                                                         "and orig_server_host like '%%' and orig_hostname like '%%'", mod_sofia_globals.hostname);
 
 
        switch_cache_db_test_reactive(dbh, test_sql, "drop table sip_registrations", reg_sql);
index e5f98b75c56dfea645d00653a4231d1ecf00bc03..9389c3209f847c03ca5d3bfdc2a3c7fbbee952bb 100644 (file)
@@ -384,25 +384,6 @@ void sofia_presence_cancel(void)
        }
 }
 
-void sofia_presence_establish_presence(sofia_profile_t *profile)
-{
-       struct resub_helper h = { 0 };
-       h.profile = profile;
-
-       if (sofia_glue_execute_sql_callback(profile, profile->ireg_mutex,
-                                                                               "select sip_user,sip_host,'Registered','unknown','' from sip_registrations",
-                                                                               sofia_presence_resub_callback, &h) != SWITCH_TRUE) {
-               return;
-       }
-
-       if (sofia_glue_execute_sql_callback(profile, profile->ireg_mutex,
-                                                                               "select sub_to_user,sub_to_host,'Online','unknown',proto from sip_subscriptions "
-                                                                               "where expires > -1 and version > -1 and proto='ext' or proto='user' or proto='conf'",
-                                                                               sofia_presence_resub_callback, &h) != SWITCH_TRUE) {
-               return;
-       }
-}
-
 char *sofia_presence_translate_rpid(char *in, char *ext)
 {
        char *r = in;
index 8c73bd08ffd567b357161778b5927573064c8ea6..ba159c7f7f32cc4956b6039091999b8db821373d 100644 (file)
@@ -1090,10 +1090,10 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
                switch_goto_int(r, 1, end);
        }
 
-       if (!reg_host) {
+       if (zstr(reg_host)) {
                reg_host = to_host;
        }
-       if (!sub_host) {
+       if (zstr(sub_host)) {
                sub_host = to_host;
        }
 
@@ -1526,7 +1526,12 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
                                        agent, from_user, guess_ip4, profile->name, mod_sofia_globals.hostname, network_ip, network_port_c, username, realm, 
                                                                 mwi_user, mwi_host, guess_ip4, mod_sofia_globals.hostname, sub_host);
                } else {
-                       sql = switch_mprintf("update sip_registrations set expires = %ld where sip_user='%q' and sip_host='%q' and contact='%q'", (long) switch_epoch_time_now(NULL) + (long) exptime + 60, to_user, reg_host, contact_str);
+                       sql = switch_mprintf("update sip_registrations set "
+                                                                "sub_host='%q', network_ip='%q',network_port='%q',"
+                                                                "expires = %ld where sip_user='%q' and sip_host='%q' and contact='%q'", 
+                                                                sub_host, network_ip, network_port_c,
+                                                                (long) switch_epoch_time_now(NULL) + (long) exptime + 60, 
+                                                                to_user, reg_host, contact_str);
                }                                
 
                if (sql) {