diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 1666d0a4f1..6c45fac650 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -928,7 +928,7 @@ typedef enum { SWITCH_MESSAGE_INDICATE_REQUEST_IMAGE_MEDIA, SWITCH_MESSAGE_INDICATE_UUID_CHANGE, SWITCH_MESSAGE_INDICATE_SIMPLIFY, - SWITCH_MESSAGE_INDICATE_DEBUG_AUDIO, + SWITCH_MESSAGE_INDICATE_DEBUG_MEDIA, SWITCH_MESSAGE_INDICATE_PROXY_MEDIA, SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC, SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC_COMPLETE, diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 4f720a1682..0e7cb74f90 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -3563,8 +3563,8 @@ SWITCH_STANDARD_API(uuid_video_refresh_function) } -#define DEBUG_AUDIO_SYNTAX " " -SWITCH_STANDARD_API(uuid_debug_audio_function) +#define DEBUG_MEDIA_SYNTAX " " +SWITCH_STANDARD_API(uuid_debug_media_function) { char *mycmd = NULL, *argv[3] = { 0 }; int argc = 0; @@ -3575,13 +3575,13 @@ SWITCH_STANDARD_API(uuid_debug_audio_function) } if (zstr(cmd) || argc < 3 || zstr(argv[0]) || zstr(argv[1]) || zstr(argv[2])) { - stream->write_function(stream, "-USAGE: %s\n", DEBUG_AUDIO_SYNTAX); + stream->write_function(stream, "-USAGE: %s\n", DEBUG_MEDIA_SYNTAX); goto done; } else { switch_core_session_message_t msg = { 0 }; switch_core_session_t *lsession = NULL; - msg.message_id = SWITCH_MESSAGE_INDICATE_DEBUG_AUDIO; + msg.message_id = SWITCH_MESSAGE_INDICATE_DEBUG_MEDIA; msg.string_array_arg[0] = argv[1]; msg.string_array_arg[1] = argv[2]; msg.from = __FILE__; @@ -6034,7 +6034,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) SWITCH_ADD_API(commands_api_interface, "uuid_broadcast", "Execute dialplan application", uuid_broadcast_function, BROADCAST_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_buglist", "List media bugs on a session", uuid_buglist_function, BUGLIST_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_chat", "Send a chat message", uuid_chat, UUID_CHAT_SYNTAX); - SWITCH_ADD_API(commands_api_interface, "uuid_debug_audio", "Debug audio", uuid_debug_audio_function, DEBUG_AUDIO_SYNTAX); + SWITCH_ADD_API(commands_api_interface, "uuid_debug_media", "Debug media", uuid_debug_media_function, DEBUG_MEDIA_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_deflect", "Send a deflect", uuid_deflect, UUID_DEFLECT_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_displace", "Displace audio", session_displace_function, " [start|stop] [] [mux]"); SWITCH_ADD_API(commands_api_interface, "uuid_display", "Update phone display", uuid_display_function, DISPLAY_SYNTAX); @@ -6176,7 +6176,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) switch_console_set_complete("add uuid_broadcast ::console::list_uuid"); switch_console_set_complete("add uuid_buglist ::console::list_uuid"); switch_console_set_complete("add uuid_chat ::console::list_uuid"); - switch_console_set_complete("add uuid_debug_audio ::console::list_uuid"); + switch_console_set_complete("add uuid_debug_media ::console::list_uuid"); switch_console_set_complete("add uuid_deflect ::console::list_uuid"); switch_console_set_complete("add uuid_displace ::console::list_uuid"); switch_console_set_complete("add uuid_display ::console::list_uuid"); diff --git a/src/mod/endpoints/mod_khomp/mod_khomp.cpp b/src/mod/endpoints/mod_khomp/mod_khomp.cpp index 557cfb46f5..1ff2be71af 100644 --- a/src/mod/endpoints/mod_khomp/mod_khomp.cpp +++ b/src/mod/endpoints/mod_khomp/mod_khomp.cpp @@ -791,8 +791,8 @@ switch_status_t khompReceiveMessage(switch_core_session_t *session, switch_core_ case SWITCH_MESSAGE_INDICATE_SIMPLIFY: DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_SIMPLIFY")); break; - case SWITCH_MESSAGE_INDICATE_DEBUG_AUDIO: - DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_DEBUG_AUDIO")); + case SWITCH_MESSAGE_INDICATE_DEBUG_MEDIA: + DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_DEBUG_MEDIA")); break; case SWITCH_MESSAGE_INDICATE_PROXY_MEDIA: DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_PROXY_MEDIA")); diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 29146a26ae..a53f1d5d10 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1687,30 +1687,38 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi } } break; - case SWITCH_MESSAGE_INDICATE_DEBUG_AUDIO: + case SWITCH_MESSAGE_INDICATE_DEBUG_MEDIA: { - if (switch_rtp_ready(tech_pvt->rtp_session) && !zstr(msg->string_array_arg[0]) && !zstr(msg->string_array_arg[1])) { + switch_rtp_t *rtp = tech_pvt->rtp_session; + const char *direction = msg->string_array_arg[0]; + + if (direction && *direction == 'v') { + direction++; + rtp = tech_pvt->video_rtp_session; + } + + if (switch_rtp_ready(rtp) && !zstr(direction) && !zstr(msg->string_array_arg[1])) { int32_t flags = 0; - if (!strcasecmp(msg->string_array_arg[0], "read")) { + if (!strcasecmp(direction, "read")) { flags |= SWITCH_RTP_FLAG_DEBUG_RTP_READ; - } else if (!strcasecmp(msg->string_array_arg[0], "write")) { + } else if (!strcasecmp(direction, "write")) { flags |= SWITCH_RTP_FLAG_DEBUG_RTP_WRITE; - } else if (!strcasecmp(msg->string_array_arg[0], "both")) { + } else if (!strcasecmp(direction, "both")) { flags |= SWITCH_RTP_FLAG_DEBUG_RTP_READ | SWITCH_RTP_FLAG_DEBUG_RTP_WRITE; } if (flags) { if (switch_true(msg->string_array_arg[1])) { - switch_rtp_set_flag(tech_pvt->rtp_session, flags); + switch_rtp_set_flag(rtp, flags); } else { - switch_rtp_clear_flag(tech_pvt->rtp_session, flags); + switch_rtp_clear_flag(rtp, flags); } } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid Options\n"); } } } - status = SWITCH_STATUS_FALSE; + status = SWITCH_STATUS_SUCCESS; goto end; case SWITCH_MESSAGE_INDICATE_TRANSCODING_NECESSARY: if (tech_pvt->rtp_session && switch_rtp_test_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833)) { diff --git a/src/mod/endpoints/mod_sofia/rtp.c b/src/mod/endpoints/mod_sofia/rtp.c index 796908232a..f943933248 100644 --- a/src/mod/endpoints/mod_sofia/rtp.c +++ b/src/mod/endpoints/mod_sofia/rtp.c @@ -554,7 +554,7 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s assert(tech_pvt != NULL); switch (msg->message_id) { - case SWITCH_MESSAGE_INDICATE_DEBUG_AUDIO: + case SWITCH_MESSAGE_INDICATE_DEBUG_MEDIA: { if (switch_rtp_ready(tech_pvt->rtp_session) && !zstr(msg->string_array_arg[0]) && !zstr(msg->string_array_arg[1])) { int32_t flags = 0; diff --git a/src/mod/languages/mod_managed/managed/swig.2010.cs b/src/mod/languages/mod_managed/managed/swig.2010.cs index 93f4ff4684..880e33cd0a 100644 --- a/src/mod/languages/mod_managed/managed/swig.2010.cs +++ b/src/mod/languages/mod_managed/managed/swig.2010.cs @@ -26620,7 +26620,7 @@ public enum switch_core_session_message_types_t { SWITCH_MESSAGE_INDICATE_REQUEST_IMAGE_MEDIA, SWITCH_MESSAGE_INDICATE_UUID_CHANGE, SWITCH_MESSAGE_INDICATE_SIMPLIFY, - SWITCH_MESSAGE_INDICATE_DEBUG_AUDIO, + SWITCH_MESSAGE_INDICATE_DEBUG_MEDIA, SWITCH_MESSAGE_INDICATE_PROXY_MEDIA, SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC, SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC_COMPLETE, diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index 7aecb11906..379ae4353d 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -26538,7 +26538,7 @@ public enum switch_core_session_message_types_t { SWITCH_MESSAGE_INDICATE_REQUEST_IMAGE_MEDIA, SWITCH_MESSAGE_INDICATE_UUID_CHANGE, SWITCH_MESSAGE_INDICATE_SIMPLIFY, - SWITCH_MESSAGE_INDICATE_DEBUG_AUDIO, + SWITCH_MESSAGE_INDICATE_DEBUG_MEDIA, SWITCH_MESSAGE_INDICATE_PROXY_MEDIA, SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC, SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC_COMPLETE, diff --git a/src/switch_core_session.c b/src/switch_core_session.c index 410ffa711b..e8f3010417 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -705,7 +705,7 @@ static const char *message_names[] = { "REQUEST_IMAGE_MEDIA", "UUID_CHANGE", "SIMPLIFY", - "DEBUG_AUDIO", + "DEBUG_MEDIA", "PROXY_MEDIA", "APPLICATION_EXEC", "APPLICATION_EXEC_COMPLETE", diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 495ccf0757..c041a51a5b 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -3640,7 +3640,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ my_host = switch_get_addr(bufc, sizeof(bufc), rtp_session->local_addr); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_CONSOLE, - "R %s b=%ld %s:%u %s:%u %s:%u pt=%d ts=%u m=%d\n", + "R %s b=%4ld %s:%u %s:%u %s:%u pt=%d ts=%u m=%d\n", switch_channel_get_name(switch_core_session_get_channel(session)), (long) bytes, my_host, switch_sockaddr_get_port(rtp_session->local_addr), @@ -4468,7 +4468,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session, my_host = switch_get_addr(bufc, sizeof(bufc), rtp_session->local_addr); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_CONSOLE, - "W %s b=%ld %s:%u %s:%u %s:%u pt=%d ts=%u m=%d\n", + "W %s b=%4ld %s:%u %s:%u %s:%u pt=%d ts=%u m=%d\n", switch_channel_get_name(switch_core_session_get_channel(session)), (long) bytes, my_host, switch_sockaddr_get_port(rtp_session->local_addr),