use the non-signal checking version of switch_channel_up/down in the core

This commit is contained in:
Anthony Minessale 2011-11-18 13:17:56 -06:00
parent 4c0bc25864
commit 9ecf187dd9
7 changed files with 43 additions and 43 deletions

View File

@ -631,7 +631,7 @@ SWITCH_DECLARE(void) switch_channel_perform_presence(switch_channel_t *channel,
if (call_info) {
char *call_info_state = "active";
if (!switch_channel_up(channel)) {
if (!switch_channel_up_nosig(channel)) {
call_info_state = "idle";
} else if (!strcasecmp(status, "hold-private")) {
call_info_state = "held-private";
@ -1374,7 +1374,7 @@ SWITCH_DECLARE(void) switch_channel_wait_for_state(switch_channel_t *channel, sw
for (;;) {
if ((channel->state == channel->running_state && channel->running_state == want_state) ||
(other_channel && switch_channel_down(other_channel)) || switch_channel_down(channel)) {
(other_channel && switch_channel_down_nosig(other_channel)) || switch_channel_down_nosig(channel)) {
break;
}
switch_yield(20000);
@ -1427,7 +1427,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_wait_for_flag(switch_channel_t *c
return SWITCH_STATUS_FALSE;
}
if (switch_channel_down(channel)) {
if (switch_channel_down_nosig(channel)) {
return SWITCH_STATUS_FALSE;
}
@ -1745,7 +1745,7 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_get_running_state(switch_c
SWITCH_DECLARE(int) switch_channel_state_change_pending(switch_channel_t *channel)
{
if (switch_channel_down(channel) || !switch_core_session_in_thread(channel->session)) {
if (switch_channel_down_nosig(channel) || !switch_core_session_in_thread(channel->session)) {
return 0;
}

View File

@ -41,7 +41,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor
switch_io_event_hook_video_write_frame_t *ptr;
switch_status_t status = SWITCH_STATUS_FALSE;
if (switch_channel_down(session->channel)) {
if (switch_channel_down_nosig(session->channel)) {
return SWITCH_STATUS_FALSE;
}
@ -65,7 +65,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(switch_core
switch_assert(session != NULL);
if (switch_channel_down(session->channel)) {
if (switch_channel_down_nosig(session->channel)) {
return SWITCH_STATUS_FALSE;
}
@ -153,7 +153,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
}
}
if (switch_channel_down(session->channel) || !switch_core_codec_ready(session->read_codec)) {
if (switch_channel_down_nosig(session->channel) || !switch_core_codec_ready(session->read_codec)) {
*frame = NULL;
status = SWITCH_STATUS_FALSE;
goto even_more_done;
@ -1110,7 +1110,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
while (switch_buffer_inuse(session->raw_write_buffer) >= session->write_impl.decoded_bytes_per_packet) {
int rate;
if (switch_channel_down(session->channel) || !session->raw_write_buffer) {
if (switch_channel_down_nosig(session->channel) || !session->raw_write_buffer) {
goto error;
}
if ((session->raw_write_frame.datalen = (uint32_t)
@ -1291,7 +1291,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_recv_dtmf(switch_core_sessio
switch_dtmf_t new_dtmf;
int fed = 0;
if (switch_channel_down(session->channel)) {
if (switch_channel_down_nosig(session->channel)) {
return SWITCH_STATUS_FALSE;
}
@ -1334,7 +1334,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf(switch_core_sessio
switch_status_t status = SWITCH_STATUS_FALSE;
switch_dtmf_t new_dtmf;
if (switch_channel_down(session->channel)) {
if (switch_channel_down_nosig(session->channel)) {
return SWITCH_STATUS_FALSE;
}
@ -1413,7 +1413,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf_string(switch_core
dtmf.flags = 0;
}
if (switch_channel_down(session->channel)) {
if (switch_channel_down_nosig(session->channel)) {
return SWITCH_STATUS_FALSE;
}

View File

@ -85,7 +85,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_lock(switch_core_sessio
switch_status_t status = SWITCH_STATUS_FALSE;
if (session->rwlock) {
if (switch_test_flag(session, SSF_DESTROYED) || switch_channel_down(session->channel)) {
if (switch_test_flag(session, SSF_DESTROYED) || switch_channel_down_nosig(session->channel)) {
status = SWITCH_STATUS_FALSE;
if (switch_thread_rwlock_tryrdlock(session->rwlock) == SWITCH_STATUS_SUCCESS) {
if (switch_channel_test_flag(session->channel, CF_THREAD_SLEEPING)) {

View File

@ -231,7 +231,7 @@ SWITCH_DECLARE(void) switch_core_session_hupall_matching_var(const char *var_nam
for(np = head; np; np = np->next) {
if ((session = switch_core_session_locate(np->str))) {
const char *this_val;
if (switch_channel_up(session->channel) &&
if (switch_channel_up_nosig(session->channel) &&
(this_val = switch_channel_get_variable(session->channel, var_name)) && (!strcmp(this_val, var_val))) {
switch_channel_hangup(session->channel, cause);
}
@ -330,7 +330,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_message_send(const char *uui
if ((session = switch_core_hash_find(session_manager.session_table, uuid_str)) != 0) {
/* Acquire a read lock on the session or forget it the channel is dead */
if (switch_core_session_read_lock(session) == SWITCH_STATUS_SUCCESS) {
if (switch_channel_up(session->channel)) {
if (switch_channel_up_nosig(session->channel)) {
status = switch_core_session_receive_message(session, message);
}
switch_core_session_rwunlock(session);
@ -350,7 +350,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_event_send(const char *uuid_
if ((session = switch_core_hash_find(session_manager.session_table, uuid_str)) != 0) {
/* Acquire a read lock on the session or forget it the channel is dead */
if (switch_core_session_read_lock(session) == SWITCH_STATUS_SUCCESS) {
if (switch_channel_up(session->channel)) {
if (switch_channel_up_nosig(session->channel)) {
status = switch_core_session_queue_event(session, event);
}
switch_core_session_rwunlock(session);
@ -684,7 +684,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_perform_receive_message(swit
goto end;
}
if (switch_channel_down(session->channel) && message->message_id != SWITCH_MESSAGE_INDICATE_SIGNAL_DATA) {
if (switch_channel_down_nosig(session->channel) && message->message_id != SWITCH_MESSAGE_INDICATE_SIGNAL_DATA) {
switch_log_printf(SWITCH_CHANNEL_ID_LOG, message->_file, message->_func, message->_line,
switch_core_session_get_uuid(session), SWITCH_LOG_DEBUG, "%s skip receive message [%s] (channel is hungup already)\n",
switch_channel_get_name(session->channel), message_names[message->message_id]);
@ -705,7 +705,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_perform_receive_message(swit
message->_func = NULL;
message->_line = 0;
if (switch_channel_up(session->channel)) {
if (switch_channel_up_nosig(session->channel)) {
switch (message->message_id) {
case SWITCH_MESSAGE_REDIRECT_AUDIO:
case SWITCH_MESSAGE_INDICATE_ANSWER:
@ -904,7 +904,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_receive_event(switch_core_se
/* Acquire a read lock on the session or forget it the channel is dead */
if (switch_core_session_read_lock(session) == SWITCH_STATUS_SUCCESS) {
if (switch_channel_up(session->channel)) {
if (switch_channel_up_nosig(session->channel)) {
if (session->endpoint_interface->io_routines->receive_event) {
status = session->endpoint_interface->io_routines->receive_event(session, *event);
}
@ -2063,7 +2063,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application_get_flag
switch_application_interface_t *application_interface;
switch_status_t status = SWITCH_STATUS_SUCCESS;
if (switch_channel_down(session->channel)) {
if (switch_channel_down_nosig(session->channel)) {
char *p;
if (!arg && (p = strstr(app, "::"))) {
*p++ = '0';

View File

@ -1353,7 +1353,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session
msg.message_id = SWITCH_MESSAGE_INDICATE_DISPLAY;
switch_core_session_receive_message(session, &msg);
while (switch_channel_up(tchannel) && switch_channel_ready(channel)) {
while (switch_channel_up_nosig(tchannel) && switch_channel_ready(channel)) {
uint32_t len = sizeof(buf);
switch_event_t *event = NULL;
char *fcommand = NULL;
@ -3285,12 +3285,12 @@ static void *SWITCH_THREAD_FUNC speech_thread(switch_thread_t *thread, void *obj
sth->ready = 1;
while (switch_channel_up(channel) && !switch_test_flag(sth->ah, SWITCH_ASR_FLAG_CLOSED)) {
while (switch_channel_up_nosig(channel) && !switch_test_flag(sth->ah, SWITCH_ASR_FLAG_CLOSED)) {
char *xmlstr = NULL;
switch_thread_cond_wait(sth->cond, sth->mutex);
if (switch_channel_down(channel) || switch_test_flag(sth->ah, SWITCH_ASR_FLAG_CLOSED)) {
if (switch_channel_down_nosig(channel) || switch_test_flag(sth->ah, SWITCH_ASR_FLAG_CLOSED)) {
break;
}

View File

@ -311,7 +311,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
goto end_of_bridge_loop;
}
if ((b_state = switch_channel_down(chan_b))) {
if ((b_state = switch_channel_down_nosig(chan_b))) {
goto end_of_bridge_loop;
}
@ -542,7 +542,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
switch_safe_free(stream.data);
}
if (!inner_bridge && switch_channel_up(chan_a)) {
if (!inner_bridge && switch_channel_up_nosig(chan_a)) {
if ((app_name = switch_channel_get_variable(chan_a, SWITCH_EXEC_AFTER_BRIDGE_APP_VARIABLE))) {
switch_caller_extension_t *extension = NULL;
if ((extension = switch_caller_extension_new(session_a, app_name, app_name)) == 0) {
@ -987,7 +987,7 @@ static switch_status_t signal_bridge_on_hangup(switch_core_session_t *session)
switch_channel_set_variable(other_channel, SWITCH_BRIDGE_VARIABLE, NULL);
switch_channel_set_variable(other_channel, "call_uuid", switch_core_session_get_uuid(other_session));
if (switch_channel_up(other_channel)) {
if (switch_channel_up_nosig(other_channel)) {
if (switch_true(switch_channel_get_variable(other_channel, SWITCH_PARK_AFTER_BRIDGE_VARIABLE))) {
switch_ivr_park_session(other_session);
@ -1051,12 +1051,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_signal_bridge(switch_core_session_t *
switch_channel_t *peer_channel = switch_core_session_get_channel(peer_session);
switch_event_t *event;
if (switch_channel_down(peer_channel)) {
if (switch_channel_down_nosig(peer_channel)) {
switch_channel_hangup(caller_channel, switch_channel_get_cause(peer_channel));
return SWITCH_STATUS_FALSE;
}
if (!switch_channel_up(caller_channel)) {
if (!switch_channel_up_nosig(caller_channel)) {
switch_channel_hangup(peer_channel, SWITCH_CAUSE_ORIGINATOR_CANCEL);
return SWITCH_STATUS_FALSE;
}
@ -1297,7 +1297,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses
switch_channel_set_variable(caller_channel, SWITCH_BRIDGE_HANGUP_CAUSE_VARIABLE, switch_channel_cause2str(cause));
}
if (switch_channel_down(peer_channel) && switch_true(switch_channel_get_variable(peer_channel, SWITCH_COPY_XML_CDR_VARIABLE))) {
if (switch_channel_down_nosig(peer_channel) && switch_true(switch_channel_get_variable(peer_channel, SWITCH_COPY_XML_CDR_VARIABLE))) {
switch_xml_t cdr = NULL;
char *xml_text;
@ -1449,7 +1449,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_uuid_bridge(const char *originator_uu
}
if (switch_channel_down(originator_channel)) {
if (switch_channel_down_nosig(originator_channel)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s is hungup refusing to bridge.\n", switch_channel_get_name(originatee_channel));
switch_core_session_rwunlock(originator_session);
switch_core_session_rwunlock(originatee_session);

View File

@ -187,13 +187,13 @@ static void *SWITCH_THREAD_FUNC collect_thread_run(switch_thread_t *thread, void
switch_core_session_exec(collect->session, application_interface, app_data);
if (switch_channel_up(channel)) {
if (switch_channel_up_nosig(channel)) {
switch_channel_set_flag(channel, CF_WINNER);
}
goto wbreak;
}
if (!switch_channel_up(channel)) {
if (!switch_channel_up_nosig(channel)) {
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
goto wbreak;
}
@ -309,7 +309,7 @@ static int check_per_channel_timeouts(originate_global_t *oglobals,
}
}
if (originate_status[i].peer_channel && switch_channel_up(originate_status[i].peer_channel)) {
if (originate_status[i].peer_channel && switch_channel_up_nosig(originate_status[i].peer_channel)) {
if (originate_status[i].per_channel_progress_timelimit_sec && elapsed > originate_status[i].per_channel_progress_timelimit_sec &&
!(switch_channel_test_flag(originate_status[i].peer_channel, CF_RING_READY) ||
switch_channel_test_flag(originate_status[i].peer_channel, CF_ANSWERED) ||
@ -447,7 +447,7 @@ static uint8_t check_channel_status(originate_global_t *oglobals, originate_stat
switch_channel_t *channel = switch_core_session_get_channel(originate_status[i].peer_session);
uint32_t j;
if (switch_channel_down(channel)) {
if (switch_channel_down_nosig(channel)) {
switch_call_cause_t cause = switch_channel_get_cause(channel);
for (j = 0; j < len; j++) {
@ -1046,7 +1046,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t
end:
if (!switch_channel_media_ready(peer_channel)) {
if (switch_channel_up(peer_channel)) {
if (switch_channel_up_nosig(peer_channel)) {
switch_channel_hangup(peer_channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
}
status = SWITCH_STATUS_FALSE;
@ -1061,7 +1061,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t
}
}
if (caller_channel && !switch_channel_up(caller_channel)) {
if (caller_channel && !switch_channel_up_nosig(caller_channel)) {
status = SWITCH_STATUS_FALSE;
}
@ -2753,7 +2753,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
}
pchannel = switch_core_session_get_channel(originate_status[i].peer_session);
if (switch_channel_down(pchannel)) {
if (switch_channel_down_nosig(pchannel)) {
int neg, pos;
cause_str = switch_channel_cause2str(switch_channel_get_cause(pchannel));
neg = *fail_on_single_reject_var == '!';
@ -3001,7 +3001,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
if (!peer_eligible(originate_status[i].peer_channel)) {
continue;
}
if (switch_channel_up(originate_status[i].peer_channel)) {
if (switch_channel_up_nosig(originate_status[i].peer_channel)) {
peer_session = originate_status[i].peer_session;
peer_channel = originate_status[i].peer_channel;
originate_status[i].peer_channel = NULL;
@ -3012,7 +3012,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
end_search:
if (peer_channel && switch_channel_down(peer_channel)) {
if (peer_channel && switch_channel_down_nosig(peer_channel)) {
switch_core_session_rwunlock(peer_session);
peer_session = NULL;
peer_channel = NULL;
@ -3095,7 +3095,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
switch_ivr_uuid_bridge(holding, switch_core_session_get_uuid(peer_session));
holding = NULL;
oglobals.idx = IDX_NADA;
if (caller_channel && switch_channel_up(caller_channel)) {
if (caller_channel && switch_channel_up_nosig(caller_channel)) {
switch_channel_hangup(caller_channel, SWITCH_CAUSE_ATTENDED_TRANSFER);
}
caller_channel = NULL;
@ -3142,7 +3142,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
reason = SWITCH_CAUSE_LOSE_RACE;
} else if (!switch_channel_ready(originate_status[i].peer_channel)) {
wait_for_cause(originate_status[i].peer_channel);
if (switch_channel_down(originate_status[i].peer_channel)) {
if (switch_channel_down_nosig(originate_status[i].peer_channel)) {
reason = switch_channel_get_cause(originate_status[i].peer_channel);
}
} else {
@ -3150,7 +3150,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
}
}
}
if (switch_channel_up(originate_status[i].peer_channel)) {
if (switch_channel_up_nosig(originate_status[i].peer_channel)) {
if (caller_channel && i == 0) {
holding = switch_channel_get_variable(caller_channel, SWITCH_SOFT_HOLDING_UUID_VARIABLE);
switch_channel_set_variable(caller_channel, SWITCH_SOFT_HOLDING_UUID_VARIABLE, NULL);
@ -3343,7 +3343,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
wait_for_cause(originate_status[i].peer_channel);
if (switch_channel_down(originate_status[i].peer_channel)) {
if (switch_channel_down_nosig(originate_status[i].peer_channel)) {
*cause = switch_channel_get_cause(originate_status[i].peer_channel);
break;
}
@ -3466,7 +3466,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
pchannel = switch_core_session_get_channel(originate_status[i].peer_session);
wait_for_cause(pchannel);
if (switch_channel_down(pchannel)) {
if (switch_channel_down_nosig(pchannel)) {
int neg, pos;
cause_str = switch_channel_cause2str(switch_channel_get_cause(pchannel));