while ((!caller_channel || switch_channel_ready(caller_channel)) &&
check_channel_status(peer_channels, peer_sessions, and_argc, &idx, file, key, ringback_data)) {
if ((to = (uint8_t)((time(NULL) - start) >= (time_t)timelimit_sec))) {
idx = IDX_CANCEL;
goto notready;
}
//WTF??? peer_sessions[0] might be NULL - Is it trying to dequeue all the other sessions when one specific session answers?
if (switch_core_session_dequeue_message(peer_sessions[0], &message) == SWITCH_STATUS_SUCCESS) {
if (session && !ringback_data && or_argc == 1 && and_argc == 1) { /* when there is only 1 channel to call and bridge and no ringback */
switch_core_session_receive_message(session, message);
}