From 331cde3c92140f85265978c75b73cc9a202ad714 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 1 Sep 2015 15:59:17 -0500 Subject: [PATCH] FS-8053: handle a=sendonly, a=sendrecv, a=recvonly to change who is sending video during a call --- .../mod_conference/conference_api.c | 6 ++-- .../mod_conference/conference_event.c | 2 +- .../mod_conference/conference_member.c | 5 ++- .../mod_conference/conference_video.c | 35 +++++++++---------- .../mod_conference/mod_conference.c | 2 +- .../mod_conference/mod_conference.h | 1 - src/mod/endpoints/mod_sofia/sofia.c | 1 + src/mod/endpoints/mod_verto/mod_verto.c | 1 + src/switch_core_media.c | 34 +++++++++++++----- src/switch_rtp.c | 15 ++++---- 10 files changed, 59 insertions(+), 43 deletions(-) diff --git a/src/mod/applications/mod_conference/conference_api.c b/src/mod/applications/mod_conference/conference_api.c index 17d8438be3..b96563f178 100644 --- a/src/mod/applications/mod_conference/conference_api.c +++ b/src/mod/applications/mod_conference/conference_api.c @@ -401,7 +401,7 @@ switch_status_t conference_api_sub_conference_video_vmute_snap(conference_member if (member == NULL) return SWITCH_STATUS_GENERR; - if (member->video_flow == SWITCH_MEDIA_FLOW_SENDONLY) { + if (switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_SENDONLY) { return SWITCH_STATUS_SUCCESS; } @@ -430,7 +430,7 @@ switch_status_t conference_api_sub_vmute(conference_member_t *member, switch_str if (member == NULL) return SWITCH_STATUS_GENERR; - if (member->video_flow == SWITCH_MEDIA_FLOW_SENDONLY) { + if (switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_SENDONLY) { return SWITCH_STATUS_SUCCESS; } @@ -486,7 +486,7 @@ switch_status_t conference_api_sub_unvmute(conference_member_t *member, switch_s if (member == NULL) return SWITCH_STATUS_GENERR; - if (member->video_flow == SWITCH_MEDIA_FLOW_SENDONLY) { + if (switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_SENDONLY) { return SWITCH_STATUS_SUCCESS; } diff --git a/src/mod/applications/mod_conference/conference_event.c b/src/mod/applications/mod_conference/conference_event.c index bbed44305e..b37ecd7e66 100644 --- a/src/mod/applications/mod_conference/conference_event.c +++ b/src/mod/applications/mod_conference/conference_event.c @@ -378,7 +378,7 @@ void conference_event_la_command_handler(switch_live_array_t *la, const char *cm void conference_event_adv_la(conference_obj_t *conference, conference_member_t *member, switch_bool_t join) { - //if (member->video_flow == SWITCH_MEDIA_FLOW_SENDONLY) { + //if (switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_SENDONLY) { switch_channel_set_flag(member->channel, CF_VIDEO_REFRESH_REQ); switch_core_media_gen_key_frame(member->session); //} diff --git a/src/mod/applications/mod_conference/conference_member.c b/src/mod/applications/mod_conference/conference_member.c index bae690f061..594633075d 100644 --- a/src/mod/applications/mod_conference/conference_member.c +++ b/src/mod/applications/mod_conference/conference_member.c @@ -170,7 +170,7 @@ void conference_member_update_status_field(conference_member_t *member) if (switch_channel_test_flag(member->channel, CF_VIDEO) || member->avatar_png_img) { video = cJSON_CreateObject(); cJSON_AddItemToObject(video, "avatarPresented", cJSON_CreateBool(!!member->avatar_png_img)); - cJSON_AddItemToObject(video, "mediaFlow", cJSON_CreateString(member->video_flow == SWITCH_MEDIA_FLOW_SENDONLY ? "sendOnly" : "sendRecv")); + cJSON_AddItemToObject(video, "mediaFlow", cJSON_CreateString(switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_SENDONLY ? "sendOnly" : "sendRecv")); cJSON_AddItemToObject(video, "muted", cJSON_CreateBool(!conference_utils_member_test_flag(member, MFLAG_CAN_BE_SEEN))); cJSON_AddItemToObject(video, "floor", cJSON_CreateBool(member && member->id == member->conference->video_floor_holder)); if (member && member->id == member->conference->video_floor_holder && conference_utils_test_flag(member->conference, CFLAG_VID_FLOOR_LOCK)) { @@ -702,7 +702,7 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m switch_mutex_unlock(conference->canvas_mutex); } - if (member->video_flow == SWITCH_MEDIA_FLOW_SENDONLY) { + if (switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_SENDONLY) { conference_utils_member_clear_flag_locked(member, MFLAG_CAN_BE_SEEN); } @@ -728,7 +728,6 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m conference_send_presence(conference); channel = switch_core_session_get_channel(member->session); - member->video_flow = switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO); conference_video_check_avatar(member, SWITCH_FALSE); diff --git a/src/mod/applications/mod_conference/conference_video.c b/src/mod/applications/mod_conference/conference_video.c index f53e09ecae..19a1e9b6e8 100644 --- a/src/mod/applications/mod_conference/conference_video.c +++ b/src/mod/applications/mod_conference/conference_video.c @@ -888,7 +888,7 @@ switch_status_t conference_video_attach_video_layer(conference_member_t *member, return SWITCH_STATUS_FALSE; } - if (member->video_flow == SWITCH_MEDIA_FLOW_SENDONLY && !member->avatar_png_img) { + if (switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_SENDONLY && !member->avatar_png_img) { return SWITCH_STATUS_FALSE; } @@ -1264,7 +1264,7 @@ void conference_video_write_canvas_image_to_codec_group(conference_obj_t *confer continue; } - if (imember->video_flow == SWITCH_MEDIA_FLOW_RECVONLY) { + if (switch_core_session_media_flow(imember->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_RECVONLY) { continue; } @@ -1571,7 +1571,7 @@ void conference_video_check_avatar(conference_member_t *member, switch_bool_t fo canvas = member->conference->canvases[member->canvas_id]; if (conference_utils_test_flag(member->conference, CFLAG_VIDEO_REQUIRED_FOR_CANVAS) && - (!switch_channel_test_flag(member->channel, CF_VIDEO) || member->video_flow == SWITCH_MEDIA_FLOW_SENDONLY)) { + (!switch_channel_test_flag(member->channel, CF_VIDEO) || switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_SENDONLY)) { return; } @@ -1581,7 +1581,7 @@ void conference_video_check_avatar(conference_member_t *member, switch_bool_t fo member->avatar_patched = 0; - if (!force && switch_channel_test_flag(member->channel, CF_VIDEO) && member->video_flow != SWITCH_MEDIA_FLOW_SENDONLY) { + if (!force && switch_channel_test_flag(member->channel, CF_VIDEO) && switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_SENDONLY) { conference_utils_member_set_flag_locked(member, MFLAG_ACK_VIDEO); } else { if (member->conference->no_video_avatar) { @@ -1705,7 +1705,7 @@ switch_status_t conference_video_find_layer(conference_obj_t *conference, mcu_ca if (!layer && (canvas->layers_used < canvas->total_layers || (avatar_layers && !member->avatar_png_img) || conference_utils_member_test_flag(member, MFLAG_MOD)) && - (member->avatar_png_img || member->video_flow != SWITCH_MEDIA_FLOW_SENDONLY)) { + (member->avatar_png_img || switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_SENDONLY)) { /* find an empty layer */ for (i = 0; i < canvas->total_layers; i++) { mcu_layer_t *xlayer = &canvas->layers[i]; @@ -1778,7 +1778,7 @@ void conference_video_pop_next_image(conference_member_t *member, switch_image_t size = switch_queue_size(member->video_queue); } while(size > 1); - if (conference_utils_member_test_flag(member, MFLAG_CAN_BE_SEEN) && member->video_layer_id > -1 && member->video_flow != SWITCH_MEDIA_FLOW_SENDONLY) { + if (conference_utils_member_test_flag(member, MFLAG_CAN_BE_SEEN) && member->video_layer_id > -1 && switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_SENDONLY) { if (img) { member->good_img++; if ((member->good_img % (int)(member->conference->video_fps.fps * 10)) == 0) { @@ -2129,7 +2129,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr switch_img_free(&img); } - if (!layer && (!conference_utils_test_flag(imember->conference, CFLAG_VIDEO_REQUIRED_FOR_CANVAS) || ((switch_channel_test_flag(imember->channel, CF_VIDEO) && imember->video_flow != SWITCH_MEDIA_FLOW_SENDONLY)))) { + if (!layer && (!conference_utils_test_flag(imember->conference, CFLAG_VIDEO_REQUIRED_FOR_CANVAS) || ((switch_channel_test_flag(imember->channel, CF_VIDEO) && switch_core_session_media_flow(imember->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_SENDONLY)))) { if (conference_video_find_layer(conference, canvas, imember, &layer) == SWITCH_STATUS_SUCCESS) { imember->layer_timeout = 0; } else { @@ -2255,7 +2255,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr total += conference->members_with_avatar; } - if (imember->video_flow != SWITCH_MEDIA_FLOW_SENDONLY) { + if (switch_core_session_media_flow(imember->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_SENDONLY) { total--; } @@ -2268,7 +2268,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr } } - if (imember->video_flow != SWITCH_MEDIA_FLOW_SENDONLY) { + if (switch_core_session_media_flow(imember->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_SENDONLY) { conference_video_pop_next_image(imember, &imember->pcanvas_img); } @@ -2299,7 +2299,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr for (imember = conference->members; imember; imember = imember->next) { int i = 0; - if (!imember->session || !switch_channel_test_flag(imember->channel, CF_VIDEO || imember->video_flow == SWITCH_MEDIA_FLOW_SENDONLY) || + if (!imember->session || !switch_channel_test_flag(imember->channel, CF_VIDEO || switch_core_session_media_flow(imember->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_SENDONLY) || switch_core_session_read_lock(imember->session) != SWITCH_STATUS_SUCCESS) { continue; } @@ -2308,7 +2308,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr mcu_layer_t *layer = NULL; switch_image_t *use_img = NULL; - if (!omember->session || !switch_channel_test_flag(omember->channel, CF_VIDEO) || omember->video_flow == SWITCH_MEDIA_FLOW_SENDONLY) { + if (!omember->session || !switch_channel_test_flag(omember->channel, CF_VIDEO) || switch_core_session_media_flow(omember->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_SENDONLY) { continue; } @@ -2588,14 +2588,11 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr } if (!imember->session || !switch_channel_test_flag(imember->channel, CF_VIDEO) || + switch_core_session_media_flow(imember->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_RECVONLY || switch_core_session_read_lock(imember->session) != SWITCH_STATUS_SUCCESS) { continue; } - - if (imember->video_flow == SWITCH_MEDIA_FLOW_RECVONLY) { - continue; - } - + if (need_refresh) { switch_core_session_request_video_refresh(imember->session); } @@ -2931,7 +2928,7 @@ void *SWITCH_THREAD_FUNC conference_video_super_muxing_thread_run(switch_thread_ continue; } - if (imember->video_flow == SWITCH_MEDIA_FLOW_RECVONLY) { + if (switch_core_session_media_flow(imember->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_RECVONLY) { continue; } @@ -3024,7 +3021,7 @@ void conference_video_find_floor(conference_member_t *member, switch_bool_t ente continue; } - if (imember->video_flow == SWITCH_MEDIA_FLOW_SENDONLY && !imember->avatar_png_img) { + if (switch_core_session_media_flow(imember->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_SENDONLY && !imember->avatar_png_img) { continue; } @@ -3080,7 +3077,7 @@ void conference_video_set_floor_holder(conference_obj_t *conference, conference_ return; } - if (member && member->video_flow == SWITCH_MEDIA_FLOW_SENDONLY && !member->avatar_png_img) { + if (member && switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_SENDONLY && !member->avatar_png_img) { return; } diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index b0be87268d..70c53f4e49 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -294,7 +294,7 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob floor_holder = imember; } - if (switch_channel_ready(channel) && switch_channel_test_flag(channel, CF_VIDEO) && imember->video_flow != SWITCH_MEDIA_FLOW_SENDONLY) { + if (switch_channel_ready(channel) && switch_channel_test_flag(channel, CF_VIDEO) && switch_core_session_media_flow(imember->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_SENDONLY) { members_with_video++; } diff --git a/src/mod/applications/mod_conference/mod_conference.h b/src/mod/applications/mod_conference/mod_conference.h index b1c78a210e..d301fb5706 100644 --- a/src/mod/applications/mod_conference/mod_conference.h +++ b/src/mod/applications/mod_conference/mod_conference.h @@ -744,7 +744,6 @@ struct conference_member { char *video_logo; char *video_mute_png; char *video_reservation_id; - switch_media_flow_t video_flow; switch_frame_buffer_t *fb; switch_image_t *avatar_png_img; switch_image_t *video_mute_img; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 99b7e5eba5..838954befa 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -7510,6 +7510,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, sofia_clear_flag(tech_pvt, TFLAG_NEW_SDP); switch_channel_set_flag(tech_pvt->channel, CF_REINVITE); + if (tech_pvt->mparams.num_codecs) { match = sofia_media_negotiate_sdp(session, r_sdp, SDP_TYPE_RESPONSE); } diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 7d0d003103..1ac88550e1 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -3094,6 +3094,7 @@ static switch_bool_t verto__attach_func(const char *method, cJSON *params, jsock switch_core_media_clear_ice(tech_pvt->session); switch_channel_set_flag(tech_pvt->channel, CF_REINVITE); + switch_channel_set_flag(tech_pvt->channel, CF_RECOVERING); //switch_channel_audio_sync(tech_pvt->channel); //switch_channel_set_flag(tech_pvt->channel, CF_VIDEO_BREAK); diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 713733c0fc..74eae14a6d 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -161,6 +161,8 @@ typedef struct switch_rtp_engine_s { switch_media_flow_t rmode; switch_media_flow_t smode; switch_thread_id_t thread_id; + uint8_t new_ice; + uint8_t new_dtls; } switch_rtp_engine_t; struct switch_media_handle_s { @@ -3135,10 +3137,15 @@ static switch_status_t check_ice(switch_media_handle_t *smh, switch_media_type_t const char *val; int ice_seen = 0, cid = 0, ai = 0; - if (engine->ice_in.is_chosen[0] && engine->ice_in.is_chosen[1] && !switch_channel_test_flag(smh->session->channel, CF_REINVITE)) { + if (engine->ice_in.is_chosen[0] && engine->ice_in.is_chosen[1]) { return SWITCH_STATUS_SUCCESS; } + if (switch_channel_test_flag(smh->session->channel, CF_REINVITE) && !switch_channel_test_flag(smh->session->channel, CF_RECOVERING)) { + engine->new_ice = 0; + engine->new_dtls = 0; + } + engine->ice_in.chosen[0] = 0; engine->ice_in.chosen[1] = 0; engine->ice_in.is_chosen[0] = 0; @@ -3375,7 +3382,7 @@ static switch_status_t check_ice(switch_media_handle_t *smh, switch_media_type_t if (switch_channel_test_flag(smh->session->channel, CF_REINVITE)) { - if (switch_rtp_ready(engine->rtp_session) && engine->ice_in.cands[engine->ice_in.chosen[0]][0].ready) { + if (switch_rtp_ready(engine->rtp_session) && engine->ice_in.cands[engine->ice_in.chosen[0]][0].ready && engine->new_ice) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_INFO, "RE-Activating %s ICE\n", type2str(type)); switch_rtp_activate_ice(engine->rtp_session, @@ -3395,7 +3402,7 @@ static switch_status_t check_ice(switch_media_handle_t *smh, switch_media_type_t ); - + engine->new_ice = 0; } @@ -3575,6 +3582,15 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s switch_channel_clear_flag(smh->session->channel, CF_DTLS); } + a_engine->new_ice = 1; + a_engine->new_dtls = 1; + v_engine->new_ice = 1; + v_engine->new_dtls = 1; + + //if (switch_channel_test_flag(session->channel, CF_REINVITE)) { + // switch_core_media_clear_ice(session); + //} + switch_core_session_parse_crypto_prefs(session); clear_pmaps(a_engine); @@ -3810,7 +3826,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s a_engine->rmode = sdp_media_flow(m->m_mode); - + if (sdp_type == SDP_TYPE_REQUEST) { switch(a_engine->rmode) { case SWITCH_MEDIA_FLOW_RECVONLY: @@ -5804,7 +5820,7 @@ SWITCH_DECLARE(void) switch_core_session_wake_video_thread(switch_core_session_t static void check_dtls_reinvite(switch_core_session_t *session, switch_rtp_engine_t *engine) { - if (switch_channel_test_flag(session->channel, CF_REINVITE)) { + if (switch_channel_test_flag(session->channel, CF_REINVITE) && engine->new_dtls) { if (!zstr(engine->local_dtls_fingerprint.str) && switch_rtp_has_dtls() && dtls_ok(session)) { dtls_type_t xtype, dtype = switch_ice_direction(session) == SWITCH_CALL_DIRECTION_INBOUND ? DTLS_TYPE_CLIENT : DTLS_TYPE_SERVER; @@ -5822,6 +5838,7 @@ static void check_dtls_reinvite(switch_core_session_t *session, switch_rtp_engin } } + engine->new_dtls = 0; } } @@ -6678,7 +6695,8 @@ static const char *get_media_profile_name(switch_core_session_t *session, int se static char *get_setup(switch_core_session_t *session, switch_sdp_type_t sdp_type) { - if (sdp_type == SDP_TYPE_RESPONSE && !switch_channel_test_flag(session->channel, CF_RECOVERING)) { + if ((sdp_type == SDP_TYPE_RESPONSE || switch_channel_test_flag(session->channel, CF_REINVITE)) && + !switch_channel_test_flag(session->channel, CF_RECOVERING)) { return "active"; } @@ -10461,7 +10479,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_encoded_video_frame(sw switch_status_t status = SWITCH_STATUS_FALSE; if (switch_core_session_media_flow(session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_RECVONLY) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Writing video to RECVONLY session\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG3, "Writing video to RECVONLY session\n"); return SWITCH_STATUS_SUCCESS; } @@ -10532,7 +10550,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor } if (switch_core_session_media_flow(session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_RECVONLY) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Writing video to RECVONLY session\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG3, "Writing video to RECVONLY session\n"); return SWITCH_STATUS_SUCCESS; } diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 0b8746ec76..d82fa7219b 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -896,10 +896,10 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d end_buf = buf + ((sizeof(buf) > packet->header.length) ? packet->header.length : sizeof(buf)); switch_stun_packet_first_attribute(packet, attr); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG8, "STUN PACKET TYPE: %s\n", - switch_stun_value_to_name(SWITCH_STUN_TYPE_PACKET_TYPE, packet->header.type)); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG8, "%s STUN PACKET TYPE: %s\n", + rtp_type(rtp_session), switch_stun_value_to_name(SWITCH_STUN_TYPE_PACKET_TYPE, packet->header.type)); do { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG8, "|---: STUN ATTR %d %x %s\n", attr->type, attr->type, + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG8, "|---: %s STUN ATTR %d %x %s\n", rtp_type(rtp_session), attr->type, attr->type, switch_stun_value_to_name(SWITCH_STUN_TYPE_ATTRIBUTE, attr->type)); switch (attr->type) { @@ -913,18 +913,19 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d switch_stun_error_code_t *err = (switch_stun_error_code_t *) attr->value; uint32_t code = (err->code * 100) + err->number; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING, "%s got stun binding response %u %s\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING, "%s got %s stun binding response %u %s\n", rtp_session_name(rtp_session), + rtp_type(rtp_session), code, err->reason ); if ((ice->type & ICE_VANILLA) && code == 487) { if ((ice->type & ICE_CONTROLLED)) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING, "Changing role to CONTROLLING\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING, "%s STUN Changing role to CONTROLLING\n", rtp_type(rtp_session)); ice->type &= ~ICE_CONTROLLED; } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING, "Changing role to CONTROLLED\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING, "%s STUN Changing role to CONTROLLED\n", rtp_type(rtp_session)); ice->type |= ICE_CONTROLLED; } packet->header.type = SWITCH_STUN_BINDING_RESPONSE; @@ -1078,7 +1079,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d } switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_INFO, - "ICE Auto Changing port from %s:%u to %s:%u\n", old_host, old, host, port); + "%s ICE Auto Changing port from %s:%u to %s:%u\n", rtp_type(rtp_session), old_host, old, host, port); if (channel) {