Revision
16278
Author
anthm
Date
2010-01-13 12:02:42 -0600 (Wed, 13 Jan 2010)

Log Message

MODAPP-387

Modified Paths

Diff

Modified: freeswitch/trunk/src/mod/applications/mod_cidlookup/mod_cidlookup.c (16277 => 16278)


--- freeswitch/trunk/src/mod/applications/mod_cidlookup/mod_cidlookup.c	2010-01-13 17:01:36 UTC (rev 16277)
+++ freeswitch/trunk/src/mod/applications/mod_cidlookup/mod_cidlookup.c	2010-01-13 18:02:42 UTC (rev 16278)
@@ -93,7 +93,7 @@
 	switch_cache_db_connection_options_t options = { {0} };
 	switch_cache_db_handle_t *dbh = NULL;
 	
-	if (globals.odbc_dsn && globals.odbc_user && globals.odbc_pass) {
+	if (!zstr(globals.odbc_dsn)) {
 		options.odbc_options.dsn = globals.odbc_dsn;
 		options.odbc_options.user = globals.odbc_user;
 		options.odbc_options.pass = globals.odbc_pass;

Modified: freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c (16277 => 16278)


--- freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c	2010-01-13 17:01:36 UTC (rev 16277)
+++ freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c	2010-01-13 18:02:42 UTC (rev 16278)
@@ -289,7 +289,7 @@
 	switch_cache_db_connection_options_t options = { {0} };
 	switch_cache_db_handle_t *dbh = NULL;
 	
-	if (globals.odbc_dsn && globals.odbc_user && globals.odbc_pass) {
+	if (!zstr(globals.odbc_dsn)) {
 		options.odbc_options.dsn = globals.odbc_dsn;
 		options.odbc_options.user = globals.odbc_user;
 		options.odbc_options.pass = globals.odbc_pass;
@@ -1873,8 +1873,6 @@
 {
 	char *cf = "fifo.conf";
 	switch_xml_t cfg, xml, fifo, fifos, member, settings, param;
-	char *odbc_user = NULL;
-	char *odbc_pass = NULL;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;	
 	char *sql;
 	switch_bool_t delete_all_outbound_member_on_startup = SWITCH_FALSE;
@@ -1913,7 +1911,7 @@
 		}
 	}
 
-	if (zstr(globals.odbc_dsn) || zstr(odbc_user) || zstr(odbc_pass)) {
+	if (zstr(globals.odbc_dsn)) {
 		globals.dbname = "fifo";
 	}
 

Modified: freeswitch/trunk/src/mod/applications/mod_lcr/mod_lcr.c (16277 => 16278)


--- freeswitch/trunk/src/mod/applications/mod_lcr/mod_lcr.c	2010-01-13 17:01:36 UTC (rev 16277)
+++ freeswitch/trunk/src/mod/applications/mod_lcr/mod_lcr.c	2010-01-13 18:02:42 UTC (rev 16278)
@@ -394,7 +394,7 @@
 	switch_cache_db_connection_options_t options = { {0} };
 	switch_cache_db_handle_t *dbh = NULL;
 	
-	if (globals.odbc_dsn && globals.odbc_user && globals.odbc_pass) {
+	if (!zstr(globals.odbc_dsn)) {
 		options.odbc_options.dsn = globals.odbc_dsn;
 		options.odbc_options.user = globals.odbc_user;
 		options.odbc_options.pass = globals.odbc_pass;

Modified: freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c (16277 => 16278)


--- freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c	2010-01-13 17:01:36 UTC (rev 16277)
+++ freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c	2010-01-13 18:02:42 UTC (rev 16278)
@@ -95,7 +95,7 @@
 	switch_cache_db_connection_options_t options = { {0} };
 	switch_cache_db_handle_t *dbh = NULL;
 	
-	if (globals.odbc_dsn && globals.odbc_user && globals.odbc_pass) {
+	if (!zstr(globals.odbc_dsn)) {
 		options.odbc_options.dsn = globals.odbc_dsn;
 		options.odbc_options.user = globals.odbc_user;
 		options.odbc_options.pass = globals.odbc_pass;
@@ -205,7 +205,7 @@
 	}
 	
 
-	if (zstr(globals.odbc_dsn) || zstr(globals.odbc_user) || zstr(globals.odbc_pass)) {
+	if (zstr(globals.odbc_dsn)) {
 		globals.dbname = "call_limit";
 		dbh = limit_get_db_handle();
 	}

Modified: freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c (16277 => 16278)


--- freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c	2010-01-13 17:01:36 UTC (rev 16277)
+++ freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c	2010-01-13 18:02:42 UTC (rev 16278)
@@ -158,7 +158,7 @@
 	switch_cache_db_connection_options_t options = { {0} };
 	switch_cache_db_handle_t *dbh = NULL;
 	
-	if (profile->odbc_dsn && profile->odbc_user && profile->odbc_pass) {
+	if (!zstr(profile->odbc_dsn)) {
 		options.odbc_options.dsn = profile->odbc_dsn;
 		options.odbc_options.user = profile->odbc_user;
 		options.odbc_options.pass = profile->odbc_pass;

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (16277 => 16278)


--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c	2010-01-13 17:01:36 UTC (rev 16277)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c	2010-01-13 18:02:42 UTC (rev 16278)
@@ -4208,7 +4208,7 @@
 	switch_cache_db_connection_options_t options = { {0} };
 	switch_cache_db_handle_t *dbh = NULL;
 	
-	if (profile->odbc_dsn && profile->odbc_user && profile->odbc_pass) {
+	if (!zstr(profile->odbc_dsn)) {
 		options.odbc_options.dsn = profile->odbc_dsn;
 		options.odbc_options.user = profile->odbc_user;
 		options.odbc_options.pass = profile->odbc_pass;

Modified: freeswitch/trunk/src/switch_core_sqldb.c (16277 => 16278)


--- freeswitch/trunk/src/switch_core_sqldb.c	2010-01-13 17:01:36 UTC (rev 16277)
+++ freeswitch/trunk/src/switch_core_sqldb.c	2010-01-13 18:02:42 UTC (rev 16278)
@@ -58,7 +58,7 @@
 	switch_cache_db_connection_options_t options = { {0} };
 	switch_status_t r;
 	
-	if (runtime.odbc_dsn && runtime.odbc_user && runtime.odbc_pass) {
+	if (!zstr(runtime.odbc_dsn)) {
 		options.odbc_options.dsn = runtime.odbc_dsn;
 		options.odbc_options.user = runtime.odbc_user;
 		options.odbc_options.pass = runtime.odbc_pass;

Modified: freeswitch/trunk/src/switch_time.c (16277 => 16278)


--- freeswitch/trunk/src/switch_time.c	2010-01-13 17:01:36 UTC (rev 16277)
+++ freeswitch/trunk/src/switch_time.c	2010-01-13 18:02:42 UTC (rev 16278)
@@ -176,29 +176,39 @@
 	
 }
 
+#define calc_step() if ((step - 10) > 10) step -= 10; else if (step > 1) step--
 static void calibrate_clock(void)
 {
 	int x;
 	switch_interval_time_t avg, val = 1000, want = 1000;
-	int over = 0, under = 0, good = 0;
+	int over = 0, under = 0, good = 0, step = 50;
 
 	for (x = 0; x < 500; x++) {
 		avg = average_time(val, 100);
-		
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Test: %ld Average: %ld Step: %d\n", val, avg, step);
+
 		if (abs((int)(want - avg)) <= 2) {
+			under = over = 0;
 			if (++good > 10) {
 				break;
 			}
 		} else if (avg > want) {
-			val--;
-			over++;
+			under = 0;
+			val -= step;
+			if (++over > 3) {
+				calc_step();
+			}
 		} else if (avg < want) {
-			val++;
-			under++;
+			over = 0;
+			val += step;
+			if (++under > 3) {
+				calc_step();
+			}
 		}
 	}
 
 	OFFSET = (int)(want - val);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Timer offset of %d calculated\n", OFFSET);
 }
 
 
@@ -289,7 +299,7 @@
 SWITCH_DECLARE(void) switch_sleep(switch_interval_time_t t)
 {
 
-	if (!globals.RUNNING || t < 1000 || t >= 10000) {
+	if (globals.RUNNING != 1 || t < 1000 || t >= 10000) {
 		do_sleep(t);
 		return;
 	}
@@ -580,7 +590,7 @@
 	}
 #endif
 
-	calibrate_clock();
+
 	switch_time_sync();
 	
 	globals.use_cond_yield = COND;
@@ -917,6 +927,9 @@
 	timer_interface->timer_check = timer_check;
 	timer_interface->timer_destroy = timer_destroy;
 
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Calibrating timer, please wait...\n");
+	calibrate_clock();
+
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;
 }

Modified: freeswitch/trunk/support-d/.bashrc (16277 => 16278)


--- freeswitch/trunk/support-d/.bashrc	2010-01-13 17:01:36 UTC (rev 16277)
+++ freeswitch/trunk/support-d/.bashrc	2010-01-13 18:02:42 UTC (rev 16278)
@@ -27,8 +27,8 @@
 alias bcommit='svn commit --no-auth-cache --username=brian'
 alias icommit='svn commit --no-auth-cache --username=intralanman'
 alias dp='emacs /usr/local/freeswitch/conf/dialplan/default.xml'
-alias fstop='top -p `cat /usr/local/freeswitch/log/freeswitch.pid`'
-alias fsgdb='gdb /usr/local/freeswitch/bin/freeswitch `cat /usr/local/freeswitch/log/freeswitch.pid`'
+alias fstop='top -p `cat /usr/local/freeswitch/run/freeswitch.pid`'
+alias fsgdb='gdb /usr/local/freeswitch/bin/freeswitch `cat /usr/local/freeswitch/run/freeswitch.pid`'
 alias fscore='gdb /usr/local/freeswitch/bin/freeswitch `ls -rt core.* | tail -n1`'
 alias emacs='emacs -nw'
 # End of file