]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix callstate stuff to behave right on outbound calls
authorAnthony Minessale <anthm@freeswitch.org>
Sat, 23 Feb 2013 18:55:53 +0000 (12:55 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Sat, 23 Feb 2013 18:55:58 +0000 (12:55 -0600)
src/switch_channel.c

index 0cdf2eaa1347cfb434a62a258a56b2a92f7931e6..c00498ce17dd80d4aa3c2972d765c0c89a931e11 100644 (file)
@@ -1998,13 +1998,15 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_set_running_state(
        if (state <= CS_DESTROY) {
                switch_event_t *event;
 
-               if (state < CS_HANGUP) {
-                       if (state == CS_ROUTING) {
-                               switch_channel_set_callstate(channel, CCS_RINGING);
-                       } else if (switch_channel_test_flag(channel, CF_ANSWERED)) {
-                               switch_channel_set_callstate(channel, CCS_ACTIVE);
-                       } else if (switch_channel_test_flag(channel, CF_EARLY_MEDIA)) {
-                               switch_channel_set_callstate(channel, CCS_EARLY);
+               if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND) {
+                       if (state < CS_HANGUP) {
+                               if (state == CS_ROUTING) {
+                                       switch_channel_set_callstate(channel, CCS_RINGING);
+                               } else if (switch_channel_test_flag(channel, CF_ANSWERED)) {
+                                       switch_channel_set_callstate(channel, CCS_ACTIVE);
+                               } else if (switch_channel_test_flag(channel, CF_EARLY_MEDIA)) {
+                                       switch_channel_set_callstate(channel, CCS_EARLY);
+                               }
                        }
                }
 
@@ -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();