From cec1d35fed0b43835433d0377e79da0cc40e688a Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 26 Jul 2012 11:28:26 +0200 Subject: [PATCH] Handle the case where ICE is activated locally but the remote does not support it. --- coreapi/linphonecall.c | 10 +++++++--- coreapi/sal_eXosip2_sdp.c | 5 +++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 2a25b3cc1..7c9ef7bf6 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -396,13 +396,17 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro call->localdesc=create_local_media_description (lc,call); call->camera_active=call->params.has_video; switch (linphone_core_get_firewall_policy(call->core)) { - case LinphonePolicyUseStun: - linphone_core_run_stun_tests(call->core,call); - break; case LinphonePolicyUseIce: linphone_core_gather_ice_candidates(call->core, call); break; + case LinphonePolicyUseStun: + linphone_core_run_stun_tests(call->core,call); + /* No break to also destroy ice session in this case. */ default: + if (sal_op_get_ice_session(call->op) != NULL) { + ice_session_destroy(sal_op_get_ice_session(call->op)); + sal_op_set_ice_session(call->op, NULL); + } break; } discover_mtu(lc,linphone_address_get_domain(from)); diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c index fee5a5313..8038d1f4e 100644 --- a/coreapi/sal_eXosip2_sdp.c +++ b/coreapi/sal_eXosip2_sdp.c @@ -689,6 +689,11 @@ int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc, IceS ice_session_set_remote_credentials(*ice_session, ice_ufrag, ice_pwd); ice_dump_session(*ice_session); } + if ((ice_session_just_created == FALSE) && ((ice_ufrag == NULL) || (ice_pwd == NULL))) { + /* We started with ICE activated but the peer apparently do not support ICE, so stop using it. */ + ice_session_destroy(*ice_session); + *ice_session = NULL; + } } return 0; }