]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
adding network_ip to the dialogs
authorBrian West <brian@freeswitch.org>
Thu, 4 Jun 2009 04:04:14 +0000 (04:04 +0000)
committerBrian West <brian@freeswitch.org>
Thu, 4 Jun 2009 04:04:14 +0000 (04:04 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13603 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/sofia_glue.c
src/mod/endpoints/mod_sofia/sofia_sla.c

index a83336304ebc8560efc6fe3e15b345cf4023b0b8..6af9bd2c3c367b83eafca40386374e3dcd2ed103 100644 (file)
@@ -3600,7 +3600,8 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
                "   hostname          VARCHAR(255),\n"
                "   contact_str       VARCHAR(255),\n"
                "   call_id           VARCHAR(255),\n"
-               "   expires           INTEGER\n"
+               "   expires           INTEGER,\n"
+               "   network_ip        VARCHAR(255)\n"
                ");\n";
 
        if (profile->odbc_dsn) {
@@ -3645,6 +3646,7 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
                        "create index ssd_contact_str on sip_shared_appearance_dialogs (contact_str)",
                        "create index ssd_call_id on sip_shared_appearance_dialogs (call_id)",
                        "create index ssd_expires on sip_shared_appearance_dialogs (expires)",
+                       "create index ssd_expires on sip_shared_appearance_dialogs (network_ip)",
                        NULL    
                };
 
@@ -3709,7 +3711,7 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
                free(test_sql);
 
 
-               test_sql = switch_mprintf("delete from sip_shared_appearance_dialogs where contact_str='' or hostname='%q'", mod_sofia_globals.hostname);
+               test_sql = switch_mprintf("delete from sip_shared_appearance_dialogs where contact_str='' or network_ip='%q'", mod_sofia_globals.hostname);
                if (switch_odbc_handle_exec(profile->master_odbc, test_sql, NULL) != SWITCH_ODBC_SUCCESS) {
                        switch_odbc_handle_exec(profile->master_odbc, "DROP TABLE sip_shared_appearance_dialogs", NULL);
                        switch_odbc_handle_exec(profile->master_odbc, shared_appearance_dialogs_sql, NULL);
@@ -3759,7 +3761,7 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
                switch_core_db_test_reactive(profile->master_db, test_sql, "DROP TABLE sip_shared_appearance_subscriptions", shared_appearance_sql);
                free(test_sql);
 
-               test_sql = switch_mprintf("delete from sip_shared_appearance_dialogs where contact_str = '' or hostname='%q'", mod_sofia_globals.hostname);
+               test_sql = switch_mprintf("delete from sip_shared_appearance_dialogs where contact_str = '' or network_ip='%q'", mod_sofia_globals.hostname);
                switch_core_db_test_reactive(profile->master_db, test_sql, "DROP TABLE sip_shared_appearance_dialogs", shared_appearance_dialogs_sql);
                free(test_sql);
                
index c3898831132350e3f90a9b5fdbba7b7ad2e80020..6dfa1e56bd2f86c080fa1160e420522ff594a1d4 100644 (file)
@@ -237,13 +237,16 @@ void sofia_sla_handle_sip_r_subscribe(int status,
                time_t expires = switch_epoch_time_now(NULL);
                char *sql;
                char *contact_str = strip_uri(full_contact);
+               char network_ip[80];
+               int network_port = 0;
 
                if (sip && sip->sip_expires) {
                        expires += sip->sip_expires->ex_delta + 30;
                }
+               sofia_glue_get_addr(nua_current_request(nua), network_ip,  sizeof(network_ip), &network_port);
 
-               if ((sql = switch_mprintf("insert into sip_shared_appearance_dialogs (profile_name, hostname, contact_str, call_id, expires) "
-                                                                 "values ('%q','%q','%q','%q','%ld')", 
+               if ((sql = switch_mprintf("insert into sip_shared_appearance_dialogs (profile_name, hostname, contact_str, call_id, expires, network_ip) "
+                                                                 "values ('%q','%q','%q','%q','%ld','%q')", 
                                                                  profile->name, mod_sofia_globals.hostname, contact_str, sip->sip_call_id->i_id, (long)expires))) {
                        sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
                }