SWITCH_DECLARE(switch_status_t) switch_channel_perform_pre_answer(switch_channel_t *channel, const char *file, const char *func, int line)
{
switch_core_session_message_t msg;
- switch_status_t status;
+ switch_status_t status = SWITCH_STATUS_SUCCESS;
switch_assert(channel != NULL);
return SWITCH_STATUS_SUCCESS;
}
- if (switch_channel_test_flag(channel, CF_OUTBOUND)) {
- return SWITCH_STATUS_SUCCESS;
+ if (!switch_channel_test_flag(channel, CF_OUTBOUND)) {
+ msg.message_id = SWITCH_MESSAGE_INDICATE_PROGRESS;
+ msg.from = channel->name;
+ status = switch_core_session_perform_receive_message(channel->session, &msg, file, func, line);
}
- msg.message_id = SWITCH_MESSAGE_INDICATE_PROGRESS;
- msg.from = channel->name;
- status = switch_core_session_perform_receive_message(channel->session, &msg, file, func, line);
-
if (status == SWITCH_STATUS_SUCCESS) {
switch_channel_perform_mark_pre_answered(channel, file, func, line);
} else {
SWITCH_DECLARE(switch_status_t) switch_channel_perform_ring_ready(switch_channel_t *channel, const char *file, const char *func, int line)
{
switch_core_session_message_t msg;
- switch_status_t status;
+ switch_status_t status = SWITCH_STATUS_SUCCESS;
switch_assert(channel != NULL);
return SWITCH_STATUS_SUCCESS;
}
- if (switch_channel_test_flag(channel, CF_OUTBOUND)) {
- return SWITCH_STATUS_SUCCESS;
+ if (!switch_channel_test_flag(channel, CF_OUTBOUND)) {
+ msg.message_id = SWITCH_MESSAGE_INDICATE_RINGING;
+ msg.from = channel->name;
+ status = switch_core_session_perform_receive_message(channel->session, &msg, file, func, line);
}
-
- msg.message_id = SWITCH_MESSAGE_INDICATE_RINGING;
- msg.from = channel->name;
- status = switch_core_session_perform_receive_message(channel->session, &msg, file, func, line);
-
+
if (status == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Ring Ready %s!\n", channel->name);
} else {
SWITCH_DECLARE(switch_status_t) switch_channel_perform_answer(switch_channel_t *channel, const char *file, const char *func, int line)
{
switch_core_session_message_t msg;
- switch_status_t status;
+ switch_status_t status = SWITCH_STATUS_SUCCESS;
switch_assert(channel != NULL);
if (switch_channel_test_flag(channel, CF_ANSWERED)) {
return SWITCH_STATUS_SUCCESS;
}
-
- if (switch_channel_test_flag(channel, CF_OUTBOUND)) {
- return SWITCH_STATUS_SUCCESS;
+
+ if (!switch_channel_test_flag(channel, CF_OUTBOUND)) {
+ msg.message_id = SWITCH_MESSAGE_INDICATE_ANSWER;
+ msg.from = channel->name;
+ status = switch_core_session_perform_receive_message(channel->session, &msg, file, func, line);
}
- msg.message_id = SWITCH_MESSAGE_INDICATE_ANSWER;
- msg.from = channel->name;
- status = switch_core_session_perform_receive_message(channel->session, &msg, file, func, line);
-
if (status == SWITCH_STATUS_SUCCESS) {
switch_channel_perform_mark_answered(channel, file, func, line);
} else {