Merge pull request #465 in FS/freeswitch from bugfix/FS-8053 to master
* commit '331cde3c92140f85265978c75b73cc9a202ad714': FS-8053: handle a=sendonly, a=sendrecv, a=recvonly to change who is sending video during a call
This commit is contained in:
commit
a12010ecd4
|
@ -401,7 +401,7 @@ switch_status_t conference_api_sub_conference_video_vmute_snap(conference_member
|
||||||
if (member == NULL)
|
if (member == NULL)
|
||||||
return SWITCH_STATUS_GENERR;
|
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;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -430,7 +430,7 @@ switch_status_t conference_api_sub_vmute(conference_member_t *member, switch_str
|
||||||
if (member == NULL)
|
if (member == NULL)
|
||||||
return SWITCH_STATUS_GENERR;
|
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;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -486,7 +486,7 @@ switch_status_t conference_api_sub_unvmute(conference_member_t *member, switch_s
|
||||||
if (member == NULL)
|
if (member == NULL)
|
||||||
return SWITCH_STATUS_GENERR;
|
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;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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)
|
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_channel_set_flag(member->channel, CF_VIDEO_REFRESH_REQ);
|
||||||
switch_core_media_gen_key_frame(member->session);
|
switch_core_media_gen_key_frame(member->session);
|
||||||
//}
|
//}
|
||||||
|
|
|
@ -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) {
|
if (switch_channel_test_flag(member->channel, CF_VIDEO) || member->avatar_png_img) {
|
||||||
video = cJSON_CreateObject();
|
video = cJSON_CreateObject();
|
||||||
cJSON_AddItemToObject(video, "avatarPresented", cJSON_CreateBool(!!member->avatar_png_img));
|
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, "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));
|
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)) {
|
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);
|
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);
|
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);
|
conference_send_presence(conference);
|
||||||
|
|
||||||
channel = switch_core_session_get_channel(member->session);
|
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);
|
conference_video_check_avatar(member, SWITCH_FALSE);
|
||||||
|
|
||||||
|
|
|
@ -888,7 +888,7 @@ switch_status_t conference_video_attach_video_layer(conference_member_t *member,
|
||||||
return SWITCH_STATUS_FALSE;
|
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;
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1264,7 +1264,7 @@ void conference_video_write_canvas_image_to_codec_group(conference_obj_t *confer
|
||||||
continue;
|
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;
|
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];
|
canvas = member->conference->canvases[member->canvas_id];
|
||||||
|
|
||||||
if (conference_utils_test_flag(member->conference, CFLAG_VIDEO_REQUIRED_FOR_CANVAS) &&
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1581,7 +1581,7 @@ void conference_video_check_avatar(conference_member_t *member, switch_bool_t fo
|
||||||
|
|
||||||
member->avatar_patched = 0;
|
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);
|
conference_utils_member_set_flag_locked(member, MFLAG_ACK_VIDEO);
|
||||||
} else {
|
} else {
|
||||||
if (member->conference->no_video_avatar) {
|
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 &&
|
if (!layer &&
|
||||||
(canvas->layers_used < canvas->total_layers ||
|
(canvas->layers_used < canvas->total_layers ||
|
||||||
(avatar_layers && !member->avatar_png_img) || conference_utils_member_test_flag(member, MFLAG_MOD)) &&
|
(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 */
|
/* find an empty layer */
|
||||||
for (i = 0; i < canvas->total_layers; i++) {
|
for (i = 0; i < canvas->total_layers; i++) {
|
||||||
mcu_layer_t *xlayer = &canvas->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);
|
size = switch_queue_size(member->video_queue);
|
||||||
} while(size > 1);
|
} 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) {
|
if (img) {
|
||||||
member->good_img++;
|
member->good_img++;
|
||||||
if ((member->good_img % (int)(member->conference->video_fps.fps * 10)) == 0) {
|
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);
|
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) {
|
if (conference_video_find_layer(conference, canvas, imember, &layer) == SWITCH_STATUS_SUCCESS) {
|
||||||
imember->layer_timeout = 0;
|
imember->layer_timeout = 0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -2255,7 +2255,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
|
||||||
total += conference->members_with_avatar;
|
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--;
|
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);
|
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) {
|
for (imember = conference->members; imember; imember = imember->next) {
|
||||||
int i = 0;
|
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) {
|
switch_core_session_read_lock(imember->session) != SWITCH_STATUS_SUCCESS) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -2308,7 +2308,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
|
||||||
mcu_layer_t *layer = NULL;
|
mcu_layer_t *layer = NULL;
|
||||||
switch_image_t *use_img = 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;
|
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) ||
|
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) {
|
switch_core_session_read_lock(imember->session) != SWITCH_STATUS_SUCCESS) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (imember->video_flow == SWITCH_MEDIA_FLOW_RECVONLY) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (need_refresh) {
|
if (need_refresh) {
|
||||||
switch_core_session_request_video_refresh(imember->session);
|
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;
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3024,7 +3021,7 @@ void conference_video_find_floor(conference_member_t *member, switch_bool_t ente
|
||||||
continue;
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3080,7 +3077,7 @@ void conference_video_set_floor_holder(conference_obj_t *conference, conference_
|
||||||
return;
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -294,7 +294,7 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
|
||||||
floor_holder = imember;
|
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++;
|
members_with_video++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -744,7 +744,6 @@ struct conference_member {
|
||||||
char *video_logo;
|
char *video_logo;
|
||||||
char *video_mute_png;
|
char *video_mute_png;
|
||||||
char *video_reservation_id;
|
char *video_reservation_id;
|
||||||
switch_media_flow_t video_flow;
|
|
||||||
switch_frame_buffer_t *fb;
|
switch_frame_buffer_t *fb;
|
||||||
switch_image_t *avatar_png_img;
|
switch_image_t *avatar_png_img;
|
||||||
switch_image_t *video_mute_img;
|
switch_image_t *video_mute_img;
|
||||||
|
|
|
@ -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);
|
sofia_clear_flag(tech_pvt, TFLAG_NEW_SDP);
|
||||||
switch_channel_set_flag(tech_pvt->channel, CF_REINVITE);
|
switch_channel_set_flag(tech_pvt->channel, CF_REINVITE);
|
||||||
|
|
||||||
|
|
||||||
if (tech_pvt->mparams.num_codecs) {
|
if (tech_pvt->mparams.num_codecs) {
|
||||||
match = sofia_media_negotiate_sdp(session, r_sdp, SDP_TYPE_RESPONSE);
|
match = sofia_media_negotiate_sdp(session, r_sdp, SDP_TYPE_RESPONSE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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_core_media_clear_ice(tech_pvt->session);
|
||||||
switch_channel_set_flag(tech_pvt->channel, CF_REINVITE);
|
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_audio_sync(tech_pvt->channel);
|
||||||
//switch_channel_set_flag(tech_pvt->channel, CF_VIDEO_BREAK);
|
//switch_channel_set_flag(tech_pvt->channel, CF_VIDEO_BREAK);
|
||||||
|
|
|
@ -161,6 +161,8 @@ typedef struct switch_rtp_engine_s {
|
||||||
switch_media_flow_t rmode;
|
switch_media_flow_t rmode;
|
||||||
switch_media_flow_t smode;
|
switch_media_flow_t smode;
|
||||||
switch_thread_id_t thread_id;
|
switch_thread_id_t thread_id;
|
||||||
|
uint8_t new_ice;
|
||||||
|
uint8_t new_dtls;
|
||||||
} switch_rtp_engine_t;
|
} switch_rtp_engine_t;
|
||||||
|
|
||||||
struct switch_media_handle_s {
|
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;
|
const char *val;
|
||||||
int ice_seen = 0, cid = 0, ai = 0;
|
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;
|
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[0] = 0;
|
||||||
engine->ice_in.chosen[1] = 0;
|
engine->ice_in.chosen[1] = 0;
|
||||||
engine->ice_in.is_chosen[0] = 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_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_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,
|
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);
|
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);
|
switch_core_session_parse_crypto_prefs(session);
|
||||||
|
|
||||||
clear_pmaps(a_engine);
|
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);
|
a_engine->rmode = sdp_media_flow(m->m_mode);
|
||||||
|
|
||||||
if (sdp_type == SDP_TYPE_REQUEST) {
|
if (sdp_type == SDP_TYPE_REQUEST) {
|
||||||
switch(a_engine->rmode) {
|
switch(a_engine->rmode) {
|
||||||
case SWITCH_MEDIA_FLOW_RECVONLY:
|
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)
|
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)) {
|
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;
|
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)
|
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";
|
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;
|
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||||
|
|
||||||
if (switch_core_session_media_flow(session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_RECVONLY) {
|
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;
|
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) {
|
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;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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));
|
end_buf = buf + ((sizeof(buf) > packet->header.length) ? packet->header.length : sizeof(buf));
|
||||||
|
|
||||||
switch_stun_packet_first_attribute(packet, attr);
|
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_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG8, "%s STUN PACKET TYPE: %s\n",
|
||||||
switch_stun_value_to_name(SWITCH_STUN_TYPE_PACKET_TYPE, packet->header.type));
|
rtp_type(rtp_session), switch_stun_value_to_name(SWITCH_STUN_TYPE_PACKET_TYPE, packet->header.type));
|
||||||
do {
|
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_stun_value_to_name(SWITCH_STUN_TYPE_ATTRIBUTE, attr->type));
|
||||||
|
|
||||||
switch (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;
|
switch_stun_error_code_t *err = (switch_stun_error_code_t *) attr->value;
|
||||||
uint32_t code = (err->code * 100) + err->number;
|
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_session_name(rtp_session),
|
||||||
|
rtp_type(rtp_session),
|
||||||
code,
|
code,
|
||||||
err->reason
|
err->reason
|
||||||
);
|
);
|
||||||
|
|
||||||
if ((ice->type & ICE_VANILLA) && code == 487) {
|
if ((ice->type & ICE_VANILLA) && code == 487) {
|
||||||
if ((ice->type & ICE_CONTROLLED)) {
|
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;
|
ice->type &= ~ICE_CONTROLLED;
|
||||||
} else {
|
} 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;
|
ice->type |= ICE_CONTROLLED;
|
||||||
}
|
}
|
||||||
packet->header.type = SWITCH_STUN_BINDING_RESPONSE;
|
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,
|
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) {
|
if (channel) {
|
||||||
|
|
Loading…
Reference in New Issue