]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
ditto
authorAnthony Minessale <anthony.minessale@gmail.com>
Tue, 6 Jan 2009 23:26:49 +0000 (23:26 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Tue, 6 Jan 2009 23:26:49 +0000 (23:26 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11082 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_apr.c
src/switch_channel.c
src/switch_ivr.c
src/switch_ivr_originate.c

index 104f50b59a35b32c57bd392f5a223773b6e375a4..9a09c4ad23ae27d5b2b21c7867a8adb90721313d 100644 (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);
index 70cf968691cb5e759d4d9702ea19aa74a6e28006..1d8f8797e5b9e2249564d82f29c03a4f9c456ebd 100644 (file)
@@ -1647,8 +1647,8 @@ 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);
        } else {
@@ -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);
index 00b24c9eb2b5b0a3e393497ec7b6335dae149391..28e0fe5cdc5f0210e2ffdce3ddb6bb0df96659ca 100644 (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 {
index 8bb21d6f295db15a7065dab1eb429593eae2fc39..35d562c557bca96a0fc2f15ea0d6509aac9e4bc5 100644 (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);
+                       }
                }
        }