mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-19 01:34:13 +00:00
add softtimer to the core, begin framework for static modules and reduces calls to gettimeofday for timestamps
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5784 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
1 parent
23758b1965
commit
bd6bd9ad57
21 files changed
+163
-303
No files matched your search
@@ -180,7 +180,7 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
|
||||
assert(channel != NULL);
|
||||
|
||||
|
||||
last = switch_time_now() - waitsec;
|
||||
last = switch_timestamp_now() - waitsec;
|
||||
|
||||
|
||||
|
||||
@@ -243,7 +243,7 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
|
||||
switch_channel_mark_ring_ready(channel);
|
||||
|
||||
while (switch_channel_get_state(channel) == CS_INIT && !switch_test_flag(tech_pvt, TFLAG_ANSWER)) {
|
||||
if (switch_time_now() - last >= waitsec) {
|
||||
if (switch_timestamp_now() - last >= waitsec) {
|
||||
char buf[512];
|
||||
switch_event_t *event;
|
||||
|
||||
@@ -257,7 +257,7 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s\n", buf);
|
||||
last = switch_time_now();
|
||||
last = switch_timestamp_now();
|
||||
if (ring_file) {
|
||||
unsigned int pos = 0;
|
||||
switch_core_file_seek(&fh, &pos, 0, SEEK_SET);
|
||||
|
||||
@@ -1061,18 +1061,18 @@ static switch_status_t negotiate_media(switch_core_session_t *session)
|
||||
|
||||
switch_set_flag_locked(tech_pvt, TFLAG_IO);
|
||||
|
||||
started = switch_time_now();
|
||||
started = switch_timestamp_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);
|
||||
switch_channel_mark_ring_ready(channel);
|
||||
|
||||
if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
|
||||
tech_pvt->next_cand = switch_time_now() + DL_CAND_WAIT;
|
||||
tech_pvt->next_desc = switch_time_now();
|
||||
tech_pvt->next_cand = started + DL_CAND_WAIT;
|
||||
tech_pvt->next_desc = started;
|
||||
} else {
|
||||
tech_pvt->next_cand = switch_time_now() + DL_CAND_WAIT;
|
||||
tech_pvt->next_desc = switch_time_now() + DL_CAND_WAIT;
|
||||
tech_pvt->next_cand = started + DL_CAND_WAIT;
|
||||
tech_pvt->next_desc = started + DL_CAND_WAIT;
|
||||
}
|
||||
|
||||
while (!(switch_test_flag(tech_pvt, TFLAG_CODEC_READY) &&
|
||||
@@ -1080,7 +1080,7 @@ static switch_status_t negotiate_media(switch_core_session_t *session)
|
||||
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_time_now();
|
||||
now = switch_timestamp_now();
|
||||
elapsed = (unsigned int) ((now - started) / 1000);
|
||||
|
||||
if (switch_channel_get_state(channel) >= CS_HANGUP || switch_test_flag(tech_pvt, TFLAG_BYE)) {
|
||||
@@ -1365,7 +1365,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
||||
|
||||
#if 0
|
||||
if (tech_pvt->last_read) {
|
||||
elapsed = (unsigned int) ((switch_time_now() - tech_pvt->last_read) / 1000);
|
||||
elapsed = (unsigned int) ((switch_timestamp_now() - tech_pvt->last_read) / 1000);
|
||||
if (elapsed > 60000) {
|
||||
return SWITCH_STATUS_TIMEOUT;
|
||||
}
|
||||
@@ -1393,7 +1393,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
||||
payload = tech_pvt->read_frame.payload;
|
||||
|
||||
#if 0
|
||||
elapsed = (unsigned int) ((switch_time_now() - started) / 1000);
|
||||
elapsed = (unsigned int) ((switch_timestamp_now() - started) / 1000);
|
||||
|
||||
if (timeout > -1) {
|
||||
if (elapsed >= (unsigned int) timeout) {
|
||||
@@ -1401,7 +1401,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
||||
}
|
||||
}
|
||||
|
||||
elapsed = (unsigned int) ((switch_time_now() - last_act) / 1000);
|
||||
elapsed = (unsigned int) ((switch_timestamp_now() - last_act) / 1000);
|
||||
if (elapsed >= hard_timeout) {
|
||||
return SWITCH_STATUS_BREAK;
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, globals.dialplan)
|
||||
assert(channel != NULL);
|
||||
|
||||
|
||||
last = switch_time_now() - waitsec;
|
||||
last = switch_timestamp_now() - waitsec;
|
||||
|
||||
|
||||
|
||||
@@ -244,7 +244,7 @@ SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, globals.dialplan)
|
||||
while (switch_channel_get_state(channel) == CS_INIT && !switch_test_flag(tech_pvt, TFLAG_ANSWER)) {
|
||||
switch_size_t olen = globals.timer.samples;
|
||||
|
||||
if (switch_time_now() - last >= waitsec) {
|
||||
if (switch_timestamp_now() - last >= waitsec) {
|
||||
char buf[512];
|
||||
switch_event_t *event;
|
||||
|
||||
@@ -257,7 +257,7 @@ SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, globals.dialplan)
|
||||
switch_event_fire(&event);
|
||||
}
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s\n", buf);
|
||||
last = switch_time_now();
|
||||
last = switch_timestamp_now();
|
||||
}
|
||||
|
||||
if (ring_file) {
|
||||
|
||||
@@ -1832,8 +1832,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
|
||||
}
|
||||
|
||||
if (!sofia_endpoint_interface || !(session = switch_core_session_request(sofia_endpoint_interface, NULL))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Session Alloc Failed!\n");
|
||||
nua_respond(nh, SIP_503_SERVICE_UNAVAILABLE, TAG_END());
|
||||
nua_respond(nh, SIP_486_BUSY_HERE, TAG_END());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user