From 2db8f94ab6543018df1792663b809e77d521cab9 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 27 May 2015 01:13:27 -0500 Subject: [PATCH 1/2] skip rtcp addr when mux is set --- src/switch_core_media.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 5ac1b60eeb..48ea843cfe 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -2975,13 +2975,19 @@ static void check_ice(switch_media_handle_t *smh, switch_media_type_t type, sdp_ } if (engine->ice_in.cands[engine->ice_in.chosen[1]][1].con_port) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_NOTICE, - "setting remote rtcp %s addr to %s:%d based on candidate\n", type2str(type), - engine->ice_in.cands[engine->ice_in.chosen[1]][1].con_addr, engine->ice_in.cands[engine->ice_in.chosen[1]][1].con_port); - engine->remote_rtcp_ice_port = engine->ice_in.cands[engine->ice_in.chosen[1]][1].con_port; - engine->remote_rtcp_ice_addr = switch_core_session_strdup(smh->session, engine->ice_in.cands[engine->ice_in.chosen[1]][1].con_addr); - - engine->remote_rtcp_port = engine->ice_in.cands[engine->ice_in.chosen[1]][1].con_port; + if (engine->rtcp_mux) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_NOTICE, + "Asked by candidate to set remote rtcp %s addr to %s:%d but this is rtcp-mux so no thanks\n", type2str(type), + engine->ice_in.cands[engine->ice_in.chosen[1]][1].con_addr, engine->ice_in.cands[engine->ice_in.chosen[1]][1].con_port); + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_NOTICE, + "Setting remote rtcp %s addr to %s:%d based on candidate\n", type2str(type), + engine->ice_in.cands[engine->ice_in.chosen[1]][1].con_addr, engine->ice_in.cands[engine->ice_in.chosen[1]][1].con_port); + engine->remote_rtcp_ice_port = engine->ice_in.cands[engine->ice_in.chosen[1]][1].con_port; + engine->remote_rtcp_ice_addr = switch_core_session_strdup(smh->session, engine->ice_in.cands[engine->ice_in.chosen[1]][1].con_addr); + + engine->remote_rtcp_port = engine->ice_in.cands[engine->ice_in.chosen[1]][1].con_port; + } } From b5f75a0f435fe80cd143d3c5b8eb3961a8e2d97f Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 27 May 2015 16:48:16 -0500 Subject: [PATCH 2/2] FS-7582 #resolve #comment port from 1.6 its probably better to start working on 1.6 for any webrtc or dtls stuff --- src/switch_core_media.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 48ea843cfe..4128b50f69 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -5885,6 +5885,15 @@ static const char *get_media_profile_name(switch_core_session_t *session, int se } +static char *get_setup(switch_core_session_t *session) +{ + if (switch_channel_direction(session->channel) == SWITCH_CALL_DIRECTION_INBOUND && !switch_channel_test_flag(session->channel, CF_RECOVERING)) { + return "active"; + } + + return "actpass"; +} + //? static void generate_m(switch_core_session_t *session, char *buf, size_t buflen, switch_port_t port, const char *family, const char *ip, @@ -6041,10 +6050,10 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen, } if (!zstr(a_engine->local_dtls_fingerprint.type) && secure) { - switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=fingerprint:%s %s\n", a_engine->local_dtls_fingerprint.type, - a_engine->local_dtls_fingerprint.str); + switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=fingerprint:%s %s\na=setup:%s\n", a_engine->local_dtls_fingerprint.type, + a_engine->local_dtls_fingerprint.str, get_setup(session)); } - + if (smh->mparams->rtcp_audio_interval_msec) { if (a_engine->rtcp_mux > 0) { switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=rtcp-mux\n"); @@ -6649,8 +6658,8 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess if (!zstr(a_engine->local_dtls_fingerprint.type)) { - switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=fingerprint:%s %s\n", a_engine->local_dtls_fingerprint.type, - a_engine->local_dtls_fingerprint.str); + switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=fingerprint:%s %s\na=setup:%s\n", a_engine->local_dtls_fingerprint.type, + a_engine->local_dtls_fingerprint.str, get_setup(session)); } if (smh->mparams->rtcp_audio_interval_msec) { @@ -7046,8 +7055,8 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess if (!zstr(v_engine->local_dtls_fingerprint.type)) { - switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=fingerprint:%s %s\n", v_engine->local_dtls_fingerprint.type, - v_engine->local_dtls_fingerprint.str); + switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=fingerprint:%s %s\na=setup:%s\n", v_engine->local_dtls_fingerprint.type, + v_engine->local_dtls_fingerprint.str, get_setup(session)); }