From a6aa0a50a5266911780ad5cbd995d057673ac452 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 16 May 2014 22:29:46 +0200 Subject: [PATCH] fix ICE call without SDP test --- coreapi/linphonecall.c | 17 ++++++++++++----- mediastreamer2 | 2 +- tester/call_tester.c | 12 +++++++++++- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index a424e4e4c..27ce04a3a 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -583,6 +583,7 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro LinphoneCall *call=ms_new0(LinphoneCall,1); char *from_str; const SalMediaDescription *md; + LinphoneFirewallPolicy fpol; call->dir=LinphoneCallIncoming; sal_op_set_user_pointer(op,call); @@ -628,16 +629,22 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro // In this case WE chose the media parameters according to policy. call->params.has_video &= linphone_core_media_description_contains_video_stream(md); } + fpol=linphone_core_get_firewall_policy(call->core); /*create the ice session now if ICE is required*/ - if (linphone_core_get_firewall_policy(call->core)==LinphonePolicyUseIce){ - call->ice_session = ice_session_new(); - ice_session_set_role(call->ice_session, IR_Controlled); + if (fpol==LinphonePolicyUseIce){ + if (md){ + call->ice_session = ice_session_new(); + ice_session_set_role(call->ice_session, IR_Controlled); + }else{ + fpol=LinphonePolicyNoFirewall; + ms_warning("ICE not supported for incoming INVITE without SDP."); + } } /*reserve the sockets immediately*/ linphone_call_init_media_streams(call); - switch (linphone_core_get_firewall_policy(call->core)) { + switch (fpol) { case LinphonePolicyUseIce: - linphone_call_prepare_ice(call,md!=NULL); + linphone_call_prepare_ice(call,TRUE); break; case LinphonePolicyUseStun: call->ping_time=linphone_core_run_stun_tests(call->core,call); diff --git a/mediastreamer2 b/mediastreamer2 index 79c18b751..ae94af9ab 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 79c18b75112262460fff45493e70733a2c35333c +Subproject commit ae94af9abbfb56bedcd37485bc38934ebbbc9c87 diff --git a/tester/call_tester.c b/tester/call_tester.c index bbbc05f23..d20cf1fd6 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -633,12 +633,22 @@ static void call_with_ice(void){ _call_with_ice(TRUE,TRUE,FALSE); } +/*ICE is not expected to work in this case, however this should not crash*/ static void call_with_ice_no_sdp(void){ LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc"); linphone_core_enable_sdp_200_ack(pauline->lc,TRUE); - _call_with_ice_base(pauline,marie,TRUE,TRUE,FALSE); + + linphone_core_set_firewall_policy(marie->lc,LinphonePolicyUseIce); + linphone_core_set_stun_server(marie->lc,"stun.linphone.org"); + + linphone_core_set_firewall_policy(pauline->lc,LinphonePolicyUseIce); + linphone_core_set_stun_server(pauline->lc,"stun.linphone.org"); + + call(pauline,marie); + + liblinphone_tester_check_rtcp(marie,pauline); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline);