uint32_t *hups,
char *file,
char *key,
- uint8_t early_ok)
+ uint8_t early_ok,
+ uint8_t *ring_ready)
{
uint32_t i;
if (!peer_channels[i]) {
continue;
}
+ if (!*ring_ready && switch_channel_test_flag(peer_channels[i], CF_RING_READY)) {
+ *ring_ready = 1;
+ }
if (switch_channel_get_state(peer_channels[i]) >= CS_HANGUP) {
(*hups)++;
} else if ((switch_channel_test_flag(peer_channels[i], CF_ANSWERED) ||
switch_core_session_message_t *message = NULL;
switch_event_t *var_event = NULL;
uint8_t fail_on_single_reject = 0;
-
+ uint8_t ring_ready = 0;
write_frame.data = fdata;
*bleg = NULL;
}
while ((!caller_channel || switch_channel_ready(caller_channel)) &&
- check_channel_status(peer_channels, peer_sessions, and_argc, &idx, &hups, file, key, early_ok)) {
+ check_channel_status(peer_channels, peer_sessions, and_argc, &idx, &hups, file, key, early_ok, &ring_ready)) {
// When the AND operator is being used, and fail_on_single_reject is set, a hangup indicates that the call should fail.
if ((to = (uint8_t)((time(NULL) - start) >= (time_t)timelimit_sec)) || (fail_on_single_reject && hups)) {
if (!SWITCH_READ_ACCEPTABLE(status)) {
break;
}
-
- if (switch_channel_test_flag(caller_channel, CF_RING_READY) &&
- read_frame && !pass && !switch_test_flag(read_frame, SFF_CNG) && read_frame->datalen > 1) {
+
+ if (ring_ready && read_frame && !pass && !switch_test_flag(read_frame, SFF_CNG) && read_frame->datalen > 1) {
if (ringback.fh) {
uint8_t abuf[1024];
switch_size_t mlen, olen;