#include <osip2/osip_mt.h>
#include <osip_rfc3264.h>
#include <osipparser2/osip_port.h>
-
+#define DBFILE "exosip.db"
static const char modname[] = "mod_exosip";
#define STRLEN 15
if (db) {
udb = db;
} else {
- udb = switch_core_db_handle();
+ udb = switch_core_db_open_file(DBFILE);
}
cbt.val = val;
cbt.len = len;
+ switch_mutex_lock(globals.reg_mutex);
snprintf(val, len, "select url from sip_registrations where key='%s'", key);
switch_core_db_exec(udb, val, find_callback, &cbt, &errmsg);
if (!db) {
switch_core_db_close(udb);
}
+ switch_mutex_unlock(globals.reg_mutex);
return cbt.matches ? val : NULL;
}
caller_profile = switch_caller_profile_clone(*new_session, outbound_profile);
- switch_mutex_lock(globals.reg_mutex);
+
if (!strchr(caller_profile->destination_number, '@') && (url = find_reg_url(NULL, caller_profile->destination_number, tmp, sizeof(tmp)))) {
caller_profile->rdnis = switch_core_session_strdup(*new_session, caller_profile->destination_number);
caller_profile->destination_number = switch_core_session_strdup(*new_session, url);
}
- switch_mutex_unlock(globals.reg_mutex);
+
switch_channel_set_caller_profile(channel, caller_profile);
tech_pvt->caller_profile = caller_profile;
/* NOTE: **interface is **_interface because the common lib redefines interface to struct in some situations */
- if ((globals.db = switch_core_db_handle())) {
+ if ((globals.db = switch_core_db_open_file(DBFILE))) {
switch_core_db_test_reactive(globals.db, "select * from sip_registrations", create_interfaces_sql);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open SQL Database!\n");
je->request->from->url->username);
}
- printf("TEST [%s]\n", sql);
switch_mutex_lock(globals.reg_mutex);
switch_core_db_persistant_execute(globals.db, sql, 25);
switch_mutex_unlock(globals.reg_mutex);
eXosip_event_t *event = NULL;
switch_event_t *s_event;
time_t now = 0, next = 0;
- int interval = 60;
+ int interval = 30;
config_exosip(0);