diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index c36b341ec..28bc348b2 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -249,6 +249,12 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li md->streams[i].ice_check_list = ice_check_list_new(); ice_session_add_check_list(call->ice_session, md->streams[i].ice_check_list); } + if ((call->dir == LinphoneCallIncoming) && (sal_call_get_remote_media_description(call->op)->streams[i].ice_check_list != NULL)) { + md->streams[i].ice_check_list = sal_call_get_remote_media_description(call->op)->streams[i].ice_check_list; + } + } + if ((call->dir == LinphoneCallIncoming) && (md->streams[0].ice_check_list != NULL)) { + call->ice_session=md->streams[0].ice_check_list->session; } linphone_address_destroy(addr); @@ -391,8 +397,6 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro linphone_call_init_common(call, from, to); linphone_core_init_default_params(lc, &call->params); call->params.has_video &= !!lc->video_policy.automatically_accept; - if (sal_call_get_remote_media_description(call->op)->streams[0].ice_check_list != NULL) - call->ice_session=sal_call_get_remote_media_description(call->op)->streams[0].ice_check_list->session; call->localdesc=create_local_media_description (lc,call); call->camera_active=call->params.has_video; switch (linphone_core_get_firewall_policy(call->core)) { @@ -969,7 +973,8 @@ void linphone_call_init_media_streams(LinphoneCall *call){ } if (linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce){ rtp_session_set_pktinfo(audiostream->session,TRUE); - audiostream->ice_check_list = call->localdesc->streams[0].ice_check_list; + if (call->dir == LinphoneCallOutgoing) audiostream->ice_check_list = call->localdesc->streams[0].ice_check_list; + else audiostream->ice_check_list = sal_call_get_remote_media_description(call->op)->streams[0].ice_check_list; ice_check_list_register_success_cb(audiostream->ice_check_list, audio_stream_set_remote_from_ice, audiostream); } @@ -994,7 +999,8 @@ void linphone_call_init_media_streams(LinphoneCall *call){ } if (linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce){ rtp_session_set_pktinfo(call->videostream->session,TRUE); - call->videostream->ice_check_list = call->localdesc->streams[1].ice_check_list; + if (call->dir == LinphoneCallOutgoing) call->videostream->ice_check_list = call->localdesc->streams[1].ice_check_list; + else call->videostream->ice_check_list = sal_call_get_remote_media_description(call->op)->streams[1].ice_check_list; ice_check_list_register_success_cb(call->videostream->ice_check_list, video_stream_set_remote_from_ice, call->videostream); } call->videostream_app_evq = ortp_ev_queue_new(); diff --git a/coreapi/misc.c b/coreapi/misc.c index f7e6feb64..2ef0e04bf 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -600,14 +600,8 @@ void linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call) video_responses[0] = video_responses[1] = FALSE; audio_ice_bases[0] = audio_ice_bases[1] = NULL; video_ice_bases[0] = video_ice_bases[1] = NULL; - if (call->dir == LinphoneCallOutgoing) { - audio_check_list = call->localdesc->streams[0].ice_check_list; - video_check_list = call->localdesc->streams[1].ice_check_list; - } else { - SalMediaDescription *md = sal_call_get_remote_media_description(call->op); - audio_check_list = md->streams[0].ice_check_list; - video_check_list = md->streams[1].ice_check_list; - } + audio_check_list = call->localdesc->streams[0].ice_check_list; + video_check_list = call->localdesc->streams[1].ice_check_list; audio_socks[0] = create_socket(call->audio_port); if (audio_socks[0] == -1) return; audio_socks[1] = create_socket(call->audio_port + 1); diff --git a/coreapi/offeranswer.c b/coreapi/offeranswer.c index 5a2b4f527..7b6ce018f 100644 --- a/coreapi/offeranswer.c +++ b/coreapi/offeranswer.c @@ -223,6 +223,7 @@ static void initiate_outgoing(const SalStreamDescription *local_offer, if (!match_crypto_algo(local_offer->crypto, remote_answer->crypto, &result->crypto[0], &result->crypto_local_tag, FALSE)) result->port = 0; } + result->ice_check_list = remote_answer->ice_check_list; } @@ -249,6 +250,7 @@ static void initiate_incoming(const SalStreamDescription *local_cap, result->port = 0; } + result->ice_check_list = local_cap->ice_check_list; } /** @@ -309,6 +311,7 @@ int offer_answer_initiate_incoming(const SalMediaDescription *local_capabilities if (rs->type==SalOther){ strncpy(result->streams[i].typeother,rs->typeother,sizeof(rs->typeother)-1); } + result->streams[i].ice_check_list = remote_offer->streams[i].ice_check_list; } } result->nstreams=i;