提交 a93ddbd2 authored 作者: Anthony Minessale's avatar Anthony Minessale

presence crap

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6048 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 5b3f19fb
......@@ -4425,6 +4425,7 @@ static switch_status_t chat_send(char *proto, char *from, char *to, char *subjec
switch_copy_string(name, to, sizeof(name));
}
if (!(conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, name))) {
ci->chat_send(CONF_CHAT_PROTO, to, hint && strchr(hint, '/') ? hint : from, "", "Conference not active.", NULL);
return SWITCH_STATUS_FALSE;
......@@ -4433,19 +4434,22 @@ static switch_status_t chat_send(char *proto, char *from, char *to, char *subjec
SWITCH_STANDARD_STREAM(stream);
if (body != NULL && (lbuf = strdup(body))) {
int argc;
char *argv[25];
//int argc;
//char *argv[25];
memset(argv, 0, sizeof(argv));
argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
//memset(argv, 0, sizeof(argv));
//argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
/* try to find a command to execute */
if (argc) {
//if (argc) {
/* special case list */
if (strcasecmp(argv[0], "list") == 0) {
if (switch_stristr("list", lbuf)) {
conference_list_pretty(conference, &stream);
/* provide help */
}
else {
return SWITCH_STATUS_SUCCESS;
}
#if 0
else {
if (strcasecmp(argv[0], "help") == 0 || strcasecmp(argv[0], "commands") == 0) {
......@@ -4456,12 +4460,11 @@ static switch_status_t chat_send(char *proto, char *from, char *to, char *subjec
}
}
#endif
} else {
stream.write_function(&stream, "No parameters specified.\nTry 'help'\n");
}
//} else {
//stream.write_function(&stream, "No parameters specified.\nTry 'help'\n");
//}
}
switch_safe_free(lbuf);
ci->chat_send(CONF_CHAT_PROTO, to, from, "", stream.data, NULL);
switch_safe_free(stream.data);
......
......@@ -1710,7 +1710,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sofia_shutdown)
{
int sanity = 0;
sofia_presence_cancel();
//sofia_presence_cancel();
switch_mutex_lock(mod_sofia_globals.mutex);
if (mod_sofia_globals.running == 1) {
......
......@@ -248,7 +248,7 @@ struct sofia_profile {
switch_mutex_t *gateway_mutex;
sofia_gateway_t *gateways;
su_home_t *home;
switch_hash_t *profile_hash;
switch_hash_t *sub_hash;
switch_hash_t *chat_hash;
switch_core_db_t *master_db;
switch_thread_rwlock_t *rwlock;
......
......@@ -42,6 +42,18 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
char const *phrase,
nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
void sofia_handle_sip_r_notify(switch_core_session_t *session, int status,
char const *phrase,
nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
{
#if 0
if (status > 299) {
nua_handle_destroy(nh);
switch_core_hash_delete(profile->sub_hash, sip->sip_call_id->i_id);
}
#endif
}
void sofia_handle_sip_i_notify(switch_core_session_t *session, int status,
char const *phrase,
nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
......@@ -177,7 +189,6 @@ void sofia_event_callback(nua_event_t event,
case nua_i_bye:
case nua_r_unsubscribe:
case nua_r_publish:
case nua_r_notify:
case nua_i_cancel:
case nua_i_error:
case nua_i_active:
......@@ -185,6 +196,9 @@ void sofia_event_callback(nua_event_t event,
case nua_i_terminated:
case nua_r_set_params:
break;
case nua_r_notify:
sofia_handle_sip_r_notify(session, status, phrase, nua, profile, nh, sofia_private, sip, tags);
break;
case nua_i_notify:
sofia_handle_sip_i_notify(session, status, phrase, nua, profile, nh, sofia_private, sip, tags);
break;
......@@ -462,6 +476,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
sofia_glue_del_profile(profile);
switch_core_hash_destroy(&profile->chat_hash);
switch_core_hash_destroy(&profile->sub_hash);
switch_thread_rwlock_unlock(profile->rwlock);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write unlock %s\n", profile->name);
......@@ -789,6 +804,7 @@ switch_status_t config_sofia(int reload, char *profile_name)
profile->dbname = switch_core_strdup(profile->pool, url);
switch_core_hash_init(&profile->chat_hash, profile->pool);
switch_core_hash_init(&profile->sub_hash, profile->pool);
switch_thread_rwlock_create(&profile->rwlock, profile->pool);
switch_mutex_init(&profile->flag_mutex, SWITCH_MUTEX_NESTED, profile->pool);
profile->dtmf_duration = 100;
......
......@@ -1684,7 +1684,7 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
switch_odbc_handle_exec(profile->master_odbc, reg_sql, NULL);
}
if (switch_odbc_handle_exec(profile->master_odbc, "select contact from sip_subscriptions", NULL) != SWITCH_ODBC_SUCCESS) {
if (switch_odbc_handle_exec(profile->master_odbc, "delete from sip_subscriptions", NULL) != SWITCH_ODBC_SUCCESS) {
switch_odbc_handle_exec(profile->master_odbc, "DROP TABLE sip_subscriptions", NULL);
switch_odbc_handle_exec(profile->master_odbc, sub_sql, NULL);
}
......@@ -1700,7 +1700,7 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
}
switch_core_db_test_reactive(profile->master_db, "select call_id from sip_registrations", "DROP TABLE sip_registrations", reg_sql);
switch_core_db_test_reactive(profile->master_db, "select contact from sip_subscriptions", "DROP TABLE sip_subscriptions", sub_sql);
switch_core_db_test_reactive(profile->master_db, "delete from sip_subscriptions", "DROP TABLE sip_subscriptions", sub_sql);
switch_core_db_test_reactive(profile->master_db, "select * from sip_authentication", "DROP TABLE sip_authentication", auth_sql);
#ifdef SWITCH_HAVE_ODBC
......
......@@ -344,7 +344,7 @@ uint8_t sofia_reg_handle_register(nua_t * nua, sofia_profile_t *profile, nua_han
char *register_gateway = NULL;
int network_port;
int cd = 0;
char *call_id = NULL;
const char *call_id = NULL;
/* all callers must confirm that sip, sip->sip_request and sip->sip_contact are not NULL */
assert(sip != NULL && sip->sip_contact != NULL && sip->sip_request != NULL);
......@@ -475,7 +475,7 @@ uint8_t sofia_reg_handle_register(nua_t * nua, sofia_profile_t *profile, nua_han
return 0;
}
call_id = sip_header_as_string(profile->home, (void *) sip->sip_call_id);
call_id = sip->sip_call_id->i_id; //sip_header_as_string(profile->home, (void *) sip->sip_call_id);
assert(call_id);
......@@ -582,9 +582,11 @@ uint8_t sofia_reg_handle_register(nua_t * nua, sofia_profile_t *profile, nua_han
}
/*
if (call_id) {
su_free(profile->home, call_id);
}
*/
if (regtype == REG_REGISTER) {
char *new_contact = NULL;
......
......@@ -201,7 +201,6 @@ SWITCH_DECLARE(const char *) switch_stristr(const char *str, const char *instr)
{
switch_size_t score = strlen(str), x = 0;
const char *a = str, *b = instr, *p = NULL;
while(*a && *b) {
if (tolower(*b) == tolower(*a)) {
if (++x == score) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论