mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-03-14 04:54:49 +00:00
add cols to sip_dialogs
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15420 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
3f2c9e3f72
commit
9750c60d3a
@ -1167,6 +1167,19 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
|||||||
case SWITCH_MESSAGE_INDICATE_ANSWER:
|
case SWITCH_MESSAGE_INDICATE_ANSWER:
|
||||||
case SWITCH_MESSAGE_INDICATE_PROGRESS:
|
case SWITCH_MESSAGE_INDICATE_PROGRESS:
|
||||||
{
|
{
|
||||||
|
const char *presence_data = switch_channel_get_variable(channel, "presence_data");
|
||||||
|
const char *presence_id = switch_channel_get_variable(channel, "presence_id");
|
||||||
|
char *sql;
|
||||||
|
|
||||||
|
if (presence_id || presence_data) {
|
||||||
|
sql = switch_mprintf("update sip_dialogs set presence_id='%q',presence_data='%q' "
|
||||||
|
"where uuid='%s';\n", switch_str_nil(presence_id), switch_str_nil(presence_data),
|
||||||
|
switch_core_session_get_uuid(session));
|
||||||
|
}
|
||||||
|
|
||||||
|
switch_assert(sql);
|
||||||
|
sofia_glue_execute_sql(tech_pvt->profile, &sql, SWITCH_TRUE);
|
||||||
|
|
||||||
const char *var;
|
const char *var;
|
||||||
if ((var = switch_channel_get_variable(channel, SOFIA_SECURE_MEDIA_VARIABLE)) && switch_true(var)) {
|
if ((var = switch_channel_get_variable(channel, SOFIA_SECURE_MEDIA_VARIABLE)) && switch_true(var)) {
|
||||||
sofia_set_flag_locked(tech_pvt, TFLAG_SECURE);
|
sofia_set_flag_locked(tech_pvt, TFLAG_SECURE);
|
||||||
|
@ -3451,7 +3451,7 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
|
|||||||
const char *from_user = "", *from_host = "", *to_user = "", *to_host = "", *contact_user = "", *contact_host = "";
|
const char *from_user = "", *from_host = "", *to_user = "", *to_host = "", *contact_user = "", *contact_host = "";
|
||||||
const char *user_agent = "", *call_id = "";
|
const char *user_agent = "", *call_id = "";
|
||||||
char *sql = NULL;
|
char *sql = NULL;
|
||||||
|
|
||||||
if (sip->sip_user_agent) {
|
if (sip->sip_user_agent) {
|
||||||
user_agent = switch_str_nil(sip->sip_user_agent->g_string);
|
user_agent = switch_str_nil(sip->sip_user_agent->g_string);
|
||||||
}
|
}
|
||||||
@ -3476,23 +3476,38 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (profile->pres_type) {
|
if (profile->pres_type) {
|
||||||
|
const char *presence_data = switch_channel_get_variable(channel, "presence_data");
|
||||||
|
const char *presence_id = switch_channel_get_variable(channel, "presence_id");
|
||||||
|
char *full_contact = "";
|
||||||
|
|
||||||
|
if (sip->sip_contact) {
|
||||||
|
full_contact = sip_header_as_string(nua_handle_home(tech_pvt->nh), (void *) sip->sip_contact);
|
||||||
|
}
|
||||||
|
|
||||||
sql = switch_mprintf("insert into sip_dialogs "
|
sql = switch_mprintf("insert into sip_dialogs "
|
||||||
"(call_id,uuid,sip_to_user,sip_to_host,sip_from_user,sip_from_host,contact_user,"
|
"(call_id,uuid,sip_to_user,sip_to_host,sip_from_user,sip_from_host,contact_user,"
|
||||||
"contact_host,state,direction,user_agent,profile_name,hostname) "
|
"contact_host,state,direction,user_agent,profile_name,hostname,contact,presence_id, presence_data) "
|
||||||
"values('%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q')",
|
"values('%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q')",
|
||||||
call_id,
|
call_id,
|
||||||
switch_core_session_get_uuid(session),
|
switch_core_session_get_uuid(session),
|
||||||
to_user, to_host, from_user, from_host, contact_user,
|
to_user, to_host, from_user, from_host, contact_user,
|
||||||
contact_host, astate, "outbound", user_agent,
|
contact_host, astate, "outbound", user_agent,
|
||||||
profile->name, mod_sofia_globals.hostname);
|
profile->name, mod_sofia_globals.hostname, switch_str_nil(full_contact),
|
||||||
|
switch_str_nil(presence_id), switch_str_nil(presence_data));
|
||||||
|
|
||||||
switch_assert(sql);
|
switch_assert(sql);
|
||||||
|
|
||||||
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
|
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
|
||||||
|
|
||||||
}
|
}
|
||||||
} else if (status == 200 && (profile->pres_type)) {
|
} else if (status == 200 && (profile->pres_type)) {
|
||||||
char *sql = NULL;
|
char *sql = NULL;
|
||||||
sql = switch_mprintf("update sip_dialogs set state='%s' where uuid='%s';\n", astate, switch_core_session_get_uuid(session));
|
const char *presence_data = switch_channel_get_variable(channel, "presence_data");
|
||||||
|
const char *presence_id = switch_channel_get_variable(channel, "presence_id");
|
||||||
|
|
||||||
|
sql = switch_mprintf("update sip_dialogs set state='%q',presence_id='%q',presence_data='%q' "
|
||||||
|
"where uuid='%s';\n", astate, switch_str_nil(presence_id), switch_str_nil(presence_data),
|
||||||
|
switch_core_session_get_uuid(session));
|
||||||
switch_assert(sql);
|
switch_assert(sql);
|
||||||
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
|
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
|
||||||
}
|
}
|
||||||
@ -5819,16 +5834,27 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (profile->pres_type) {
|
if (profile->pres_type) {
|
||||||
|
const char *presence_data = switch_channel_get_variable(channel, "presence_data");
|
||||||
|
const char *presence_id = switch_channel_get_variable(channel, "presence_id");
|
||||||
|
char *full_contact = "";
|
||||||
|
|
||||||
|
if (sip->sip_contact) {
|
||||||
|
full_contact = sip_header_as_string(nua_handle_home(tech_pvt->nh), (void *) sip->sip_contact);
|
||||||
|
}
|
||||||
|
|
||||||
sql = switch_mprintf("insert into sip_dialogs "
|
sql = switch_mprintf("insert into sip_dialogs "
|
||||||
"(call_id,uuid,sip_to_user,sip_to_host,sip_from_user,sip_from_host,contact_user,"
|
"(call_id,uuid,sip_to_user,sip_to_host,sip_from_user,sip_from_host,contact_user,"
|
||||||
"contact_host,state,direction,user_agent,profile_name,hostname) "
|
"contact_host,state,direction,user_agent,profile_name,hostname,contact,presence_id,presence_data) "
|
||||||
"values('%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q')",
|
"values('%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q')",
|
||||||
call_id,
|
call_id,
|
||||||
tech_pvt->sofia_private->uuid,
|
tech_pvt->sofia_private->uuid,
|
||||||
to_user, to_host, dialog_from_user, dialog_from_host,
|
to_user, to_host, dialog_from_user, dialog_from_host,
|
||||||
contact_user, contact_host, "confirmed", "inbound", user_agent,
|
contact_user, contact_host, "confirmed", "inbound", user_agent,
|
||||||
profile->name, mod_sofia_globals.hostname);
|
profile->name, mod_sofia_globals.hostname, switch_str_nil(full_contact),
|
||||||
|
switch_str_nil(presence_id), switch_str_nil(presence_data));
|
||||||
|
|
||||||
switch_assert(sql);
|
switch_assert(sql);
|
||||||
|
|
||||||
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
|
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3657,7 +3657,10 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
|
|||||||
" direction VARCHAR(255),\n"
|
" direction VARCHAR(255),\n"
|
||||||
" user_agent VARCHAR(255),\n"
|
" user_agent VARCHAR(255),\n"
|
||||||
" profile_name VARCHAR(255),\n"
|
" profile_name VARCHAR(255),\n"
|
||||||
" hostname VARCHAR(255)\n"
|
" hostname VARCHAR(255),\n"
|
||||||
|
" contact VARCHAR(255),\n"
|
||||||
|
" presence_id VARCHAR(255),\n"
|
||||||
|
" presence_data VARCHAR(255)\n"
|
||||||
");\n";
|
");\n";
|
||||||
|
|
||||||
char sub_sql[] =
|
char sub_sql[] =
|
||||||
@ -3750,6 +3753,9 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
|
|||||||
"create index ssa_profile_name on sip_shared_appearance_subscriptions (profile_name)",
|
"create index ssa_profile_name on sip_shared_appearance_subscriptions (profile_name)",
|
||||||
"create index ssa_aor on sip_shared_appearance_subscriptions (aor)",
|
"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_profile_name on sip_shared_appearance_dialogs (profile_name)",
|
||||||
|
"create index ssd_contact on sip_shared_appearance_dialogs (contact)",
|
||||||
|
"create index ssd_presence_id on sip_shared_appearance_dialogs (presence_id)",
|
||||||
|
"create index ssd_presence_data on sip_shared_appearance_dialogs (presence_data)",
|
||||||
"create index ssd_hostname on sip_shared_appearance_dialogs (hostname)",
|
"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_contact_str on sip_shared_appearance_dialogs (contact_str)",
|
||||||
"create index ssd_call_id on sip_shared_appearance_dialogs (call_id)",
|
"create index ssd_call_id on sip_shared_appearance_dialogs (call_id)",
|
||||||
@ -3787,7 +3793,7 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
free(test_sql);
|
free(test_sql);
|
||||||
test_sql = switch_mprintf("delete from sip_dialogs where hostname='%q'", mod_sofia_globals.hostname);
|
test_sql = switch_mprintf("delete from sip_dialogs where hostname='%q' and contact like '%%'", mod_sofia_globals.hostname);
|
||||||
|
|
||||||
if (switch_odbc_handle_exec(profile->master_odbc, test_sql, NULL) != SWITCH_ODBC_SUCCESS) {
|
if (switch_odbc_handle_exec(profile->master_odbc, test_sql, NULL) != SWITCH_ODBC_SUCCESS) {
|
||||||
switch_odbc_handle_exec(profile->master_odbc, "DROP TABLE sip_dialogs", NULL);
|
switch_odbc_handle_exec(profile->master_odbc, "DROP TABLE sip_dialogs", NULL);
|
||||||
@ -3852,7 +3858,7 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
|
|||||||
switch_core_db_test_reactive(profile->master_db, test_sql, "DROP TABLE sip_subscriptions", sub_sql);
|
switch_core_db_test_reactive(profile->master_db, test_sql, "DROP TABLE sip_subscriptions", sub_sql);
|
||||||
free(test_sql);
|
free(test_sql);
|
||||||
|
|
||||||
test_sql = switch_mprintf("delete from sip_dialogs where hostname='%q'", mod_sofia_globals.hostname);
|
test_sql = switch_mprintf("delete from sip_dialogs where hostname='%q' and contact like '%%'", mod_sofia_globals.hostname);
|
||||||
switch_core_db_test_reactive(profile->master_db, test_sql, "DROP TABLE sip_dialogs", dialog_sql);
|
switch_core_db_test_reactive(profile->master_db, test_sql, "DROP TABLE sip_dialogs", dialog_sql);
|
||||||
free(test_sql);
|
free(test_sql);
|
||||||
|
|
||||||
@ -3926,6 +3932,9 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
|
|||||||
|
|
||||||
switch_core_db_exec(profile->master_db, "create index if not exists sd_uuid on sip_dialogs (uuid)", NULL, NULL, NULL);
|
switch_core_db_exec(profile->master_db, "create index if not exists sd_uuid on sip_dialogs (uuid)", NULL, NULL, NULL);
|
||||||
switch_core_db_exec(profile->master_db, "create index if not exists sd_hostname on sip_dialogs (hostname)", NULL, NULL, NULL);
|
switch_core_db_exec(profile->master_db, "create index if not exists sd_hostname on sip_dialogs (hostname)", NULL, NULL, NULL);
|
||||||
|
switch_core_db_exec(profile->master_db, "create index if not exists sd_hostname on sip_dialogs (contact)", NULL, NULL, NULL);
|
||||||
|
switch_core_db_exec(profile->master_db, "create index if not exists sd_hostname on sip_dialogs (presence_id)", NULL, NULL, NULL);
|
||||||
|
switch_core_db_exec(profile->master_db, "create index if not exists sd_hostname on sip_dialogs (presence_data)", NULL, NULL, NULL);
|
||||||
|
|
||||||
switch_core_db_exec(profile->master_db, "create index if not exists sp_hostname on sip_presence (hostname)", NULL, NULL, NULL);
|
switch_core_db_exec(profile->master_db, "create index if not exists sp_hostname on sip_presence (hostname)", NULL, NULL, NULL);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user