git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11082 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2009-01-06 23:26:49 +00:00
parent c576ef7a6e
commit abb2691bde
4 changed files with 17 additions and 10 deletions

View File

@ -761,9 +761,9 @@ SWITCH_DECLARE(switch_status_t) switch_socket_atmark(switch_socket_t *sock, int
SWITCH_DECLARE(switch_status_t) switch_socket_recvfrom(switch_sockaddr_t *from, switch_socket_t *sock, int32_t flags, char *buf, size_t *len)
{
apr_status_t r;
apr_status_t r = SWITCH_STATUS_GENERR;
if ((r = apr_socket_recvfrom(from, sock, flags, buf, len)) == APR_SUCCESS) {
if (from && sock && (r = apr_socket_recvfrom(from, sock, flags, buf, len)) == APR_SUCCESS) {
from->port = ntohs(from->sa.sin.sin_port);
/* from->ipaddr_ptr = &(from->sa.sin.sin_addr);
* from->ipaddr_ptr = inet_ntoa(from->sa.sin.sin_addr);

View File

@ -1647,7 +1647,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_pre_answer(switch_channel
msg.message_id = SWITCH_MESSAGE_INDICATE_PROGRESS;
msg.from = channel->name;
status = switch_core_session_receive_message(channel->session, &msg);
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);
@ -1679,7 +1679,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_ring_ready(switch_channel
msg.message_id = SWITCH_MESSAGE_INDICATE_RINGING;
msg.from = channel->name;
status = switch_core_session_receive_message(channel->session, &msg);
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);
@ -1784,7 +1784,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_answer(switch_channel_t *
msg.message_id = SWITCH_MESSAGE_INDICATE_ANSWER;
msg.from = channel->name;
status = switch_core_session_receive_message(channel->session, &msg);
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);

View File

@ -64,8 +64,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session,
media_ready = (switch_channel_media_ready(channel) && !switch_channel_test_flag(channel, CF_SERVICE));
if (media_ready && (var = switch_channel_get_variable(channel, SWITCH_SEND_SILENCE_WHEN_IDLE_VARIABLE)) && (sval = atoi(var)) && sval >= 100) {
if (ms > 100 && media_ready && (var = switch_channel_get_variable(channel, SWITCH_SEND_SILENCE_WHEN_IDLE_VARIABLE)) && (sval = atoi(var))) {
switch_core_session_get_read_impl(session, &imp);
if (switch_core_codec_init(&codec,
@ -94,6 +93,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session,
}
if (!write_frame.datalen) {
sval = 0;
}
cng_frame.data = data;
cng_frame.datalen = 2;
cng_frame.buflen = 2;
@ -177,7 +180,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session,
break;
}
if (sval) {
if (sval && write_frame.datalen) {
switch_generate_sln_silence((int16_t *) write_frame.data, write_frame.samples, sval);
switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0);
} else {

View File

@ -41,7 +41,11 @@ static switch_status_t originate_on_consume_media_transmit(switch_core_session_t
if (!switch_channel_test_flag(channel, CF_PROXY_MODE)) {
while (switch_channel_get_state(channel) == CS_CONSUME_MEDIA && !switch_channel_test_flag(channel, CF_TAGGED)) {
switch_ivr_sleep(session, 10, SWITCH_FALSE, NULL);
if (!switch_channel_media_ready(channel)) {
switch_yield(10000);
} else {
switch_ivr_sleep(session, 10, SWITCH_FALSE, NULL);
}
}
}