From ff8bf014cf30879f2f47e093175b3a4108b8a49e Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 12 May 2015 15:52:53 -0500 Subject: [PATCH] FS-7500: change variable names to reflect audio vs video %NEEDS_DOC remote_media_ip_reported => remote_audio_ip_reported and remote_video_ip_reported new vars remote_audio_ip and remote_video_ip like remote_media_ip but specific to audio and video remote_media_port_reported => remote_audio_port_reported and remote_audio_port_reported remote_media_port => remote_audio_port and remote_video_port rtp_auto_adjust => rtp_auto_adjust_audio and rtp_auto_adjust_video --- src/switch_rtp.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index b4a2e8a950..f35b48c70f 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -6318,12 +6318,23 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ switch_sockaddr_get_port(rtp_session->rtp_from_addr)); if (channel) { - switch_channel_set_variable(channel, "remote_media_ip_reported", switch_channel_get_variable(channel, "remote_media_ip")); - switch_channel_set_variable(channel, "remote_media_ip", tx_host); + char varname[80] = ""; + + switch_snprintf(varname, sizeof(varname), "remote_%s_ip_reported", rtp_type(rtp_session)); + switch_channel_set_variable(channel, varname, switch_channel_get_variable(channel, "remote_media_ip")); + + switch_snprintf(varname, sizeof(varname), "remote_%s_ip", rtp_type(rtp_session)); + switch_channel_set_variable(channel, varname, tx_host); + + switch_snprintf(varname, sizeof(varname), "remote_%s_port_reported", rtp_type(rtp_session)); switch_snprintf(adj_port, sizeof(adj_port), "%u", switch_sockaddr_get_port(rtp_session->rtp_from_addr)); - switch_channel_set_variable(channel, "remote_media_port_reported", switch_channel_get_variable(channel, "remote_media_port")); - switch_channel_set_variable(channel, "remote_media_port", adj_port); - switch_channel_set_variable(channel, "rtp_auto_adjust", "true"); + switch_channel_set_variable(channel, varname, switch_channel_get_variable(channel, "remote_media_port")); + + switch_snprintf(varname, sizeof(varname), "remote_%s_port", rtp_type(rtp_session)); + switch_channel_set_variable(channel, varname, adj_port); + + switch_snprintf(varname, sizeof(varname), "rtp_auto_adjust_%s", rtp_type(rtp_session)); + switch_channel_set_variable(channel, varname, "true"); } rtp_session->auto_adj_used = 1; switch_rtp_set_remote_address(rtp_session, tx_host, switch_sockaddr_get_port(rtp_session->rtp_from_addr), 0, SWITCH_FALSE, &err); @@ -6340,7 +6351,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ if ((rtp_session->rtp_bugs & RTP_BUG_ALWAYS_AUTO_ADJUST)) { switch_rtp_set_flag(rtp_session, SWITCH_RTP_FLAG_AUTOADJ); } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG, "Correct ip/port confirmed.\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG, "Correct %s ip/port confirmed.\n", rtp_type(rtp_session)); switch_rtp_clear_flag(rtp_session, SWITCH_RTP_FLAG_AUTOADJ); } rtp_session->auto_adj_used = 0;