fix callstate stuff to behave right on outbound calls

This commit is contained in:
Anthony Minessale 2013-02-23 12:55:53 -06:00
parent 3e31837a0b
commit 28680c5e58
1 changed files with 11 additions and 7 deletions

View File

@ -1998,6 +1998,7 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_set_running_state(
if (state <= CS_DESTROY) {
switch_event_t *event;
if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND) {
if (state < CS_HANGUP) {
if (state == CS_ROUTING) {
switch_channel_set_callstate(channel, CCS_RINGING);
@ -2007,6 +2008,7 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_set_running_state(
switch_channel_set_callstate(channel, CCS_EARLY);
}
}
}
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_STATE) == SWITCH_STATUS_SUCCESS) {
if (state == CS_ROUTING) {
@ -3038,6 +3040,8 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_ring_ready_value(swi
if (!switch_channel_test_flag(channel, CF_RING_READY) && !switch_channel_test_flag(channel, CF_ANSWERED)) {
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_channel_get_uuid(channel), SWITCH_LOG_NOTICE, "Ring-Ready %s!\n", channel->name);
switch_channel_set_flag_value(channel, CF_RING_READY, rv);
switch_channel_set_callstate(channel, CCS_RINGING);
if (channel->caller_profile && channel->caller_profile->times) {
switch_mutex_lock(channel->profile_mutex);
channel->caller_profile->times->progress = switch_micro_time_now();