forked from mirrors/linphone-iphone
add flexisip test suite
This commit is contained in:
parent
10b8224e38
commit
3c47f01e84
17 changed files with 704 additions and 138 deletions
|
|
@ -1 +1 @@
|
|||
Subproject commit e2ea92a34d2577910115e20574f3f1e6474850da
|
||||
Subproject commit bba5dff9ea4d4b6bc84d6b9b1e17469a3f8e6869
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
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)
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
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 },
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
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
|
||||
|
|
|
|||
574
tester/flexisip_tester.c
Normal file
574
tester/flexisip_tester.c
Normal file
|
|
@ -0,0 +1,574 @@
|
|||
/*
|
||||
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 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
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"
|
||||
#include "lpconfig.h"
|
||||
#include "private.h"
|
||||
#include "liblinphone_tester.h"
|
||||
|
||||
static void subscribe_forking(void) {
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc_tcp");
|
||||
LinphoneCoreManager* pauline2 = linphone_core_manager_new( "pauline_rc_tcp");
|
||||
LinphoneContent content={0};
|
||||
LinphoneEvent *lev;
|
||||
int expires= 600;
|
||||
MSList* lcs=ms_list_append(NULL,marie->lc);
|
||||
|
||||
lcs=ms_list_append(lcs,pauline->lc);
|
||||
lcs=ms_list_append(lcs,pauline2->lc);
|
||||
|
||||
content.type="application";
|
||||
content.subtype="somexml";
|
||||
content.data=(char*)liblinphone_tester_get_subscribe_content();
|
||||
content.size=strlen(liblinphone_tester_get_subscribe_content());
|
||||
|
||||
lev=linphone_core_subscribe(marie->lc,pauline->identity,"dodo",expires,&content);
|
||||
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionOutgoingInit,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionIncomingReceived,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline2->stat.number_of_LinphoneSubscriptionIncomingReceived,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionActive,1,1000));
|
||||
|
||||
/*make sure marie receives first notification before terminating*/
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_NotifyReceived,1,1000));
|
||||
|
||||
linphone_event_terminate(lev);
|
||||
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
linphone_core_manager_destroy(pauline2);
|
||||
ms_list_free(lcs);
|
||||
}
|
||||
|
||||
static void message_forking(void) {
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc_tcp");
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager* marie2 = linphone_core_manager_new( "marie_rc");
|
||||
MSList* lcs=ms_list_append(NULL,marie->lc);
|
||||
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");
|
||||
|
||||
lcs=ms_list_append(lcs,pauline->lc);
|
||||
lcs=ms_list_append(lcs,marie2->lc);
|
||||
|
||||
linphone_chat_room_send_message2(chat_room,message,liblinphone_tester_chat_message_state_change,pauline->lc);
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneMessageReceived,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneMessageReceived,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneMessageDelivered,1,1000));
|
||||
CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1);
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(marie2);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
ms_free(to);
|
||||
ms_list_free(lcs);
|
||||
}
|
||||
|
||||
static void message_forking_with_unreachable_recipients(void) {
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc_tcp");
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager* marie2 = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager* marie3 = linphone_core_manager_new( "marie_rc");
|
||||
MSList* lcs=ms_list_append(NULL,marie->lc);
|
||||
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");
|
||||
|
||||
lcs=ms_list_append(lcs,pauline->lc);
|
||||
lcs=ms_list_append(lcs,marie2->lc);
|
||||
lcs=ms_list_append(lcs,marie3->lc);
|
||||
|
||||
/*marie2 and marie3 go offline*/
|
||||
linphone_core_set_network_reachable(marie2->lc,FALSE);
|
||||
linphone_core_set_network_reachable(marie3->lc,FALSE);
|
||||
|
||||
linphone_chat_room_send_message2(chat_room,message,liblinphone_tester_chat_message_state_change,pauline->lc);
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneMessageReceived,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneMessageDelivered,1,1000));
|
||||
CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1);
|
||||
CU_ASSERT_TRUE( marie2->stat.number_of_LinphoneMessageReceived==0);
|
||||
CU_ASSERT_TRUE( marie3->stat.number_of_LinphoneMessageReceived==0);
|
||||
/*marie 2 goes online */
|
||||
linphone_core_set_network_reachable(marie2->lc,TRUE);
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneMessageReceived,1,1000));
|
||||
|
||||
/*wait a long time so that all transactions are expired*/
|
||||
wait_for_list(lcs,NULL,0,32000);
|
||||
|
||||
/*marie 3 goes online now*/
|
||||
linphone_core_set_network_reachable(marie3->lc,TRUE);
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneMessageReceived,1,1000));
|
||||
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(marie2);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
ms_free(to);
|
||||
ms_list_free(lcs);
|
||||
}
|
||||
|
||||
static void message_forking_with_all_recipients_unreachable(void) {
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc_tcp");
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager* marie2 = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager* marie3 = linphone_core_manager_new( "marie_rc");
|
||||
MSList* lcs=ms_list_append(NULL,marie->lc);
|
||||
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");
|
||||
|
||||
lcs=ms_list_append(lcs,pauline->lc);
|
||||
lcs=ms_list_append(lcs,marie2->lc);
|
||||
lcs=ms_list_append(lcs,marie3->lc);
|
||||
|
||||
/*All marie's device go offline*/
|
||||
linphone_core_set_network_reachable(marie->lc,FALSE);
|
||||
linphone_core_set_network_reachable(marie2->lc,FALSE);
|
||||
linphone_core_set_network_reachable(marie3->lc,FALSE);
|
||||
|
||||
linphone_chat_room_send_message2(chat_room,message,liblinphone_tester_chat_message_state_change,pauline->lc);
|
||||
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneMessageInProgress,1,1000));
|
||||
/*flexisip will accept the message with 202 after 16 seconds*/
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneMessageDelivered,1,18000));
|
||||
CU_ASSERT_TRUE( marie->stat.number_of_LinphoneMessageReceived==0);
|
||||
CU_ASSERT_TRUE( marie2->stat.number_of_LinphoneMessageReceived==0);
|
||||
CU_ASSERT_TRUE( marie3->stat.number_of_LinphoneMessageReceived==0);
|
||||
|
||||
/*marie 1 goes online */
|
||||
linphone_core_set_network_reachable(marie->lc,TRUE);
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneMessageReceived,1,1000));
|
||||
|
||||
/*marie 2 goes online */
|
||||
linphone_core_set_network_reachable(marie2->lc,TRUE);
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneMessageReceived,1,1000));
|
||||
|
||||
/*wait a long time so that all transactions are expired*/
|
||||
wait_for_list(lcs,NULL,0,32000);
|
||||
|
||||
/*marie 3 goes online now*/
|
||||
linphone_core_set_network_reachable(marie3->lc,TRUE);
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneMessageReceived,1,1000));
|
||||
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(marie2);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
ms_free(to);
|
||||
ms_list_free(lcs);
|
||||
}
|
||||
|
||||
static void call_forking(void){
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc_tcp");
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager* marie2 = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager* marie3 = linphone_core_manager_new( "marie_rc");
|
||||
MSList* lcs=ms_list_append(NULL,pauline->lc);
|
||||
|
||||
lcs=ms_list_append(lcs,marie->lc);
|
||||
lcs=ms_list_append(lcs,marie2->lc);
|
||||
lcs=ms_list_append(lcs,marie3->lc);
|
||||
|
||||
linphone_core_set_user_agent(marie->lc,"Natted Linphone",NULL);
|
||||
linphone_core_set_user_agent(marie2->lc,"Natted Linphone",NULL);
|
||||
linphone_core_set_user_agent(marie3->lc,"Natted Linphone",NULL);
|
||||
linphone_core_set_user_agent(pauline->lc,"Natted Linphone",NULL);
|
||||
|
||||
linphone_core_invite_address(pauline->lc,marie->identity);
|
||||
/*pauline should hear ringback*/
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,1000));
|
||||
/*all devices from Marie should be ringing*/
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallIncomingReceived,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallIncomingReceived,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallIncomingReceived,1,1000));
|
||||
|
||||
/*marie accepts the call on its first device*/
|
||||
linphone_core_accept_call(marie->lc,linphone_core_get_current_call(marie->lc));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallConnected,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,1,1000));
|
||||
|
||||
/*other devices should stop ringing*/
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallEnd,1,1000));
|
||||
|
||||
linphone_core_terminate_call(pauline->lc,linphone_core_get_current_call(pauline->lc));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000));
|
||||
|
||||
linphone_core_manager_destroy(pauline);
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(marie2);
|
||||
linphone_core_manager_destroy(marie3);
|
||||
ms_list_free(lcs);
|
||||
}
|
||||
|
||||
static void call_forking_with_urgent_reply(void){
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc_tcp");
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager* marie2 = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager* marie3 = linphone_core_manager_new( "marie_rc");
|
||||
MSList* lcs=ms_list_append(NULL,pauline->lc);
|
||||
|
||||
lcs=ms_list_append(lcs,marie->lc);
|
||||
lcs=ms_list_append(lcs,marie2->lc);
|
||||
lcs=ms_list_append(lcs,marie3->lc);
|
||||
|
||||
linphone_core_set_user_agent(marie->lc,"Natted Linphone",NULL);
|
||||
linphone_core_set_user_agent(marie2->lc,"Natted Linphone",NULL);
|
||||
linphone_core_set_user_agent(marie3->lc,"Natted Linphone",NULL);
|
||||
linphone_core_set_user_agent(pauline->lc,"Natted Linphone",NULL);
|
||||
|
||||
CU_ASSERT_TRUE(linphone_core_media_encryption_supported(pauline->lc,LinphoneMediaEncryptionSRTP));
|
||||
linphone_core_set_media_encryption(pauline->lc,LinphoneMediaEncryptionSRTP);
|
||||
linphone_core_set_network_reachable(marie2->lc,FALSE);
|
||||
linphone_core_set_network_reachable(marie3->lc,FALSE);
|
||||
|
||||
linphone_core_invite_address(pauline->lc,marie->identity);
|
||||
/*pauline should hear ringback, after 5 seconds, when it will retry without SRTP*/
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,6000));
|
||||
/*Marie should be ringing*/
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallIncomingReceived,1,1000));
|
||||
|
||||
/*marie accepts the call on its first device*/
|
||||
linphone_core_accept_call(marie->lc,linphone_core_get_current_call(marie->lc));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallConnected,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,1,1000));
|
||||
|
||||
linphone_core_terminate_call(pauline->lc,linphone_core_get_current_call(pauline->lc));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000));
|
||||
|
||||
linphone_core_manager_destroy(pauline);
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(marie2);
|
||||
linphone_core_manager_destroy(marie3);
|
||||
ms_list_free(lcs);
|
||||
}
|
||||
|
||||
static void call_forking_cancelled(void){
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc_tcp");
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager* marie2 = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager* marie3 = linphone_core_manager_new( "marie_rc");
|
||||
MSList* lcs=ms_list_append(NULL,pauline->lc);
|
||||
|
||||
lcs=ms_list_append(lcs,marie->lc);
|
||||
lcs=ms_list_append(lcs,marie2->lc);
|
||||
lcs=ms_list_append(lcs,marie3->lc);
|
||||
|
||||
linphone_core_set_user_agent(marie->lc,"Natted Linphone",NULL);
|
||||
linphone_core_set_user_agent(marie2->lc,"Natted Linphone",NULL);
|
||||
linphone_core_set_user_agent(marie3->lc,"Natted Linphone",NULL);
|
||||
linphone_core_set_user_agent(pauline->lc,"Natted Linphone",NULL);
|
||||
|
||||
linphone_core_invite_address(pauline->lc,marie->identity);
|
||||
/*pauline should hear ringback*/
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,3000));
|
||||
/*all devices from Marie should be ringing*/
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallIncomingReceived,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallIncomingReceived,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallIncomingReceived,1,1000));
|
||||
|
||||
/*pauline finally cancels the call*/
|
||||
linphone_core_terminate_call(pauline->lc,linphone_core_get_current_call(pauline->lc));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000));
|
||||
|
||||
/*all devices should stop ringing*/
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallEnd,1,1000));
|
||||
|
||||
linphone_core_manager_destroy(pauline);
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(marie2);
|
||||
linphone_core_manager_destroy(marie3);
|
||||
ms_list_free(lcs);
|
||||
}
|
||||
|
||||
static void call_forking_declined(bool_t declined_globaly){
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc_tcp");
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager* marie2 = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager* marie3 = linphone_core_manager_new( "marie_rc");
|
||||
MSList* lcs=ms_list_append(NULL,pauline->lc);
|
||||
|
||||
lcs=ms_list_append(lcs,marie->lc);
|
||||
lcs=ms_list_append(lcs,marie2->lc);
|
||||
lcs=ms_list_append(lcs,marie3->lc);
|
||||
|
||||
linphone_core_set_user_agent(marie->lc,"Natted Linphone",NULL);
|
||||
linphone_core_set_user_agent(marie2->lc,"Natted Linphone",NULL);
|
||||
linphone_core_set_user_agent(marie3->lc,"Natted Linphone",NULL);
|
||||
linphone_core_set_user_agent(pauline->lc,"Natted Linphone",NULL);
|
||||
|
||||
linphone_core_invite_address(pauline->lc,marie->identity);
|
||||
/*pauline should hear ringback*/
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,3000));
|
||||
/*all devices from Marie should be ringing*/
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallIncomingReceived,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallIncomingReceived,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallIncomingReceived,1,1000));
|
||||
|
||||
/*marie1 finally declines the call*/
|
||||
linphone_core_decline_call(marie->lc,linphone_core_get_current_call(marie->lc),
|
||||
declined_globaly ? LinphoneReasonDeclined : LinphoneReasonBusy
|
||||
);
|
||||
|
||||
if (declined_globaly){
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000));
|
||||
/*all devices should stop ringing*/
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallEnd,1,1000));
|
||||
}else{
|
||||
/*pauline should continue ringing and be able to hear a call taken by marie2 */
|
||||
linphone_core_accept_call(marie2->lc, linphone_core_get_current_call(marie2->lc));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,2000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallStreamsRunning,1,2000));
|
||||
liblinphone_tester_check_rtcp(pauline,marie2);
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallEnd,1,1000));
|
||||
linphone_core_terminate_call(marie2->lc,linphone_core_get_current_call(marie2->lc));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000));
|
||||
}
|
||||
|
||||
linphone_core_manager_destroy(pauline);
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(marie2);
|
||||
linphone_core_manager_destroy(marie3);
|
||||
ms_list_free(lcs);
|
||||
}
|
||||
|
||||
static void call_forking_declined_globaly(void){
|
||||
call_forking_declined(TRUE);
|
||||
}
|
||||
|
||||
static void call_forking_declined_localy(void){
|
||||
call_forking_declined(FALSE);
|
||||
}
|
||||
|
||||
static void call_forking_with_push_notification_single(void){
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc_tcp");
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
|
||||
|
||||
linphone_core_set_user_agent(marie->lc,"Natted Linphone",NULL);
|
||||
linphone_core_set_user_agent(pauline->lc,"Natted Linphone",NULL);
|
||||
|
||||
MSList* lcs=ms_list_append(NULL,pauline->lc);
|
||||
|
||||
lcs=ms_list_append(lcs,marie->lc);
|
||||
|
||||
/*unfortunately marie gets unreachable due to crappy 3G operator or iOS bug...*/
|
||||
linphone_core_set_network_reachable(marie->lc,FALSE);
|
||||
|
||||
linphone_core_invite_address(pauline->lc,marie->identity);
|
||||
|
||||
/*the server is expected to send a push notification to marie, this will wake up linphone, that will reconnect:*/
|
||||
linphone_core_set_network_reachable(marie->lc,TRUE);
|
||||
|
||||
/*Marie shall receive the call immediately*/
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallIncomingReceived,1,1000));
|
||||
/*pauline should hear ringback as well*/
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,1000));
|
||||
|
||||
/*marie accepts the call*/
|
||||
linphone_core_accept_call(marie->lc,linphone_core_get_current_call(marie->lc));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallConnected,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,1,1000));
|
||||
|
||||
liblinphone_tester_check_rtcp(pauline,marie);
|
||||
|
||||
linphone_core_terminate_call(pauline->lc,linphone_core_get_current_call(pauline->lc));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000));
|
||||
|
||||
linphone_core_manager_destroy(pauline);
|
||||
linphone_core_manager_destroy(marie);
|
||||
ms_list_free(lcs);
|
||||
}
|
||||
|
||||
static void call_forking_with_push_notification_multiple(void){
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc_tcp");
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager* marie2 = linphone_core_manager_new( "marie_rc");
|
||||
|
||||
MSList* lcs=ms_list_append(NULL,pauline->lc);
|
||||
|
||||
lcs=ms_list_append(lcs,marie->lc);
|
||||
lcs=ms_list_append(lcs,marie2->lc);
|
||||
|
||||
linphone_core_set_user_agent(marie->lc,"Natted Linphone",NULL);
|
||||
linphone_core_set_user_agent(marie2->lc,"Natted Linphone",NULL);
|
||||
linphone_core_set_user_agent(pauline->lc,"Natted Linphone",NULL);
|
||||
|
||||
/*unfortunately marie gets unreachable due to crappy 3G operator or iOS bug...*/
|
||||
linphone_core_set_network_reachable(marie2->lc,FALSE);
|
||||
|
||||
linphone_core_invite_address(pauline->lc,marie->identity);
|
||||
|
||||
/*marie1 will ring*/
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallIncomingReceived,1,1000));
|
||||
/*pauline should hear ringback as well*/
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,1000));
|
||||
|
||||
/*the server is expected to send a push notification to marie2, this will wake up linphone, that will reconnect:*/
|
||||
linphone_core_set_network_reachable(marie2->lc,TRUE);
|
||||
|
||||
/*Marie shall receive the call immediately*/
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallIncomingReceived,1,1000));
|
||||
|
||||
/*marie2 accepts the call*/
|
||||
linphone_core_accept_call(marie2->lc,linphone_core_get_current_call(marie2->lc));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallConnected,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallStreamsRunning,1,1000));
|
||||
|
||||
/*call to marie1 should be cancelled*/
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000));
|
||||
|
||||
liblinphone_tester_check_rtcp(pauline,marie2);
|
||||
|
||||
linphone_core_terminate_call(pauline->lc,linphone_core_get_current_call(pauline->lc));
|
||||
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,1000));
|
||||
|
||||
linphone_core_manager_destroy(pauline);
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(marie2);
|
||||
}
|
||||
|
||||
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_tcp");
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
test_t flexisip_tests[] = {
|
||||
{ "Subscribe forking", subscribe_forking },
|
||||
{ "Message forking", message_forking },
|
||||
{ "Message forking with unreachable recipients", message_forking_with_unreachable_recipients },
|
||||
{ "Message forking with all recipients unreachable", message_forking_with_all_recipients_unreachable},
|
||||
{ "Call forking", call_forking },
|
||||
{ "Call forking cancelled", call_forking_cancelled },
|
||||
{ "Call forking declined globaly", call_forking_declined_globaly },
|
||||
{ "Call forking declined localy", call_forking_declined_localy },
|
||||
{ "Call forking with urgent reply", call_forking_with_urgent_reply },
|
||||
{ "Call forking with push notification (single)", call_forking_with_push_notification_single },
|
||||
{ "Call forking with push notification (multiple)", call_forking_with_push_notification_multiple },
|
||||
{ "Early-media call forking", early_media_call_forking },
|
||||
};
|
||||
|
||||
|
||||
test_suite_t flexisip_test_suite = {
|
||||
"Flexisip",
|
||||
NULL,
|
||||
NULL,
|
||||
sizeof(flexisip_tests) / sizeof(flexisip_tests[0]),
|
||||
flexisip_tests
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
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){
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
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_ */
|
||||
|
||||
|
|
|
|||
1
tester/local_tester_hosts
Normal file
1
tester/local_tester_hosts
Normal file
|
|
@ -0,0 +1 @@
|
|||
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
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
[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
|
||||
echocancellation=0 #to not overload cpu in case of VG
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
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);*/
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
[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
|
||||
echocancellation=0 #to not overload cpu in case of VG
|
||||
|
|
|
|||
47
tester/pauline_rc_tcp
Normal file
47
tester/pauline_rc_tcp
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
[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
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
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,
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
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,
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue