diff --git a/tester/complex_sip_call_tester.c b/tester/complex_sip_call_tester.c index 228f44350..3f8906de0 100644 --- a/tester/complex_sip_call_tester.c +++ b/tester/complex_sip_call_tester.c @@ -44,7 +44,7 @@ void check_rtcp(LinphoneCall *call) { linphone_call_unref(call); } -FILE *sip_start(const char *senario, const char* dest_username, LinphoneAddress* dest_addres) { +FILE *sip_start(const char *senario, const char* dest_username, const char *passwd, LinphoneAddress* dest_addres) { #if HAVE_SIPP char *dest; char *command; @@ -55,7 +55,10 @@ FILE *sip_start(const char *senario, const char* dest_username, LinphoneAddress* else dest = ms_strdup_printf("%s",linphone_address_get_domain(dest_addres)); //until errors logs are handled correctly and stop breaks output, they will be DISABLED - command = ms_strdup_printf(SIPP_COMMAND" -sf %s -s %s %s -trace_err -trace_msg -rtp_echo -m 1 -d 1000 2>/dev/null",senario,dest_username,dest); + command = ms_strdup_printf(SIPP_COMMAND" -sf %s -s %s %s -trace_err -trace_msg -rtp_echo -m 1 -d 1000 -ap %s 2>/dev/null",senario + ,dest_username + ,dest + ,(passwd?passwd:"none")); ms_message("Starting sipp command [%s]",command); file = popen(command, "r"); @@ -85,18 +88,37 @@ static FILE *sip_start_recv(const char *senario) { #endif } - -/*static void dest_server_server_resolved(void *data, const char *name, struct addrinfo *ai_list) { +static void dest_server_server_resolved(void *data, const char *name, struct addrinfo *ai_list) { *(struct addrinfo **)data =ai_list; -}*/ -static void sip_update_within_icoming_reinvite_with_no_sdp(void) { - LinphoneCoreManager *mgr; -/* LinphoneProxyConfig *proxy = linphone_core_get_default_proxy_config(mgr->lc); - LinphoneAddress *dest = linphone_address_new(linphone_proxy_config_get_route(proxy) ?linphone_proxy_config_get_route(proxy):linphone_proxy_config_get_server_addr(proxy)); + } +LinphoneAddress * linphone_core_manager_resolve(LinphoneCoreManager *mgr, const LinphoneAddress *source) { struct addrinfo *addrinfo = NULL; char ipstring [INET6_ADDRSTRLEN]; int err; - int port = linphone_address_get_port(dest);*/ + int port = linphone_address_get_port(source); + LinphoneAddress * dest; + + sal_resolve_a( mgr->lc->sal + ,linphone_address_get_domain(source) + ,linphone_address_get_port(source) + ,AF_INET + ,(SalResolverCallback)dest_server_server_resolved + ,&addrinfo); + + dest=linphone_address_new(NULL); + + wait_for(mgr->lc, mgr->lc, (int*)&addrinfo, 1); + err=getnameinfo((struct sockaddr*)addrinfo->ai_addr,addrinfo->ai_addrlen,ipstring,INET6_ADDRSTRLEN,NULL,0,NI_NUMERICHOST); + linphone_address_set_domain(dest, ipstring); + if (port > 0) + linphone_address_set_port(dest, port); + + return dest; +} + + +static void sip_update_within_icoming_reinvite_with_no_sdp(void) { + LinphoneCoreManager *mgr; char *identity_char; char *scen; FILE * sipp_out; @@ -108,25 +130,8 @@ static void sip_update_within_icoming_reinvite_with_no_sdp(void) { identity_char=linphone_address_as_string(mgr->identity); linphone_core_set_primary_contact(mgr->lc,identity_char); linphone_core_iterate(mgr->lc); - /* - sal_resolve_a( mgr->lc->sal - ,linphone_address_get_domain(dest) - ,linphone_address_get_port(dest) - ,AF_INET - ,(SalResolverCallback)dest_server_server_resolved - ,&addrinfo); - linphone_address_destroy(dest); - dest=linphone_address_new(NULL); - - wait_for(mgr->lc, mgr->lc, (int*)&addrinfo, 1); - err=getnameinfo((struct sockaddr - *)addrinfo->ai_addr,addrinfo->ai_addrlen,ipstring,INET6_ADDRSTRLEN,NULL,0,NI_NUMERICHOST); - linphone_address_set_domain(dest, ipstring); - if (port > 0) - linphone_address_set_port(dest, port); - */ scen = bc_tester_res("sipp/sip_update_within_icoming_reinvite_with_no_sdp.xml"); - sipp_out = sip_start(scen, linphone_address_get_username(mgr->identity), mgr->identity); + sipp_out = sip_start(scen, linphone_address_get_username(mgr->identity),NULL, mgr->identity); if (sipp_out) { BC_ASSERT_TRUE(wait_for(mgr->lc, mgr->lc, &mgr->stat.number_of_LinphoneCallIncomingReceived, 1)); @@ -156,7 +161,7 @@ static void call_with_audio_mline_before_video_in_sdp(void) { scen = bc_tester_res("sipp/call_with_audio_mline_before_video_in_sdp.xml"); - sipp_out = sip_start(scen, linphone_address_get_username(mgr->identity), mgr->identity); + sipp_out = sip_start(scen, linphone_address_get_username(mgr->identity), NULL, mgr->identity); if (sipp_out) { BC_ASSERT_TRUE(wait_for(mgr->lc, mgr->lc, &mgr->stat.number_of_LinphoneCallIncomingReceived, 1)); @@ -197,7 +202,7 @@ static void call_with_video_mline_before_audio_in_sdp(void) { scen = bc_tester_res("sipp/call_with_video_mline_before_audio_in_sdp.xml"); - sipp_out = sip_start(scen, linphone_address_get_username(mgr->identity), mgr->identity); + sipp_out = sip_start(scen, linphone_address_get_username(mgr->identity), NULL, mgr->identity); if (sipp_out) { BC_ASSERT_TRUE(wait_for(mgr->lc, mgr->lc, &mgr->stat.number_of_LinphoneCallIncomingReceived, 1)); @@ -238,7 +243,7 @@ static void call_with_multiple_audio_mline_in_sdp(void) { scen = bc_tester_res("sipp/call_with_multiple_audio_mline_in_sdp.xml"); - sipp_out = sip_start(scen, linphone_address_get_username(mgr->identity), mgr->identity); + sipp_out = sip_start(scen, linphone_address_get_username(mgr->identity), NULL, mgr->identity); if (sipp_out) { BC_ASSERT_TRUE(wait_for(mgr->lc, mgr->lc, &mgr->stat.number_of_LinphoneCallIncomingReceived, 1)); @@ -279,7 +284,7 @@ static void call_with_multiple_video_mline_in_sdp(void) { scen = bc_tester_res("sipp/call_with_multiple_video_mline_in_sdp.xml"); - sipp_out = sip_start(scen, linphone_address_get_username(mgr->identity), mgr->identity); + sipp_out = sip_start(scen, linphone_address_get_username(mgr->identity), NULL, mgr->identity); if (sipp_out) { BC_ASSERT_TRUE(wait_for(mgr->lc, mgr->lc, &mgr->stat.number_of_LinphoneCallIncomingReceived, 1)); diff --git a/tester/flexisip_tester.c b/tester/flexisip_tester.c index 8411434fc..503b586b3 100644 --- a/tester/flexisip_tester.c +++ b/tester/flexisip_tester.c @@ -540,12 +540,16 @@ static void early_media_call_forking(void) { linphone_core_set_user_agent(marie2->lc,"Natted Linphone",NULL); linphone_core_set_user_agent(pauline->lc,"Natted Linphone",NULL); - linphone_core_enable_video(pauline->lc,TRUE,TRUE); - - linphone_core_enable_video(marie->lc,TRUE,TRUE); + linphone_core_enable_video_capture(pauline->lc,TRUE); + linphone_core_enable_video_display(pauline->lc,TRUE); + + linphone_core_enable_video_capture(marie->lc,TRUE); + linphone_core_enable_video_display(marie->lc,TRUE); linphone_core_set_video_policy(marie->lc,&pol); - linphone_core_enable_video(marie2->lc,TRUE,TRUE); + linphone_core_enable_video_capture(marie2->lc,TRUE); + linphone_core_enable_video_display(marie2->lc,TRUE); + linphone_core_set_video_policy(marie2->lc,&pol); linphone_core_set_audio_port_range(marie2->lc,40200,40300); linphone_core_set_video_port_range(marie2->lc,40400,40500); @@ -911,16 +915,20 @@ static void dos_module_trigger(void) { linphone_core_manager_destroy(pauline); } -#define USE_PRESENCE_SERVER 0 + static void test_subscribe_notify_with_sipp_publisher(void) { -#if USE_PRESENCE_SERVER char *scen; FILE * sipp_out; LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc"); /*just to get an identity*/ LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); - + LinphoneAddress *sip_example_org; + const LinphoneAuthInfo *marie_auth = linphone_core_find_auth_info(marie->lc, NULL, linphone_address_get_username(marie->identity), NULL); LpConfig *pauline_lp = linphone_core_get_config(pauline->lc); + + linphone_core_set_user_agent(marie->lc, "full-presence-support", NULL); + linphone_core_set_user_agent(pauline->lc, "full-presence-support", NULL); + char* lf_identity=linphone_address_as_string_uri_only(marie->identity); LinphoneFriend *lf = linphone_core_create_friend_with_address(pauline->lc,lf_identity); ms_free(lf_identity); @@ -930,32 +938,39 @@ static void test_subscribe_notify_with_sipp_publisher(void) { linphone_core_add_friend(pauline->lc,lf); /*wait for subscribe acknowledgment*/ - wait_for_until(pauline->lc,pauline->lc,&pauline->stat.number_of_NotifyReceived,1,2000); + BC_ASSERT_TRUE(wait_for_until(pauline->lc,pauline->lc,&pauline->stat.number_of_NotifyPresenceReceived,1,2000)); BC_ASSERT_EQUAL(LinphoneStatusOffline,linphone_friend_get_status(lf), int, "%d"); scen = bc_tester_res("sipp/simple_publish.xml"); - - sipp_out = sip_start(scen, linphone_address_get_username(marie->identity), marie->identity); - + + sip_example_org = linphone_core_manager_resolve(marie, marie->identity); + sipp_out = sip_start(scen, linphone_address_get_username(marie->identity), linphone_auth_info_get_passwd(marie_auth), sip_example_org); + linphone_address_destroy(sip_example_org); + if (sipp_out) { /*wait for marie status*/ - wait_for_until(pauline->lc,pauline->lc,&pauline->stat.number_of_NotifyReceived,2,3000); + BC_ASSERT_TRUE(wait_for_until(pauline->lc,pauline->lc,&pauline->stat.number_of_NotifyPresenceReceived,2,3000)); BC_ASSERT_EQUAL(LinphoneStatusOnline,linphone_friend_get_status(lf), int, "%d"); - pclose(sipp_out); + BC_ASSERT_EQUAL(0,pclose(sipp_out),int,"%d"); } linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); -#endif } static void test_subscribe_notify_with_sipp_publisher_double_publish(void) { -#if USE_PRESENCE_SERVER +#if 0 + //does not work because sipp seams not able to manage 2 call id in case file + char *scen; FILE * sipp_out; LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc"); /*just to get an identity*/ LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); - + LinphoneAddress *sip_example_org; + + linphone_core_set_user_agent(marie->lc, "full-presence-support", NULL); + linphone_core_set_user_agent(pauline->lc, "full-presence-support", NULL); + LpConfig *pauline_lp = linphone_core_get_config(pauline->lc); char* lf_identity=linphone_address_as_string_uri_only(marie->identity); LinphoneFriend *lf = linphone_core_create_friend_with_address(pauline->lc,lf_identity); @@ -965,19 +980,20 @@ static void test_subscribe_notify_with_sipp_publisher_double_publish(void) { linphone_core_add_friend(pauline->lc,lf); /*wait for subscribe acknowledgment*/ - wait_for_until(pauline->lc,pauline->lc,&pauline->stat.number_of_NotifyReceived,1,2000); + BC_ASSERT_TRUE(wait_for_until(pauline->lc,pauline->lc,&pauline->stat.number_of_NotifyPresenceReceived,1,2000)); BC_ASSERT_EQUAL(LinphoneStatusOffline,linphone_friend_get_status(lf), int, "%d"); scen = bc_tester_res("sipp/double_publish_with_error.xml"); - - sipp_out = sip_start(scen, linphone_address_get_username(marie->identity), marie->identity); - + + sip_example_org = linphone_core_manager_resolve(marie, marie->identity); + sipp_out = sip_start(scen, linphone_address_get_username(marie->identity), sip_example_org); + if (sipp_out) { /*wait for marie status*/ - wait_for_until(pauline->lc,pauline->lc,&pauline->stat.number_of_NotifyReceived,2,3000); + BC_ASSERT_TRUE(wait_for_until(pauline->lc,pauline->lc,&pauline->stat.number_of_NotifyPresenceReceived,2,3000)); BC_ASSERT_EQUAL(LinphoneStatusOnline,linphone_friend_get_status(lf), int, "%d"); pclose(sipp_out); - BC_ASSERT_EQUAL(pauline->stat.number_of_NotifyReceived,2,int, "%d"); + BC_ASSERT_EQUAL(pauline->stat.number_of_NotifyPresenceReceived,2,int, "%d"); } linphone_core_manager_destroy(marie); @@ -1080,6 +1096,27 @@ static void test_list_subscribe (void) { linphone_core_manager_destroy(laure); } +static void test_subscribe_on_wrong_dialog(void) { + char *scen; + FILE * sipp_out; + /*just to get an identity*/ + LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); + const LinphoneAuthInfo *marie_auth = linphone_core_find_auth_info(marie->lc, NULL, linphone_address_get_username(marie->identity), NULL); + LinphoneAddress *sip_example_org; + + scen = bc_tester_res("sipp/subscribe_on_wrong_dialog.xml"); + sip_example_org = linphone_core_manager_resolve(marie, marie->identity); + sipp_out = sip_start(scen, linphone_address_get_username(marie->identity),linphone_auth_info_get_passwd(marie_auth), sip_example_org); + linphone_address_destroy(sip_example_org); + + if (sipp_out) { + /*wait for marie status*/ + BC_ASSERT_EQUAL(0, pclose(sipp_out),int,"%d"); + } + + linphone_core_manager_destroy(marie); +} + test_t flexisip_tests[] = { TEST_ONE_TAG("Subscribe forking", subscribe_forking, "LeaksMemory"), @@ -1098,14 +1135,15 @@ test_t flexisip_tests[] = { TEST_NO_TAG("Call with sips", call_with_sips), TEST_ONE_TAG("Call with sips not achievable", call_with_sips_not_achievable, "LeaksMemory"), TEST_NO_TAG("Call with ipv6", call_with_ipv6), - TEST_NO_TAG("Subscribe Notify with sipp publisher", test_subscribe_notify_with_sipp_publisher), - TEST_NO_TAG("Subscribe Notify with sipp double publish", test_subscribe_notify_with_sipp_publisher_double_publish), + TEST_ONE_TAG("Subscribe Notify with sipp publisher", test_subscribe_notify_with_sipp_publisher, "LeaksMemory"), + TEST_ONE_TAG("Subscribe Notify with sipp double publish", test_subscribe_notify_with_sipp_publisher_double_publish, "LeaksMemory"), TEST_NO_TAG("Publish/unpublish", test_publish_unpublish), - TEST_ONE_TAG("List subscribe", test_list_subscribe, "LeaksMemory"), + TEST_ONE_TAG("List subscribe", test_list_subscribe,"LeaksMemory"), TEST_ONE_TAG("File transfer message rcs to external body client", file_transfer_message_rcs_to_external_body_client, "LeaksMemory"), TEST_ONE_TAG("File transfer message external body to rcs client", file_transfer_message_external_body_to_rcs_client, "LeaksMemory"), TEST_ONE_TAG("File transfer message external body to external body client", file_transfer_message_external_body_to_external_body_client, "LeaksMemory"), - TEST_NO_TAG("DoS module trigger by sending a lot of chat messages", dos_module_trigger) + TEST_NO_TAG("DoS module trigger by sending a lot of chat messages", dos_module_trigger), + TEST_NO_TAG("Subscribe on wrong dialog", test_subscribe_on_wrong_dialog) }; test_suite_t flexisip_test_suite = {"Flexisip", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each, diff --git a/tester/liblinphone_tester.h b/tester/liblinphone_tester.h index b56908e12..71d5b9f49 100644 --- a/tester/liblinphone_tester.h +++ b/tester/liblinphone_tester.h @@ -366,8 +366,9 @@ LinphoneConferenceServer* linphone_conference_server_new(const char *rc_file, bo void linphone_conference_server_destroy(LinphoneConferenceServer *conf_srv); extern const char *liblinphone_tester_mire_id; - -FILE *sip_start(const char *senario, const char* dest_username, LinphoneAddress* dest_addres); + +LinphoneAddress * linphone_core_manager_resolve(LinphoneCoreManager *mgr, const LinphoneAddress *source); +FILE *sip_start(const char *senario, const char* dest_username, const char *passwd, LinphoneAddress* dest_addres); void wait_core(LinphoneCore *core) ; diff --git a/tester/rcfiles/marie_rc b/tester/rcfiles/marie_rc index 5492e8dc9..f1f65441b 100644 --- a/tester/rcfiles/marie_rc +++ b/tester/rcfiles/marie_rc @@ -6,6 +6,7 @@ default_proxy=0 ping_with_options=0 register_only_when_network_is_up=0 composing_idle_timeout=1 +store_ha1_passwd=0 #used for sipp [auth_info_0] username=marie diff --git a/tester/sipp/simple_publish.xml b/tester/sipp/simple_publish.xml index 83b04bedd..4040471ce 100644 --- a/tester/sipp/simple_publish.xml +++ b/tester/sipp/simple_publish.xml @@ -53,6 +53,38 @@ + + + + + + ;tag=[pid]SIPpTag00[call_number] + To: sipp + Call-ID: [call_id] + CSeq: 2 PUBLISH + Max-Forwards: 70 + [authentication] + Expire: 60 + Event: presence + Content-Type: application/pidf+xml + Content-Length: [len] + + + + + + open + + sip:[service]@[local_ip]:[local_port] + 2015-09-28T15:49:00Z + + + ]]> + diff --git a/tester/sipp/subscribe_on_wrong_dialog.xml b/tester/sipp/subscribe_on_wrong_dialog.xml new file mode 100644 index 000000000..ab583e0b9 --- /dev/null +++ b/tester/sipp/subscribe_on_wrong_dialog.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + ;tag=[pid]SIPpTag00[call_number] + To: sut ;tag=pasdetagicinormalement + Call-ID: [call_id] + CSeq: 1 SUBSCRIBE + Contact: sip:sipp@[local_ip]:[local_port] + Max-Forwards: 70 + Event: presence + Expires: 60 + Accept: application/pidf+xml + Allow-Events: presence + User-Agent: full-presence-support + Content-Length: 0 + + ]]> + + + + + + + + + ;tag=[pid]SIPpTag00[call_number] + To: sut ;tag=pasdetagicinormalement + Call-ID: [call_id] + CSeq: 2 SUBSCRIBE + Contact: sip:sipp@[local_ip]:[local_port] + Max-Forwards: 70 + Event: presence + [authentication] + Expires: 60 + Accept: application/pidf+xml + Allow-Events: presence + User-Agent: full-presence-support + Content-Length: 0 + + ]]> + + + + + + + + + + + +