提交 786ca1f9 authored 作者: Anthony Minessale's avatar Anthony Minessale

presence changes

上级 3604bd05
...@@ -4732,8 +4732,7 @@ int sofia_glue_init_sql(sofia_profile_t *profile) ...@@ -4732,8 +4732,7 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
" hostname VARCHAR(255),\n" " hostname VARCHAR(255),\n"
" network_ip VARCHAR(255),\n" " network_ip VARCHAR(255),\n"
" network_port VARCHAR(6),\n" " network_port VARCHAR(6),\n"
" content_type VARCHAR(255),\n" " open_closed VARCHAR(255)\n"
" content text"
");\n"; ");\n";
char dialog_sql[] = char dialog_sql[] =
...@@ -4756,7 +4755,9 @@ int sofia_glue_init_sql(sofia_profile_t *profile) ...@@ -4756,7 +4755,9 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
" presence_data VARCHAR(255),\n" " presence_data VARCHAR(255),\n"
" call_info VARCHAR(255),\n" " call_info VARCHAR(255),\n"
" call_info_state VARCHAR(255),\n" " call_info_state VARCHAR(255),\n"
" expires INTEGER default 0\n" " expires INTEGER default 0,\n"
" status VARCHAR(255),\n"
" rpid VARCHAR(255)\n"
");\n"; ");\n";
char sub_sql[] = char sub_sql[] =
...@@ -4915,7 +4916,7 @@ int sofia_glue_init_sql(sofia_profile_t *profile) ...@@ -4915,7 +4916,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' and expires <> -9999", mod_sofia_globals.hostname); test_sql = switch_mprintf("delete from sip_dialogs where hostname='%q' and expires <> -9999 or rpid=''", mod_sofia_globals.hostname);
if (switch_odbc_handle_exec(odbc_dbh, test_sql, NULL, NULL) != SWITCH_ODBC_SUCCESS) { if (switch_odbc_handle_exec(odbc_dbh, test_sql, NULL, NULL) != SWITCH_ODBC_SUCCESS) {
switch_odbc_handle_exec(odbc_dbh, "DROP TABLE sip_dialogs", NULL, NULL); switch_odbc_handle_exec(odbc_dbh, "DROP TABLE sip_dialogs", NULL, NULL);
...@@ -4923,7 +4924,7 @@ int sofia_glue_init_sql(sofia_profile_t *profile) ...@@ -4923,7 +4924,7 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
} }
free(test_sql); free(test_sql);
test_sql = switch_mprintf("delete from sip_presence where hostname='%q' or content_type=''", mod_sofia_globals.hostname); test_sql = switch_mprintf("delete from sip_presence where hostname='%q' or open_closed=''", mod_sofia_globals.hostname);
if (switch_odbc_handle_exec(odbc_dbh, test_sql, NULL, NULL) != SWITCH_ODBC_SUCCESS) { if (switch_odbc_handle_exec(odbc_dbh, test_sql, NULL, NULL) != SWITCH_ODBC_SUCCESS) {
switch_odbc_handle_exec(odbc_dbh, "DROP TABLE sip_presence", NULL, NULL); switch_odbc_handle_exec(odbc_dbh, "DROP TABLE sip_presence", NULL, NULL);
...@@ -4995,11 +4996,11 @@ int sofia_glue_init_sql(sofia_profile_t *profile) ...@@ -4995,11 +4996,11 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
switch_core_db_test_reactive(db, test_sql, "DROP TABLE sip_subscriptions", sub_sql); switch_core_db_test_reactive(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' and expires <> -9999", mod_sofia_globals.hostname); test_sql = switch_mprintf("delete from sip_dialogs where hostname='%q' and expires <> -9999 or rpid=''", mod_sofia_globals.hostname);
switch_core_db_test_reactive(db, test_sql, "DROP TABLE sip_dialogs", dialog_sql); switch_core_db_test_reactive(db, test_sql, "DROP TABLE sip_dialogs", dialog_sql);
free(test_sql); free(test_sql);
test_sql = switch_mprintf("delete from sip_presence where hostname='%q' or content_type=''", mod_sofia_globals.hostname); test_sql = switch_mprintf("delete from sip_presence where hostname='%q' or open_closed=''", mod_sofia_globals.hostname);
switch_core_db_test_reactive(db, test_sql, "DROP TABLE sip_presence", pres_sql); switch_core_db_test_reactive(db, test_sql, "DROP TABLE sip_presence", pres_sql);
free(test_sql); free(test_sql);
......
...@@ -567,7 +567,7 @@ void sofia_reg_expire_call_id(sofia_profile_t *profile, const char *call_id, int ...@@ -567,7 +567,7 @@ void sofia_reg_expire_call_id(sofia_profile_t *profile, const char *call_id, int
switch_safe_free(sql); switch_safe_free(sql);
sql = switch_mprintf("delete from sip_registrations where call_id='%q' or (sip_user='%q' and sip_host='%q')", call_id, user, host); sql = switch_mprintf("delete from sip_registrations where call_id='%q' or (sip_user='%q' and sip_host='%q')", call_id, user, host);
sofia_glue_execute_sql(profile, &sql, SWITCH_FALSE); sofia_glue_execute_sql_now(profile, &sql, SWITCH_FALSE);
switch_safe_free(sql); switch_safe_free(sql);
switch_safe_free(dup); switch_safe_free(dup);
...@@ -1127,6 +1127,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand ...@@ -1127,6 +1127,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
switch_find_local_ip(guess_ip4, sizeof(guess_ip4), NULL, AF_INET); switch_find_local_ip(guess_ip4, sizeof(guess_ip4), NULL, AF_INET);
sql = switch_mprintf("insert into sip_registrations " sql = switch_mprintf("insert into sip_registrations "
"(call_id,sip_user,sip_host,presence_hosts,contact,status,rpid,expires," "(call_id,sip_user,sip_host,presence_hosts,contact,status,rpid,expires,"
"user_agent,server_user,server_host,profile_name,hostname,network_ip,network_port,sip_username,sip_realm," "user_agent,server_user,server_host,profile_name,hostname,network_ip,network_port,sip_username,sip_realm,"
...@@ -1141,6 +1142,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand ...@@ -1141,6 +1142,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
} }
switch_mutex_unlock(profile->ireg_mutex); switch_mutex_unlock(profile->ireg_mutex);
if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_REGISTER) == SWITCH_STATUS_SUCCESS) { if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_REGISTER) == SWITCH_STATUS_SUCCESS) {
...@@ -1245,7 +1247,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand ...@@ -1245,7 +1247,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
sql = switch_mprintf("delete from sip_subscriptions where call_id='%q'", call_id); sql = switch_mprintf("delete from sip_subscriptions where call_id='%q'", call_id);
} }
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE); sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
if (multi_reg_contact) { if (multi_reg_contact) {
sql = sql =
...@@ -1254,16 +1256,16 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand ...@@ -1254,16 +1256,16 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
sql = switch_mprintf("delete from sip_registrations where call_id='%q'", call_id); sql = switch_mprintf("delete from sip_registrations where call_id='%q'", call_id);
} }
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE); sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
switch_safe_free(icontact); switch_safe_free(icontact);
} else { } else {
if ((sql = switch_mprintf("delete from sip_subscriptions where sip_user='%q' and sip_host='%q'", to_user, reg_host))) { if ((sql = switch_mprintf("delete from sip_subscriptions where sip_user='%q' and sip_host='%q'", to_user, reg_host))) {
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE); sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
} }
if ((sql = switch_mprintf("delete from sip_registrations where sip_user='%q' and sip_host='%q'", to_user, reg_host))) { if ((sql = switch_mprintf("delete from sip_registrations where sip_user='%q' and sip_host='%q'", to_user, reg_host))) {
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE); sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
} }
} }
} }
......
...@@ -528,7 +528,7 @@ SWITCH_DECLARE(void) switch_core_session_hangup_state(switch_core_session_t *ses ...@@ -528,7 +528,7 @@ SWITCH_DECLARE(void) switch_core_session_hangup_state(switch_core_session_t *ses
switch_channel_set_variable(session->channel, "hangup_cause", switch_channel_cause2str(cause)); switch_channel_set_variable(session->channel, "hangup_cause", switch_channel_cause2str(cause));
switch_channel_set_variable_printf(session->channel, "hangup_cause_q850", "%d", cause_q850); switch_channel_set_variable_printf(session->channel, "hangup_cause_q850", "%d", cause_q850);
switch_channel_presence(session->channel, "unknown", switch_channel_cause2str(cause), NULL); //switch_channel_presence(session->channel, "unknown", switch_channel_cause2str(cause), NULL);
switch_channel_set_timestamps(session->channel); switch_channel_set_timestamps(session->channel);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论