Commit 3c47f01e authored by Simon Morlat's avatar Simon Morlat

add flexisip test suite

parent 10b8224e
mediastreamer2 @ bba5dff9
Subproject commit e2ea92a34d2577910115e20574f3f1e6474850da
Subproject commit bba5dff9ea4d4b6bc84d6b9b1e17469a3f8e6869
EXTRA_DIST= empty_rc laure_rc marie_early_rc marie_no_sdp_rc marie_rc multi_account_lrc pauline_alt_rc \
pauline_rc pauline_wild_rc tester_hosts sounds images certificates
pauline_rc pauline_wild_rc pauline_rc_tcp tester_hosts sounds images certificates
if BUILD_CUNIT_TESTS
......@@ -13,7 +13,8 @@ liblinphone_tester_SOURCES= liblinphone_tester.c liblinphone_tester.h\
call_tester.c \
presence_tester.c \
upnp_tester.c \
eventapi_tester.c
eventapi_tester.c \
flexisip_tester.c
#liblinphone_tester_CFLAGS=$(CUNIT_CFLAGS)
......
/*
belle-sip - SIP (RFC3261) library.
Copyright (C) 2010 Belledonne Communications SARL
liblinphone_tester - liblinphone test suite
Copyright (C) 2013 Belledonne Communications SARL
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
......@@ -16,6 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include "CUnit/Basic.h"
#include "linphonecore.h"
......@@ -95,13 +96,18 @@ static void linphone_call_cb(LinphoneCall *call,void * user_data) {
}
#endif
static void check_rtcp(LinphoneCoreManager* caller, LinphoneCoreManager* callee) {
void liblinphone_tester_check_rtcp(LinphoneCoreManager* caller, LinphoneCoreManager* callee) {
LinphoneCall *c1,*c2;
int i;
int dummy=0;
c1=linphone_core_get_current_call(caller->lc);
c2=linphone_core_get_current_call(callee->lc);
CU_ASSERT_PTR_NOT_NULL(c1);
CU_ASSERT_PTR_NOT_NULL(c2);
if (!c1 || !c2) return;
for (i=0; i<24 /*=12s need at least one exchange of SR to maybe 10s*/; i++) {
if (linphone_call_get_audio_stats(c1)->round_trip_delay >0.0
......@@ -214,7 +220,7 @@ static void simple_call(void) {
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
CU_ASSERT_TRUE(call(pauline,marie));
check_rtcp(marie,pauline);
liblinphone_tester_check_rtcp(marie,pauline);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
......@@ -527,7 +533,7 @@ static void call_with_ice(void) {
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2));
check_rtcp(marie,pauline);
liblinphone_tester_check_rtcp(marie,pauline);
/*then close the call*/
......@@ -765,7 +771,7 @@ static void video_call(void) {
linphone_call_send_vfu_request(marie_call);
CU_ASSERT_TRUE( wait_for(marie->lc,pauline->lc,&marie->stat.number_of_IframeDecoded,1));
check_rtcp(marie,pauline);
liblinphone_tester_check_rtcp(marie,pauline);
linphone_core_terminate_all_calls(pauline->lc);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1));
......@@ -782,11 +788,11 @@ static void call_with_media_relay(void) {
linphone_core_set_user_agent(marie->lc,"Natted Linphone",NULL);
linphone_core_set_user_agent(pauline->lc,"Natted Linphone",NULL);
CU_ASSERT_TRUE(call(pauline,marie));
check_rtcp(pauline,marie);
liblinphone_tester_check_rtcp(pauline,marie);
#ifdef VIDEO_ENABLED
CU_ASSERT_TRUE(add_video(pauline,marie));
check_rtcp(pauline,marie);
liblinphone_tester_check_rtcp(pauline,marie);
#endif
/*just to sleep*/
......@@ -1004,7 +1010,7 @@ static void srtp_ice_call(void) {
add_video(pauline,marie);
CU_ASSERT_TRUE(check_ice(pauline,marie,LinphoneIceStateHostConnection));
check_rtcp(marie,pauline);
liblinphone_tester_check_rtcp(marie,pauline);
/*wait for ice to found the direct path*/
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_IframeDecoded,1));
#endif
......@@ -1050,89 +1056,6 @@ static void early_media_call(void) {
linphone_core_manager_destroy(pauline);
}
static void early_media_call_forking(void) {
LinphoneCoreManager* marie1 = linphone_core_manager_new("marie_early_rc");
LinphoneCoreManager* marie2 = linphone_core_manager_new("marie_early_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new("pauline_rc");
MSList *lcs=NULL;
LinphoneCallParams *params=linphone_core_create_default_call_parameters(pauline->lc);
LinphoneVideoPolicy pol;
LinphoneCall *marie1_call;
LinphoneCall *marie2_call;
LinphoneCall *pauline_call;
int dummy=0;
char ringbackpath[256];
snprintf(ringbackpath,sizeof(ringbackpath), "%s/sounds/hello8000.wav" /*use hello because rinback is too short*/, liblinphone_tester_file_prefix);
pol.automatically_accept=1;
pol.automatically_initiate=1;
linphone_core_set_user_agent(marie1->lc,"Natted Linphone",NULL);
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(marie1->lc,TRUE,TRUE);
linphone_core_set_video_policy(marie1->lc,&pol);
/*use playfile for marie1 to avoid locking on capture card*/
linphone_core_use_files (marie1->lc,TRUE);
linphone_core_set_play_file(marie1->lc,ringbackpath);
linphone_core_enable_video(marie2->lc,TRUE,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);
/*use playfile for marie2 to avoid locking on capture card*/
linphone_core_use_files (marie2->lc,TRUE);
linphone_core_set_play_file(marie2->lc,ringbackpath);
lcs=ms_list_append(lcs,marie1->lc);
lcs=ms_list_append(lcs,marie2->lc);
lcs=ms_list_append(lcs,pauline->lc);
linphone_call_params_enable_early_media_sending(params,TRUE);
linphone_call_params_enable_video(params,TRUE);
linphone_core_invite_address_with_params(pauline->lc,marie1->identity,params);
linphone_call_params_destroy(params);
CU_ASSERT_TRUE(wait_for_list(lcs, &marie1->stat.number_of_LinphoneCallIncomingEarlyMedia,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs, &marie2->stat.number_of_LinphoneCallIncomingEarlyMedia,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallOutgoingEarlyMedia,1,1000));
pauline_call=linphone_core_get_current_call(pauline->lc);
marie1_call=linphone_core_get_current_call(marie1->lc);
marie2_call=linphone_core_get_current_call(marie2->lc);
/*wait a bit that streams are established*/
wait_for_list(lcs,&dummy,1,3000);
CU_ASSERT_TRUE(linphone_call_get_audio_stats(pauline_call)->download_bandwidth>70);
CU_ASSERT_TRUE(linphone_call_get_audio_stats(marie1_call)->download_bandwidth>70);
CU_ASSERT_TRUE(linphone_call_get_audio_stats(marie2_call)->download_bandwidth>70);
linphone_core_accept_call(marie1->lc,linphone_core_get_current_call(marie1->lc));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie1->stat.number_of_LinphoneCallStreamsRunning,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,1000));
/*marie2 should get her call terminated*/
CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,1000));
/*wait a bit that streams are established*/
wait_for_list(lcs,&dummy,1,1000);
CU_ASSERT_TRUE(linphone_call_get_audio_stats(pauline_call)->download_bandwidth>71);
CU_ASSERT_TRUE(linphone_call_get_audio_stats(marie1_call)->download_bandwidth>71);
linphone_core_terminate_all_calls(pauline->lc);
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie1->stat.number_of_LinphoneCallEnd,1,1000));
ms_list_free(lcs);
linphone_core_manager_destroy(marie1);
linphone_core_manager_destroy(marie2);
linphone_core_manager_destroy(pauline);
}
static void simple_call_transfer(void) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
......@@ -1539,7 +1462,6 @@ test_t call_tests[] = {
{ "Call with media relay", call_with_media_relay},
{ "Simple call compatibility mode", simple_call_compatibility_mode },
{ "Early-media call", early_media_call },
{ "Early-media call forking", early_media_call_forking },
{ "Call terminated by caller", call_terminated_by_caller },
{ "Call without SDP", call_with_no_sdp},
{ "Call paused resumed", call_paused_resumed },
......
/*
belle-sip - SIP (RFC3261) library.
Copyright (C) 2010 Belledonne Communications SARL
liblinphone_tester - liblinphone test suite
Copyright (C) 2013 Belledonne Communications SARL
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
......@@ -16,6 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include "CUnit/Basic.h"
#include "linphonecore.h"
......@@ -28,6 +29,14 @@
static const char *subscribe_content="<somexml>blabla</somexml>";
static const char *notify_content="<somexml2>blabla</somexml2>";
const char *liblinphone_tester_get_subscribe_content(void){
return subscribe_content;
}
const char *liblinphone_tester_get_notify_content(void){
return notify_content;
}
void linphone_notify_received(LinphoneCore *lc, LinphoneEvent *lev, const char *eventname, const LinphoneContent *content){
CU_ASSERT_PTR_NOT_NULL_FATAL(content);
CU_ASSERT_TRUE(strcmp(notify_content,(const char*)content->data)==0);
......
......@@ -259,7 +259,7 @@ stateful=true
# Fork invites to late registers
# Default value: false
fork-late=false
fork-late=true
# Only forward one response of forked invite to the caller
# Default value: true
......@@ -272,7 +272,7 @@ fork-no-global-decline=false
# Maximum duration for delivering a message (text)
# Default value: 3600
message-delivery-timeout=3600
message-delivery-timeout=60
##
## The Registrar module accepts REGISTERs for domains it manages,
## and store the address of record in order to route other requests
......@@ -301,12 +301,12 @@ max-contacts-by-aor=15
# List of contact uri parameters that can be used to identify a
# user's device.
# Default value: line
unique-id-parameters=line
# Default value: +sip.instance
#unique-id-parameters=
# Maximum expire time for a REGISTER, in seconds.
# Default value: 86400
max-expires=86400
max-expires=60
# Minimum expire time for a REGISTER, in seconds.
# Default value: 60
......
This diff is collapsed.
/*
belle-sip - SIP (RFC3261) library.
Copyright (C) 2010 Belledonne Communications SARL
liblinphone_tester - liblinphone test suite
Copyright (C) 2013 Belledonne Communications SARL
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
......@@ -15,6 +15,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include "CUnit/Basic.h"
#include "linphonecore.h"
......@@ -321,6 +322,7 @@ void liblinphone_tester_init(void) {
add_test_suite(&upnp_test_suite);
#endif
add_test_suite(&event_test_suite);
add_test_suite(&flexisip_test_suite);
}
void liblinphone_tester_uninit(void) {
......@@ -423,6 +425,7 @@ void helper(const char *name) {
"\t\t\t--auth-domain <test auth domain>\n"
"\t\t\t--suite <suite name>\n"
"\t\t\t--test <test name>\n"
"\t\t\t--dns-hosts </etc/hosts -like file to used to override DNS names (default: tester_hosts)>\n"
#if HAVE_CU_CURSES
"\t\t\t--curses\n"
#endif
......@@ -468,7 +471,10 @@ int main (int argc, char *argv[]) {
} else if (strcmp(argv[i],"--config")==0){
CHECK_ARG("--config", ++i, argc);
liblinphone_tester_file_prefix=argv[i];
} else if (strcmp(argv[i],"--suite")==0){
}else if (strcmp(argv[i],"--dns-hosts")==0){
CHECK_ARG("--dns-hosts", ++i, argc);
userhostsfile=argv[i];
}else if (strcmp(argv[i],"--suite")==0){
CHECK_ARG("--suite", ++i, argc);
suite_name=argv[i];
} else if (strcmp(argv[i],"--list-suites")==0){
......
/*
belle-sip - SIP (RFC3261) library.
Copyright (C) 2010 Belledonne Communications SARL
liblinphone_tester - liblinphone test suite
Copyright (C) 2013 Belledonne Communications SARL
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
......@@ -16,6 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIBLINPHONE_TESTER_H_
#define LIBLINPHONE_TESTER_H_
......@@ -52,6 +53,7 @@ extern test_suite_t message_test_suite;
extern test_suite_t presence_test_suite;
extern test_suite_t upnp_test_suite;
extern test_suite_t event_test_suite;
extern test_suite_t flexisip_test_suite;
extern int liblinphone_tester_nb_test_suites(void);
......@@ -62,7 +64,6 @@ extern void liblinphone_tester_init(void);
extern void liblinphone_tester_uninit(void);
extern int liblinphone_tester_run_tests(const char *suite_name, const char *test_name);
#ifdef __cplusplus
};
#endif
......@@ -210,6 +211,10 @@ bool_t wait_for_until(LinphoneCore* lc_1, LinphoneCore* lc_2,int* counter,int va
bool_t call(LinphoneCoreManager* caller_mgr,LinphoneCoreManager* callee_mgr);
stats * get_stats(LinphoneCore *lc);
LinphoneCoreManager *get_manager(LinphoneCore *lc);
const char *liblinphone_tester_get_subscribe_content(void);
const char *liblinphone_tester_get_notify_content(void);
void liblinphone_tester_chat_message_state_change(LinphoneChatMessage* msg,LinphoneChatMessageState state,void* ud);
void liblinphone_tester_check_rtcp(LinphoneCoreManager* caller, LinphoneCoreManager* callee);
#endif /* LIBLINPHONE_TESTER_H_ */
127.0.0.1 sip2.linphone.org sip.example.org sipopen.example.org auth.example.org auth1.example.org auth2.example.org altname.linphone.org sip.wildcard1.linphone.org altname.wildcard2.linphone.org
[sip]
sip_port=5082
sip_tcp_port=5082
sip_tls_port=5083
sip_port=-1
sip_tcp_port=-1
sip_tls_port=-1
default_proxy=0
ping_with_options=0
register_only_when_network_is_up=0
......@@ -45,4 +45,4 @@ automatically_accept=0
device=StaticImage: Static picture
[sound]
echocancellation=0 #to not overload cpu in case of VG
\ No newline at end of file
echocancellation=0 #to not overload cpu in case of VG
/*
belle-sip - SIP (RFC3261) library.
Copyright (C) 2010 Belledonne Communications SARL
liblinphone_tester - liblinphone test suite
Copyright (C) 2013 Belledonne Communications SARL
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
......@@ -16,6 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include "CUnit/Basic.h"
#include "linphonecore.h"
......@@ -53,7 +54,7 @@ void is_composing_received(LinphoneCore *lc, LinphoneChatRoom *room) {
}
}
void linphone_chat_message_state_change(LinphoneChatMessage* msg,LinphoneChatMessageState state,void* ud) {
void liblinphone_tester_chat_message_state_change(LinphoneChatMessage* msg,LinphoneChatMessageState state,void* ud) {
LinphoneCore* lc=(LinphoneCore*)ud;
stats* counters = get_stats(lc);
ms_message("Message [%s] [%s]",linphone_chat_message_get_text(msg),linphone_chat_message_state_to_string(state));
......@@ -158,7 +159,7 @@ static void text_message_with_ack(void) {
char* to = linphone_address_as_string(marie->identity);
LinphoneChatRoom* chat_room = linphone_core_create_chat_room(pauline->lc,to);
LinphoneChatMessage* message = linphone_chat_room_create_message(chat_room,"Bli bli bli \n blu");
linphone_chat_room_send_message2(chat_room,message,linphone_chat_message_state_change,pauline->lc);
linphone_chat_room_send_message2(chat_room,message,liblinphone_tester_chat_message_state_change,pauline->lc);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneMessageDelivered,1));
CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1);
......@@ -173,7 +174,7 @@ static void text_message_with_external_body(void) {
LinphoneChatRoom* chat_room = linphone_core_create_chat_room(pauline->lc,to);
LinphoneChatMessage* message = linphone_chat_room_create_message(chat_room,"Bli bli bli \n blu");
linphone_chat_message_set_external_body_url(message,message_external_body_url="http://www.linphone.org");
linphone_chat_room_send_message2(chat_room,message,linphone_chat_message_state_change,pauline->lc);
linphone_chat_room_send_message2(chat_room,message,liblinphone_tester_chat_message_state_change,pauline->lc);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneMessageDelivered,1));
......@@ -192,7 +193,7 @@ static void text_message_with_send_error(void) {
LinphoneChatMessage* message = linphone_chat_room_create_message(chat_room,"Bli bli bli \n blu");
/*simultate a network error*/
sal_set_send_error(marie->lc->sal, -1);
linphone_chat_room_send_message2(chat_room,message,linphone_chat_message_state_change,marie->lc);
linphone_chat_room_send_message2(chat_room,message,liblinphone_tester_chat_message_state_change,marie->lc);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageNotDelivered,1));
/*CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageInProgress,1);*/
......
[sip]
sip_port=5072
sip_tcp_port=5072
sip_tls_port=5073
sip_port=-1
sip_tcp_port=-1
sip_tls_port=-1
default_proxy=0
ping_with_options=0
register_only_when_network_is_up=0
......@@ -44,4 +44,4 @@ automatically_accept=0
device=StaticImage: Static picture
[sound]
echocancellation=0 #to not overload cpu in case of VG
\ No newline at end of file
echocancellation=0 #to not overload cpu in case of VG
[sip]
sip_port=-1
sip_tcp_port=-1
sip_tls_port=-1
default_proxy=0
ping_with_options=0
register_only_when_network_is_up=0
composing_idle_timeout=1
[auth_info_0]
username=pauline
userid=pauline
passwd=secret
realm=sip.example.org
[proxy_0]
reg_proxy=sip2.linphone.org;transport=tcp
reg_route=sip2.linphone.org;transport=tcp
reg_identity=sip:pauline@sip.example.org
reg_expires=3600
reg_sendregister=1
publish=0
dial_escape_plus=0
#[friend_0]
#url="Mariette" <sip:marie@sip.example.org>
#pol=accept
#subscribe=0
[rtp]
audio_rtp_port=8090
video_rtp_port=9092
[video]
display=0
capture=0
show_local=0
size=vga
enabled=0
self_view=0
automatically_initiate=0
automatically_accept=0
device=StaticImage: Static picture
[sound]
echocancellation=0 #to not overload cpu in case of VG
/*
belle-sip - SIP (RFC3261) library.
Copyright (C) 2010 Belledonne Communications SARL
liblinphone_tester - liblinphone test suite
Copyright (C) 2013 Belledonne Communications SARL
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
......
......@@ -4,7 +4,7 @@
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
......
/*
belle-sip - SIP (RFC3261) library.
Copyright (C) 2010 Belledonne Communications SARL
liblinphone_tester - liblinphone test suite
Copyright (C) 2013 Belledonne Communications SARL
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
......
/*
belle-sip - SIP (RFC3261) library.
Copyright (C) 2010 Belledonne Communications SARL
liblinphone_tester - liblinphone test suite
Copyright (C) 2013 Belledonne Communications SARL
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment