some refactoring and plumbing for 1.4

This commit is contained in:
Anthony Minessale committed 2013-10-16 02:24:32 +05:00
1 parent c7ccf84a14
commit 4a172402d2
37 files changed
+1729 -287

No files matched your search

-3
View File
@@ -297,9 +297,6 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
switch_set_flag_locked(tech_pvt, TFLAG_IO);
/* Move channel's state machine to ROUTING */
switch_channel_set_state(channel, CS_ROUTING);
return SWITCH_STATUS_SUCCESS;
}
@@ -1916,6 +1916,7 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
{
switch_channel_t *channel = switch_core_session_get_channel(session);
struct private_object *tech_pvt = NULL;
switch_status_t status = SWITCH_STATUS_SUCCESS;
tech_pvt = switch_core_session_get_private(session);
switch_assert(tech_pvt != NULL);
@@ -1928,11 +1929,10 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
switch_channel_mark_answered(channel);
}
/* Move channel's state machine to ROUTING */
switch_channel_set_state(channel, CS_ROUTING);
status = SWITCH_STATUS_SUCCESS;
}
return SWITCH_STATUS_SUCCESS;
return status;
}
static switch_status_t channel_on_routing(switch_core_session_t *session)
@@ -586,11 +586,6 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
//ERRORA("%s CHANNEL INIT\n", GSMOPEN_P_LOG, tech_pvt->name);
switch_set_flag(tech_pvt, TFLAG_IO);
/* Move channel's state machine to ROUTING. This means the call is trying
to get from the initial start where the call because, to the point
where a destination has been identified. If the channel is simply
left in the initial state, nothing will happen. */
switch_channel_set_state(channel, CS_ROUTING);
switch_mutex_lock(globals.mutex);
globals.calls++;
@@ -416,11 +416,6 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
switch_set_flag(tech_pvt, TFLAG_IO);
switch_mutex_unlock(tech_pvt->flag_mutex);
/* Move channel's state machine to ROUTING. This means the call is trying
to get from the initial start where the call because, to the point
where a destination has been identified. If the channel is simply
left in the initial state, nothing will happen. */
switch_channel_set_state(channel, CS_ROUTING);
switch_mutex_lock(globals.mutex);
globals.calls++;
-1
View File
@@ -1655,7 +1655,6 @@ switch_status_t FSH323Connection::on_init()
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"Started routing for connection [%p]\n",this);
switch_channel_set_state(channel, CS_ROUTING);
return SWITCH_STATUS_SUCCESS;
}
@@ -231,6 +231,7 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
switch_caller_profile_t *caller_profile;
switch_event_t *vars = NULL;
const char *var;
switch_status_t status = SWITCH_STATUS_FALSE;
tech_pvt = switch_core_session_get_private(session);
switch_assert(tech_pvt != NULL);
@@ -354,11 +355,12 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
}
switch_channel_set_variable(channel, "loopback_leg", switch_test_flag(tech_pvt, TFLAG_BLEG) ? "B" : "A");
status = SWITCH_STATUS_SUCCESS;
switch_channel_set_state(channel, CS_ROUTING);
end:
return SWITCH_STATUS_SUCCESS;
return status;
}
static void do_reset(loopback_private_t *tech_pvt)
+1 -1
View File
@@ -853,7 +853,7 @@ switch_status_t FSConnection::on_init()
return SWITCH_STATUS_FALSE;
PTRACE(4, "mod_opal\tStarted routing for connection " << *this);
switch_channel_set_state(m_fsChannel, CS_ROUTING);
return SWITCH_STATUS_SUCCESS;
}
@@ -282,11 +282,6 @@ SWITCH_STANDARD_API(pa_cmd);
*/
static switch_status_t channel_on_init(switch_core_session_t *session)
{
switch_channel_t *channel = switch_core_session_get_channel(session);
/* Move channel's state machine to ROUTING */
switch_channel_set_state(channel, CS_ROUTING);
return SWITCH_STATUS_SUCCESS;
}
@@ -141,11 +141,6 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
assert(channel != NULL);
switch_set_flag_locked(tech_pvt, TFLAG_IO);
/* Move channel's state machine to ROUTING. This means the call is trying
to get from the initial start where the call because, to the point
where a destination has been identified. If the channel is simply
left in the initial state, nothing will happen. */
switch_channel_set_state(channel, CS_ROUTING);
switch_mutex_lock(globals.mutex);
globals.calls++;
switch_mutex_unlock(globals.mutex);
-7
View File
@@ -163,13 +163,6 @@ switch_status_t rtmp_on_init(switch_core_session_t *session)
switch_set_flag_locked(tech_pvt, TFLAG_IO);
/* Move channel's state machine to ROUTING. This means the call is trying
to get from the initial start where the call because, to the point
where a destination has been identified. If the channel is simply
left in the initial state, nothing will happen. */
switch_channel_set_state(channel, CS_ROUTING);
switch_mutex_lock(rsession->profile->mutex);
rsession->profile->calls++;
switch_mutex_unlock(rsession->profile->mutex);
+2 -1
View File
@@ -648,7 +648,8 @@ switch_status_t channel_on_init(switch_core_session_t *session)
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CHANNEL INIT\n", switch_channel_get_name(channel));
return SWITCH_STATUS_SUCCESS;
/* This does not set the state to routing like most modules do, this now happens in the default state handeler so return FALSE TO BLOCK IT*/
return SWITCH_STATUS_FALSE;
}
struct channel_on_routing_helper {
@@ -457,11 +457,6 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
switch_set_flag(tech_pvt, TFLAG_IO);
switch_mutex_unlock(tech_pvt->flag_mutex);
/* Move channel's state machine to ROUTING. This means the call is trying
to get from the initial start where the call because, to the point
where a destination has been identified. If the channel is simply
left in the initial state, nothing will happen. */
switch_channel_set_state(channel, CS_ROUTING);
DEBUGA_SKYPE("%s CHANNEL INIT %s\n", SKYPOPEN_P_LOG, tech_pvt->name, switch_core_session_get_uuid(session));
switch_copy_string(tech_pvt->session_uuid_str, switch_core_session_get_uuid(session), sizeof(tech_pvt->session_uuid_str));
@@ -670,11 +665,11 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session)
static switch_status_t channel_on_routing(switch_core_session_t *session)
{
switch_channel_t *channel = NULL;
//switch_channel_t *channel = NULL;
private_t *tech_pvt = NULL;
channel = switch_core_session_get_channel(session);
switch_assert(channel != NULL);
//channel = switch_core_session_get_channel(session);
//switch_assert(channel != NULL);
tech_pvt = switch_core_session_get_private(session);
switch_assert(tech_pvt != NULL);
+1 -55
View File
@@ -102,20 +102,6 @@ static switch_status_t sofia_on_init(switch_core_session_t *session)
}
}
if (switch_channel_test_flag(tech_pvt->channel, CF_RECOVERING_BRIDGE)) {
switch_channel_set_state(channel, CS_RESET);
} else {
if (switch_channel_test_flag(tech_pvt->channel, CF_RECOVERING)) {
switch_channel_set_state(channel, CS_EXECUTE);
} else {
/* Move channel's state machine to ROUTING */
switch_channel_set_state(channel, CS_ROUTING);
assert(switch_channel_get_state(channel) != CS_INIT);
}
}
end:
switch_mutex_unlock(tech_pvt->sofia_mutex);
@@ -156,43 +142,6 @@ static switch_status_t sofia_on_reset(switch_core_session_t *session)
switch_channel_get_name(switch_core_session_get_channel(session)));
if (switch_channel_test_flag(tech_pvt->channel, CF_RECOVERING_BRIDGE)) {
switch_core_session_t *other_session = NULL;
const char *uuid = switch_core_session_get_uuid(session);
if (switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) {
const char *other_uuid = switch_channel_get_partner_uuid(channel);
int x = 0;
if (other_uuid) {
for (x = 0; other_session == NULL && x < 20; x++) {
if (!switch_channel_up(channel)) {
break;
}
other_session = switch_core_session_locate(other_uuid);
switch_yield(100000);
}
}
if (other_session) {
switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
switch_channel_clear_flag(channel, CF_BRIDGE_ORIGINATOR);
switch_channel_wait_for_state_timeout(other_channel, CS_RESET, 5000);
switch_channel_wait_for_flag(other_channel, CF_MEDIA_ACK, SWITCH_TRUE, 2000, NULL);
if (switch_channel_test_flag(channel, CF_PROXY_MODE) && switch_channel_test_flag(other_channel, CF_PROXY_MODE)) {
switch_ivr_signal_bridge(session, other_session);
} else {
switch_ivr_uuid_bridge(uuid, other_uuid);
}
switch_core_session_rwunlock(other_session);
}
}
switch_channel_clear_flag(tech_pvt->channel, CF_RECOVERING_BRIDGE);
}
return SWITCH_STATUS_SUCCESS;
}
@@ -221,12 +170,11 @@ static switch_status_t sofia_on_execute(switch_core_session_t *session)
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_assert(tech_pvt != NULL);
switch_channel_clear_flag(tech_pvt->channel, CF_RECOVERING);
if (!sofia_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) {
sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
switch_channel_clear_flag(channel, CF_LEG_HOLDING);
}
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s SOFIA EXECUTE\n",
switch_channel_get_name(switch_core_session_get_channel(session)));
@@ -873,8 +821,6 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
tech_pvt->session_refresher = nua_no_refresher;
}
if (sofia_use_soa(tech_pvt)) {
nua_respond(tech_pvt->nh, SIP_200_OK,
NUTAG_AUTOANSWER(0),
+1 -1
View File
@@ -300,7 +300,7 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
switch_channel_set_state(channel, CS_CONSUME_MEDIA);
return SWITCH_STATUS_SUCCESS;
return SWITCH_STATUS_FALSE;
}
static switch_status_t channel_on_destroy(switch_core_session_t *session)
-3
View File
@@ -1907,9 +1907,6 @@ int sofia_recover_callback(switch_core_session_t *session)
switch_channel_get_name(channel), use_uuid);
}
}
switch_core_media_recover_session(session);
}
r++;
@@ -850,11 +850,6 @@ static switch_status_t unicall_on_init(switch_core_session_t *session)
switch_set_flag_locked(tech_pvt, TFLAG_IO);
/* Move channel's state machine to ROUTING. This means the call is trying
to get from the initial state to the point where a destination has been
identified. If the channel is simply left in the initial state, nothing
will happen. */
switch_channel_set_state(channel, CS_ROUTING);
switch_mutex_lock(globals.mutex);
globals.calls++;
switch_mutex_unlock(globals.mutex);