]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-9390 #resolve ['Segmentation fault' during call setup]
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 28 Jul 2016 21:27:17 +0000 (16:27 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 28 Jul 2016 21:27:17 +0000 (16:27 -0500)
src/switch_ivr_originate.c

index 47b49725a48e0d6cba091705cc8e0501e45d8cc9..d35cb9662f44faaa9ee8d3c76c6d22a78eaed807 100644 (file)
@@ -1759,9 +1759,18 @@ static void *SWITCH_THREAD_FUNC early_thread_run(switch_thread_t *thread, void *
        switch_codec_implementation_t read_impl = { 0 };
 
        for (i = 0; i < MAX_PEERS && i < state->ttl; i++) {
-               if (switch_core_session_read_lock(state->originate_status[i].peer_session) == SWITCH_STATUS_SUCCESS) {
-                       originate_status[i].peer_session = state->originate_status[i].peer_session;
-                       originate_status[i].peer_channel = switch_core_session_get_channel(state->originate_status[i].peer_session);
+               switch_core_session_t *session = state->originate_status[i].peer_session;
+               switch_channel_t *channel = NULL;
+               
+               if (session) channel = switch_core_session_get_channel(session);
+
+               if (!session || !channel || !switch_channel_up(channel)) {
+                       continue;
+               }
+
+               if (switch_core_session_read_lock(session) == SWITCH_STATUS_SUCCESS) {
+                       originate_status[i].peer_session = session;
+                       originate_status[i].peer_channel = channel;
                }
        }