Commit 33e77fda authored by Nicolas Michon's avatar Nicolas Michon

Feature/groupchat benchmark

parent a556d959
......@@ -147,6 +147,8 @@ set(RC_FILES
rcfiles/stun_rc
rcfiles/zero_length_params_rc
rcfiles/marie_bodyless_rc
rcfiles/groupchat_rc
rcfiles/groupchat_lime_x3dh_rc
)
set(IMAGE_FILES
......@@ -236,15 +238,31 @@ if(APPLE)
endif()
endif()
set(GROUP_CHAT_BENCHMARK_SOURCE_C
accountmanager.c
tester.c
group_chat_tester.c
group_chat_benchmark.c
)
set(GROUP_CHAT_BENCHMARK_HEADERS
liblinphone_tester.h
tools/tester.h
)
# TODO: Remove me later!
list(REMOVE_ITEM STRICT_OPTIONS_CPP "-Wconversion" "-Werror=conversion" "-Wcast-align" "-Werror=cast-align")
if (ANDROID AND CMAKE_C_COMPILER_ID STREQUAL "GNU") #restrict to Android as it seems to break reguler linux
list (APPEND STRICT_OPTIONS_C "-std=c99")
endif()
bc_apply_compile_flags(SOURCE_FILES_C STRICT_OPTIONS_CPP STRICT_OPTIONS_C)
bc_apply_compile_flags(SOURCE_FILES_CXX STRICT_OPTIONS_CPP STRICT_OPTIONS_CXX)
bc_apply_compile_flags(SOURCE_FILES_OBJC STRICT_OPTIONS_CPP STRICT_OPTIONS_OBJC)
bc_apply_compile_flags(GROUP_CHAT_BENCHMARK_SOURCE_C STRICT_OPTIONS_CPP STRICT_OPTIONS_C)
add_definitions("-DLINPHONE_TESTER")
if(MSVC)
......@@ -341,6 +359,21 @@ if(NOT ANDROID AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
add_executable(groupchat_benchmark ${GROUP_CHAT_BENCHMARK_HEADERS} ${GROUP_CHAT_BENCHMARK_SOURCE_C})
set_target_properties(groupchat_benchmark PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}")
set_target_properties(groupchat_benchmark PROPERTIES LINKER_LANGUAGE CXX)
set_target_properties(groupchat_benchmark PROPERTIES C_STANDARD 99)
target_include_directories(groupchat_benchmark PUBLIC ${BCTOOLBOX_TESTER_INCLUDE_DIRS})
target_link_libraries(groupchat_benchmark ${LINPHONE_LIBS_FOR_TOOLS} ${OTHER_LIBS_FOR_TESTER})
install(TARGETS groupchat_benchmark
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
endif()
install(FILES ${CERTIFICATE_ALT_FILES} DESTINATION "${CMAKE_INSTALL_DATADIR}/liblinphone_tester/certificates/altname")
install(FILES ${CERTIFICATE_CLIENT_FILES} DESTINATION "${CMAKE_INSTALL_DATADIR}/liblinphone_tester/certificates/client")
......
This diff is collapsed.
......@@ -19,13 +19,6 @@
#include "liblinphone_tester.h"
#include "tester_utils.h"
void dtmf_received(LinphoneCore *lc, LinphoneCall *call, int dtmf) {
stats* counters = get_stats(lc);
char** dst = &counters->dtmf_list_received;
*dst = *dst ? ms_strcat_printf(*dst, "%c", dtmf) : ms_strdup_printf("%c", dtmf);
counters->dtmf_count++;
}
void send_dtmf_base(LinphoneCoreManager **pmarie, LinphoneCoreManager **ppauline, bool_t use_rfc2833, bool_t use_sipinfo, char dtmf, char* dtmf_seq, bool_t use_opus) {
char* expected = NULL;
int dtmf_count_prev;
......
......@@ -24,8 +24,8 @@
#include "liblinphone_tester.h"
#include "tester_utils.h"
static const char *subscribe_content="<somexml>blabla</somexml>";
static const char *notify_content="<somexml2>blabla</somexml2>";
static const char *subscribe_content="<somexml>blabla</somexml>";
const char *liblinphone_tester_get_subscribe_content(void){
return subscribe_content;
......@@ -35,102 +35,6 @@ 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){
LinphoneCoreManager *mgr;
const char * ua = linphone_event_get_custom_header(lev, "User-Agent");
if (!BC_ASSERT_PTR_NOT_NULL(content)) return;
if (!linphone_content_is_multipart(content) && (!ua || !strstr(ua, "flexisip"))) { /*disable check for full presence server support*/
/*hack to disable content checking for list notify */
BC_ASSERT_STRING_EQUAL(linphone_content_get_string_buffer(content), notify_content);
}
mgr = get_manager(lc);
mgr->stat.number_of_NotifyReceived++;
}
void linphone_subscribe_received(LinphoneCore *lc, LinphoneEvent *lev, const char *eventname, const LinphoneContent *content) {
LinphoneCoreManager *mgr = get_manager(lc);
if (!mgr->decline_subscribe)
linphone_event_accept_subscription(lev);
else
linphone_event_deny_subscription(lev, LinphoneReasonDeclined);
}
void linphone_subscription_state_change(LinphoneCore *lc, LinphoneEvent *lev, LinphoneSubscriptionState state) {
stats* counters = get_stats(lc);
LinphoneCoreManager *mgr=get_manager(lc);
LinphoneContent* content;
const LinphoneAddress* from_addr = linphone_event_get_from(lev);
char* from = linphone_address_as_string(from_addr);
content = linphone_core_create_content(lc);
linphone_content_set_type(content,"application");
linphone_content_set_subtype(content,"somexml2");
linphone_content_set_buffer(content,(const uint8_t *)notify_content,strlen(notify_content));
ms_message("Subscription state [%s] from [%s]",linphone_subscription_state_to_string(state),from);
ms_free(from);
switch(state){
case LinphoneSubscriptionNone:
break;
case LinphoneSubscriptionIncomingReceived:
counters->number_of_LinphoneSubscriptionIncomingReceived++;
mgr->lev=lev;
break;
case LinphoneSubscriptionOutgoingProgress:
counters->number_of_LinphoneSubscriptionOutgoingProgress++;
break;
case LinphoneSubscriptionPending:
counters->number_of_LinphoneSubscriptionPending++;
break;
case LinphoneSubscriptionActive:
counters->number_of_LinphoneSubscriptionActive++;
if (linphone_event_get_subscription_dir(lev)==LinphoneSubscriptionIncoming){
mgr->lev=lev;
if(strcmp(linphone_event_get_name(lev), "conference") == 0) {
// TODO : Get LocalConfEventHandler and call handler->subscribeReceived(lev)
} else {
linphone_event_notify(lev,content);
}
}
break;
case LinphoneSubscriptionTerminated:
counters->number_of_LinphoneSubscriptionTerminated++;
mgr->lev=NULL;
break;
case LinphoneSubscriptionError:
counters->number_of_LinphoneSubscriptionError++;
mgr->lev=NULL;
break;
case LinphoneSubscriptionExpiring:
counters->number_of_LinphoneSubscriptionExpiring++;
mgr->lev=NULL;
break;
}
linphone_content_unref(content);
}
void linphone_publish_state_changed(LinphoneCore *lc, LinphoneEvent *ev, LinphonePublishState state){
stats* counters = get_stats(lc);
const LinphoneAddress* from_addr = linphone_event_get_from(ev);
char* from = linphone_address_as_string(from_addr);
ms_message("Publish state [%s] from [%s]",linphone_publish_state_to_string(state),from);
ms_free(from);
switch(state){
case LinphonePublishProgress: counters->number_of_LinphonePublishProgress++; break;
case LinphonePublishOk:
/*make sure custom header access API is working*/
BC_ASSERT_PTR_NOT_NULL(linphone_event_get_custom_header(ev,"From"));
counters->number_of_LinphonePublishOk++;
break;
case LinphonePublishError: counters->number_of_LinphonePublishError++; break;
case LinphonePublishExpiring: counters->number_of_LinphonePublishExpiring++; break;
case LinphonePublishCleared: counters->number_of_LinphonePublishCleared++;break;
default:
break;
}
}
static void subscribe_test_declined(void) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc");
......
This diff is collapsed.
......@@ -73,7 +73,11 @@ static void chat_room_participant_device_added (LinphoneChatRoom *cr, const Linp
static void chat_room_state_changed (LinphoneChatRoom *cr, LinphoneChatRoomState newState) {
LinphoneCore *core = linphone_chat_room_get_core(cr);
LinphoneCoreManager *manager = (LinphoneCoreManager *)linphone_core_get_user_data(core);
ms_message("ChatRoom [%p] state changed: %d", cr, newState);
const LinphoneAddress *addr = linphone_chat_room_get_conference_address(cr);
if (addr) {
ms_message("ChatRoom [%s] state changed: %d", linphone_address_as_string(addr), newState);
}
switch (newState) {
case LinphoneChatRoomStateNone:
break;
......@@ -138,7 +142,7 @@ static void chat_room_conference_joined (LinphoneChatRoom *cr, const LinphoneEve
manager->stat.number_of_LinphoneChatRoomConferenceJoined++;
}
static void core_chat_room_state_changed (LinphoneCore *core, LinphoneChatRoom *cr, LinphoneChatRoomState state) {
void core_chat_room_state_changed (LinphoneCore *core, LinphoneChatRoom *cr, LinphoneChatRoomState state) {
if (state == LinphoneChatRoomStateInstantiated) {
LinphoneChatRoomCbs *cbs = linphone_factory_create_chat_room_cbs(linphone_factory_get());
linphone_chat_room_cbs_set_is_composing_received(cbs, chat_room_is_composing_received);
......@@ -156,7 +160,7 @@ static void core_chat_room_state_changed (LinphoneCore *core, LinphoneChatRoom *
}
}
static void configure_core_for_conference (LinphoneCore *core, const char* username, const LinphoneAddress *factoryAddr, bool_t server) {
void configure_core_for_conference (LinphoneCore *core, const char* username, const LinphoneAddress *factoryAddr, bool_t server) {
const char *identity = linphone_core_get_identity(core);
const char *new_username;
LinphoneAddress *addr = linphone_address_new(identity);
......@@ -176,22 +180,22 @@ static void configure_core_for_conference (LinphoneCore *core, const char* usern
linphone_core_set_linphone_specs(core, "groupchat");
}
static void _configure_core_for_conference (LinphoneCoreManager *lcm, LinphoneAddress *factoryAddr) {
void _configure_core_for_conference (LinphoneCoreManager *lcm, LinphoneAddress *factoryAddr) {
configure_core_for_conference(lcm->lc, NULL, factoryAddr, FALSE);
}
static void _configure_core_for_callbacks(LinphoneCoreManager *lcm, LinphoneCoreCbs *cbs) {
void configure_core_for_callbacks(LinphoneCoreManager *lcm, LinphoneCoreCbs *cbs) {
// Remove is-composing callback from the core, we use our own on the chat room
linphone_core_cbs_set_is_composing_received(lcm->cbs, NULL);
linphone_core_add_callbacks(lcm->lc, cbs);
linphone_core_set_user_data(lcm->lc, lcm);
}
static void _start_core(LinphoneCoreManager *lcm) {
void _start_core(LinphoneCoreManager *lcm) {
linphone_core_manager_start(lcm, TRUE);
}
static LinphoneChatMessage *_send_message(LinphoneChatRoom *chatRoom, const char *message) {
LinphoneChatMessage *_send_message(LinphoneChatRoom *chatRoom, const char *message) {
LinphoneChatMessage *msg = linphone_chat_room_create_message(chatRoom, message);
LinphoneChatMessageCbs *msgCbs = linphone_chat_message_get_callbacks(msg);
linphone_chat_message_cbs_set_msg_state_changed(msgCbs, liblinphone_tester_chat_message_msg_state_changed);
......@@ -274,14 +278,14 @@ static void _receive_file_plus_text(bctbx_list_t *coresList, LinphoneCoreManager
}
// Configure list of core manager for conference and add the listener
static bctbx_list_t * init_core_for_conference(bctbx_list_t *coreManagerList) {
bctbx_list_t * init_core_for_conference(bctbx_list_t *coreManagerList) {
LinphoneAddress *factoryAddr = linphone_address_new(sFactoryUri);
bctbx_list_for_each2(coreManagerList, (void (*)(void *, void *))_configure_core_for_conference, (void *) factoryAddr);
linphone_address_unref(factoryAddr);
LinphoneCoreCbs *cbs = linphone_factory_create_core_cbs(linphone_factory_get());
linphone_core_cbs_set_chat_room_state_changed(cbs, core_chat_room_state_changed);
bctbx_list_for_each2(coreManagerList, (void (*)(void *, void *))_configure_core_for_callbacks, (void *) cbs);
bctbx_list_for_each2(coreManagerList, (void (*)(void *, void *))configure_core_for_callbacks, (void *) cbs);
linphone_core_cbs_unref(cbs);
bctbx_list_t *coresList = NULL;
......@@ -291,11 +295,11 @@ static bctbx_list_t * init_core_for_conference(bctbx_list_t *coreManagerList) {
return coresList;
}
static void start_core_for_conference(bctbx_list_t *coreManagerList) {
void start_core_for_conference(bctbx_list_t *coreManagerList) {
bctbx_list_for_each(coreManagerList, (void (*)(void *))_start_core);
}
static LinphoneChatRoom * check_creation_chat_room_client_side(bctbx_list_t *lcs, LinphoneCoreManager *lcm, stats *initialStats, const LinphoneAddress *confAddr, const char* subject, int participantNumber, bool_t isAdmin) {
LinphoneChatRoom * check_creation_chat_room_client_side(bctbx_list_t *lcs, LinphoneCoreManager *lcm, stats *initialStats, const LinphoneAddress *confAddr, const char* subject, int participantNumber, bool_t isAdmin) {
BC_ASSERT_TRUE(wait_for_list(lcs, &lcm->stat.number_of_LinphoneChatRoomStateCreationPending, initialStats->number_of_LinphoneChatRoomStateCreationPending + 1, 3000));
BC_ASSERT_TRUE(wait_for_list(lcs, &lcm->stat.number_of_LinphoneChatRoomStateCreated, initialStats->number_of_LinphoneChatRoomStateCreated + 1, 3000));
BC_ASSERT_TRUE(wait_for_list(lcs, &lcm->stat.number_of_LinphoneChatRoomConferenceJoined, initialStats->number_of_LinphoneChatRoomConferenceJoined + 1, 3000));
......@@ -316,7 +320,7 @@ static LinphoneChatRoom * check_creation_chat_room_client_side(bctbx_list_t *lcs
return chatRoom;
}
static LinphoneChatRoom * create_chat_room_client_side_with_expected_number_of_participants(bctbx_list_t *lcs, LinphoneCoreManager *lcm, stats *initialStats, bctbx_list_t *participantsAddresses, const char* initialSubject, int expectedParticipantSize, bool_t encrypted) {
LinphoneChatRoom * create_chat_room_client_side_with_expected_number_of_participants(bctbx_list_t *lcs, LinphoneCoreManager *lcm, stats *initialStats, bctbx_list_t *participantsAddresses, const char* initialSubject, int expectedParticipantSize, bool_t encrypted) {
LinphoneChatRoom *chatRoom = linphone_core_create_client_group_chat_room_2(lcm->lc, initialSubject, FALSE, encrypted);
if (!chatRoom) return NULL;
......@@ -345,7 +349,7 @@ static LinphoneChatRoom * create_chat_room_client_side_with_expected_number_of_p
return chatRoom;
}
static LinphoneChatRoom * create_chat_room_client_side(bctbx_list_t *lcs, LinphoneCoreManager *lcm, stats *initialStats, bctbx_list_t *participantsAddresses, const char* initialSubject, bool_t encrypted) {
LinphoneChatRoom * create_chat_room_client_side(bctbx_list_t *lcs, LinphoneCoreManager *lcm, stats *initialStats, bctbx_list_t *participantsAddresses, const char* initialSubject, bool_t encrypted) {
return create_chat_room_client_side_with_expected_number_of_participants(lcs, lcm, initialStats, participantsAddresses, initialSubject, -1, encrypted);
}
......@@ -2017,7 +2021,7 @@ static void group_chat_room_add_device (void) {
linphone_address_unref(factoryAddr);
LinphoneCoreCbs *cbs = linphone_factory_create_core_cbs(linphone_factory_get());
linphone_core_cbs_set_chat_room_state_changed(cbs, core_chat_room_state_changed);
_configure_core_for_callbacks(marie2, cbs);
configure_core_for_callbacks(marie2, cbs);
linphone_core_cbs_unref(cbs);
coresList = bctbx_list_append(coresList, marie2->lc);
_start_core(marie2);
......
......@@ -306,6 +306,51 @@ int logfile_arg_func(const char *arg) {
return 0;
}
void liblinphone_tester_add_suites() {
bc_tester_add_suite(&setup_test_suite);
bc_tester_add_suite(&register_test_suite);
bc_tester_add_suite(&tunnel_test_suite);
bc_tester_add_suite(&offeranswer_test_suite);
bc_tester_add_suite(&call_test_suite);
#ifdef VIDEO_ENABLED
bc_tester_add_suite(&call_video_test_suite);
#endif // ifdef VIDEO_ENABLED
bc_tester_add_suite(&audio_bypass_suite);
bc_tester_add_suite(&multi_call_test_suite);
bc_tester_add_suite(&message_test_suite);
bc_tester_add_suite(&presence_test_suite);
bc_tester_add_suite(&presence_server_test_suite);
bc_tester_add_suite(&account_creator_test_suite);
bc_tester_add_suite(&stun_test_suite);
bc_tester_add_suite(&event_test_suite);
bc_tester_add_suite(&conference_event_test_suite);
bc_tester_add_suite(&contents_test_suite);
bc_tester_add_suite(&flexisip_test_suite);
bc_tester_add_suite(&remote_provisioning_test_suite);
bc_tester_add_suite(&quality_reporting_test_suite);
bc_tester_add_suite(&log_collection_test_suite);
bc_tester_add_suite(&player_test_suite);
bc_tester_add_suite(&dtmf_test_suite);
bc_tester_add_suite(&cpim_test_suite);
bc_tester_add_suite(&multipart_test_suite);
bc_tester_add_suite(&clonable_object_test_suite);
bc_tester_add_suite(&main_db_test_suite);
bc_tester_add_suite(&property_container_test_suite);
#ifdef VIDEO_ENABLED
bc_tester_add_suite(&video_test_suite);
#endif // ifdef VIDEO_ENABLED
bc_tester_add_suite(&multicast_call_test_suite);
bc_tester_add_suite(&proxy_config_test_suite);
#if HAVE_SIPP
bc_tester_add_suite(&complex_sip_call_test_suite);
#endif
#ifdef VCARD_ENABLED
bc_tester_add_suite(&vcard_test_suite);
#endif
bc_tester_add_suite(&group_chat_test_suite);
bc_tester_add_suite(&utils_test_suite);
}
void liblinphone_tester_init(void(*ftester_printf)(int level, const char *fmt, va_list args)) {
bctbx_init_logger(FALSE);
if (! log_file) {
......
......@@ -362,8 +362,10 @@ void linphone_core_manager_uninit(LinphoneCoreManager *mgr);
void linphone_core_manager_wait_for_stun_resolution(LinphoneCoreManager *mgr);
void linphone_core_manager_destroy(LinphoneCoreManager* mgr);
void linphone_core_manager_delete_chat_room (LinphoneCoreManager *mgr, LinphoneChatRoom *cr, bctbx_list_t *coresList);
bctbx_list_t * init_core_for_conference(bctbx_list_t *coreManagerList);
void start_core_for_conference(bctbx_list_t *coreManagerList);
void reset_counters( stats* counters);
void reset_counters(stats* counters);
void registration_state_changed(struct _LinphoneCore *lc, LinphoneProxyConfig *cfg, LinphoneRegistrationState cstate, const char *message);
void call_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *msg);
......@@ -373,6 +375,7 @@ void notify_presence_received_for_uri_or_tel(LinphoneCore *lc, LinphoneFriend *l
void message_received(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage* message);
void file_transfer_received(LinphoneChatMessage *message, const LinphoneContent* content, const LinphoneBuffer *buffer);
LinphoneBuffer * tester_file_transfer_send(LinphoneChatMessage *message, const LinphoneContent* content, size_t offset, size_t size);
LinphoneChatMessage *_send_message(LinphoneChatRoom *chatRoom, const char *message);
LinphoneBuffer * tester_memory_file_transfer_send(LinphoneChatMessage *message, const LinphoneContent* content, size_t offset, size_t size);
void file_transfer_progress_indication(LinphoneChatMessage *message, const LinphoneContent* content, size_t offset, size_t total);
void is_composing_received(LinphoneCore *lc, LinphoneChatRoom *room);
......@@ -420,6 +423,8 @@ 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_chat_message_msg_state_changed(LinphoneChatMessage *msg, LinphoneChatMessageState state);
void core_chat_room_state_changed (LinphoneCore *core, LinphoneChatRoom *cr, LinphoneChatRoomState state);
void liblinphone_tester_check_rtcp(LinphoneCoreManager* caller, LinphoneCoreManager* callee);
void liblinphone_tester_clock_start(MSTimeSpec *start);
bool_t liblinphone_tester_clock_elapsed(const MSTimeSpec *start, int value_ms);
......@@ -427,6 +432,7 @@ void linphone_core_manager_check_accounts(LinphoneCoreManager *m);
void account_manager_destroy(void);
LinphoneAddress *account_manager_get_identity_with_modified_identity(const LinphoneAddress *modified_identity);
LinphoneCore *configure_lc_from(LinphoneCoreCbs *cbs, const char *path, const char *file, void *user_data);
void configure_core_for_callbacks(LinphoneCoreManager *lcm, LinphoneCoreCbs *cbs);
void liblinphone_tester_set_next_video_frame_decoded_cb(LinphoneCall *call);
void call_paused_resumed_base(bool_t multicast,bool_t with_losses);
......@@ -442,6 +448,14 @@ void _call_with_ice_base(LinphoneCoreManager* pauline,LinphoneCoreManager* marie
int check_nb_media_starts(LinphoneCoreManager *caller, LinphoneCoreManager *callee, unsigned int caller_nb_media_starts, unsigned int callee_nb_media_starts);
void record_call(const char *filename, bool_t enableVideo, const char *video_codec);
void setup_sdp_handling(const LinphoneCallTestParams* params, LinphoneCoreManager* mgr);
LinphoneChatRoom * create_chat_room_client_side(bctbx_list_t *lcs, LinphoneCoreManager *lcm, stats *initialStats, bctbx_list_t *participantsAddresses, const char* initialSubject, bool_t encrypted);
LinphoneChatRoom * check_creation_chat_room_client_side(bctbx_list_t *lcs, LinphoneCoreManager *lcm, stats *initialStats, const LinphoneAddress *confAddr, const char* subject, int participantNumber, bool_t isAdmin);
void configure_core_for_conference (LinphoneCore *core, const char* username, const LinphoneAddress *factoryAddr, bool_t server);
void _start_core(LinphoneCoreManager *lcm);
/*
* this function return max value in the last 3 seconds*/
int linphone_core_manager_get_max_audio_down_bw(const LinphoneCoreManager *mgr);
......
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 sipv4.example.org conf.example.org subscribe.example.org x3dh.example.org http-proxy.example.org
::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
188.165.46.90 tunnel.wildcard2.linphone.org
64:ff9b::94.23.19.176 sipv4-nat64.example.org
64:ff9b::94.23.19.176 sipv4-nat64.example.org
This diff is collapsed.
......@@ -37,136 +37,11 @@ static LinphoneCoreManager* presence_linphone_core_manager_new_with_rc_name(char
ms_free(identity_char);
return mgr;
}
static LinphoneCoreManager* presence_linphone_core_manager_new(char* username) {
return presence_linphone_core_manager_new_with_rc_name(username, "empty_rc");
}
void new_subscription_requested(LinphoneCore *lc, LinphoneFriend *lf, const char *url){
stats* counters;
const LinphoneAddress *addr = linphone_friend_get_address(lf);
struct addrinfo *ai;
const char *domain;
char *ipaddr;
if (addr != NULL) {
char* from=linphone_address_as_string(addr);
ms_message("New subscription request from [%s] url [%s]",from,url);
ms_free(from);
}
counters = get_stats(lc);
counters->number_of_NewSubscriptionRequest++;
domain = linphone_address_get_domain(addr);
if (domain[0] == '['){
ipaddr = ms_strdup(domain+1);
ipaddr[strlen(ipaddr)] = '\0';
}else ipaddr = ms_strdup(domain);
ai = bctbx_ip_address_to_addrinfo(strchr(domain, ':') != NULL ? AF_INET6 : AF_INET, SOCK_DGRAM, ipaddr, 4444);
ms_free(ipaddr);
if (ai){/* this SUBSCRIBE comes from friend without registered SIP account, don't attempt to subscribe, it will fail*/
ms_message("Disabling subscription because friend has numeric host.");
linphone_friend_enable_subscribes(lf, FALSE);
bctbx_freeaddrinfo(ai);
}
linphone_core_add_friend(lc,lf); /*accept subscription*/
}
void notify_presence_received(LinphoneCore *lc, LinphoneFriend * lf) {
stats* counters;
unsigned int i;
const LinphoneAddress *addr = linphone_friend_get_address(lf);
if (addr != NULL) {
char* from=linphone_address_as_string(addr);
ms_message("New Notify request from [%s] ",from);
ms_free(from);
}
counters = get_stats(lc);
counters->number_of_NotifyPresenceReceived++;
counters->last_received_presence = linphone_friend_get_presence_model(lf);
if (linphone_presence_model_get_basic_status(counters->last_received_presence) == LinphonePresenceBasicStatusOpen) {
counters->number_of_LinphonePresenceBasicStatusOpen++;
} else if (linphone_presence_model_get_basic_status(counters->last_received_presence) == LinphonePresenceBasicStatusClosed) {
counters->number_of_LinphonePresenceBasicStatusClosed++;
} else {
ms_error("Unexpected basic status [%i]",linphone_presence_model_get_basic_status(counters->last_received_presence));
}
if (counters->last_received_presence && linphone_presence_model_get_nb_activities(counters->last_received_presence) > 0) {
for (i=0;counters->last_received_presence&&i<linphone_presence_model_get_nb_activities(counters->last_received_presence); i++) {
LinphonePresenceActivity *activity = linphone_presence_model_get_nth_activity(counters->last_received_presence, i);
switch (linphone_presence_activity_get_type(activity)) {
case LinphonePresenceActivityAppointment:
counters->number_of_LinphonePresenceActivityAppointment++; break;
case LinphonePresenceActivityAway:
counters->number_of_LinphonePresenceActivityAway++; break;
case LinphonePresenceActivityBreakfast:
counters->number_of_LinphonePresenceActivityBreakfast++; break;
case LinphonePresenceActivityBusy:
counters->number_of_LinphonePresenceActivityBusy++; break;
case LinphonePresenceActivityDinner:
counters->number_of_LinphonePresenceActivityDinner++; break;
case LinphonePresenceActivityHoliday:
counters->number_of_LinphonePresenceActivityHoliday++; break;
case LinphonePresenceActivityInTransit:
counters->number_of_LinphonePresenceActivityInTransit++; break;
case LinphonePresenceActivityLookingForWork:
counters->number_of_LinphonePresenceActivityLookingForWork++; break;
case LinphonePresenceActivityLunch:
counters->number_of_LinphonePresenceActivityLunch++; break;
case LinphonePresenceActivityMeal:
counters->number_of_LinphonePresenceActivityMeal++; break;
case LinphonePresenceActivityMeeting:
counters->number_of_LinphonePresenceActivityMeeting++; break;
case LinphonePresenceActivityOnThePhone:
counters->number_of_LinphonePresenceActivityOnThePhone++; break;
case LinphonePresenceActivityOther:
counters->number_of_LinphonePresenceActivityOther++; break;
case LinphonePresenceActivityPerformance:
counters->number_of_LinphonePresenceActivityPerformance++; break;
case LinphonePresenceActivityPermanentAbsence:
counters->number_of_LinphonePresenceActivityPermanentAbsence++; break;
case LinphonePresenceActivityPlaying:
counters->number_of_LinphonePresenceActivityPlaying++; break;
case LinphonePresenceActivityPresentation:
counters->number_of_LinphonePresenceActivityPresentation++; break;
case LinphonePresenceActivityShopping:
counters->number_of_LinphonePresenceActivityShopping++; break;
case LinphonePresenceActivitySleeping:
counters->number_of_LinphonePresenceActivitySleeping++; break;
case LinphonePresenceActivitySpectator:
counters->number_of_LinphonePresenceActivitySpectator++; break;
case LinphonePresenceActivitySteering:
counters->number_of_LinphonePresenceActivitySteering++; break;
case LinphonePresenceActivityTravel:
counters->number_of_LinphonePresenceActivityTravel++; break;
case LinphonePresenceActivityTV:
counters->number_of_LinphonePresenceActivityTV++; break;
case LinphonePresenceActivityUnknown:
counters->number_of_LinphonePresenceActivityUnknown++; break;
case LinphonePresenceActivityVacation:
counters->number_of_LinphonePresenceActivityVacation++; break;
case LinphonePresenceActivityWorking:
counters->number_of_LinphonePresenceActivityWorking++; break;
case LinphonePresenceActivityWorship:
counters->number_of_LinphonePresenceActivityWorship++; break;
}
}
} else {
if (linphone_presence_model_get_basic_status(counters->last_received_presence) == LinphonePresenceBasicStatusOpen)
counters->number_of_LinphonePresenceActivityOnline++;
else
counters->number_of_LinphonePresenceActivityOffline++;
}
}
void notify_presence_received_for_uri_or_tel(LinphoneCore *lc, LinphoneFriend *lf, const char *uri_or_tel, const LinphonePresenceModel *presence) {
stats *counters = get_stats(lc);
ms_message("Presence notification for URI or phone number [%s]", uri_or_tel);
counters->number_of_NotifyPresenceReceivedForUriOrTel++;
}
static bool_t subscribe_to_callee_presence(LinphoneCoreManager* caller_mgr,LinphoneCoreManager* callee_mgr) {
stats initial_caller=caller_mgr->stat;
stats initial_callee=callee_mgr->stat;
......
[lime]
lime_x3dh=1
#x3dh_db_path=groupchat.x3dh.sqlite3
lime_update_threshold=86400
max_nb_device_per_participant=10
allow_message_in_unsafe_chatroom=0
unsafe_if_sas_refused=1
[sip]
sip_port=-1
sip_tcp_port=-1
sip_tls_port=-1
default_proxy=0
ping_with_options=0
composing_idle_timeout=1
store_ha1_passwd=0 #used for sipp
zrtp_cache_migration_done=1
[net]
dns_srv_enabled=0 #no srv needed in general
stun_server=stun.linphone.org
[sip]
sip_port=-1
sip_tcp_port=-1
sip_tls_port=-1
default_proxy=0
ping_with_options=0
composing_idle_timeout=1
[net]
dns_srv_enabled=0 #no srv needed in general
......@@ -46,24 +46,6 @@ static LinphoneCoreManager* create_lcm(void) {
return create_lcm_with_auth(0);
}
void registration_state_changed(struct _LinphoneCore *lc, LinphoneProxyConfig *cfg, LinphoneRegistrationState cstate, const char *message){
stats* counters;
ms_message("New registration state %s for user id [%s] at proxy [%s]\n"
,linphone_registration_state_to_string(cstate)
,linphone_proxy_config_get_identity(cfg)
,linphone_proxy_config_get_addr(cfg));
counters = get_stats(lc);
switch (cstate) {
case LinphoneRegistrationNone:counters->number_of_LinphoneRegistrationNone++;break;
case LinphoneRegistrationProgress:counters->number_of_LinphoneRegistrationProgress++;break;
case LinphoneRegistrationOk:counters->number_of_LinphoneRegistrationOk++;break;
case LinphoneRegistrationCleared:counters->number_of_LinphoneRegistrationCleared++;break;
case LinphoneRegistrationFailed:counters->number_of_LinphoneRegistrationFailed++;break;
default:
BC_FAIL("unexpected event");break;
}
}
static void register_with_refresh_base_3_for_algo(
LinphoneCore* lc,
bool_t refresh,
......
......@@ -21,20 +21,6 @@
#include "liblinphone_tester.h"
#include "tester_utils.h"
void linphone_configuration_status(LinphoneCore *lc, LinphoneConfiguringState status, const char *message) {
stats* counters;
ms_message("Configuring state = %i with message %s", status, message?message:"");
counters = get_stats(lc);
if (status == LinphoneConfiguringSkipped) {
counters->number_of_LinphoneConfiguringSkipped++;
} else if (status == LinphoneConfiguringFailed) {
counters->number_of_LinphoneConfiguringFailed++;
} else if (status == LinphoneConfiguringSuccessful) {
counters->number_of_LinphoneConfiguringSuccessful++;
}
}
static void remote_provisioning_skipped(void) {
LinphoneCoreManager* marie = linphone_core_manager_new2("marie_rc", FALSE);
BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSkipped,1));
......
......@@ -65,51 +65,6 @@ static void _remove_friends_from_list(LinphoneFriendList *list, const char *frie
}
}
void _check_friend_result_list(LinphoneCore *lc, const bctbx_list_t *resultList, const unsigned int index, const char* uri, const char* phone) {
if (index >= bctbx_list_size(resultList)) {
ms_error("Attempt to access result to an outbound index");
return;
}
const LinphoneSearchResult *sr = bctbx_list_nth_data(resultList, index);
const LinphoneFriend *lf = linphone_search_result_get_friend(sr);
if (lf || linphone_search_result_get_address(sr)) {
const LinphoneAddress *la = (linphone_search_result_get_address(sr)) ?
linphone_search_result_get_address(sr) : linphone_friend_get_address(lf);
if (la) {
char* fa = linphone_address_as_string(la);
BC_ASSERT_STRING_EQUAL(fa , uri);
free(fa);
return;
} else if (phone) {
const LinphonePresenceModel *presence = linphone_friend_get_presence_model_for_uri_or_tel(lf, phone);
if (BC_ASSERT_PTR_NOT_NULL(presence)) {
char *contact = linphone_presence_model_get_contact(presence);
BC_ASSERT_STRING_EQUAL(contact, uri);
free(contact);
return;
}
}
} else {
const bctbx_list_t *callLog = linphone_core_get_call_logs(lc);
const bctbx_list_t *f;
for (f = callLog ; f != NULL ; f = bctbx_list_next(f)) {
LinphoneCallLog *log = (LinphoneCallLog*)(f->data);
const LinphoneAddress *addr = (linphone_call_log_get_dir(log) == LinphoneCallIncoming) ?
linphone_call_log_get_from_address(log) : linphone_call_log_get_to_address(log);
if (addr) {
char *addrUri = linphone_address_as_string_uri_only(addr);
if (addrUri && strcmp(addrUri, uri) == 0) {
bctbx_free(addrUri);
return;
}
if (addrUri) bctbx_free(addrUri);
}
}
}
BC_ASSERT(FALSE);
ms_error("Address NULL and Presence NULL");
}
static void _create_call_log(LinphoneCore *lc, LinphoneAddress *addrFrom, LinphoneAddress *addrTo) {
linphone_call_log_unref(
linphone_core_create_call_log(lc, addrFrom, addrTo, LinphoneCallOutgoing, 100, time(NULL), time(NULL), LinphoneCallSuccess, FALSE, 1.0)
......
This diff is collapsed.
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