diff --git a/tester/call_tester.c b/tester/call_tester.c index becd29549..e2fee2bb0 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -1043,11 +1043,9 @@ static bool_t check_ice(LinphoneCoreManager* caller, LinphoneCoreManager* callee static void _call_with_ice_base(LinphoneCoreManager* pauline,LinphoneCoreManager* marie, bool_t caller_with_ice, bool_t callee_with_ice, bool_t random_ports) { if (callee_with_ice){ linphone_core_set_firewall_policy(marie->lc,LinphonePolicyUseIce); - linphone_core_set_stun_server(marie->lc,"stun.linphone.org"); } if (caller_with_ice){ linphone_core_set_firewall_policy(pauline->lc,LinphonePolicyUseIce); - linphone_core_set_stun_server(pauline->lc,"stun.linphone.org"); } if (random_ports){ @@ -1093,10 +1091,8 @@ static void call_with_ice_no_sdp(void){ linphone_core_enable_sdp_200_ack(pauline->lc,TRUE); 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); @@ -1390,10 +1386,8 @@ static void audio_call_with_ice_no_matching_audio_codecs(void) { linphone_core_enable_payload_type(marie->lc, linphone_core_find_payload_type(marie->lc, "PCMU", 8000, 1), FALSE); /* Disable PCMU */ linphone_core_enable_payload_type(marie->lc, linphone_core_find_payload_type(marie->lc, "PCMA", 8000, 1), TRUE); /* Enable PCMA */ 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"); - + out_call = linphone_core_invite_address(marie->lc, pauline->identity); linphone_call_ref(out_call); CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallOutgoingInit, 1)); @@ -1417,7 +1411,7 @@ static LinphoneCall* setup_video(LinphoneCoreManager* caller,LinphoneCoreManager if (!linphone_core_get_current_call(callee->lc) || linphone_call_get_state(linphone_core_get_current_call(callee->lc)) != LinphoneCallStreamsRunning || !linphone_core_get_current_call(caller->lc) || linphone_call_get_state(linphone_core_get_current_call(caller->lc)) != LinphoneCallStreamsRunning ) { ms_warning("bad state for adding video"); - return FALSE; + return NULL; } caller_policy.automatically_accept=TRUE; @@ -1437,7 +1431,7 @@ static LinphoneCall* setup_video(LinphoneCoreManager* caller,LinphoneCoreManager return call_obj; } -static bool_t add_video(LinphoneCoreManager* caller,LinphoneCoreManager* callee) { +bool_t add_video(LinphoneCoreManager* caller,LinphoneCoreManager* callee) { stats initial_caller_stat=caller->stat; stats initial_callee_stat=callee->stat; LinphoneCall *call_obj; @@ -1856,12 +1850,8 @@ static void call_with_ice_video_added(void) { linphone_core_set_video_policy(marie->lc,&vpol); 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"); - if (1){ linphone_core_set_audio_port(marie->lc,-1); @@ -2343,10 +2333,7 @@ void call_base_with_configfile(LinphoneMediaEncryption mode, bool_t enable_video } linphone_core_set_firewall_policy(marie->lc,policy); - linphone_core_set_stun_server(marie->lc,"stun.linphone.org"); linphone_core_set_firewall_policy(pauline->lc,policy); - linphone_core_set_stun_server(pauline->lc,"stun.linphone.org"); - CU_ASSERT_TRUE(call(pauline,marie)); if (linphone_core_get_media_encryption(pauline->lc) == LinphoneMediaEncryptionZRTP @@ -3041,7 +3028,6 @@ static void accept_call_in_send_base(bool_t caller_has_ice) { pauline = linphone_core_manager_new("pauline_rc"); if (caller_has_ice) { - linphone_core_set_stun_server(pauline->lc,"stun.linphone.org"); linphone_core_set_firewall_policy(pauline->lc,LinphonePolicyUseIce); } marie = linphone_core_manager_new("marie_rc"); @@ -3567,7 +3553,6 @@ static void early_media_without_sdp_in_200_base( bool_t use_video, bool_t use_ic lcs = ms_list_append(lcs,pauline->lc); if (use_ice){ linphone_core_set_firewall_policy(marie->lc, LinphonePolicyUseIce); - linphone_core_set_stun_server(marie->lc, "stun.linphone.org"); } /* Marie calls Pauline, and after the call has rung, transitions to an early_media session diff --git a/tester/liblinphone_tester.h b/tester/liblinphone_tester.h index 72e6abd99..a8c00f987 100644 --- a/tester/liblinphone_tester.h +++ b/tester/liblinphone_tester.h @@ -283,6 +283,7 @@ bool_t call_with_test_params(LinphoneCoreManager* caller_mgr ,const LinphoneCallTestParams *callee_test_params); bool_t call(LinphoneCoreManager* caller_mgr,LinphoneCoreManager* callee_mgr); +bool_t add_video(LinphoneCoreManager* caller,LinphoneCoreManager* callee); void end_call(LinphoneCoreManager *m1, LinphoneCoreManager *m2); void disable_all_audio_codecs_except_one(LinphoneCore *lc, const char *mime, int rate); void disable_all_video_codecs_except_one(LinphoneCore *lc, const char *mime); diff --git a/tester/rcfiles/laure_rc b/tester/rcfiles/laure_rc index 2b6ce617a..283f917f7 100644 --- a/tester/rcfiles/laure_rc +++ b/tester/rcfiles/laure_rc @@ -42,3 +42,5 @@ echocancellation=0 #to not overload cpu in case of VG [net] dns_srv_enabled=0 #no srv needed in general +stun_server=stun.linphone.org + diff --git a/tester/rcfiles/marie_early_rc b/tester/rcfiles/marie_early_rc index f1866026b..efa5408bb 100644 --- a/tester/rcfiles/marie_early_rc +++ b/tester/rcfiles/marie_early_rc @@ -42,4 +42,8 @@ enabled=0 self_view=0 automatically_initiate=0 automatically_accept=0 -device=StaticImage: Static picture \ No newline at end of file +device=StaticImage: Static picture + +[net] +stun_server=stun.linphone.org + diff --git a/tester/rcfiles/marie_rc b/tester/rcfiles/marie_rc index 5dec5f724..fe9687c36 100644 --- a/tester/rcfiles/marie_rc +++ b/tester/rcfiles/marie_rc @@ -51,3 +51,5 @@ echocancellation=0 #to not overload cpu in case of VG [net] dns_srv_enabled=0 #no srv needed in general +stun_server=stun.linphone.org + diff --git a/tester/rcfiles/marie_sips_rc b/tester/rcfiles/marie_sips_rc index 7a935d4cb..f67cca50d 100644 --- a/tester/rcfiles/marie_sips_rc +++ b/tester/rcfiles/marie_sips_rc @@ -51,3 +51,4 @@ echocancellation=0 #to not overload cpu in case of VG [net] dns_srv_enabled=0 #no srv needed in general +stun_server=stun.linphone.org diff --git a/tester/rcfiles/pauline_rc b/tester/rcfiles/pauline_rc index f8cffd4b3..50920606b 100644 --- a/tester/rcfiles/pauline_rc +++ b/tester/rcfiles/pauline_rc @@ -47,4 +47,5 @@ device=StaticImage: Static picture echocancellation=0 #to not overload cpu in case of VG [net] -dns_srv_enabled=0 #no srv needed in general \ No newline at end of file +dns_srv_enabled=0 #no srv needed in general +stun_server=stun.linphone.org diff --git a/tester/rcfiles/pauline_tcp_rc b/tester/rcfiles/pauline_tcp_rc index 73fd469d7..1b2a85e80 100644 --- a/tester/rcfiles/pauline_tcp_rc +++ b/tester/rcfiles/pauline_tcp_rc @@ -45,3 +45,7 @@ device=StaticImage: Static picture [sound] echocancellation=0 #to not overload cpu in case of VG + +[net] +stun_server=stun.linphone.org + diff --git a/tester/transport_tester.c b/tester/transport_tester.c index e847e0fe8..f08e4f569 100644 --- a/tester/transport_tester.c +++ b/tester/transport_tester.c @@ -61,11 +61,11 @@ static char* get_public_contact_ip(LinphoneCore* lc) { } -static void call_with_transport_base(LinphoneTunnelMode tunnel_mode, bool_t with_sip, LinphoneMediaEncryption encryption) { +static void call_with_transport_base(LinphoneTunnelMode tunnel_mode, bool_t with_sip, LinphoneMediaEncryption encryption, bool_t with_video_and_ice) { if (linphone_core_tunnel_available()){ LinphoneCoreManager *pauline = linphone_core_manager_new( "pauline_rc"); LinphoneCoreManager *marie = linphone_core_manager_new( "marie_rc"); - LinphoneCall *pauline_call; + LinphoneCall *pauline_call, *marie_call; LinphoneProxyConfig *proxy = linphone_core_get_default_proxy_config(pauline->lc); LinphoneAddress *server_addr = linphone_address_new(linphone_proxy_config_get_server_addr(proxy)); LinphoneAddress *route = linphone_address_new(linphone_proxy_config_get_route(proxy)); @@ -77,6 +77,26 @@ static void call_with_transport_base(LinphoneTunnelMode tunnel_mode, bool_t with CU_ASSERT_STRING_NOT_EQUAL(public_ip, tunnel_ip); linphone_core_set_media_encryption(pauline->lc, encryption); + + if (with_video_and_ice){ + /*we want to test that tunnel is able to work with long SIP message, above mtu. + * Enable ICE and many codec to make the SIP message bigger*/ + linphone_core_set_firewall_policy(marie->lc, LinphonePolicyUseIce); + linphone_core_set_firewall_policy(pauline->lc, LinphonePolicyUseIce); + linphone_core_enable_payload_type(pauline->lc, + linphone_core_find_payload_type(pauline->lc, "speex", 32000, 1), TRUE); + linphone_core_enable_payload_type(pauline->lc, + linphone_core_find_payload_type(pauline->lc, "speex", 16000, 1), TRUE); + linphone_core_enable_payload_type(pauline->lc, + linphone_core_find_payload_type(pauline->lc, "G722", 8000, 1), TRUE); + linphone_core_enable_payload_type(marie->lc, + linphone_core_find_payload_type(marie->lc, "speex", 32000, 1), TRUE); + linphone_core_enable_payload_type(marie->lc, + linphone_core_find_payload_type(marie->lc, "speex", 16000, 1), TRUE); + linphone_core_enable_payload_type(marie->lc, + linphone_core_find_payload_type(marie->lc, "G722", 8000, 1), TRUE); + + } if (tunnel_mode != LinphoneTunnelModeDisable){ LinphoneTunnel *tunnel = linphone_core_get_tunnel(pauline->lc); @@ -97,7 +117,7 @@ static void call_with_transport_base(LinphoneTunnelMode tunnel_mode, bool_t with * full testing of the automatic mode. */ - if(tunnel_mode == LinphoneTunnelModeEnable && with_sip) { + if (tunnel_mode == LinphoneTunnelModeEnable && with_sip) { CU_ASSERT_TRUE(wait_for(pauline->lc,NULL,&pauline->stat.number_of_LinphoneRegistrationOk,2)); /* Ensure that we did use the tunnel. If so, we should see contact changed from: Contact: ;.[...] @@ -120,6 +140,26 @@ static void call_with_transport_base(LinphoneTunnelMode tunnel_mode, bool_t with CU_ASSERT_EQUAL(linphone_call_params_get_media_encryption(linphone_call_get_current_params(pauline_call)), encryption); } + if (tunnel_mode == LinphoneTunnelModeEnable && with_sip){ + /* make sure the call from pauline arrived from the tunnel by checking the contact address*/ + marie_call = linphone_core_get_current_call(marie->lc); + CU_ASSERT_PTR_NOT_NULL(marie_call); + if (marie_call){ + const char *remote_contact = linphone_call_get_remote_contact(marie_call); + CU_ASSERT_PTR_NOT_NULL(remote_contact); + if (remote_contact){ + LinphoneAddress *tmp = linphone_address_new(remote_contact); + CU_ASSERT_PTR_NOT_NULL(tmp); + if (tmp){ + CU_ASSERT_STRING_EQUAL(linphone_address_get_domain(tmp), tunnel_ip); + linphone_address_destroy(tmp); + } + } + } + } + if (with_video_and_ice){ + CU_ASSERT_TRUE(add_video(pauline, marie)); + } end_call(pauline,marie); ms_free(public_ip); @@ -135,26 +175,34 @@ static void call_with_transport_base(LinphoneTunnelMode tunnel_mode, bool_t with static void call_with_tunnel(void) { - call_with_transport_base(LinphoneTunnelModeEnable, TRUE, LinphoneMediaEncryptionNone); + call_with_transport_base(LinphoneTunnelModeEnable, TRUE, LinphoneMediaEncryptionNone, FALSE); } static void call_with_tunnel_srtp(void) { - call_with_transport_base(LinphoneTunnelModeEnable, TRUE, LinphoneMediaEncryptionSRTP); + call_with_transport_base(LinphoneTunnelModeEnable, TRUE, LinphoneMediaEncryptionSRTP, FALSE); } static void call_with_tunnel_without_sip(void) { - call_with_transport_base(LinphoneTunnelModeEnable, FALSE, LinphoneMediaEncryptionNone); + call_with_transport_base(LinphoneTunnelModeEnable, FALSE, LinphoneMediaEncryptionNone, FALSE); } static void call_with_tunnel_auto(void) { - call_with_transport_base(LinphoneTunnelModeAuto, TRUE, LinphoneMediaEncryptionNone); + call_with_transport_base(LinphoneTunnelModeAuto, TRUE, LinphoneMediaEncryptionNone, FALSE); } static void call_with_tunnel_auto_without_sip_with_srtp(void) { - call_with_transport_base(LinphoneTunnelModeAuto, FALSE, LinphoneMediaEncryptionSRTP); + call_with_transport_base(LinphoneTunnelModeAuto, FALSE, LinphoneMediaEncryptionSRTP, FALSE); } #ifdef VIDEO_ENABLED + +static void full_tunnel_video_ice_call(void){ + if (linphone_core_tunnel_available()){ + call_with_transport_base(LinphoneTunnelModeEnable, TRUE, LinphoneMediaEncryptionNone, TRUE); + }else + ms_warning("Could not test %s because tunnel functionality is not available",__FUNCTION__); +} + static void tunnel_srtp_video_ice_call(void) { if (linphone_core_tunnel_available()) call_base(LinphoneMediaEncryptionSRTP,TRUE,FALSE,LinphonePolicyUseIce,TRUE); @@ -214,6 +262,7 @@ test_t transport_tests[] = { { "Tunnel ZRTP ice call", tunnel_zrtp_ice_call }, #ifdef VIDEO_ENABLED { "Tunnel ice video call", tunnel_video_ice_call }, + { "Tunnel with SIP - ice video call", full_tunnel_video_ice_call }, { "Tunnel SRTP ice video call", tunnel_srtp_video_ice_call }, { "Tunnel DTLS ice video call", tunnel_dtls_video_ice_call }, { "Tunnel ZRTP ice video call", tunnel_zrtp_video_ice_call },