Freeswitch-svn
Threads by month
- ----- 2026 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
January 2009
- 20 participants
- 514 discussions
Author: anthm
Date: Mon Jan 26 10:47:00 2009
New Revision: 11490
Log:
add missing code
Modified:
freeswitch/trunk/src/switch_core_io.c
Modified: freeswitch/trunk/src/switch_core_io.c
==============================================================================
--- freeswitch/trunk/src/switch_core_io.c (original)
+++ freeswitch/trunk/src/switch_core_io.c Mon Jan 26 10:47:00 2009
@@ -328,7 +328,7 @@
}
}
- if (session->bugs) {
+ if (session->bugs && !switch_channel_test_flag(session->channel, CF_PAUSE_BUGS)) {
switch_media_bug_t *bp, *dp, *last = NULL;
switch_bool_t ok = SWITCH_TRUE;
switch_thread_rwlock_rdlock(session->bug_rwlock);
@@ -493,7 +493,7 @@
if (flag & SFF_CNG) {
switch_set_flag((*frame), SFF_CNG);
}
- if (session->bugs) {
+ if (session->bugs && !switch_channel_test_flag(session->channel, CF_PAUSE_BUGS)) {
switch_media_bug_t *bp, *dp, *last = NULL;
switch_bool_t ok = SWITCH_TRUE;
switch_thread_rwlock_rdlock(session->bug_rwlock);
@@ -745,7 +745,7 @@
switch_mutex_unlock(session->resample_mutex);
}
- if (session->bugs) {
+ if (session->bugs && !switch_channel_test_flag(session->channel, CF_PAUSE_BUGS)) {
switch_media_bug_t *bp, *dp, *last = NULL;
switch_thread_rwlock_rdlock(session->bug_rwlock);
1
0
[commit] r11489 - freeswitch/trunk/src/mod/event_handlers/mod_erlang_event
by FreeSWITCH SVN 26 Jan '09
by FreeSWITCH SVN 26 Jan '09
26 Jan '09
Author: andrew
Date: Sun Jan 25 22:09:08 2009
New Revision: 11489
Log:
Monitor spawned outbound processes for premature exits
Modified:
freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/ei_helpers.c
freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c
freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h
Modified: freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/ei_helpers.c
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/ei_helpers.c (original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/ei_helpers.c Sun Jan 25 22:09:08 2009
@@ -258,6 +258,19 @@
}
+int ei_compare_pids(erlang_pid *pid1, erlang_pid *pid2)
+{
+ if ((!strcmp(pid1->node, pid2->node)) &&
+ pid1->creation == pid2->creation &&
+ pid1->num == pid2->num &&
+ pid1->serial == pid2->serial) {
+ return 0;
+ } else {
+ return 1;
+ }
+}
+
+
switch_status_t initialise_ei(struct ei_cnode_s *ec)
{
switch_status_t rv;
Modified: freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c (original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c Sun Jan 25 22:09:08 2009
@@ -114,7 +114,7 @@
for (ptr = bindings.head; ptr; lst = ptr, ptr = ptr->next) {
if ((listener && ptr->listener == listener) ||
- (pid && (&ptr->process.type == ERLANG_PID) && (!strcmp(pid->node, ptr->process.pid.node)) && pid->creation == ptr->process.pid.creation && pid->num == ptr->process.pid.num && pid->serial == ptr->process.pid.serial)) {
+ (pid && (ptr->process.type == ERLANG_PID) && !ei_compare_pids(&ptr->process.pid, pid))) {
if (bindings.head == ptr) {
if (ptr->next) {
bindings.head = ptr->next;
@@ -301,6 +301,49 @@
switch_mutex_unlock(listener->session_mutex);
}
+static void remove_session_elem_from_listener(listener_t *listener, session_elem_t *session)
+{
+ session_elem_t *s, *last = NULL;
+
+ if(!session)
+ return;
+
+ switch_mutex_lock(listener->session_mutex);
+ for(s = listener->session_list; s; s = s->next) {
+ if (s == session) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Removing session\n");
+ if (last) {
+ last->next = s->next;
+ } else {
+ listener->session_list = s->next;
+ }
+ switch_channel_clear_flag(switch_core_session_get_channel(s->session), CF_CONTROLLED);
+ /* this allows the application threads to exit */
+ switch_clear_flag_locked(s, LFLAG_SESSION_ALIVE);
+ switch_core_session_rwunlock(s->session);
+ }
+ last = s;
+ }
+ switch_mutex_unlock(listener->session_mutex);
+}
+
+
+session_elem_t * find_session_elem_by_pid(listener_t *listener, erlang_pid *pid)
+{
+ session_elem_t *s = NULL;
+
+ switch_mutex_lock(listener->session_mutex);
+ for (s = listener->session_list; s; s = s->next) {
+ if (s->process.type == ERLANG_PID && ei_compare_pids(pid, &s->process.pid)) {
+ break;
+ }
+ }
+ switch_mutex_unlock(listener->session_mutex);
+
+ return s;
+}
+
+
static switch_xml_t erlang_fetch(const char *sectionstr, const char *tag_name, const char *key_name, const char *key_value,
switch_event_t *params, void *user_data)
{
@@ -635,6 +678,8 @@
case ERL_EXIT :
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "erl_exit from %s <%d.%d.%d>\n", msg.from.node, msg.from.creation, msg.from.num, msg.from.serial);
remove_binding(NULL, &msg.from);
+ /* TODO - if a spawned process that was handling an outbound call fails.. what do we do with the call? */
+ remove_session_elem_from_listener(listener, find_session_elem_by_pid(listener, &msg.from));
/* TODO - check if this linked pid is any of the log/event handler processes and cleanup if it is. */
break;
default :
@@ -955,6 +1000,8 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "got pid!\n");
+ ei_link(listener, pid, ei_self(listener->ec));
+
session_element->process.type = ERLANG_PID;
memcpy(&session_element->process.pid, pid, sizeof(erlang_pid));
switch_set_flag(session_element, LFLAG_SESSION_ALIVE);
Modified: freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h (original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h Sun Jan 25 22:09:08 2009
@@ -54,7 +54,6 @@
switch_core_session_t *session;
switch_mutex_t *flag_mutex;
uint32_t flags;
- /* registered process name that will receive call notifications from this session */
struct erlang_process process;
switch_queue_t *event_queue;
struct session_elem *next;
@@ -194,6 +193,7 @@
void ei_x_print_msg(ei_x_buff *buf, erlang_pid *pid, int send);
int ei_sendto(ei_cnode *ec, int fd, struct erlang_process *process, ei_x_buff *buf);
void ei_hash_ref(erlang_ref *ref, char *output);
+int ei_compare_pids(erlang_pid *pid1, erlang_pid *pid2);
switch_status_t initialise_ei(struct ei_cnode_s *ec);
#define ei_encode_switch_event(_b, _e) ei_encode_switch_event_tag(_b, _e, "event")
1
0
[commit] r11488 - freeswitch/trunk/src/mod/event_handlers/mod_erlang_event
by FreeSWITCH SVN 25 Jan '09
by FreeSWITCH SVN 25 Jan '09
25 Jan '09
Author: andrew
Date: Sun Jan 25 15:35:27 2009
New Revision: 11488
Log:
Fix setting up a listener for an outbound session if one doesn't already exist, add beginnings of 'erlang' console command
Modified:
freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c
Modified: freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c (original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c Sun Jan 25 15:35:27 2009
@@ -886,7 +886,7 @@
if (SWITCH_STATUS_SUCCESS==initialise_ei(&ec)) {
errno = 0;
- if ((clientfd=ei_connect(&ec,node)) == ERL_ERROR) {
+ if ((clientfd=ei_connect(&ec,node)) < 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error connecting to node %s (erl_errno=%d, errno=%d)!\n",node,erl_errno,errno);
return NULL;
}
@@ -899,7 +899,7 @@
session_elem_t* attach_call_to_registered_process(listener_t* listener, char* reg_name, switch_core_session_t *session)
{
/* create a session list element */
- session_elem_t* session_element=NULL;
+ session_elem_t* session_element = NULL;
if (!(session_element = switch_core_alloc(switch_core_session_get_pool(session), sizeof(*session_element)))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to allocate session element\n");
}
@@ -969,6 +969,25 @@
}
+int count_listener_sessions(listener_t *listener) {
+ session_elem_t *last,*sp;
+ int count = 0;
+
+ switch_mutex_lock(listener->session_mutex);
+ sp = listener->session_list;
+ last = NULL;
+ while(sp) {
+ count++;
+ last = sp;
+ sp = sp->next;
+ }
+
+ switch_mutex_unlock(listener->session_mutex);
+
+ return count;
+}
+
+
/* Module Hooks */
/* Entry point for outbound mode */
@@ -1024,13 +1043,17 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Creating new listener for session\n");
new_session = SWITCH_TRUE;
listener = new_outbound_listener(node);
- add_listener(listener);
}
else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Using existing listener for session\n");
}
if (listener) {
+ if (new_session == SWITCH_TRUE) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Launching new listener\n");
+ launch_listener_thread(listener);
+ }
+
if (module && function) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Creating new spawned session for listener\n");
session_element=attach_call_to_spawned_process(listener, module, function, session);
@@ -1041,8 +1064,6 @@
if (session_element) {
- if (new_session)
- launch_listener_thread(listener);
switch_ivr_park(session, NULL);
/* keep app thread running for lifetime of session */
@@ -1057,9 +1078,57 @@
}
+/* 'erlang' console stuff */
+SWITCH_STANDARD_API(erlang_cmd)
+{
+ char *argv[1024] = { 0 };
+ int argc = 0;
+ char *mycmd = NULL;
+ switch_status_t status = SWITCH_STATUS_SUCCESS;
+
+ const char *usage_string = "Supply some arguments, maybe?";
+
+ if (switch_strlen_zero(cmd)) {
+ stream->write_function(stream, "%s", usage_string);
+ goto done;
+ }
+
+
+ if (!(mycmd = strdup(cmd))) {
+ status = SWITCH_STATUS_MEMERR;
+ goto done;
+ }
+
+ if (!(argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
+ stream->write_function(stream, "%s", usage_string);
+ goto done;
+ }
+
+ if (!strcasecmp(argv[0], "listeners")) {
+
+ listener_t *l;
+ switch_mutex_lock(globals.listener_mutex);
+
+ for (l = listen_list.listeners; l; l = l->next) {
+ stream->write_function(stream, "Listener to %s with %d outbound sessions\n", l->peer_nodename, count_listener_sessions(l));
+ }
+
+ switch_mutex_unlock(globals.listener_mutex);
+ } else {
+ stream->write_function(stream, "I don't care for those arguments at all, sorry");
+ goto done;
+ }
+
+done:
+ switch_safe_free(mycmd);
+ return status;
+}
+
+
SWITCH_MODULE_LOAD_FUNCTION(mod_erlang_event_load)
{
switch_application_interface_t *app_interface;
+ switch_api_interface_t *api_interface;
switch_mutex_init(&globals.listener_mutex, SWITCH_MUTEX_NESTED, pool);
@@ -1091,6 +1160,8 @@
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
SWITCH_ADD_APP(app_interface, "erlang", "Connect to an erlang node", "Connect to erlang", erlang_outbound_function, "<registered name> <node@host>", SAF_SUPPORT_NOMEDIA);
+ SWITCH_ADD_API(api_interface, "erlang", "PortAudio", erlang_cmd, "<command> [<args>]");
+ switch_console_set_complete("add erlang listeners");
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
1
0
[commit] r11487 - in freeswitch/trunk/src/mod/languages/mod_managed: . managed
by FreeSWITCH SVN 25 Jan '09
by FreeSWITCH SVN 25 Jan '09
25 Jan '09
Author: anthm
Date: Sun Jan 25 15:24:05 2009
New Revision: 11487
Log:
swigall
Modified:
freeswitch/trunk/src/mod/languages/mod_managed/freeswitch_wrap.cxx
freeswitch/trunk/src/mod/languages/mod_managed/managed/swig.cs
Modified: freeswitch/trunk/src/mod/languages/mod_managed/freeswitch_wrap.cxx
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_managed/freeswitch_wrap.cxx (original)
+++ freeswitch/trunk/src/mod/languages/mod_managed/freeswitch_wrap.cxx Sun Jan 25 15:24:05 2009
@@ -4876,6 +4876,22 @@
}
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_media_bug_pause(void * jarg1) {
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+
+ arg1 = (switch_core_session_t *)jarg1;
+ switch_core_media_bug_pause(arg1);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_media_bug_resume(void * jarg1) {
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+
+ arg1 = (switch_core_session_t *)jarg1;
+ switch_core_media_bug_resume(arg1);
+}
+
+
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_media_bug_get_user_data(void * jarg1) {
void * jresult ;
switch_media_bug_t *arg1 = (switch_media_bug_t *) 0 ;
@@ -7604,11 +7620,11 @@
}
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_timestamp_now() {
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_micro_time_now() {
void * jresult ;
switch_time_t result;
- result = switch_timestamp_now();
+ result = switch_micro_time_now();
jresult = new switch_time_t((switch_time_t &)result);
return jresult;
}
@@ -7644,13 +7660,13 @@
}
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_timestamp(void * jarg1) {
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_epoch_time_now(void * jarg1) {
void * jresult ;
time_t *arg1 = (time_t *) 0 ;
time_t result;
arg1 = (time_t *)jarg1;
- result = switch_timestamp(arg1);
+ result = switch_epoch_time_now(arg1);
jresult = new time_t((time_t &)result);
return jresult;
}
@@ -8315,6 +8331,30 @@
}
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_string_var_check_const(char * jarg1) {
+ int jresult ;
+ char *arg1 = (char *) 0 ;
+ switch_bool_t result;
+
+ arg1 = (char *)jarg1;
+ result = (switch_bool_t)switch_string_var_check_const((char const *)arg1);
+ jresult = result;
+ return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_var_clean_string(char * jarg1) {
+ char * jresult ;
+ char *arg1 = (char *) 0 ;
+ char *result = 0 ;
+
+ arg1 = (char *)jarg1;
+ result = (char *)switch_var_clean_string(arg1);
+ jresult = SWIG_csharp_string_callback((const char *)result);
+ return jresult;
+}
+
+
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_clean_string(char * jarg1) {
char * jresult ;
char *arg1 = (char *) 0 ;
@@ -18613,6 +18653,40 @@
}
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_app_flag(void * jarg1, unsigned long jarg2) {
+ switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+ uint32_t arg2 ;
+
+ arg1 = (switch_channel_t *)jarg1;
+ arg2 = (uint32_t)jarg2;
+ switch_channel_set_app_flag(arg1,arg2);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_clear_app_flag(void * jarg1, unsigned long jarg2) {
+ switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+ uint32_t arg2 ;
+
+ arg1 = (switch_channel_t *)jarg1;
+ arg2 = (uint32_t)jarg2;
+ switch_channel_clear_app_flag(arg1,arg2);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_test_app_flag(void * jarg1, unsigned long jarg2) {
+ int jresult ;
+ switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+ uint32_t arg2 ;
+ int result;
+
+ arg1 = (switch_channel_t *)jarg1;
+ arg2 = (uint32_t)jarg2;
+ result = (int)switch_channel_test_app_flag(arg1,arg2);
+ jresult = result;
+ return jresult;
+}
+
+
SWIGEXPORT int SWIGSTDCALL CSharp_switch_buffer_create(void * jarg1, void * jarg2, void * jarg3) {
int jresult ;
switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ;
Modified: freeswitch/trunk/src/mod/languages/mod_managed/managed/swig.cs
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_managed/managed/swig.cs (original)
+++ freeswitch/trunk/src/mod/languages/mod_managed/managed/swig.cs Sun Jan 25 15:24:05 2009
@@ -869,6 +869,14 @@
return ret;
}
+ public static void switch_core_media_bug_pause(SWIGTYPE_p_switch_core_session session) {
+ freeswitchPINVOKE.switch_core_media_bug_pause(SWIGTYPE_p_switch_core_session.getCPtr(session));
+ }
+
+ public static void switch_core_media_bug_resume(SWIGTYPE_p_switch_core_session session) {
+ freeswitchPINVOKE.switch_core_media_bug_resume(SWIGTYPE_p_switch_core_session.getCPtr(session));
+ }
+
public static SWIGTYPE_p_void switch_core_media_bug_get_user_data(SWIGTYPE_p_switch_media_bug bug) {
IntPtr cPtr = freeswitchPINVOKE.switch_core_media_bug_get_user_data(SWIGTYPE_p_switch_media_bug.getCPtr(bug));
SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
@@ -1850,8 +1858,8 @@
return ret;
}
- public static SWIGTYPE_p_switch_time_t switch_timestamp_now() {
- SWIGTYPE_p_switch_time_t ret = new SWIGTYPE_p_switch_time_t(freeswitchPINVOKE.switch_timestamp_now(), true);
+ public static SWIGTYPE_p_switch_time_t switch_micro_time_now() {
+ SWIGTYPE_p_switch_time_t ret = new SWIGTYPE_p_switch_time_t(freeswitchPINVOKE.switch_micro_time_now(), true);
return ret;
}
@@ -1879,8 +1887,8 @@
freeswitchPINVOKE.switch_time_sync();
}
- public static SWIGTYPE_p_time_t switch_timestamp(SWIGTYPE_p_time_t t) {
- SWIGTYPE_p_time_t ret = new SWIGTYPE_p_time_t(freeswitchPINVOKE.switch_timestamp(SWIGTYPE_p_time_t.getCPtr(t)), true);
+ public static SWIGTYPE_p_time_t switch_epoch_time_now(SWIGTYPE_p_time_t t) {
+ SWIGTYPE_p_time_t ret = new SWIGTYPE_p_time_t(freeswitchPINVOKE.switch_epoch_time_now(SWIGTYPE_p_time_t.getCPtr(t)), true);
return ret;
}
@@ -2099,6 +2107,16 @@
return ret;
}
+ public static switch_bool_t switch_string_var_check_const(string s) {
+ switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_string_var_check_const(s);
+ return ret;
+ }
+
+ public static string switch_var_clean_string(string s) {
+ string ret = freeswitchPINVOKE.switch_var_clean_string(s);
+ return ret;
+ }
+
public static string switch_clean_string(string s) {
string ret = freeswitchPINVOKE.switch_clean_string(s);
return ret;
@@ -2631,6 +2649,19 @@
return ret;
}
+ public static void switch_channel_set_app_flag(SWIGTYPE_p_switch_channel channel, uint flags) {
+ freeswitchPINVOKE.switch_channel_set_app_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), flags);
+ }
+
+ public static void switch_channel_clear_app_flag(SWIGTYPE_p_switch_channel channel, uint flags) {
+ freeswitchPINVOKE.switch_channel_clear_app_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), flags);
+ }
+
+ public static int switch_channel_test_app_flag(SWIGTYPE_p_switch_channel channel, uint flags) {
+ int ret = freeswitchPINVOKE.switch_channel_test_app_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), flags);
+ return ret;
+ }
+
public static switch_status_t switch_buffer_create(SWIGTYPE_p_apr_pool_t pool, SWIGTYPE_p_p_switch_buffer buffer, SWIGTYPE_p_switch_size_t max_len) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_buffer_create(SWIGTYPE_p_apr_pool_t.getCPtr(pool), SWIGTYPE_p_p_switch_buffer.getCPtr(buffer), SWIGTYPE_p_switch_size_t.getCPtr(max_len));
if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
@@ -5542,6 +5573,12 @@
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_add")]
public static extern int switch_core_media_bug_add(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4, uint jarg5, HandleRef jarg6);
+ [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_pause")]
+ public static extern void switch_core_media_bug_pause(HandleRef jarg1);
+
+ [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_resume")]
+ public static extern void switch_core_media_bug_resume(HandleRef jarg1);
+
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_get_user_data")]
public static extern IntPtr switch_core_media_bug_get_user_data(HandleRef jarg1);
@@ -6133,8 +6170,8 @@
[DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_create_interface")]
public static extern IntPtr switch_loadable_module_create_interface(HandleRef jarg1, int jarg2);
- [DllImport("mod_managed", EntryPoint="CSharp_switch_timestamp_now")]
- public static extern IntPtr switch_timestamp_now();
+ [DllImport("mod_managed", EntryPoint="CSharp_switch_micro_time_now")]
+ public static extern IntPtr switch_micro_time_now();
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_memory_reclaim")]
public static extern void switch_core_memory_reclaim();
@@ -6154,8 +6191,8 @@
[DllImport("mod_managed", EntryPoint="CSharp_switch_time_sync")]
public static extern void switch_time_sync();
- [DllImport("mod_managed", EntryPoint="CSharp_switch_timestamp")]
- public static extern IntPtr switch_timestamp(HandleRef jarg1);
+ [DllImport("mod_managed", EntryPoint="CSharp_switch_epoch_time_now")]
+ public static extern IntPtr switch_epoch_time_now(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_strftime_tz")]
public static extern int switch_strftime_tz(string jarg1, string jarg2, string jarg3, uint jarg4, HandleRef jarg5);
@@ -6292,6 +6329,12 @@
[DllImport("mod_managed", EntryPoint="CSharp_switch_string_var_check")]
public static extern int switch_string_var_check(string jarg1, int jarg2);
+ [DllImport("mod_managed", EntryPoint="CSharp_switch_string_var_check_const")]
+ public static extern int switch_string_var_check_const(string jarg1);
+
+ [DllImport("mod_managed", EntryPoint="CSharp_switch_var_clean_string")]
+ public static extern string switch_var_clean_string(string jarg1);
+
[DllImport("mod_managed", EntryPoint="CSharp_switch_clean_string")]
public static extern string switch_clean_string(string jarg1);
@@ -8824,6 +8867,15 @@
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_test_private_flag")]
public static extern int switch_channel_test_private_flag(HandleRef jarg1, uint jarg2);
+ [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_app_flag")]
+ public static extern void switch_channel_set_app_flag(HandleRef jarg1, uint jarg2);
+
+ [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_clear_app_flag")]
+ public static extern void switch_channel_clear_app_flag(HandleRef jarg1, uint jarg2);
+
+ [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_test_app_flag")]
+ public static extern int switch_channel_test_app_flag(HandleRef jarg1, uint jarg2);
+
[DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_create")]
public static extern int switch_buffer_create(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
@@ -17171,6 +17223,21 @@
namespace FreeSWITCH.Native {
+public enum switch_channel_app_flag_t {
+ CF_APP_TAGGED = (1 << 0)
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org)
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
public enum switch_channel_flag_t {
CF_ANSWERED = 1,
CF_OUTBOUND,
@@ -17202,6 +17269,7 @@
CF_INNER_BRIDGE,
CF_REQ_MEDIA,
CF_VERBOSE_EVENTS,
+ CF_PAUSE_BUGS,
CF_FLAG_MAX
}
1
0
Author: anthm
Date: Sun Jan 25 15:23:07 2009
New Revision: 11486
Log:
change low res sleep func api names
Modified:
freeswitch/trunk/scripts/contrib/dschreiber/mod_nibblebill/mod_nibblebill.c
freeswitch/trunk/src/include/switch_core.h
freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c
freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c
freeswitch/trunk/src/mod/applications/mod_esf/mod_esf.c
freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c
freeswitch/trunk/src/mod/applications/mod_fsv/mod_fsv.c
freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c
freeswitch/trunk/src/mod/applications/mod_rss/mod_rss.c
freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c
freeswitch/trunk/src/mod/endpoints/mod_alsa/mod_alsa.c
freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c
freeswitch/trunk/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c
freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c
freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
freeswitch/trunk/src/mod/loggers/mod_logfile/mod_logfile.c
freeswitch/trunk/src/mod/say/mod_say_de/mod_say_de.c
freeswitch/trunk/src/mod/say/mod_say_en/mod_say_en.c
freeswitch/trunk/src/mod/say/mod_say_es/mod_say_es.c
freeswitch/trunk/src/mod/say/mod_say_fr/mod_say_fr.c
freeswitch/trunk/src/mod/say/mod_say_it/mod_say_it.c
freeswitch/trunk/src/mod/say/mod_say_nl/mod_say_nl.c
freeswitch/trunk/src/mod/say/mod_say_zh/mod_say_zh.c
freeswitch/trunk/src/switch_channel.c
freeswitch/trunk/src/switch_console.c
freeswitch/trunk/src/switch_core.c
freeswitch/trunk/src/switch_core_io.c
freeswitch/trunk/src/switch_core_port_allocator.c
freeswitch/trunk/src/switch_core_session.c
freeswitch/trunk/src/switch_core_sqldb.c
freeswitch/trunk/src/switch_event.c
freeswitch/trunk/src/switch_ivr.c
freeswitch/trunk/src/switch_ivr_async.c
freeswitch/trunk/src/switch_ivr_originate.c
freeswitch/trunk/src/switch_ivr_play_say.c
freeswitch/trunk/src/switch_log.c
freeswitch/trunk/src/switch_resample.c
freeswitch/trunk/src/switch_rtp.c
freeswitch/trunk/src/switch_scheduler.c
freeswitch/trunk/src/switch_stun.c
freeswitch/trunk/src/switch_time.c
freeswitch/trunk/src/switch_utils.c
Modified: freeswitch/trunk/scripts/contrib/dschreiber/mod_nibblebill/mod_nibblebill.c
==============================================================================
--- freeswitch/trunk/scripts/contrib/dschreiber/mod_nibblebill/mod_nibblebill.c (original)
+++ freeswitch/trunk/scripts/contrib/dschreiber/mod_nibblebill/mod_nibblebill.c Sun Jan 25 15:23:07 2009
@@ -307,7 +307,7 @@
/* Local vars */
nibble_data_t *nibble_data;
- switch_time_t ts = switch_timestamp_now();
+ switch_time_t ts = switch_micro_time_now();
float billamount;
char date[80] = "";
char *tmp;
@@ -476,7 +476,7 @@
static void nibblebill_pause(switch_core_session_t *session)
{
switch_channel_t *channel = switch_core_session_get_channel(session);
- switch_time_t ts = switch_timestamp_now();
+ switch_time_t ts = switch_micro_time_now();
nibble_data_t *nibble_data;
if (!channel) {
@@ -512,7 +512,7 @@
static void nibblebill_resume(switch_core_session_t *session)
{
switch_channel_t *channel = switch_core_session_get_channel(session);
- switch_time_t ts = switch_timestamp_now();
+ switch_time_t ts = switch_micro_time_now();
nibble_data_t *nibble_data;
if (!channel) {
@@ -555,7 +555,7 @@
static void nibblebill_reset(switch_core_session_t *session)
{
switch_channel_t *channel = switch_core_session_get_channel(session);
- switch_time_t ts = switch_timestamp_now();
+ switch_time_t ts = switch_micro_time_now();
nibble_data_t *nibble_data;
if (!channel) {
Modified: freeswitch/trunk/src/include/switch_core.h
==============================================================================
--- freeswitch/trunk/src/include/switch_core.h (original)
+++ freeswitch/trunk/src/include/switch_core.h Sun Jan 25 15:23:07 2009
@@ -1690,14 +1690,14 @@
SWITCH_DECLARE(switch_loadable_module_interface_t *) switch_loadable_module_create_module_interface(switch_memory_pool_t *pool, const char *name);
SWITCH_DECLARE(void *) switch_loadable_module_create_interface(switch_loadable_module_interface_t *mod, switch_module_interface_name_t iname);
-SWITCH_DECLARE(switch_time_t) switch_timestamp_now(void);
+SWITCH_DECLARE(switch_time_t) switch_micro_time_now(void);
SWITCH_DECLARE(void) switch_core_memory_reclaim(void);
SWITCH_DECLARE(void) switch_core_memory_reclaim_events(void);
SWITCH_DECLARE(void) switch_core_memory_reclaim_logger(void);
SWITCH_DECLARE(void) switch_core_memory_reclaim_all(void);
SWITCH_DECLARE(void) switch_core_setrlimits(void);
SWITCH_DECLARE(void) switch_time_sync(void);
-SWITCH_DECLARE(time_t) switch_timestamp(time_t *t);
+SWITCH_DECLARE(time_t) switch_epoch_time_now(time_t *t);
SWITCH_DECLARE(switch_status_t) switch_strftime_tz(const char *tz, const char *format, char *date, size_t len, switch_time_t thetime);
SWITCH_DECLARE(switch_status_t) switch_time_exp_tz_name(const char *tz, switch_time_exp_t *tm, switch_time_t thetime);
SWITCH_DECLARE(void) switch_load_network_lists(switch_bool_t reload);
Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c Sun Jan 25 15:23:07 2009
@@ -1384,13 +1384,13 @@
uint32_t mto;
if (*argv[4] == '+') {
if ((mto = atoi(argv[4] + 1)) > 0) {
- to = switch_timestamp(NULL) + mto;
+ to = switch_epoch_time_now(NULL) + mto;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID Timeout!\n");
goto done;
}
} else {
- if ((to = atoi(argv[4])) < switch_timestamp(NULL)) {
+ if ((to = atoi(argv[4])) < switch_epoch_time_now(NULL)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID Timeout!\n");
to = 0;
goto done;
@@ -1520,7 +1520,7 @@
time_t when;
if (*argv[0] == '+') {
- when = switch_timestamp(NULL) + atol(argv[0] + 1);
+ when = switch_epoch_time_now(NULL) + atol(argv[0] + 1);
} else {
when = atol(argv[0]);
}
@@ -1558,7 +1558,7 @@
switch_call_cause_t cause = SWITCH_CAUSE_ALLOTTED_TIMEOUT;
if (*argv[0] == '+') {
- when = switch_timestamp(NULL) + atol(argv[0] + 1);
+ when = switch_epoch_time_now(NULL) + atol(argv[0] + 1);
} else {
when = atol(argv[0]);
}
@@ -1665,7 +1665,7 @@
time_t when;
if (*argv[0] == '+') {
- when = switch_timestamp(NULL) + atol(argv[0] + 1);
+ when = switch_epoch_time_now(NULL) + atol(argv[0] + 1);
} else {
when = atol(argv[0]);
}
@@ -2205,7 +2205,7 @@
switch_safe_free(cmd);
if (api_task->recur) {
- task->runtime = switch_timestamp(NULL) + api_task->recur;
+ task->runtime = switch_epoch_time_now(NULL) + api_task->recur;
}
@@ -2252,10 +2252,10 @@
if (*tm == '+') {
- when = switch_timestamp(NULL) + atol(tm + 1);
+ when = switch_epoch_time_now(NULL) + atol(tm + 1);
} else if (*tm == '@') {
recur = (uint32_t) atol(tm + 1);
- when = switch_timestamp(NULL) + recur;
+ when = switch_epoch_time_now(NULL) + recur;
} else {
when = atol(tm);
}
Modified: freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c Sun Jan 25 15:23:07 2009
@@ -473,7 +473,7 @@
time_t when;
if (*argv[0] == '+') {
- when = switch_timestamp(NULL) + atol(argv[0] + 1);
+ when = switch_epoch_time_now(NULL) + atol(argv[0] + 1);
} else {
when = atol(argv[0]);
}
@@ -498,7 +498,7 @@
switch_bool_t bleg = SWITCH_FALSE;
if (*argv[0] == '+') {
- when = switch_timestamp(NULL) + atol(argv[0] + 1);
+ when = switch_epoch_time_now(NULL) + atol(argv[0] + 1);
} else {
when = atol(argv[0]);
}
@@ -530,7 +530,7 @@
switch_media_flag_t flags = SMF_NONE;
if (*argv[0] == '+') {
- when = switch_timestamp(NULL) + atol(argv[0] + 1);
+ when = switch_epoch_time_now(NULL) + atol(argv[0] + 1);
} else {
when = atol(argv[0]);
}
@@ -981,7 +981,7 @@
switch_time_exp_t tm;
char date[80] = "";
- switch_time_exp_lt(&tm, switch_timestamp_now());
+ switch_time_exp_lt(&tm, switch_micro_time_now());
switch_strftime(date, &retsize, sizeof(date), argv[1], &tm);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SET [%s]=[%s]\n", argv[0], date);
switch_channel_set_variable(switch_core_session_get_channel(session), argv[0], date);
@@ -993,7 +993,7 @@
switch_time_t out;
if (switch_strlen_zero(cmd)) {
- out = switch_timestamp_now();
+ out = switch_micro_time_now();
} else {
out = switch_str_time(cmd);
}
@@ -1014,7 +1014,7 @@
thetime = switch_time_make(atoi(cmd), 0);
cmd = p + 1;
} else {
- thetime = switch_timestamp_now();
+ thetime = switch_micro_time_now();
}
switch_time_exp_lt(&tm, thetime);
if (switch_strlen_zero(cmd)) {
@@ -1207,12 +1207,12 @@
uint32_t mto;
if (*argv[3] == '+') {
if ((mto = atol(argv[3] + 1)) > 0) {
- to = switch_timestamp(NULL) + mto;
+ to = switch_epoch_time_now(NULL) + mto;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID Timeout!\n");
}
} else {
- if ((to = atol(argv[3])) < switch_timestamp(NULL)) {
+ if ((to = atol(argv[3])) < switch_epoch_time_now(NULL)) {
if (to >= 1) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID Timeout!\n");
}
Modified: freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c Sun Jan 25 15:23:07 2009
@@ -531,7 +531,7 @@
tv.tv_sec = i;
tv.tv_usec = 0;
i = select((int) (fd + 1), &fds, 0, 0, &tv);
- now = switch_timestamp(NULL);
+ now = switch_epoch_time_now(NULL);
if (i > 0) {
dns_ioevent(nctx, now);
}
Modified: freeswitch/trunk/src/mod/applications/mod_esf/mod_esf.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_esf/mod_esf.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_esf/mod_esf.c Sun Jan 25 15:23:07 2009
@@ -205,7 +205,7 @@
}
}
- control_packet.unique_id = htonl((u_long) switch_timestamp(NULL));
+ control_packet.unique_id = htonl((u_long) switch_epoch_time_now(NULL));
control_packet.command = htonl(LS_START_BCAST);
control_packet.ip = inet_addr(mcast_ip);
control_packet.port = htonl(mcast_port);
@@ -233,7 +233,7 @@
}
}
- control_packet.unique_id = htonl((u_long) switch_timestamp(NULL));
+ control_packet.unique_id = htonl((u_long) switch_epoch_time_now(NULL));
control_packet.command = htonl(LS_STOP_BCAST);
bytes = 8;
switch_socket_sendto(socket, control_packet_addr, 0, (void *) &control_packet, &bytes);
Modified: freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c Sun Jan 25 15:23:07 2009
@@ -195,7 +195,7 @@
return SWITCH_STATUS_SUCCESS;
}
- if (cd->total && switch_timestamp(NULL) >= cd->next) {
+ if (cd->total && switch_epoch_time_now(NULL) >= cd->next) {
if (cd->index == MAX_CHIME || cd->index == cd->total || !cd->list[cd->index]) {
cd->index = 0;
}
@@ -213,10 +213,10 @@
cd->abort = 1;
return SWITCH_STATUS_FALSE;
}
- cd->next = switch_timestamp(NULL) + cd->freq;
+ cd->next = switch_epoch_time_now(NULL) + cd->freq;
cd->index++;
}
- } else if (cd->orbit_timeout && switch_timestamp(NULL) >= cd->orbit_timeout) {
+ } else if (cd->orbit_timeout && switch_epoch_time_now(NULL) >= cd->orbit_timeout) {
cd->do_orbit = 1;
return SWITCH_STATUS_FALSE;
}
@@ -418,7 +418,7 @@
if (state == CS_HANGUP || state == CS_ROUTING) {
if ((uuid = switch_channel_get_variable(channel, "fifo_outbound_uuid"))) {
switch_snprintf(sql, sizeof(sql), "update fifo_outbound set use_count=use_count-1, outbound_call_count=outbound_call_count+1, next_avail=%ld + lag where uuid='%s'",
- (long)switch_timestamp(NULL), uuid);
+ (long)switch_epoch_time_now(NULL), uuid);
fifo_execute_sql(sql, globals.sql_mutex);
}
@@ -451,7 +451,7 @@
if (switch_ivr_originate(NULL, &session, &cause, h->originate_string, h->timeout, NULL, NULL, NULL, NULL, NULL, SOF_NONE) != SWITCH_STATUS_SUCCESS) {
switch_snprintf(sql, sizeof(sql), "update fifo_outbound set use_count=use_count-1, outbound_fail_count=outbound_fail_count+1, next_avail=%ld + lag where uuid='%s'",
- (long)switch_timestamp(NULL), h->uuid);
+ (long)switch_epoch_time_now(NULL), h->uuid);
fifo_execute_sql(sql, globals.sql_mutex);
goto end;
}
@@ -512,7 +512,7 @@
sql = switch_mprintf("select uuid, fifo_name, originate_string, simo_count, use_count, timeout, lag, "
"next_avail, expires, static, outbound_call_count, outbound_fail_count, hostname "
"from fifo_outbound where (use_count < simo_count) and (next_avail = 0 or next_avail <= %ld) order by outbound_call_count",
- (long) switch_timestamp(NULL));
+ (long) switch_epoch_time_now(NULL));
switch_assert(sql);
fifo_execute_sql_callback(globals.sql_mutex, sql, place_call_callback, &need);
free(sql);
@@ -668,7 +668,7 @@
switch_event_t *event = NULL;
char date[80] = "";
switch_time_exp_t tm;
- switch_time_t ts = switch_timestamp_now();
+ switch_time_t ts = switch_micro_time_now();
switch_size_t retsize;
char *list_string;
int nlist_count;
@@ -796,7 +796,7 @@
to = 60;
}
}
- cd.orbit_timeout = switch_timestamp(NULL) + to;
+ cd.orbit_timeout = switch_epoch_time_now(NULL) + to;
}
}
@@ -823,7 +823,7 @@
}
if (!node_consumer_wait_count(node)) {
- node->start_waiting = switch_timestamp_now();
+ node->start_waiting = switch_micro_time_now();
}
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) {
@@ -843,7 +843,7 @@
switch_mutex_unlock(node->mutex);
- ts = switch_timestamp_now();
+ ts = switch_micro_time_now();
switch_time_exp_lt(&tm, ts);
switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
switch_channel_set_variable(channel, "fifo_status", "WAITING");
@@ -856,7 +856,7 @@
char *list_dup = switch_core_session_strdup(session, chime_list);
cd.total = switch_separate_string(list_dup, ',', cd.list, (sizeof(cd.list) / sizeof(cd.list[0])));
cd.freq = freq;
- cd.next = switch_timestamp(NULL) + cd.freq;
+ cd.next = switch_epoch_time_now(NULL) + cd.freq;
}
send_presence(node);
@@ -930,7 +930,7 @@
switch_channel_set_state(channel, CS_HIBERNATE);
goto done;
} else {
- ts = switch_timestamp_now();
+ ts = switch_micro_time_now();
switch_time_exp_lt(&tm, ts);
switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
switch_channel_set_variable(channel, "fifo_status", cd.do_orbit ? "TIMEOUT" : "ABORTED");
@@ -1027,7 +1027,7 @@
switch_event_fire(&event);
}
- ts = switch_timestamp_now();
+ ts = switch_micro_time_now();
switch_time_exp_lt(&tm, ts);
switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
switch_channel_set_variable(channel, "fifo_status", "WAITING");
@@ -1220,7 +1220,7 @@
switch_assert(cloned_profile->next == NULL);
switch_channel_set_originatee_caller_profile(channel, cloned_profile);
- ts = switch_timestamp_now();
+ ts = switch_micro_time_now();
switch_time_exp_lt(&tm, ts);
switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
switch_channel_set_variable(channel, "fifo_status", "TALKING");
@@ -1251,7 +1251,7 @@
}
}
- ts = switch_timestamp_now();
+ ts = switch_micro_time_now();
switch_time_exp_lt(&tm, ts);
switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
switch_channel_set_variable(channel, "fifo_status", "WAITING");
@@ -1300,7 +1300,7 @@
}
if (fifo_consumer_wrapup_time) {
- wrapup_time_started = switch_timestamp_now();
+ wrapup_time_started = switch_micro_time_now();
}
if (!switch_strlen_zero(fifo_consumer_wrapup_key) && strcmp(buf, fifo_consumer_wrapup_key)) {
@@ -1308,7 +1308,7 @@
char terminator = 0;
if (fifo_consumer_wrapup_time) {
- wrapup_time_elapsed = (switch_timestamp_now() - wrapup_time_started) / 1000;
+ wrapup_time_elapsed = (switch_micro_time_now() - wrapup_time_started) / 1000;
if (wrapup_time_elapsed > fifo_consumer_wrapup_time) {
break;
} else {
@@ -1324,7 +1324,7 @@
}
} else if (fifo_consumer_wrapup_time && (switch_strlen_zero(fifo_consumer_wrapup_key) || !strcmp(buf, fifo_consumer_wrapup_key))) {
while(switch_channel_ready(channel)) {
- wrapup_time_elapsed = (switch_timestamp_now() - wrapup_time_started) / 1000;
+ wrapup_time_elapsed = (switch_micro_time_now() - wrapup_time_started) / 1000;
if (wrapup_time_elapsed > fifo_consumer_wrapup_time) {
break;
}
@@ -1949,7 +1949,7 @@
lag = atoi(argv[5]);
}
if (argc > 6) {
- expires = switch_timestamp(NULL) + atoi(argv[6]);
+ expires = switch_epoch_time_now(NULL) + atoi(argv[6]);
}
if (simo_count < 0) {
simo_count = 1;
Modified: freeswitch/trunk/src/mod/applications/mod_fsv/mod_fsv.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_fsv/mod_fsv.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_fsv/mod_fsv.c Sun Jan 25 15:23:07 2009
@@ -140,7 +140,7 @@
vid_codec = switch_core_session_get_video_read_codec(session);
h.version = VERSION;
- h.created = switch_timestamp_now();
+ h.created = switch_micro_time_now();
switch_set_string(h.video_codec_name, vid_codec->implementation->iananame);
if (vid_codec->fmtp_in) {
switch_set_string(h.video_fmtp, vid_codec->fmtp_in);
Modified: freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c Sun Jan 25 15:23:07 2009
@@ -811,7 +811,7 @@
char *szinterval = NULL;
limit_hash_item_t *item = NULL;
switch_channel_t *channel = switch_core_session_get_channel(session);
- time_t now = switch_timestamp(NULL);
+ time_t now = switch_epoch_time_now(NULL);
switch_hash_t *channel_hash = NULL;
uint8_t increment = 1;
uint8_t new_channel = 0;
Modified: freeswitch/trunk/src/mod/applications/mod_rss/mod_rss.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_rss/mod_rss.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_rss/mod_rss.c Sun Jan 25 15:23:07 2009
@@ -478,7 +478,7 @@
switch_size_t retsize;
char dtmf[5] = "";
- switch_time_exp_lt(&tm, switch_timestamp_now());
+ switch_time_exp_lt(&tm, switch_micro_time_now());
switch_strftime_nocheck(date, &retsize, sizeof(date), "%I:%M %p", &tm);
Modified: freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c Sun Jan 25 15:23:07 2009
@@ -1767,7 +1767,7 @@
}
}
switch_snprintf(sql, sizeof(sql), "update voicemail_msgs set read_epoch=%ld where username='%s' and domain='%s' and flags='save'",
- (long) switch_timestamp(NULL), myid, domain_name);
+ (long) switch_epoch_time_now(NULL), myid, domain_name);
vm_execute_sql(profile, sql, profile->mutex);
switch_snprintf(sql, sizeof(sql), "select file_path from voicemail_msgs where username='%s' and domain='%s' and flags='delete'", myid,
domain_name);
@@ -2309,11 +2309,11 @@
switch_event_add_header_string(message_event, SWITCH_STACK_BOTTOM, "VM-Flags", read_flags);
switch_event_add_header_string(message_event, SWITCH_STACK_BOTTOM, "VM-Folder", myfolder);
switch_event_add_header(message_event, SWITCH_STACK_BOTTOM, "VM-Message-Len", "%u", message_len);
- switch_event_add_header(message_event, SWITCH_STACK_BOTTOM, "VM-Timestamp", "%lu", (unsigned long) switch_timestamp(NULL));
+ switch_event_add_header(message_event, SWITCH_STACK_BOTTOM, "VM-Timestamp", "%lu", (unsigned long) switch_epoch_time_now(NULL));
switch_event_fire(&message_event);
- usql = switch_mprintf("insert into voicemail_msgs values(%ld,0,'%q','%q','%q','%q','%q','%q','%q','%u','','%q')", (long) switch_timestamp(NULL),
+ usql = switch_mprintf("insert into voicemail_msgs values(%ld,0,'%q','%q','%q','%q','%q','%q','%q','%u','','%q')", (long) switch_epoch_time_now(NULL),
myid, domain_name, uuid_str, caller_id_name, caller_id_number,
myfolder, file_path, message_len, read_flags);
@@ -2346,7 +2346,7 @@
&total_new_urgent_messages, &total_saved_urgent_messages);
if (switch_strlen_zero(vm_timezone) || (switch_strftime_tz(vm_timezone, profile->date_fmt, date, sizeof(date), 0) != SWITCH_STATUS_SUCCESS)) {
- switch_time_exp_lt(&tm, switch_timestamp_now());
+ switch_time_exp_lt(&tm, switch_micro_time_now());
switch_strftime(date, &retsize, sizeof(date), profile->date_fmt, &tm);
}
@@ -2696,7 +2696,7 @@
switch_time_exp_t tm;
char date[80] = "";
switch_size_t retsize;
- switch_time_t ts = switch_timestamp_now();
+ switch_time_t ts = switch_micro_time_now();
char *dbuf = NULL;
char *vm_storage_dir = NULL;
char *record_macro = VM_RECORD_MESSAGE_MACRO;
@@ -3271,7 +3271,7 @@
struct holder holder;
sql = switch_mprintf("update voicemail_msgs set read_epoch=%ld where username='%s' and domain='%s' and file_path like '%%%s'",
- (long) switch_timestamp(NULL), user, domain, file);
+ (long) switch_epoch_time_now(NULL), user, domain, file);
vm_execute_sql(profile, sql, profile->mutex);
free(sql);
Modified: freeswitch/trunk/src/mod/endpoints/mod_alsa/mod_alsa.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_alsa/mod_alsa.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_alsa/mod_alsa.c Sun Jan 25 15:23:07 2009
@@ -180,7 +180,7 @@
assert(channel != NULL);
- last = switch_timestamp_now() - waitsec;
+ last = switch_micro_time_now() - waitsec;
@@ -243,7 +243,7 @@
switch_channel_mark_ring_ready(channel);
while (switch_channel_get_state(channel) == CS_INIT && !switch_test_flag(tech_pvt, TFLAG_ANSWER)) {
- if (switch_timestamp_now() - last >= waitsec) {
+ if (switch_micro_time_now() - last >= waitsec) {
char buf[512];
switch_event_t *event;
@@ -257,7 +257,7 @@
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s\n", buf);
- last = switch_timestamp_now();
+ last = switch_micro_time_now();
if (ring_file) {
unsigned int pos = 0;
switch_core_file_seek(&fh, &pos, 0, SEEK_SET);
Modified: freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c Sun Jan 25 15:23:07 2009
@@ -1070,7 +1070,7 @@
switch_set_flag_locked(tech_pvt, TFLAG_IO);
- started = switch_timestamp_now();
+ started = switch_micro_time_now();
/* jingle has no ringing indication so we will just pretend that we got one */
switch_core_session_queue_indication(session, SWITCH_MESSAGE_INDICATE_RINGING);
@@ -1088,7 +1088,7 @@
switch_test_flag(tech_pvt, TFLAG_RTP_READY) &&
switch_test_flag(tech_pvt, TFLAG_ANSWER) && switch_test_flag(tech_pvt, TFLAG_TRANSPORT_ACCEPT) &&
tech_pvt->remote_ip && tech_pvt->remote_port && switch_test_flag(tech_pvt, TFLAG_TRANSPORT))) {
- now = switch_timestamp_now();
+ now = switch_micro_time_now();
elapsed = (unsigned int) ((now - started) / 1000);
if (switch_channel_get_state(channel) >= CS_HANGUP || switch_test_flag(tech_pvt, TFLAG_BYE)) {
@@ -1340,7 +1340,7 @@
#if 0
if (tech_pvt->last_read) {
- elapsed = (unsigned int) ((switch_timestamp_now() - tech_pvt->last_read) / 1000);
+ elapsed = (unsigned int) ((switch_micro_time_now() - tech_pvt->last_read) / 1000);
if (elapsed > 60000) {
return SWITCH_STATUS_TIMEOUT;
}
@@ -1368,7 +1368,7 @@
payload = tech_pvt->read_frame.payload;
#if 0
- elapsed = (unsigned int) ((switch_timestamp_now() - started) / 1000);
+ elapsed = (unsigned int) ((switch_micro_time_now() - started) / 1000);
if (timeout > -1) {
if (elapsed >= (unsigned int) timeout) {
@@ -1376,7 +1376,7 @@
}
}
- elapsed = (unsigned int) ((switch_timestamp_now() - last_act) / 1000);
+ elapsed = (unsigned int) ((switch_micro_time_now() - last_act) / 1000);
if (elapsed >= hard_timeout) {
return SWITCH_STATUS_BREAK;
}
Modified: freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c Sun Jan 25 15:23:07 2009
@@ -182,7 +182,7 @@
switch_assert(tech_pvt != NULL);
- last = switch_timestamp_now() - waitsec;
+ last = switch_micro_time_now() - waitsec;
if ((val = switch_channel_get_variable(channel, "pa_hold_file"))) {
hold_file = val;
@@ -251,7 +251,7 @@
while (switch_channel_get_state(channel) == CS_INIT && !switch_test_flag(tech_pvt, TFLAG_ANSWER)) {
switch_size_t olen = globals.timer.samples;
- if (switch_timestamp_now() - last >= waitsec) {
+ if (switch_micro_time_now() - last >= waitsec) {
char buf[512];
switch_event_t *event;
@@ -264,7 +264,7 @@
switch_event_fire(&event);
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s\n", buf);
- last = switch_timestamp_now();
+ last = switch_micro_time_now();
}
if (ring_file) {
@@ -449,7 +449,7 @@
if (globals.call_list) {
switch_set_flag_locked(globals.call_list, TFLAG_MASTER);
} else {
- globals.deactivate_timer = switch_timestamp(NULL) + 2;
+ globals.deactivate_timer = switch_epoch_time_now(NULL) + 2;
deactivate_audio_device();
}
@@ -1259,7 +1259,7 @@
int codec_ms = globals.codec_ms;
switch_mutex_lock(globals.device_lock);
- while (globals.deactivate_timer > switch_timestamp(NULL)) {
+ while (globals.deactivate_timer > switch_epoch_time_now(NULL)) {
switch_yield(1000000);
}
switch_mutex_unlock(globals.device_lock);
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Sun Jan 25 15:23:07 2009
@@ -1650,7 +1650,7 @@
switch_assert(gp->state < REG_STATE_LAST);
stream->write_function(stream, "%25s\t%s\t %32s\t%s", gp->name, "gateway", gp->register_to, sofia_state_names[gp->state]);
if (gp->state == REG_STATE_FAILED || gp->state == REG_STATE_TRYING) {
- time_t now = switch_timestamp(NULL);
+ time_t now = switch_epoch_time_now(NULL);
if (gp->retry > now) {
stream->write_function(stream, " (retry: %ds)", gp->retry - now);
} else {
@@ -1842,7 +1842,7 @@
switch_assert(gp->state < REG_STATE_LAST);
stream->write_function(stream, "<gateway>\n<Name>%s</Name>\n<Type>%s</Type>\n<Data>%s</Data>\n<State>%s</State>\n</gateway>\n", gp->name, "gateway", gp->register_to, sofia_state_names[gp->state]);
if (gp->state == REG_STATE_FAILED || gp->state == REG_STATE_TRYING) {
- time_t now = switch_timestamp(NULL);
+ time_t now = switch_epoch_time_now(NULL);
if (gp->retry > now) {
stream->write_function(stream, " (retry: %ds)", gp->retry - now);
} else {
@@ -2042,7 +2042,7 @@
if (!strcasecmp(argv[1], "stop") || !strcasecmp(argv[1], "restart")) {
int rsec = 10;
- int diff = (int) (switch_timestamp(NULL) - profile->started);
+ int diff = (int) (switch_epoch_time_now(NULL) - profile->started);
int remain = rsec - diff;
if (diff < rsec) {
stream->write_function(stream, "Profile %s must be up for at least %d seconds to stop/restart.\nPlease wait %d second%s\n",
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Sun Jan 25 15:23:07 2009
@@ -284,11 +284,11 @@
void sofia_wait_for_reply(struct private_object *tech_pvt, nua_event_t event, uint32_t timeout)
{
- time_t exp = switch_timestamp(NULL) + timeout;
+ time_t exp = switch_epoch_time_now(NULL) + timeout;
tech_pvt->want_event = event;
- while(switch_channel_ready(tech_pvt->channel) && tech_pvt->want_event && switch_timestamp(NULL) < exp) {
+ while(switch_channel_ready(tech_pvt->channel) && tech_pvt->want_event && switch_epoch_time_now(NULL) < exp) {
switch_yield(100000);
}
@@ -522,7 +522,7 @@
char *rpid = switch_event_get_header(event, "orig-rpid");
char *call_id = switch_event_get_header(event, "orig-call-id");
char *user_agent = switch_event_get_header(event, "user-agent");
- long expires = (long) switch_timestamp(NULL);
+ long expires = (long) switch_epoch_time_now(NULL);
char *profile_name = switch_event_get_header(event, "orig-profile-name");
char *to_user = switch_event_get_header(event, "orig-to-user");
char *presence_hosts = switch_event_get_header(event, "presence-hosts");
@@ -601,12 +601,12 @@
if (++loops >= 100) {
if (++ireg_loops >= IREG_SECONDS) {
- sofia_reg_check_expire(profile, switch_timestamp(NULL), 0);
+ sofia_reg_check_expire(profile, switch_epoch_time_now(NULL), 0);
ireg_loops = 0;
}
if (++gateway_loops >= GATEWAY_SECONDS) {
- sofia_reg_check_gateway(profile, switch_timestamp(NULL));
+ sofia_reg_check_gateway(profile, switch_epoch_time_now(NULL));
gateway_loops = 0;
}
sofia_sub_check_gateway(profile, time(NULL));
@@ -778,7 +778,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Starting thread for %s\n", profile->name);
- profile->started = switch_timestamp(NULL);
+ profile->started = switch_epoch_time_now(NULL);
sofia_set_pflag_locked(profile, PFLAG_RUNNING);
launch_sofia_worker_thread(profile);
@@ -1104,7 +1104,7 @@
if (ping_freq) {
if (ping_freq >= 5) {
gateway->ping_freq = ping_freq;
- gateway->ping = switch_timestamp(NULL) + ping_freq;
+ gateway->ping = switch_epoch_time_now(NULL) + ping_freq;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERROR: invalid ping!\n");
}
@@ -2350,12 +2350,12 @@
gateway->state = REG_STATE_FAILED;
}
}
- gateway->ping = switch_timestamp(NULL) + gateway->ping_freq;
+ gateway->ping = switch_epoch_time_now(NULL) + gateway->ping_freq;
sofia_reg_release_gateway(gateway);
gateway->pinging = 0;
} else if ((profile->pflags & PFLAG_UNREG_OPTIONS_FAIL) && status != 200 && sip && sip->sip_to) {
char *sql;
- time_t now = switch_timestamp(NULL);
+ time_t now = switch_epoch_time_now(NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Expire registration '%s@%s' due to options failure\n",
sip->sip_to->a_url->url_user, sip->sip_to->a_url->url_host);
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Sun Jan 25 15:23:07 2009
@@ -55,7 +55,7 @@
}
if (!tech_pvt->owner_id) {
- tech_pvt->owner_id = (uint32_t) switch_timestamp(NULL) - port;
+ tech_pvt->owner_id = (uint32_t) switch_epoch_time_now(NULL) - port;
}
if (!tech_pvt->session_id) {
@@ -145,7 +145,7 @@
}
if (!tech_pvt->owner_id) {
- tech_pvt->owner_id = (uint32_t) switch_timestamp(NULL) - port;
+ tech_pvt->owner_id = (uint32_t) switch_epoch_time_now(NULL) - port;
}
if (!tech_pvt->session_id) {
@@ -2902,7 +2902,7 @@
switch_hash_this(hi, &var, NULL, &val);
if ((pptr = (sofia_profile_t *) val)) {
int rsec = 10;
- int diff = (int) (switch_timestamp(NULL) - pptr->started);
+ int diff = (int) (switch_epoch_time_now(NULL) - pptr->started);
int remain = rsec - diff;
if (sofia_test_pflag(pptr, PFLAG_RESPAWN) || !sofia_test_pflag(pptr, PFLAG_RUNNING)) {
continue;
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c Sun Jan 25 15:23:07 2009
@@ -946,7 +946,7 @@
char *open;
char *prpid;
const char *ct = "no/idea";
- time_t exptime = switch_timestamp(NULL) + 3600;
+ time_t exptime = switch_epoch_time_now(NULL) + 3600;
int is_dialog = 0;
sofia_profile_t *ext_profile = NULL, *profile = helper->profile;
char sstr[128] = "";
@@ -990,7 +990,7 @@
if (expires) {
long tmp = atol(expires);
if (tmp > 0) {
- exptime = tmp - switch_timestamp(NULL) - SUB_OVERLAP;
+ exptime = tmp - switch_epoch_time_now(NULL) - SUB_OVERLAP;
} else {
exptime = tmp;
}
@@ -1281,7 +1281,7 @@
}
id = switch_mprintf("sip:%s@%s", sub_to_user, sub_to_host);
- expire_sec = (int) (expire_sec - switch_timestamp(NULL));
+ expire_sec = (int) (expire_sec - switch_epoch_time_now(NULL));
if (expire_sec < 0) {
expire_sec = 3600;
}
@@ -1585,7 +1585,7 @@
exp_delta = profile->force_subscription_expires ? profile->force_subscription_expires : (sip->sip_expires ? sip->sip_expires->ex_delta : 3600);
if (exp_delta) {
- exp_abs = (long) switch_timestamp(NULL) + exp_delta;
+ exp_abs = (long) switch_epoch_time_now(NULL) + exp_delta;
} else {
exp_abs = 0;
sub_state = nua_substate_terminated;
@@ -1859,7 +1859,7 @@
}
exp_delta = (sip->sip_expires ? sip->sip_expires->ex_delta : 3600);
- exp = (long) switch_timestamp(NULL) + exp_delta;
+ exp = (long) switch_epoch_time_now(NULL) + exp_delta;
if ((sql =
switch_mprintf("delete from sip_presence where sip_user='%q' and sip_host='%q' "
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Sun Jan 25 15:23:07 2009
@@ -612,7 +612,7 @@
switch_uuid_format(uuid_str, &uuid);
sql = switch_mprintf("insert into sip_authentication (nonce,expires,profile_name,hostname) "
- "values('%q', %ld, '%q', '%q')", uuid_str, switch_timestamp(NULL) + profile->nonce_ttl, profile->name, mod_sofia_globals.hostname);
+ "values('%q', %ld, '%q', '%q')", uuid_str, switch_epoch_time_now(NULL) + profile->nonce_ttl, profile->name, mod_sofia_globals.hostname);
switch_assert(sql != NULL);
sofia_glue_actually_execute_sql(profile, SWITCH_FALSE, sql, profile->ireg_mutex);
switch_safe_free(sql);
@@ -940,7 +940,7 @@
"(call_id,sip_user,sip_host,presence_hosts,contact,status,rpid,expires,user_agent,server_user,server_host,profile_name,hostname) "
"values ('%q','%q', '%q','%q','%q','%q', '%q', %ld, '%q', '%q', '%q', '%q', '%q')",
call_id, to_user, reg_host, profile->presence_hosts ? profile->presence_hosts : reg_host,
- contact_str, reg_desc, rpid, (long) switch_timestamp(NULL) + (long) exptime * 2,
+ contact_str, reg_desc, rpid, (long) switch_epoch_time_now(NULL) + (long) exptime * 2,
agent, from_user, guess_ip4, profile->name, mod_sofia_globals.hostname);
if (sql) {
@@ -1091,7 +1091,7 @@
}
}
- switch_rfc822_date(date, switch_timestamp_now());
+ switch_rfc822_date(date, switch_micro_time_now());
nua_respond(nh, SIP_200_OK, SIPTAG_CONTACT(sip->sip_contact),
TAG_IF(path_val, SIPTAG_PATH_STR(path_val)),
NUTAG_WITH_THIS(nua),
Modified: freeswitch/trunk/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c (original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c Sun Jan 25 15:23:07 2009
@@ -99,7 +99,7 @@
fd->fd = -1;
if (globals.rotate) {
- switch_time_exp_lt(&tm, switch_timestamp_now());
+ switch_time_exp_lt(&tm, switch_micro_time_now());
switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d-%H-%M-%S", &tm);
len = strlen(fd->path) + strlen(date) + 2;
Modified: freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c (original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c Sun Jan 25 15:23:07 2009
@@ -196,7 +196,7 @@
continue;
}
- if (switch_test_flag(l, LFLAG_STATEFUL) && l->timeout && switch_timestamp(NULL) - l->last_flush > l->timeout) {
+ if (switch_test_flag(l, LFLAG_STATEFUL) && l->timeout && switch_epoch_time_now(NULL) - l->last_flush > l->timeout) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Stateful Listener %u has expired\n", l->id);
remove_listener(l);
expire_listener(&l);
Modified: freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c (original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c Sun Jan 25 15:23:07 2009
@@ -231,7 +231,7 @@
continue;
}
- if (switch_test_flag(l, LFLAG_STATEFUL) && l->timeout && switch_timestamp(NULL) - l->last_flush > l->timeout) {
+ if (switch_test_flag(l, LFLAG_STATEFUL) && l->timeout && switch_epoch_time_now(NULL) - l->last_flush > l->timeout) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Stateful Listener %u has expired\n", l->id);
remove_listener(l);
expire_listener(&l);
@@ -718,7 +718,7 @@
switch_thread_rwlock_create(&listener->rwlock, listener->pool);
listener->id = next_id();
listener->timeout = 60;
- listener->last_flush = switch_timestamp(NULL);
+ listener->last_flush = switch_epoch_time_now(NULL);
if (events) {
char delim = ',';
@@ -820,7 +820,7 @@
goto end;
}
- listener->last_flush = switch_timestamp(NULL);
+ listener->last_flush = switch_epoch_time_now(NULL);
stream->write_function(stream, "<data>\n <reply type=\"success\">Current Events Follow</reply>\n");
xmlize_listener(listener, stream);
@@ -963,7 +963,7 @@
int clen = 0;
*event = NULL;
- start = switch_timestamp(NULL);
+ start = switch_epoch_time_now(NULL);
ptr = mbuf;
@@ -1074,7 +1074,7 @@
}
if (timeout) {
- elapsed = (uint32_t) (switch_timestamp(NULL) - start);
+ elapsed = (uint32_t) (switch_epoch_time_now(NULL) - start);
if (elapsed >= timeout) {
switch_clear_flag_locked(listener, LFLAG_RUNNING);
return SWITCH_STATUS_FALSE;
Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c (original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c Sun Jan 25 15:23:07 2009
@@ -2118,7 +2118,7 @@
channel = switch_core_session_get_channel(jss->session);
CHANNEL_MEDIA_SANITY_CHECK();
- started = switch_timestamp_now();
+ started = switch_micro_time_now();
if (argc > 0) {
JS_ValueToInt32(cx, argv[0], &timeout);
@@ -2132,7 +2132,7 @@
}
saveDepth = JS_SuspendRequest(cx);
for (;;) {
- if (((elapsed = (unsigned int) ((switch_timestamp_now() - started) / 1000)) > (switch_time_t) timeout)
+ if (((elapsed = (unsigned int) ((switch_micro_time_now() - started) / 1000)) > (switch_time_t) timeout)
|| switch_channel_get_state(channel) >= CS_HANGUP) {
*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
break;
@@ -2165,7 +2165,7 @@
METHOD_SANITY_CHECK();
channel = switch_core_session_get_channel(jss->session);
- started = switch_timestamp_now();
+ started = switch_micro_time_now();
if (argc > 0) {
JS_ValueToInt32(cx, argv[0], &timeout);
@@ -2180,7 +2180,7 @@
saveDepth = JS_SuspendRequest(cx);
for (;;) {
- if (((elapsed = (unsigned int) ((switch_timestamp_now() - started) / 1000)) > (switch_time_t) timeout)
+ if (((elapsed = (unsigned int) ((switch_micro_time_now() - started) / 1000)) > (switch_time_t) timeout)
|| switch_channel_get_state(channel) >= CS_HANGUP) {
*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
break;
Modified: freeswitch/trunk/src/mod/loggers/mod_logfile/mod_logfile.c
==============================================================================
--- freeswitch/trunk/src/mod/loggers/mod_logfile/mod_logfile.c (original)
+++ freeswitch/trunk/src/mod/loggers/mod_logfile/mod_logfile.c Sun Jan 25 15:23:07 2009
@@ -124,7 +124,7 @@
switch_mutex_lock(globals.mutex);
- switch_time_exp_lt(&tm, switch_timestamp_now());
+ switch_time_exp_lt(&tm, switch_micro_time_now());
switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d-%H-%M-%S", &tm);
profile->log_size = 0;
Modified: freeswitch/trunk/src/mod/say/mod_say_de/mod_say_de.c
==============================================================================
--- freeswitch/trunk/src/mod/say/mod_say_de/mod_say_de.c (original)
+++ freeswitch/trunk/src/mod/say/mod_say_de/mod_say_de.c Sun Jan 25 15:23:07 2009
@@ -303,7 +303,7 @@
}
} else {
if ((seconds = atoi(tosay)) <= 0) {
- seconds = (int64_t) switch_timestamp(NULL);
+ seconds = (int64_t) switch_epoch_time_now(NULL);
}
if (seconds >= 60) {
@@ -361,7 +361,7 @@
if ((t = atoi(tosay)) > 0) {
target = switch_time_make(t, 0);
} else {
- target = switch_timestamp_now();
+ target = switch_micro_time_now();
}
switch_time_exp_lt(&tm, target);
Modified: freeswitch/trunk/src/mod/say/mod_say_en/mod_say_en.c
==============================================================================
--- freeswitch/trunk/src/mod/say/mod_say_en/mod_say_en.c (original)
+++ freeswitch/trunk/src/mod/say/mod_say_en/mod_say_en.c Sun Jan 25 15:23:07 2009
@@ -294,7 +294,7 @@
}
} else {
if ((seconds = atol(tosay)) <= 0) {
- seconds = (int64_t) switch_timestamp(NULL);
+ seconds = (int64_t) switch_epoch_time_now(NULL);
}
if (seconds >= 60) {
@@ -352,7 +352,7 @@
if ((t = atol(tosay)) > 0) {
target = switch_time_make(t, 0);
} else {
- target = switch_timestamp_now();
+ target = switch_micro_time_now();
}
if (tz) {
Modified: freeswitch/trunk/src/mod/say/mod_say_es/mod_say_es.c
==============================================================================
--- freeswitch/trunk/src/mod/say/mod_say_es/mod_say_es.c (original)
+++ freeswitch/trunk/src/mod/say/mod_say_es/mod_say_es.c Sun Jan 25 15:23:07 2009
@@ -292,7 +292,7 @@
}
} else {
if ((seconds = atoi(tosay)) <= 0) {
- seconds = (int64_t) switch_timestamp(NULL);
+ seconds = (int64_t) switch_epoch_time_now(NULL);
}
if (seconds >= 60) {
@@ -350,7 +350,7 @@
if ((t = atoi(tosay)) > 0) {
target = switch_time_make(t, 0);
} else {
- target = switch_timestamp_now();
+ target = switch_micro_time_now();
}
switch_time_exp_lt(&tm, target);
Modified: freeswitch/trunk/src/mod/say/mod_say_fr/mod_say_fr.c
==============================================================================
--- freeswitch/trunk/src/mod/say/mod_say_fr/mod_say_fr.c (original)
+++ freeswitch/trunk/src/mod/say/mod_say_fr/mod_say_fr.c Sun Jan 25 15:23:07 2009
@@ -292,7 +292,7 @@
}
} else {
if ((seconds = atoi(tosay)) <= 0) {
- seconds = (int64_t) switch_timestamp(NULL);
+ seconds = (int64_t) switch_epoch_time_now(NULL);
}
if (seconds >= 60) {
@@ -350,7 +350,7 @@
if ((t = atoi(tosay)) > 0) {
target = switch_time_make(t, 0);
} else {
- target = switch_timestamp_now();
+ target = switch_micro_time_now();
}
switch_time_exp_lt(&tm, target);
Modified: freeswitch/trunk/src/mod/say/mod_say_it/mod_say_it.c
==============================================================================
--- freeswitch/trunk/src/mod/say/mod_say_it/mod_say_it.c (original)
+++ freeswitch/trunk/src/mod/say/mod_say_it/mod_say_it.c Sun Jan 25 15:23:07 2009
@@ -292,7 +292,7 @@
}
} else {
if ((seconds = atoi(tosay)) <= 0) {
- seconds = (int64_t) switch_timestamp(NULL);
+ seconds = (int64_t) switch_epoch_time_now(NULL);
}
if (seconds >= 60) {
@@ -350,7 +350,7 @@
if ((t = atoi(tosay)) > 0) {
target = switch_time_make(t, 0);
} else {
- target = switch_timestamp_now();
+ target = switch_micro_time_now();
}
switch_time_exp_lt(&tm, target);
Modified: freeswitch/trunk/src/mod/say/mod_say_nl/mod_say_nl.c
==============================================================================
--- freeswitch/trunk/src/mod/say/mod_say_nl/mod_say_nl.c (original)
+++ freeswitch/trunk/src/mod/say/mod_say_nl/mod_say_nl.c Sun Jan 25 15:23:07 2009
@@ -292,7 +292,7 @@
}
} else {
if ((seconds = atoi(tosay)) <= 0) {
- seconds = (int64_t) switch_timestamp(NULL);
+ seconds = (int64_t) switch_epoch_time_now(NULL);
}
if (seconds >= 60) {
@@ -350,7 +350,7 @@
if ((t = atoi(tosay)) > 0) {
target = switch_time_make(t, 0);
} else {
- target = switch_timestamp_now();
+ target = switch_micro_time_now();
}
switch_time_exp_lt(&tm, target);
Modified: freeswitch/trunk/src/mod/say/mod_say_zh/mod_say_zh.c
==============================================================================
--- freeswitch/trunk/src/mod/say/mod_say_zh/mod_say_zh.c (original)
+++ freeswitch/trunk/src/mod/say/mod_say_zh/mod_say_zh.c Sun Jan 25 15:23:07 2009
@@ -367,7 +367,7 @@
}
} else {
if ((seconds = atoi(tosay)) <= 0) {
- seconds = (int64_t) switch_timestamp(NULL);
+ seconds = (int64_t) switch_epoch_time_now(NULL);
}
if (seconds >= 60) {
@@ -425,7 +425,7 @@
if ((t = atoi(tosay)) > 0)
target = switch_time_make(t, 0);
else
- target = switch_timestamp_now();
+ target = switch_micro_time_now();
switch_time_exp_lt(&tm, target);
switch (type) {
@@ -455,7 +455,7 @@
#if 0
tm = *localtime(&then);
- this_morning = switch_timestamp_now();
+ this_morning = switch_micro_time_now();
switch_time_exp_lt(&tm2, this_morning);
tm2->tm_hour = 0;
tm2->tm_min = 0;
Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c (original)
+++ freeswitch/trunk/src/switch_channel.c Sun Jan 25 15:23:07 2009
@@ -1328,7 +1328,7 @@
}
caller_profile->times = (switch_channel_timetable_t *) switch_core_session_alloc(channel->session, sizeof(*caller_profile->times));
- caller_profile->times->profile_created = switch_timestamp_now();
+ caller_profile->times->profile_created = switch_micro_time_now();
if (channel->caller_profile && channel->caller_profile->times) {
channel->caller_profile->times->transferred = caller_profile->times->profile_created;
@@ -1341,7 +1341,7 @@
switch_caller_extension_clone(&caller_profile->caller_extension, channel->caller_profile->caller_extension, caller_profile->pool);
}
} else {
- caller_profile->times->created = switch_timestamp_now();
+ caller_profile->times->created = switch_micro_time_now();
}
caller_profile->next = channel->caller_profile;
@@ -1534,7 +1534,7 @@
if (channel->caller_profile && channel->caller_profile->times && !channel->caller_profile->times->hungup) {
switch_mutex_lock(channel->profile_mutex);
- channel->caller_profile->times->hungup = switch_timestamp_now();
+ channel->caller_profile->times->hungup = switch_micro_time_now();
switch_mutex_unlock(channel->profile_mutex);
}
@@ -1580,7 +1580,7 @@
switch_channel_set_flag(channel, CF_RING_READY);
if (channel->caller_profile && channel->caller_profile->times) {
switch_mutex_lock(channel->profile_mutex);
- channel->caller_profile->times->progress = switch_timestamp_now();
+ channel->caller_profile->times->progress = switch_micro_time_now();
if (channel->caller_profile->originator_caller_profile) {
switch_core_session_t *other_session;
if ((other_session = switch_core_session_locate(channel->caller_profile->originator_caller_profile->uuid))) {
@@ -1638,7 +1638,7 @@
if (channel->caller_profile && channel->caller_profile->times) {
switch_mutex_lock(channel->profile_mutex);
- channel->caller_profile->times->progress_media = switch_timestamp_now();
+ channel->caller_profile->times->progress_media = switch_micro_time_now();
if (channel->caller_profile->originator_caller_profile) {
switch_core_session_t *osession;
if ((osession = switch_core_session_locate(channel->caller_profile->originator_caller_profile->uuid))) {
@@ -1756,7 +1756,7 @@
if (channel->caller_profile && channel->caller_profile->times) {
switch_mutex_lock(channel->profile_mutex);
- channel->caller_profile->times->answered = switch_timestamp_now();
+ channel->caller_profile->times->answered = switch_micro_time_now();
switch_mutex_unlock(channel->profile_mutex);
}
Modified: freeswitch/trunk/src/switch_console.c
==============================================================================
--- freeswitch/trunk/src/switch_console.c (original)
+++ freeswitch/trunk/src/switch_console.c Sun Jan 25 15:23:07 2009
@@ -296,7 +296,7 @@
goto done;
}
- switch_time_exp_lt(&tm, switch_timestamp_now());
+ switch_time_exp_lt(&tm, switch_micro_time_now());
switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
if (channel == SWITCH_CHANNEL_ID_LOG) {
Modified: freeswitch/trunk/src/switch_core.c
==============================================================================
--- freeswitch/trunk/src/switch_core.c (original)
+++ freeswitch/trunk/src/switch_core.c Sun Jan 25 15:23:07 2009
@@ -136,7 +136,7 @@
check_ip();
/* reschedule this task */
- task->runtime = switch_timestamp(NULL) + 20;
+ task->runtime = switch_epoch_time_now(NULL) + 20;
}
@@ -1088,7 +1088,7 @@
switch_scheduler_task_thread_start();
runtime.initiated = switch_time_now();
- switch_scheduler_add_task(switch_timestamp(NULL), heartbeat_callback, "heartbeat", "core", 0, NULL, SSHF_NONE | SSHF_NO_DEL);
+ switch_scheduler_add_task(switch_epoch_time_now(NULL), heartbeat_callback, "heartbeat", "core", 0, NULL, SSHF_NONE | SSHF_NO_DEL);
switch_uuid_get(&uuid);
switch_uuid_format(runtime.uuid_str, &uuid);
@@ -1323,7 +1323,7 @@
SWITCH_DECLARE(switch_time_t) switch_core_uptime(void)
{
- return switch_timestamp_now() - runtime.initiated;
+ return switch_micro_time_now() - runtime.initiated;
}
SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, int32_t *val)
Modified: freeswitch/trunk/src/switch_core_io.c
==============================================================================
--- freeswitch/trunk/src/switch_core_io.c (original)
+++ freeswitch/trunk/src/switch_core_io.c Sun Jan 25 15:23:07 2009
@@ -353,7 +353,7 @@
}
}
- if (bp->stop_time && bp->stop_time <= switch_timestamp(NULL)) {
+ if (bp->stop_time && bp->stop_time <= switch_epoch_time_now(NULL)) {
ok = SWITCH_FALSE;
}
@@ -502,7 +502,7 @@
switch_mutex_lock(bp->read_mutex);
if (bp->callback) {
if (bp->callback(bp, bp->user_data, SWITCH_ABC_TYPE_READ_PING) == SWITCH_FALSE
- || (bp->stop_time && bp->stop_time <= switch_timestamp(NULL))) {
+ || (bp->stop_time && bp->stop_time <= switch_epoch_time_now(NULL))) {
ok = SWITCH_FALSE;
}
}
@@ -775,7 +775,7 @@
}
}
- if (bp->stop_time && bp->stop_time <= switch_timestamp(NULL)) {
+ if (bp->stop_time && bp->stop_time <= switch_epoch_time_now(NULL)) {
ok = SWITCH_FALSE;
}
Modified: freeswitch/trunk/src/switch_core_port_allocator.c
==============================================================================
--- freeswitch/trunk/src/switch_core_port_allocator.c (original)
+++ freeswitch/trunk/src/switch_core_port_allocator.c Sun Jan 25 15:23:07 2009
@@ -118,7 +118,7 @@
int odd = switch_test_flag(alloc, SPF_ODD);
switch_mutex_lock(alloc->mutex);
- srand(getpid() + (unsigned) switch_timestamp(NULL));
+ srand(getpid() + (unsigned) switch_epoch_time_now(NULL));
while (alloc->track_used < alloc->track_len) {
uint32_t index;
Modified: freeswitch/trunk/src/switch_core_session.c
==============================================================================
--- freeswitch/trunk/src/switch_core_session.c (original)
+++ freeswitch/trunk/src/switch_core_session.c Sun Jan 25 15:23:07 2009
@@ -874,7 +874,7 @@
switch_event_fire(&event);
/* reschedule this task */
- task->runtime = switch_timestamp(NULL) + session->track_duration;
+ task->runtime = switch_epoch_time_now(NULL) + session->track_duration;
switch_core_session_rwunlock(session);
}
@@ -892,7 +892,7 @@
{
switch_core_session_unsched_heartbeat(session);
- session->track_id = switch_scheduler_add_task(switch_timestamp(NULL), sch_heartbeat_callback, (char *) __SWITCH_FUNC__,
+ session->track_id = switch_scheduler_add_task(switch_epoch_time_now(NULL), sch_heartbeat_callback, (char *) __SWITCH_FUNC__,
switch_core_session_get_uuid(session), 0, strdup(switch_core_session_get_uuid(session)), SSHF_FREE_ARG);
}
Modified: freeswitch/trunk/src/switch_core_sqldb.c
==============================================================================
--- freeswitch/trunk/src/switch_core_sqldb.c (original)
+++ freeswitch/trunk/src/switch_core_sqldb.c Sun Jan 25 15:23:07 2009
@@ -278,7 +278,7 @@
sql = switch_mprintf("insert into channels (uuid,created,created_epoch, name,state,dialplan,context) values('%q','%q','%ld','%q','%q','%q','%q')",
switch_event_get_header_nil(event, "unique-id"),
switch_event_get_header_nil(event, "event-date-local"),
- (long)switch_timestamp(NULL),
+ (long)switch_epoch_time_now(NULL),
switch_event_get_header_nil(event, "channel-name"),
switch_event_get_header_nil(event, "channel-state"),
switch_event_get_header_nil(event, "caller-dialplan"),
@@ -339,7 +339,7 @@
case SWITCH_EVENT_CHANNEL_BRIDGE:
sql = switch_mprintf("insert into calls values ('%s', '%ld', '%s','%q','%q','%q','%q','%s','%q','%q','%q','%q','%s')",
switch_event_get_header_nil(event, "event-date-local"),
- (long)switch_timestamp(NULL),
+ (long)switch_epoch_time_now(NULL),
switch_event_get_header_nil(event, "event-calling-function"),
switch_event_get_header_nil(event, "caller-caller-id-name"),
switch_event_get_header_nil(event, "caller-caller-id-number"),
Modified: freeswitch/trunk/src/switch_event.c
==============================================================================
--- freeswitch/trunk/src/switch_event.c (original)
+++ freeswitch/trunk/src/switch_event.c Sun Jan 25 15:23:07 2009
@@ -1019,7 +1019,7 @@
switch_time_exp_t tm;
char date[80] = "";
switch_size_t retsize;
- switch_time_t ts = switch_timestamp_now();
+ switch_time_t ts = switch_micro_time_now();
switch_assert(BLOCK != NULL);
switch_assert(RUNTIME_POOL != NULL);
Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c (original)
+++ freeswitch/trunk/src/switch_ivr.c Sun Jan 25 15:23:07 2009
@@ -42,7 +42,7 @@
{
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_status_t status = SWITCH_STATUS_SUCCESS;
- switch_time_t start = switch_timestamp_now(), now, done = switch_timestamp_now() + (ms * 1000);
+ switch_time_t start = switch_micro_time_now(), now, done = switch_micro_time_now() + (ms * 1000);
switch_frame_t *read_frame, cng_frame = { 0 };
int32_t left, elapsed;
char data[2] = "";
@@ -114,7 +114,7 @@
}
for (;;) {
- now = switch_timestamp_now();
+ now = switch_micro_time_now();
elapsed = (int32_t) ((now - start) / 1000);
left = ms - elapsed;
@@ -452,9 +452,9 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Command Execute %s(%s)\n",
switch_channel_get_name(channel), app_name, switch_str_nil(app_arg));
- b4 = switch_timestamp_now();
+ b4 = switch_micro_time_now();
switch_core_session_exec(session, application_interface, app_arg);
- aftr = switch_timestamp_now();
+ aftr = switch_micro_time_now();
if (!switch_channel_ready(channel) || switch_channel_test_flag(channel, CF_STOP_BROADCAST) || aftr - b4 < 500000) {
break;
}
@@ -593,7 +593,7 @@
if ((timeout = atoi(to)) < 0) {
timeout = 0;
} else {
- expires = switch_timestamp(NULL) + timeout;
+ expires = switch_epoch_time_now(NULL) + timeout;
}
}
@@ -610,7 +610,7 @@
break;
}
- if (expires && switch_timestamp(NULL) >= expires) {
+ if (expires && switch_epoch_time_now(NULL) >= expires) {
switch_channel_hangup(channel, SWITCH_CAUSE_RECOVERY_ON_TIMER_EXPIRE);
break;
}
@@ -733,7 +733,7 @@
}
if (timeout) {
- started = switch_timestamp_now();
+ started = switch_micro_time_now();
}
while (switch_channel_ready(channel)) {
@@ -748,7 +748,7 @@
}
if (timeout) {
- elapsed = (uint32_t) ((switch_timestamp_now() - started) / 1000);
+ elapsed = (uint32_t) ((switch_micro_time_now() - started) / 1000);
if (elapsed >= timeout) {
break;
}
@@ -855,7 +855,7 @@
}
if (abs_timeout) {
- started = switch_timestamp_now();
+ started = switch_micro_time_now();
}
if (digit_timeout && first_timeout) {
@@ -868,14 +868,14 @@
if (eff_timeout) {
- digit_started = switch_timestamp_now();
+ digit_started = switch_micro_time_now();
}
while (switch_channel_ready(channel)) {
switch_frame_t *read_frame;
if (abs_timeout) {
- abs_elapsed = (uint32_t) ((switch_timestamp_now() - started) / 1000);
+ abs_elapsed = (uint32_t) ((switch_micro_time_now() - started) / 1000);
if (abs_elapsed >= abs_timeout) {
break;
}
@@ -887,7 +887,7 @@
if (eff_timeout) {
- digit_elapsed = (uint32_t) ((switch_timestamp_now() - digit_started) / 1000);
+ digit_elapsed = (uint32_t) ((switch_micro_time_now() - digit_started) / 1000);
if (digit_elapsed >= eff_timeout) {
status = SWITCH_STATUS_TIMEOUT;
break;
@@ -900,7 +900,7 @@
if (eff_timeout) {
eff_timeout = digit_timeout;
- digit_started = switch_timestamp_now();
+ digit_started = switch_micro_time_now();
}
for (y = 0; y <= maxdigits; y++) {
@@ -1476,12 +1476,12 @@
stream->digits = tmp;
*(stream->digits + (len++)) = digit;
*(stream->digits + len) = '\0';
- stream->last_digit_time = switch_timestamp_now() / 1000;
+ stream->last_digit_time = switch_micro_time_now() / 1000;
}
}
}
/* don't allow collected digit string testing if there are varying sized keys until timeout */
- if (parser->maxlen - parser->minlen > 0 && (switch_timestamp_now() / 1000) - stream->last_digit_time < parser->digit_timeout_ms) {
+ if (parser->maxlen - parser->minlen > 0 && (switch_micro_time_now() / 1000) - stream->last_digit_time < parser->digit_timeout_ms) {
len = 0;
}
/* if we have digits to test */
Modified: freeswitch/trunk/src/switch_ivr_async.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_async.c (original)
+++ freeswitch/trunk/src/switch_ivr_async.c Sun Jan 25 15:23:07 2009
@@ -378,7 +378,7 @@
switch_channel_pre_answer(channel);
if (limit) {
- to = switch_timestamp(NULL) + limit;
+ to = switch_epoch_time_now(NULL) + limit;
}
if (flags && strchr(flags, 'm')) {
@@ -892,7 +892,7 @@
}
if (limit) {
- to = switch_timestamp(NULL) + limit;
+ to = switch_epoch_time_now(NULL) + limit;
}
if ((status = switch_core_media_bug_add(session, record_callback, fh, to, flags, &bug)) != SWITCH_STATUS_SUCCESS) {
@@ -1525,7 +1525,7 @@
{
switch_channel_t *channel = switch_core_session_get_channel(session);
dtmf_meta_data_t *md = switch_channel_get_private(channel, SWITCH_META_VAR_KEY);
- time_t now = switch_timestamp(NULL);
+ time_t now = switch_epoch_time_now(NULL);
char digit[2] = "";
int dval;
Modified: freeswitch/trunk/src/switch_ivr_originate.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_originate.c (original)
+++ freeswitch/trunk/src/switch_ivr_originate.c Sun Jan 25 15:23:07 2009
@@ -219,7 +219,7 @@
time_t start)
{
int x = 0,i;
- time_t elapsed = switch_timestamp(NULL) - start;
+ time_t elapsed = switch_epoch_time_now(NULL) - start;
for (i = 0; i < max; i++) {
if (originate_status[i].peer_channel && switch_channel_get_state(originate_status[i].peer_channel) < CS_HANGUP) {
@@ -592,7 +592,7 @@
}
timelimit *= 1000000;
- start = switch_timestamp_now();
+ start = switch_micro_time_now();
if (caller_channel) {
if (switch_channel_test_flag(caller_channel, CF_ANSWERED)) {
@@ -708,7 +708,7 @@
while (switch_channel_ready(peer_channel)
&& !(switch_channel_test_flag(peer_channel, CF_ANSWERED) || switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA))) {
- int diff = (int) (switch_timestamp_now() - start);
+ int diff = (int) (switch_micro_time_now() - start);
if (diff > timelimit) {
status = SWITCH_STATUS_TIMEOUT;
@@ -1486,7 +1486,7 @@
}
}
- switch_timestamp(&start);
+ switch_epoch_time_now(&start);
for (;;) {
uint32_t valid_channels = 0;
@@ -1514,7 +1514,7 @@
goto notready;
}
- elapsed = switch_timestamp(NULL) - start;
+ elapsed = switch_epoch_time_now(NULL) - start;
if (elapsed > (time_t) timelimit_sec) {
to++;
@@ -1653,7 +1653,7 @@
}
while ((!caller_channel || switch_channel_ready(caller_channel)) && check_channel_status(&oglobals, originate_status, and_argc)) {
- time_t elapsed = switch_timestamp(NULL) - start;
+ time_t elapsed = switch_epoch_time_now(NULL) - start;
if (caller_channel && !oglobals.sent_ring && oglobals.ring_ready && !oglobals.return_ring_ready) {
switch_channel_ring_ready(caller_channel);
oglobals.sent_ring = 1;
Modified: freeswitch/trunk/src/switch_ivr_play_say.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_play_say.c (original)
+++ freeswitch/trunk/src/switch_ivr_play_say.c Sun Jan 25 15:23:07 2009
@@ -497,7 +497,7 @@
}
if (limit) {
- start = switch_timestamp(NULL);
+ start = switch_epoch_time_now(NULL);
}
if (fh->thresh) {
@@ -531,7 +531,7 @@
switch_ivr_parse_all_events(session);
}
- if (start && (switch_timestamp(NULL) - start) > limit) {
+ if (start && (switch_epoch_time_now(NULL) - start) > limit) {
break;
}
Modified: freeswitch/trunk/src/switch_log.c
==============================================================================
--- freeswitch/trunk/src/switch_log.c (original)
+++ freeswitch/trunk/src/switch_log.c Sun Jan 25 15:23:07 2009
@@ -246,7 +246,7 @@
const char *filep = (file ? switch_cut_path(file) : "");
const char *funcp = (func ? func : "");
char *content = NULL;
- switch_time_t now = switch_timestamp_now();
+ switch_time_t now = switch_micro_time_now();
uint32_t len;
const char *extra_fmt = "%s [%s] %s:%d %s()%c%s";
Modified: freeswitch/trunk/src/switch_resample.c
==============================================================================
--- freeswitch/trunk/src/switch_resample.c (original)
+++ freeswitch/trunk/src/switch_resample.c Sun Jan 25 15:23:07 2009
@@ -206,7 +206,7 @@
int16_t x;
uint32_t i;
int sum_rnd = 0;
- int16_t rnd2 = (int16_t) switch_timestamp_now();
+ int16_t rnd2 = (int16_t) switch_micro_time_now();
assert(divisor);
Modified: freeswitch/trunk/src/switch_rtp.c
==============================================================================
--- freeswitch/trunk/src/switch_rtp.c (original)
+++ freeswitch/trunk/src/switch_rtp.c Sun Jan 25 15:23:07 2009
@@ -228,7 +228,7 @@
#if 0
if (rtp_session->last_stun) {
- elapsed = (unsigned int) ((switch_timestamp_now() - rtp_session->last_stun) / 1000);
+ elapsed = (unsigned int) ((switch_micro_time_now() - rtp_session->last_stun) / 1000);
if (elapsed > 30000) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No stun for a long time (PUNT!)\n");
@@ -282,7 +282,7 @@
}
if (rtp_session->last_stun) {
- elapsed = (unsigned int) ((switch_timestamp_now() - rtp_session->last_stun) / 1000);
+ elapsed = (unsigned int) ((switch_micro_time_now() - rtp_session->last_stun) / 1000);
if (elapsed > 30000) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No stun for a long time (PUNT!)\n");
@@ -310,7 +310,7 @@
return;
}
- rtp_session->last_stun = switch_timestamp_now();
+ rtp_session->last_stun = switch_micro_time_now();
}
static void handle_ice(switch_rtp_t *rtp_session, void *data, switch_size_t len)
@@ -346,7 +346,7 @@
}
end_buf = buf + ((sizeof(buf) > packet->header.length) ? packet->header.length : sizeof(buf));
- rtp_session->last_stun = switch_timestamp_now();
+ rtp_session->last_stun = switch_micro_time_now();
switch_stun_packet_first_attribute(packet, attr);
@@ -830,7 +830,7 @@
rtp_session->seq = (uint16_t) rand();
- rtp_session->ssrc = (uint32_t) ((intptr_t) &rtp_session + (uint32_t) switch_timestamp(NULL));
+ rtp_session->ssrc = (uint32_t) ((intptr_t) &rtp_session + (uint32_t) switch_epoch_time_now(NULL));
rtp_session->send_msg.header.ssrc = htonl(rtp_session->ssrc);
rtp_session->send_msg.header.ts = 0;
rtp_session->send_msg.header.m = 0;
@@ -1967,7 +1967,7 @@
}
if (!rtp_session->timer.interval &&
- ((unsigned)((switch_timestamp_now() - rtp_session->last_write_timestamp))) > (rtp_session->ms_per_packet *2)) {
+ ((unsigned)((switch_micro_time_now() - rtp_session->last_write_timestamp))) > (rtp_session->ms_per_packet *2)) {
m++;
}
@@ -1995,7 +1995,7 @@
uint32_t rate = 0;
uint32_t codec_flags = 0;
uint32_t len = sizeof(decoded);
- time_t now = switch_timestamp(NULL);
+ time_t now = switch_epoch_time_now(NULL);
send = 0;
if (rtp_session->vad_data.scan_freq && rtp_session->vad_data.next_scan <= now) {
@@ -2132,7 +2132,7 @@
if (rtp_session->timer.interval) {
rtp_session->last_write_samplecount = rtp_session->timer.samplecount;
} else {
- rtp_session->last_write_timestamp = (uint32_t) switch_timestamp_now();
+ rtp_session->last_write_timestamp = (uint32_t) switch_micro_time_now();
}
rtp_session->last_write_ts = this_ts;
@@ -2209,7 +2209,7 @@
rtp_session->vad_data.cng_freq = 50;
rtp_session->vad_data.ts = 1;
rtp_session->vad_data.start = 0;
- rtp_session->vad_data.next_scan = switch_timestamp(NULL);
+ rtp_session->vad_data.next_scan = switch_epoch_time_now(NULL);
rtp_session->vad_data.scan_freq = 0;
switch_set_flag_locked(rtp_session, SWITCH_RTP_FLAG_VAD);
switch_set_flag(&rtp_session->vad_data, SWITCH_VAD_FLAG_CNG);
Modified: freeswitch/trunk/src/switch_scheduler.c
==============================================================================
--- freeswitch/trunk/src/switch_scheduler.c (original)
+++ freeswitch/trunk/src/switch_scheduler.c Sun Jan 25 15:23:07 2009
@@ -107,7 +107,7 @@
if (done) {
tp->destroyed = 1;
} else {
- int64_t now = switch_timestamp(NULL);
+ int64_t now = switch_epoch_time_now(NULL);
if (now >= tp->task.runtime && !tp->in_thread) {
int32_t diff = (int32_t) (now - tp->task.runtime);
if (diff > 1) {
@@ -190,7 +190,7 @@
switch_zmalloc(container, sizeof(*container));
switch_assert(func);
container->func = func;
- container->task.created = switch_timestamp(NULL);
+ container->task.created = switch_epoch_time_now(NULL);
container->task.runtime = task_runtime;
container->task.group = strdup(group ? group : "none");
container->task.cmd_id = cmd_id;
Modified: freeswitch/trunk/src/switch_stun.c
==============================================================================
--- freeswitch/trunk/src/switch_stun.c (original)
+++ freeswitch/trunk/src/switch_stun.c Sun Jan 25 15:23:07 2009
@@ -105,7 +105,7 @@
max = (int) strlen(set);
- srand((unsigned int) switch_timestamp_now());
+ srand((unsigned int) switch_micro_time_now());
for (x = 0; x < len; x++) {
int j = (int) (max * 1.0 * rand() / (RAND_MAX + 1.0));
@@ -510,7 +510,7 @@
}
switch_socket_sendto(sock, remote_addr, 0, (void *) packet, &bytes);
- started = switch_timestamp_now();
+ started = switch_micro_time_now();
*ip = NULL;
*port = 0;
@@ -522,7 +522,7 @@
break;
}
- if ((elapsed = (unsigned int) ((switch_timestamp_now() - started) / 1000)) > 5000) {
+ if ((elapsed = (unsigned int) ((switch_micro_time_now() - started) / 1000)) > 5000) {
*err = "Timeout";
switch_socket_shutdown(sock, SWITCH_SHUTDOWN_READWRITE);
switch_socket_close(sock);
Modified: freeswitch/trunk/src/switch_time.c
==============================================================================
--- freeswitch/trunk/src/switch_time.c (original)
+++ freeswitch/trunk/src/switch_time.c Sun Jan 25 15:23:07 2009
@@ -111,15 +111,15 @@
}
-SWITCH_DECLARE(switch_time_t) switch_timestamp_now(void)
+SWITCH_DECLARE(switch_time_t) switch_micro_time_now(void)
{
return runtime.timestamp ? runtime.timestamp : switch_time_now();
}
-SWITCH_DECLARE(time_t) switch_timestamp(time_t *t)
+SWITCH_DECLARE(time_t) switch_epoch_time_now(time_t *t)
{
- time_t now = switch_timestamp_now() / APR_USEC_PER_SEC;
+ time_t now = switch_micro_time_now() / APR_USEC_PER_SEC;
if (t) {
*t = now;
}
@@ -671,7 +671,7 @@
time_t timep;
if (!thetime) {
- thetime = switch_timestamp_now();
+ thetime = switch_micro_time_now();
}
timep = (thetime) / (int64_t) (1000000);
@@ -707,7 +707,7 @@
switch_time_exp_t stm;
if (!thetime) {
- thetime = switch_timestamp_now();
+ thetime = switch_micro_time_now();
}
timep = (thetime) / (int64_t) (1000000);
Modified: freeswitch/trunk/src/switch_utils.c
==============================================================================
--- freeswitch/trunk/src/switch_utils.c (original)
+++ freeswitch/trunk/src/switch_utils.c Sun Jan 25 15:23:07 2009
@@ -377,7 +377,7 @@
unsigned char in[B64BUFFLEN];
unsigned char out[B64BUFFLEN + 512];
- switch_snprintf(filename, 80, "%smail.%d%04x", SWITCH_GLOBAL_dirs.temp_dir, (int) switch_timestamp(NULL), rand() & 0xffff);
+ switch_snprintf(filename, 80, "%smail.%d%04x", SWITCH_GLOBAL_dirs.temp_dir, (int) switch_epoch_time_now(NULL), rand() & 0xffff);
if ((fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644))) {
if (file) {
@@ -828,7 +828,7 @@
switch_time_t ret = 0;
char *pattern = "^(\\d+)-(\\d+)-(\\d+)\\s*(\\d*):{0,1}(\\d*):{0,1}(\\d*)";
- switch_time_exp_lt(&tm, switch_timestamp_now());
+ switch_time_exp_lt(&tm, switch_micro_time_now());
tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
if ((proceed = switch_regex_perform(in, pattern, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
1
0
25 Jan '09
Author: anthm
Date: Sun Jan 25 15:15:37 2009
New Revision: 11485
Log:
try closing the device when not in use again
Modified:
freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c
Modified: freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c Sun Jan 25 15:15:37 2009
@@ -127,8 +127,7 @@
switch_timer_t timer;
switch_timer_t hold_timer;
int dual_streams;
- int monitor_running;
- int deactivate_timer;
+ time_t deactivate_timer;
} globals;
@@ -290,7 +289,7 @@
}
if (ring_file) {
- //deactivate_ring_device();
+ deactivate_ring_device();
switch_core_file_close(&fh);
}
@@ -327,6 +326,8 @@
return;
}
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stop audio device.\n");
+
switch_mutex_lock(globals.device_lock);
/* LOCKED ************************************************************************************************** */
@@ -372,6 +373,7 @@
return;
}
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stop ring device.\n");
switch_mutex_lock(globals.device_lock);
if (globals.ring_stream && globals.ring_stream != globals.audio_stream) {
CloseAudioStream(globals.ring_stream);
@@ -424,8 +426,6 @@
}
}
- globals.deactivate_timer = 0;
-
switch_mutex_unlock(globals.pvt_lock);
}
@@ -449,7 +449,8 @@
if (globals.call_list) {
switch_set_flag_locked(globals.call_list, TFLAG_MASTER);
} else {
- globals.deactivate_timer = 5;
+ globals.deactivate_timer = switch_timestamp(NULL) + 2;
+ deactivate_audio_device();
}
switch_mutex_unlock(globals.pvt_lock);
@@ -963,18 +964,6 @@
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_portaudio_shutdown)
{
-#if 0
- if (globals.monitor_running == 1) {
- int sanity = 20;
- globals.monitor_running = -1;
- while(globals.monitor_running) {
- switch_yield(1000000);
- if (!--sanity) {
- break;
- }
- }
- }
-#endif
deactivate_audio_device();
deactivate_ring_device();
@@ -988,26 +977,6 @@
return SWITCH_STATUS_SUCCESS;
}
-#if 0
-SWITCH_MODULE_RUNTIME_FUNCTION(mod_portaudio_runtime)
-{
- globals.monitor_running = 1;
- while(globals.monitor_running == 1) {
- switch_mutex_lock(globals.pvt_lock);
- if (!globals.call_list && globals.deactivate_timer > 0) {
- if (!--globals.deactivate_timer) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No more channels, deactivating audio\n");
- deactivate_audio_device();
- }
- }
- switch_mutex_unlock(globals.pvt_lock);
- switch_yield(1000000);
- }
- globals.monitor_running = 0;
- return SWITCH_STATUS_TERM;
-}
-#endif
-
static int get_dev_by_number(char *numstr, int in)
{
int numDevices = Pa_GetDeviceCount();
@@ -1289,6 +1258,12 @@
int sample_rate = globals.sample_rate;
int codec_ms = globals.codec_ms;
+ switch_mutex_lock(globals.device_lock);
+ while (globals.deactivate_timer > switch_timestamp(NULL)) {
+ switch_yield(1000000);
+ }
+ switch_mutex_unlock(globals.device_lock);
+
if (restart) {
deactivate_audio_device();
@@ -1552,6 +1527,7 @@
switch_channel_t *channel = switch_core_session_get_channel(tp->session);
switch_set_flag_locked(tp, TFLAG_ANSWER);
add_pvt(tp, PA_MASTER);
+ deactivate_ring_device();
switch_channel_mark_answered(channel);
}
} else {
@@ -1566,6 +1542,7 @@
switch_channel_t *channel = switch_core_session_get_channel(tp->session);
switch_set_flag_locked(tp, TFLAG_ANSWER);
add_pvt(tp, PA_MASTER);
+ deactivate_ring_device();
switch_channel_mark_answered(channel);
x++;
break;
@@ -1747,6 +1724,7 @@
tech_pvt->session = session;
if ((status = engage_device(0)) == SWITCH_STATUS_SUCCESS) {
switch_set_flag_locked(tech_pvt, TFLAG_ANSWER);
+ deactivate_ring_device();
switch_channel_mark_answered(channel);
switch_channel_set_state(channel, CS_INIT);
if (switch_core_session_thread_launch(tech_pvt->session) != SWITCH_STATUS_SUCCESS) {
@@ -1903,7 +1881,7 @@
devname = "indev";
if (devval > -1) {
globals.indev = devval;
- engage_device(1);
+ //engage_device(1);
}
} else if (argv[1] && !strcmp(argv[0], "outdev")) {
@@ -1920,7 +1898,7 @@
devname = "outdev";
if (devval > -1) {
globals.outdev = devval;
- engage_device(1);
+ //engage_device(1);
}
} else if (argv[1] && !strcmp(argv[0], "ringdev")) {
@@ -1937,7 +1915,7 @@
devname = "ringdev";
if (devval > -1) {
globals.ringdev = devval;
- engage_device(1);
+ //engage_device(1);
}
} else if ((argv[1] && !strcasecmp(argv[0], "play"))) {
switch_file_handle_t fh = { 0 };
@@ -1988,6 +1966,7 @@
}
switch_core_file_close(&fh);
+ deactivate_audio_device();
} else {
stream->write_function(stream, "Cannot play requested file %s\n", argv[1]);
}
@@ -2016,6 +1995,7 @@
if (!success) {
stream->write_function(stream, "Failed to read any bytes from indev\n");
}
+ deactivate_audio_device();
} else {
stream->write_function(stream, "Failed to engage audio device\n");
}
1
0
Author: brian
Date: Sat Jan 24 19:40:50 2009
New Revision: 11484
Log:
temp fix for 8k to 48k popping.
Modified:
freeswitch/trunk/src/switch_resample.c
Modified: freeswitch/trunk/src/switch_resample.c
==============================================================================
--- freeswitch/trunk/src/switch_resample.c (original)
+++ freeswitch/trunk/src/switch_resample.c Sat Jan 24 19:40:50 2009
@@ -137,9 +137,9 @@
s[i] = (short) (ft - 0.5);
}
if ((float) s[i] > MAXSAMPLE)
- s[i] = (short) MAXSAMPLE;
+ s[i] = (short) MAXSAMPLE / 2;
if (s[i] < (short) -MAXSAMPLE)
- s[i] = (short) -MAXSAMPLE;
+ s[i] = (short) -MAXSAMPLE / 2;
}
return len;
}
1
0
24 Jan '09
Author: anthm
Date: Sat Jan 24 12:38:45 2009
New Revision: 11483
Log:
update
Modified:
freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c
Modified: freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c
==============================================================================
--- freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c (original)
+++ freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c Sat Jan 24 12:38:45 2009
@@ -544,6 +544,12 @@
{
shout_context_t *context = (shout_context_t *) obj;
+ if (context->thread_running) {
+ context->thread_running++;
+ } else {
+ return NULL;
+ }
+
if (!context->lame_ready) {
lame_init_params(context->gfp);
lame_print_config(context->gfp);
@@ -620,6 +626,7 @@
{
switch_thread_t *thread;
switch_threadattr_t *thd_attr = NULL;
+ int sanity = 10;
if (context->err) {
return;
@@ -630,6 +637,11 @@
switch_threadattr_detach_set(thd_attr, 1);
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
switch_thread_create(&thread, thd_attr, write_stream_thread, context, context->memory_pool);
+
+ while (context->thread_running && context->thread_running != 2) {
+ switch_yield(100000);
+ if (!--sanity) break;
+ }
}
#define TC_BUFFER_SIZE 1024 * 32
1
0
24 Jan '09
Author: anthm
Date: Sat Jan 24 12:11:42 2009
New Revision: 11482
Log:
add error checking
Modified:
freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c
freeswitch/trunk/src/switch_core_file.c
Modified: freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c
==============================================================================
--- freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c (original)
+++ freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c Sat Jan 24 12:11:42 2009
@@ -876,6 +876,10 @@
*len = 0;
+ if (!context || context->err) {
+ return SWITCH_STATUS_FALSE;
+ }
+
if (context->fd) {
rb = decode_fd(context, data, bytes);
} else {
@@ -923,7 +927,16 @@
return SWITCH_STATUS_FALSE;
}
+ if (context->err) {
+ return SWITCH_STATUS_FALSE;
+ }
+
if (context->shout && !context->shout_init) {
+
+ if (!context->gfp) {
+ return SWITCH_STATUS_FALSE;
+ }
+
context->shout_init++;
if (shout_open(context->shout) != SHOUTERR_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening stream: %s\n", shout_get_error(context->shout));
Modified: freeswitch/trunk/src/switch_core_file.c
==============================================================================
--- freeswitch/trunk/src/switch_core_file.c (original)
+++ freeswitch/trunk/src/switch_core_file.c Sat Jan 24 12:11:42 2009
@@ -45,6 +45,11 @@
char stream_name[128] = "";
char *rhs = NULL;
+ if (switch_test_flag(fh, SWITCH_FILE_OPEN)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Handle already open\n");
+ return SWITCH_STATUS_FALSE;
+ }
+
if (switch_strlen_zero(file_path)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Filename\n");
return SWITCH_STATUS_FALSE;
@@ -140,6 +145,10 @@
switch_assert(fh != NULL);
switch_assert(fh->file_interface != NULL);
+ if (!switch_test_flag(fh, SWITCH_FILE_OPEN)) {
+ return SWITCH_STATUS_FALSE;
+ }
+
top:
if (fh->buffer && switch_buffer_inuse(fh->buffer) >= *len * 2) {
@@ -253,6 +262,10 @@
switch_assert(fh != NULL);
switch_assert(fh->file_interface != NULL);
+ if (!switch_test_flag(fh, SWITCH_FILE_OPEN)) {
+ return SWITCH_STATUS_FALSE;
+ }
+
if (!fh->file_interface->file_write) {
return SWITCH_STATUS_FALSE;
}
1
0
Author: ctrix
Date: Sat Jan 24 09:50:34 2009
New Revision: 11481
Log:
Fix this test before complete rework
Modified:
freeswitch/branches/ctrix/mod_airpe/Makefile
freeswitch/branches/ctrix/mod_airpe/airpe_if_osx.c
Modified: freeswitch/branches/ctrix/mod_airpe/Makefile
==============================================================================
--- freeswitch/branches/ctrix/mod_airpe/Makefile (original)
+++ freeswitch/branches/ctrix/mod_airpe/Makefile Sat Jan 24 09:50:34 2009
@@ -10,7 +10,8 @@
#LOCAL_LDFLAGS=-lX11
#--------------------------------- OSX
-LOCAL_LDFLAGS=-framework Skype -framework CoreFoundation
+#LOCAL_LDFLAGS=-framework CoreFoundation
+LOCAL_LDFLAGS=-framework Skype -framework CoreFoundation -framework Carbon
include ../../../../build/modmake.rules
Modified: freeswitch/branches/ctrix/mod_airpe/airpe_if_osx.c
==============================================================================
--- freeswitch/branches/ctrix/mod_airpe/airpe_if_osx.c (original)
+++ freeswitch/branches/ctrix/mod_airpe/airpe_if_osx.c Sat Jan 24 09:50:34 2009
@@ -4,6 +4,7 @@
#if defined (MACOSX) || defined(DARWIN)
#include "Skype/SkypeAPI-Carbon.h"
+#include <CoreFoundation/CoreFoundation.h>
struct skype_window_handler_s {
struct SkypeDelegate delegate;
@@ -43,18 +44,22 @@
string = CFStringCreateWithCString(NULL, message_P, kCFStringEncodingUTF8 );
SendSkypeCommand(string);
CFRelease(string);
+ RunCurrentEventLoop(0.01);
return SWITCH_STATUS_SUCCESS;
}
switch_status_t airpe_skype_avalaible(skype_window_handler_t *window)
{
+/*
if ( IsSkypeAvailable() ) {
return SWITCH_STATUS_SUCCESS;
}
else {
return SWITCH_STATUS_FALSE;
}
+*/
+ return SWITCH_STATUS_FALSE;
}
@@ -62,20 +67,16 @@
/*****************************************************************************
THREADS
*****************************************************************************/
-static void IncomingMessage(CFStringRef aNotificationString) {
+static int attached = -1;
+static void IncomingMessage(CFStringRef aNotificationString) {
ADEBUG("Incoming message");
-
-// char *string;
-// airpe_manage_skype_msg( airpe, string);
-
}
static void AttachResponse(unsigned int aAttachResponseCode) {
ADEBUG("Attach: %d\n", aAttachResponseCode);
+ attached = aAttachResponseCode;
}
-
-
void *SWITCH_THREAD_FUNC airpe_skype_thread(switch_thread_t * thread, void *obj) {
airpe_interface_t *airpe = NULL;
struct SkypeDelegate *del;
@@ -85,13 +86,17 @@
if ( !IsSkypeAvailable() ) {
ADEBUG("Sorry, not available\n");
- return NULL;
+ goto done;
}
-
+ RunCurrentEventLoop(0.1);
+/*
if ( !IsSkypeRunning() ) {
ADEBUG("Sorry, not running\n");
- return NULL;
+ goto done;
}
+ RunCurrentEventLoop(0.1);
+*/
+ airpe->running = 1;
del = &airpe->skype_window->delegate;
del->clientApplicationName=CFSTR("airpe");
@@ -99,26 +104,37 @@
del->SkypeAttachResponse=AttachResponse;
SetSkypeDelegate(del);
+ RunCurrentEventLoop(0.1);
ConnectToSkype();
+ RunCurrentEventLoop(0.1);
+
+ while ( airpe->running && attached !=1 ) {
+// ADEBUG("Sorry, not attached\n");
+ RunCurrentEventLoop(0.01);
+ }
+
+ if ( !attached && airpe->running ) {
+ ADEBUG("Sorry, not attached\n");
+ goto done;
+ }
if ( airpe_on_connect_messages( airpe, 6 ) != SWITCH_STATUS_SUCCESS ) {
switch_log_printf( SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
"airpe client %s. Failed to send handshake messages\n",
airpe->name);
- return NULL;
+ goto done;
}
- airpe->running = 1;
while ( airpe->running ) {
- switch_sleep(1000000);
+ RunCurrentEventLoop(0.01);
}
DisconnectFromSkype();
RemoveSkypeDelegate();
+ done:
ADEBUG("Exiting\n");
-
airpe->airpe_thread_skype = NULL;
return NULL;
1
0