]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-2966 I already fixed this in the wait_for_state, so i copied the same fix to wait_...
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 3 Mar 2011 02:50:33 +0000 (20:50 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 3 Mar 2011 02:50:33 +0000 (20:50 -0600)
src/switch_channel.c
src/switch_cpp.cpp

index 179f63da7933cfe5ba874a8dbb73578b30cc4e9f..4341ea921486d9a70bc7aaf3a49a1f84073747ed 100644 (file)
@@ -1206,18 +1206,20 @@ SWITCH_DECLARE(void) switch_channel_wait_for_state(switch_channel_t *channel, sw
 }
 
 
-SWITCH_DECLARE(void) switch_channel_wait_for_state_timeout(switch_channel_t *other_channel, switch_channel_state_t want_state, uint32_t timeout)
+SWITCH_DECLARE(void) switch_channel_wait_for_state_timeout(switch_channel_t *channel, switch_channel_state_t want_state, uint32_t timeout)
 {
        switch_channel_state_t state;
        uint32_t count = 0;
 
        for (;;) {
-               state = switch_channel_get_running_state(other_channel);
+               state = switch_channel_get_running_state(channel);
 
-               if (state >= want_state) {
+               if ((channel->state == channel->running_state && channel->running_state == want_state) || channel->state >= CS_HANGUP) {
                        break;
                }
+
                switch_cond_next();
+
                if (++count >= timeout) {
                        break;
                }
index c62946b7600e227c2174610cece9815221f34877..7d2f281a896d4b4ce99f85c9bcf2c1dbf209ebf0 100644 (file)
@@ -516,6 +516,7 @@ SWITCH_DECLARE_CONSTRUCTOR CoreSession::CoreSession(char *nuuid, CoreSession *a_
                        switch_set_flag(this, S_HUP);
                        uuid = strdup(switch_core_session_get_uuid(session));
                        switch_channel_set_state(switch_core_session_get_channel(session), CS_SOFT_EXECUTE);
+                       switch_channel_wait_for_state(switch_core_session_get_channel(session), switch_core_session_get_channel(a_leg->session), CS_SOFT_EXECUTE);
                }
        }
 }