diff --git a/src/include/switch_channel.h b/src/include/switch_channel.h index 739ef5c5cf..2ce6ea3ef1 100644 --- a/src/include/switch_channel.h +++ b/src/include/switch_channel.h @@ -301,16 +301,16 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_answered(switch_chan */ #define switch_channel_mark_pre_answered(channel) switch_channel_perform_mark_pre_answered(channel, __FILE__, __SWITCH_FUNC__, __LINE__) -SWITCH_DECLARE(switch_status_t) switch_channel_perform_ringback(switch_channel_t *channel, - const char *file, - const char *func, - int line); +SWITCH_DECLARE(switch_status_t) switch_channel_perform_ring_ready(switch_channel_t *channel, + const char *file, + const char *func, + int line); /*! \brief Send Ringing message to a channel \param channel channel to ring \return SWITCH_STATUS_SUCCESS if successful */ -#define switch_channel_ringback(channel) switch_channel_perform_ringback(channel, __FILE__, __SWITCH_FUNC__, __LINE__) +#define switch_channel_ring_ready(channel) switch_channel_perform_ring_ready(channel, __FILE__, __SWITCH_FUNC__, __LINE__) SWITCH_DECLARE(switch_status_t) switch_channel_perform_pre_answer(switch_channel_t *channel, diff --git a/src/include/switch_types.h b/src/include/switch_types.h index ab440c5aa9..72a6797d22 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -485,8 +485,8 @@ CF_CONTROLLED = (1 << 12) - Channel is under control CF_NOMEDIA = (1 << 13) - Channel has no media CF_SUSPEND = (1 << 14) - Suspend i/o CF_EVENT_PARSE = (1 << 15) - Suspend control events -CF_NO_INDICATE = (1 << 16) - Disable Indications -CF_REPEAT_STATE = (1 << 17) - Tell the state machine to repeat a state +CF_REPEAT_STATE = (1 << 16) - Tell the state machine to repeat a state +CF_GEN_RINGBACK = (1 << 17) - Channel is generating it's own ringback CF_RING_READY = (1 << 18) - Channel is ready to send ringback */ @@ -508,8 +508,8 @@ typedef enum { CF_NOMEDIA = (1 << 13), CF_SUSPEND = (1 << 14), CF_EVENT_PARSE = (1 << 15), - CF_NO_INDICATE = (1 << 16), - CF_REPEAT_STATE = (1 << 17), + CF_REPEAT_STATE = (1 << 16), + CF_GEN_RINGBACK = (1 << 17), CF_RING_READY = (1 << 18) } switch_channel_flag_t; diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 47d0cecfb3..764dfb23d9 100644 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -63,12 +63,12 @@ static void detect_speech_function(switch_core_session_t *session, char *data) } -static void ringback_function(switch_core_session_t *session, char *data) +static void ring_ready_function(switch_core_session_t *session, char *data) { switch_channel_t *channel; channel = switch_core_session_get_channel(session); assert(channel != NULL); - switch_channel_ringback(channel); + switch_channel_ring_ready(channel); } static void queue_dtmf_function(switch_core_session_t *session, char *data) @@ -538,11 +538,11 @@ static const switch_application_interface_t detect_speech_application_interface /*.next */ &ivr_application_interface }; -static const switch_application_interface_t ringback_application_interface = { - /*.interface_name */ "ringback", - /*.application_function */ ringback_function, - /* long_desc */ "Indicate Ringback on a channel.", - /* short_desc */ "Indicate Ringback", +static const switch_application_interface_t ring_ready_application_interface = { + /*.interface_name */ "ring_ready", + /*.application_function */ ring_ready_function, + /* long_desc */ "Indicate Ring_Ready on a channel.", + /* short_desc */ "Indicate Ring_Ready", /* syntax */ "", /*.next */ &detect_speech_application_interface }; @@ -553,7 +553,7 @@ static const switch_application_interface_t unset_application_interface = { /* long_desc */ "Unset a channel varaible for the channel calling the application.", /* short_desc */ "Unset a channel varaible", /* syntax */ "", - /*.next */ &ringback_application_interface + /*.next */ &ring_ready_application_interface }; static const switch_application_interface_t set_application_interface = { diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index cc8651bd45..2ea53aad8f 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -2810,25 +2810,27 @@ static void sip_i_state(int status, break; case nua_callstate_proceeding: if (channel) { - if (status == 180 && !(switch_channel_test_flag(channel, CF_NO_INDICATE))) { + if (status == 180) { switch_channel_mark_ring_ready(channel); - if (switch_test_flag(tech_pvt, TFLAG_NOMEDIA)) { - if ((uuid = switch_channel_get_variable(channel, SWITCH_BRIDGE_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) { - switch_core_session_message_t msg; - msg.message_id = SWITCH_MESSAGE_INDICATE_RINGING; - msg.from = __FILE__; - switch_core_session_receive_message(other_session, &msg); - switch_core_session_rwunlock(other_session); - } - - } else { - switch_core_session_message_t *msg; - if ((msg = malloc(sizeof(*msg)))) { - memset(msg, 0, sizeof(*msg)); - msg->message_id = SWITCH_MESSAGE_INDICATE_RINGING; - msg->from = __FILE__; - switch_core_session_queue_message(session, msg); - switch_set_flag(msg, SCSMF_DYNAMIC); + if (!switch_channel_test_flag(channel, CF_GEN_RINGBACK)) { + if (switch_test_flag(tech_pvt, TFLAG_NOMEDIA)) { + if ((uuid = switch_channel_get_variable(channel, SWITCH_BRIDGE_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) { + switch_core_session_message_t msg; + msg.message_id = SWITCH_MESSAGE_INDICATE_RINGING; + msg.from = __FILE__; + switch_core_session_receive_message(other_session, &msg); + switch_core_session_rwunlock(other_session); + } + + } else { + switch_core_session_message_t *msg; + if ((msg = malloc(sizeof(*msg)))) { + memset(msg, 0, sizeof(*msg)); + msg->message_id = SWITCH_MESSAGE_INDICATE_RINGING; + msg->from = __FILE__; + switch_core_session_queue_message(session, msg); + switch_set_flag(msg, SCSMF_DYNAMIC); + } } } } @@ -2837,12 +2839,13 @@ static void sip_i_state(int status, if (switch_test_flag(tech_pvt, TFLAG_NOMEDIA)) { switch_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA); switch_channel_mark_pre_answered(channel); - if ((uuid = switch_channel_get_variable(channel, SWITCH_BRIDGE_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) { + if (!switch_channel_test_flag(channel, CF_GEN_RINGBACK) && + (uuid = switch_channel_get_variable(channel, SWITCH_BRIDGE_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) { other_channel = switch_core_session_get_channel(other_session); if (!switch_channel_get_variable(other_channel, SWITCH_B_SDP_VARIABLE)) { switch_channel_set_variable(other_channel, SWITCH_B_SDP_VARIABLE, (char *)r_sdp); } - + switch_channel_pre_answer(other_channel); switch_core_session_rwunlock(other_session); } diff --git a/src/switch_channel.c b/src/switch_channel.c index c3de8b5232..414580a125 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -1063,10 +1063,10 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_pre_answer(switch_channel return status; } -SWITCH_DECLARE(switch_status_t) switch_channel_perform_ringback(switch_channel_t *channel, - const char *file, - const char *func, - int line) +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; char *uuid = switch_core_session_get_uuid(channel->session); @@ -1091,7 +1091,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_ringback(switch_channel_t status = switch_core_session_message_send(uuid, &msg); if (status == SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_ID_LOG, (char *) file, func, line, SWITCH_LOG_NOTICE, "Ringback %s!\n", channel->name); + switch_log_printf(SWITCH_CHANNEL_ID_LOG, (char *) file, func, line, SWITCH_LOG_NOTICE, "Ring Ready %s!\n", channel->name); } return status; diff --git a/src/switch_console.c b/src/switch_console.c index 27e15e106e..1752b24a86 100644 --- a/src/switch_console.c +++ b/src/switch_console.c @@ -120,7 +120,7 @@ static int switch_console_process(char *cmd) SWITCH_STANDARD_STREAM(stream); if (stream.data) { if (switch_api_execute(cmd, arg, NULL, &stream) == SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_CONSOLE, "API CALL [%s(%s)] output:\n%s\n", cmd, arg ? arg : "", stream.data); + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_CONSOLE, "API CALL [%s(%s)] output:\n%s\n", cmd, arg ? arg : "", (char *)stream.data); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Unknown Command: %s\n", cmd); } diff --git a/src/switch_core.c b/src/switch_core.c index 0f25b84599..921682a0eb 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -2067,7 +2067,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi } else { if (!session->raw_read_buffer) { switch_size_t bytes = session->read_codec->implementation->bytes_per_frame; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Engaging Read Buffer at %u bytes\n", bytes); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Engaging Read Buffer at %u bytes\n", (uint32_t)bytes); switch_buffer_create_dynamic(&session->raw_read_buffer, bytes * SWITCH_BUFFER_BLOCK_FRAMES, bytes * SWITCH_BUFFER_START_FRAMES, 0); } if (!switch_buffer_write(session->raw_read_buffer, read_frame->data, read_frame->datalen)) { @@ -2321,9 +2321,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess if (!session->raw_write_buffer) { switch_size_t bytes = session->write_codec->implementation->bytes_per_frame; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, - "Engaging Write Buffer at %u bytes to accomodate %u->%u\n", - bytes, - write_frame->datalen, session->write_codec->implementation->bytes_per_frame); + "Engaging Write Buffer at %u bytes to accomodate %u->%u\n", + (uint32_t)bytes, + write_frame->datalen, session->write_codec->implementation->bytes_per_frame); if ((status =switch_buffer_create_dynamic(&session->raw_write_buffer, bytes * SWITCH_BUFFER_BLOCK_FRAMES, bytes * SWITCH_BUFFER_START_FRAMES, @@ -4132,7 +4132,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(char *console, const char **err switch_core_sql_thread_launch(); #endif - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Allocated memory pool. Sessions are %u bytes\n", sizeof(switch_core_session_t)); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Allocated memory pool. Sessions are %u bytes\n", (uint32_t)sizeof(switch_core_session_t)); switch_event_init(runtime.memory_pool); switch_rtp_init(runtime.memory_pool); diff --git a/src/switch_ivr.c b/src/switch_ivr.c index a4fd2865ff..4725abe854 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -1533,7 +1533,7 @@ SWITCH_DECLARE(switch_status_t) switch_play_and_get_digits(switch_core_session_t args.buflen = digit_buffer_length; //Play the file status = switch_ivr_play_file(session, NULL, prompt_audio_file, &args); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "play gave up %s", digit_buffer); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "play gave up %s", (char *) digit_buffer); //Make sure we made it out alive if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) { @@ -1545,7 +1545,7 @@ SWITCH_DECLARE(switch_status_t) switch_play_and_get_digits(switch_core_session_t if (max_digits == 1 && status == SWITCH_STATUS_BREAK) { //Check the digit if we have a regex if (digits_regex != NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Checking regex [%s] on [%s]\n", digits_regex, digit_buffer); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Checking regex [%s] on [%s]\n", digits_regex, (char *) digit_buffer); //Make sure the digit is allowed if (switch_regex_match(digit_buffer, digits_regex) == SWITCH_STATUS_SUCCESS) { @@ -1586,7 +1586,7 @@ SWITCH_DECLARE(switch_status_t) switch_play_and_get_digits(switch_core_session_t if (min_digits <= strlen(digit_buffer)) { //See if we need to test a regex if (digits_regex != NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Checking regex [%s] on [%s]\n", digits_regex, digit_buffer); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Checking regex [%s] on [%s]\n", digits_regex, (char *) digit_buffer); //Test the regex if (switch_regex_match(digit_buffer, digits_regex) == SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Match found!\n"); @@ -2579,7 +2579,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess or_argc = switch_separate_string(data, '|', pipe_names, (sizeof(pipe_names) / sizeof(pipe_names[0]))); if (caller_channel && or_argc > 1 && !ringback_data) { - switch_channel_ringback(caller_channel); + switch_channel_ring_ready(caller_channel); sent_ring = 1; } @@ -2606,7 +2606,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess and_argc = switch_separate_string(pipe_names[r], ',', peer_names, (sizeof(peer_names) / sizeof(peer_names[0]))); if (caller_channel && !sent_ring && and_argc > 1 && !ringback_data) { - switch_channel_ringback(caller_channel); + switch_channel_ring_ready(caller_channel); sent_ring = 1; } @@ -2746,7 +2746,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess if (caller_channel && !switch_channel_ready(caller_channel)) { goto notready; } - + if ((time(NULL) - start) > (time_t)timelimit_sec) { to++; idx = IDX_CANCEL; @@ -3839,11 +3839,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_event(switch_ if (parser->terminator == '\0') { if (len > parser->maxlen) { parser->maxlen = len; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "max len %u\n",parser->maxlen); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "max len %u\n", (uint32_t) parser->maxlen); } if (parser->minlen == 0 || len < parser->minlen) { parser->minlen = len; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "min len %u\n",parser->minlen); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "min len %u\n", (uint32_t) parser->minlen); } } else { // since we have a terminator, reset min and max