add support for running core-db over odbc

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15487 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale committed 2009-11-17 00:12:54 +00:00
1 parent 220ebe8175
commit 5d815cfdfe
18 files changed
+692 -346

No files matched your search

+7 -4
View File
@@ -2876,7 +2876,8 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
switch_channel_t *nchannel;
char *host = NULL, *dest_to = NULL;
const char *hval = NULL;
char *not_const = NULL;
*new_session = NULL;
if (!outbound_profile || zstr(outbound_profile->destination_number)) {
@@ -3115,10 +3116,12 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
caller_profile = switch_caller_profile_clone(nsession, outbound_profile);
caller_profile->destination_number = switch_sanitize_number(caller_profile->destination_number);
caller_profile->caller_id_name = switch_sanitize_number((char *)caller_profile->caller_id_name);
caller_profile->caller_id_number = switch_sanitize_number((char *)caller_profile->caller_id_number);
not_const = (char *)caller_profile->caller_id_name;
caller_profile->caller_id_name = switch_sanitize_number(not_const);
not_const = (char *)caller_profile->caller_id_number;
caller_profile->caller_id_number = switch_sanitize_number(not_const);
//caller_profile->destination_number = switch_core_strdup(caller_profile->pool, dest_num);
switch_channel_set_caller_profile(nchannel, caller_profile);
+9 -7
View File
@@ -4008,12 +4008,14 @@ void sofia_glue_sql_close(sofia_profile_t *profile, time_t prune)
if ((dbh = (sofia_cache_db_handle_t *) val)) {
time_t diff = 0;
if (prune > 0 && prune > dbh->last_used) {
diff = (time_t) prune - dbh->last_used;
}
if (prune > 0) {
if (prune > dbh->last_used) {
diff = (time_t) prune - dbh->last_used;
}
if (diff < SQL_CACHE_TIMEOUT) {
continue;
if (diff < SQL_CACHE_TIMEOUT) {
continue;
}
}
if (switch_mutex_trylock(dbh->mutex) == SWITCH_STATUS_SUCCESS) {
@@ -4121,7 +4123,7 @@ sofia_cache_db_handle_t *sofia_glue_get_db_handle(sofia_profile_t *profile)
if (db) dbh->db = db; else dbh->odbc_dbh = odbc_dbh;
switch_mutex_init(&dbh->mutex, SWITCH_MUTEX_NESTED, dbh->pool);
switch_mutex_init(&dbh->mutex, 0, dbh->pool);
switch_mutex_lock(dbh->mutex);
switch_core_hash_insert(profile->db_hash, thread_str, dbh);
@@ -4202,7 +4204,7 @@ switch_bool_t sofia_glue_execute_sql_callback(sofia_profile_t *profile,
}
if (switch_odbc_available() && dbh->odbc_dbh) {
switch_odbc_handle_callback_exec(dbh->odbc_dbh, sql, callback, pdata);
switch_odbc_handle_callback_exec(dbh->odbc_dbh, sql, callback, pdata, NULL);
} else if (profile->odbc_dsn) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");
} else {
+3 -1
View File
@@ -1678,7 +1678,9 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile,
if ((regtype == REG_REGISTER) && sofia_test_pflag(profile, PFLAG_CHECKUSER)) {
if (zstr(username) || zstr(to_user) || strcasecmp(to_user, username)) {
/* Names don't match, so fail */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SIP username %s does not match auth username\n", switch_str_nil(to_user));
if (profile->debug) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SIP username %s does not match auth username\n", switch_str_nil(to_user));
}
goto end;
}
}