[Freeswitch-svn] [commit] r13602 - freeswitch/trunk/src/mod/endpoints/mod_sofia
FreeSWITCH SVN
brian at freeswitch.org
Wed Jun 3 18:18:01 PDT 2009
Author: brian
Date: Wed Jun 3 20:18:00 2009
New Revision: 13602
Log:
adding test_sql and network_ip to sub callback
Modified:
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Wed Jun 3 20:18:00 2009
@@ -3570,7 +3570,8 @@
" user_agent VARCHAR(255),\n"
" accept VARCHAR(255),\n"
" profile_name VARCHAR(255),\n"
- " hostname VARCHAR(255)\n"
+ " hostname VARCHAR(255),\n"
+ " network_ip VARCHAR(255)\n"
");\n";
char auth_sql[] =
@@ -3621,6 +3622,7 @@
"create index sr_sip_realm on sip_registrations (sip_realm)",
"create index ss_call_id on sip_subscriptions (call_id)",
"create index ss_hostname on sip_subscriptions (hostname)",
+ "create index ss_hostname on sip_subscriptions (network_ip)",
"create index ss_sip_user on sip_subscriptions (sip_user)",
"create index ss_sip_host on sip_subscriptions (sip_host)",
"create index ss_presence_hosts on sip_subscriptions (presence_hosts)",
@@ -3634,16 +3636,15 @@
"create index sa_nonce on sip_authentication (nonce)",
"create index sa_hostname on sip_authentication (hostname)",
"create index ssa_hostname on sip_shared_appearance_subscriptions (hostname)",
+ "create index ssa_hostname on sip_shared_appearance_subscriptions (network_ip)",
"create index ssa_subscriber on sip_shared_appearance_subscriptions (subscriber)",
"create index ssa_profile_name on sip_shared_appearance_subscriptions (profile_name)",
"create index ssa_aor on sip_shared_appearance_subscriptions (aor)",
-
"create index ssd_profile_name on sip_shared_appearance_dialogs (profile_name)",
"create index ssd_hostname on sip_shared_appearance_dialogs (hostname)",
"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)",
-
NULL
};
@@ -3700,7 +3701,7 @@
}
free(test_sql);
- test_sql = switch_mprintf("delete from sip_shared_appearance_subscriptions where contact_str='' or hostname='%q'", mod_sofia_globals.hostname);
+ test_sql = switch_mprintf("delete from sip_shared_appearance_subscriptions 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_subscriptions", NULL);
switch_odbc_handle_exec(profile->master_odbc, shared_appearance_sql, NULL);
@@ -3737,7 +3738,7 @@
switch_core_db_test_reactive(profile->master_db, test_sql, "DROP TABLE sip_registrations", reg_sql);
free(test_sql);
- test_sql = switch_mprintf("delete from sip_subscriptions where hostname='%q'", mod_sofia_globals.hostname);
+ test_sql = switch_mprintf("delete from sip_subscriptions where network_ip='%q'", mod_sofia_globals.hostname);
switch_core_db_test_reactive(profile->master_db, test_sql, "DROP TABLE sip_subscriptions", sub_sql);
free(test_sql);
@@ -3754,7 +3755,7 @@
free(test_sql);
- test_sql = switch_mprintf("delete from sip_shared_appearance_subscriptions where contact_str = '' or hostname='%q'", mod_sofia_globals.hostname);
+ test_sql = switch_mprintf("delete from sip_shared_appearance_subscriptions 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_subscriptions", shared_appearance_sql);
free(test_sql);
@@ -3775,6 +3776,8 @@
NULL, NULL, NULL);
switch_core_db_exec(profile->master_db, "create index if not exists ssd_hostname on sip_shared_appearance_dialogs (hostname)",
NULL, NULL, NULL);
+ switch_core_db_exec(profile->master_db, "create index if not exists ssd_hostname on sip_shared_appearance_dialogs (network_ip)",
+ NULL, NULL, NULL);
switch_core_db_exec(profile->master_db, "create index if not exists ssd_contact_str on sip_shared_appearance_dialogs (contact_str)",
NULL, NULL, NULL);
switch_core_db_exec(profile->master_db, "create index if not exists ssd_call_id on sip_shared_appearance_dialogs (call_id)",
@@ -3801,6 +3804,7 @@
switch_core_db_exec(profile->master_db, "create index if not exists ss_call_id on sip_subscriptions (call_id)", NULL, NULL, NULL);
switch_core_db_exec(profile->master_db, "create index if not exists ss_hostname on sip_subscriptions (hostname)", NULL, NULL, NULL);
+ switch_core_db_exec(profile->master_db, "create index if not exists ss_hostname on sip_subscriptions (network_ip)", NULL, NULL, NULL);
switch_core_db_exec(profile->master_db, "create index if not exists ss_sip_user on sip_subscriptions (sip_user)", NULL, NULL, NULL);
switch_core_db_exec(profile->master_db, "create index if not exists ss_sip_host on sip_subscriptions (sip_host)", NULL, NULL, NULL);
switch_core_db_exec(profile->master_db, "create index if not exists ss_presence_hosts on sip_subscriptions (presence_hosts)", NULL, NULL, NULL);
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c Wed Jun 3 20:18:00 2009
@@ -209,7 +209,7 @@
if ((sql = switch_mprintf(
"select proto,sip_user,sip_host,sub_to_user,sub_to_host,event,contact,call_id,full_from,"
- "full_via,expires,user_agent,accept,profile_name"
+ "full_via,expires,user_agent,accept,profile_name,network_ip"
",-1,'unavailable','unavailable' from sip_subscriptions where event='presence' and hostname='%q'",
mod_sofia_globals.hostname))) {
switch_mutex_lock(mod_sofia_globals.hash_mutex);
@@ -354,13 +354,13 @@
if (for_everyone) {
sql = switch_mprintf("select proto,sip_user,sip_host,sub_to_user,sub_to_host,event,contact,call_id,full_from,"
- "full_via,expires,user_agent,accept,profile_name"
+ "full_via,expires,user_agent,accept,profile_name,network_ip"
",'%q','%q' from sip_subscriptions where event='message-summary' "
"and sub_to_user='%q' and (sub_to_host='%q' or presence_hosts like '%%%q%%')",
stream.data, host, user, host, host);
} else if (sub_call_id) {
sql = switch_mprintf("select proto,sip_user,sip_host,sub_to_user,sub_to_host,event,contact,call_id,full_from,"
- "full_via,expires,user_agent,accept,profile_name"
+ "full_via,expires,user_agent,accept,profile_name,network_ip"
",'%q','%q' from sip_subscriptions where event='message-summary' "
"and sub_to_user='%q' and (sub_to_host='%q' or presence_hosts like '%%%q%%' and call_id='%q')",
stream.data, host, user, host, host, sub_call_id);
@@ -446,7 +446,7 @@
"sip_subscriptions.sub_to_user,sip_subscriptions.sub_to_host,sip_subscriptions.event,"
"sip_subscriptions.contact,sip_subscriptions.call_id,sip_subscriptions.full_from,"
"sip_subscriptions.full_via,sip_subscriptions.expires,sip_subscriptions.user_agent,"
- "sip_subscriptions.accept,sip_subscriptions.profile_name"
+ "sip_subscriptions.accept,sip_subscriptions.profile_name,sip_subscriptions.network_ip"
",1,'%q','%q',sip_presence.status,sip_presence.rpid "
"from sip_subscriptions left join sip_presence on "
"(sip_subscriptions.sub_to_user=sip_presence.sip_user and sip_subscriptions.sub_to_host=sip_presence.sip_host and "
@@ -459,7 +459,7 @@
"sip_subscriptions.sub_to_user,sip_subscriptions.sub_to_host,sip_subscriptions.event,"
"sip_subscriptions.contact,sip_subscriptions.call_id,sip_subscriptions.full_from,"
"sip_subscriptions.full_via,sip_subscriptions.expires,sip_subscriptions.user_agent,"
- "sip_subscriptions.accept,sip_subscriptions.profile_name"
+ "sip_subscriptions.accept,sip_subscriptions.profile_name,sip_subscriptions.network_ip"
",1,'%q','%q',sip_presence.status,sip_presence.rpid "
"from sip_subscriptions left join sip_presence on "
"(sip_subscriptions.sub_to_user=sip_presence.sip_user and sip_subscriptions.sub_to_host=sip_presence.sip_host and "
@@ -1777,15 +1777,12 @@
sql = switch_mprintf("insert into sip_subscriptions "
"(proto,sip_user,sip_host,sub_to_user,sub_to_host,presence_hosts,event,contact,call_id,full_from,"
- "full_via,expires,user_agent,accept,profile_name,hostname) "
- "values ('%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q',%ld,'%q','%q','%q','%q')",
+ "full_via,expires,user_agent,accept,profile_name,hostname,network_ip) "
+ "values ('%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q',%ld,'%q','%q','%q','%q','%q')",
proto, from_user, from_host, to_user, to_host, profile->presence_hosts ? profile->presence_hosts : to_host,
event, contact_str, call_id, full_from, full_via,
-
exp_delta * -1,
- //exp_abs + SUB_OVERLAP,
-
- full_agent, accept, profile->name,mod_sofia_globals.hostname);
+ full_agent, accept, profile->name,mod_sofia_globals.hostname, network_ip);
if (mod_sofia_globals.debug_presence > 0) {
More information about the Freeswitch-svn
mailing list