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;