FS-5670 --resolve allow debug rtp if rtp is not attached to a session

This commit is contained in:
Seven Du 2013-08-08 08:48:40 +08:00
parent bd1c6106dc
commit f9487a9aa8
2 changed files with 36 additions and 51 deletions

View File

@ -2372,6 +2372,7 @@ SWITCH_DECLARE(uint8_t) switch_core_session_check_interface(switch_core_session_
SWITCH_DECLARE(char *) switch_core_session_get_uuid(switch_core_session_t *session)
{
if (!session) return NULL;
return session->uuid_str;
}

View File

@ -25,7 +25,7 @@
*
* Anthony Minessale II <anthm@freeswitch.org>
* Marcel Barbulescu <marcelbarbulescu@gmail.com>
*
* Seven Du <dujinfang@gmail.com>
*
* switch_rtp.c -- RTP
*
@ -2859,15 +2859,11 @@ static void do_flush(switch_rtp_t *rtp_session)
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_DEBUG_RTP_READ)) {
switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
if (!session) {
switch_clear_flag(rtp_session, SWITCH_RTP_FLAG_DEBUG_RTP_READ);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "RTP HAS NO SESSION!\n");
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session),
SWITCH_LOG_CONSOLE, "%s FLUSH\n", switch_channel_get_name(switch_core_session_get_channel(session))
SWITCH_LOG_CONSOLE, "%s FLUSH\n",
session ? switch_channel_get_name(switch_core_session_get_channel(session)) : "NoName"
);
}
}
if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_NOBLOCK)) {
was_blocking = 1;
@ -3623,11 +3619,6 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
if (bytes && switch_test_flag(rtp_session, SWITCH_RTP_FLAG_DEBUG_RTP_READ)) {
switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
if (!session) {
switch_clear_flag(rtp_session, SWITCH_RTP_FLAG_DEBUG_RTP_READ);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "RTP HAS NO SESSION!\n");
} else {
const char *tx_host;
const char *old_host;
const char *my_host;
@ -3641,7 +3632,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_CONSOLE,
"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)),
session ? switch_channel_get_name(switch_core_session_get_channel(session)) : "NoName",
(long) bytes,
my_host, switch_sockaddr_get_port(rtp_session->local_addr),
old_host, rtp_session->remote_port,
@ -3649,7 +3640,6 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
rtp_session->recv_msg.header.pt, ntohl(rtp_session->recv_msg.header.ts), rtp_session->recv_msg.header.m);
}
}
if (((rtp_session->cng_pt && rtp_session->recv_msg.header.pt == rtp_session->cng_pt) || rtp_session->recv_msg.header.pt == 13)) {
*flags |= SFF_NOT_AUDIO;
@ -4453,11 +4443,6 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_DEBUG_RTP_WRITE)) {
switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
if (!session) {
switch_clear_flag(rtp_session, SWITCH_RTP_FLAG_DEBUG_RTP_WRITE);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "RTP HAS NO SESSION!\n");
} else {
const char *tx_host;
const char *old_host;
const char *my_host;
@ -4471,7 +4456,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_CONSOLE,
"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)),
session ? switch_channel_get_name(switch_core_session_get_channel(session)) : "NoName",
(long) bytes,
my_host, switch_sockaddr_get_port(rtp_session->local_addr),
old_host, rtp_session->remote_port,
@ -4479,7 +4464,6 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
send_msg->header.pt, ntohl(send_msg->header.ts), send_msg->header.m);
}
}
if (switch_socket_sendto(rtp_session->sock_output, rtp_session->remote_addr, 0, (void *) send_msg, &bytes) != SWITCH_STATUS_SUCCESS) {