Commit ed4ef8a7 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Added project for tester + more linphonecore exports

parent 1721fbd0
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM">
<Configuration>Release</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{5e94a00b-b14a-4e42-8284-8cb0ef099534}</ProjectGuid>
<RootNamespace>LibLinphoneTester</RootNamespace>
<DefaultLanguage>en-US</DefaultLanguage>
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110_wp80</PlatformToolset>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v110</PlatformToolset>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v110_wp80</PlatformToolset>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PreprocessorDefinitions>_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<CompileAsWinRT>false</CompileAsWinRT>
<AdditionalUsingDirectories>$(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PreprocessorDefinitions>_USRDLL;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<CompileAsWinRT>false</CompileAsWinRT>
<AdditionalUsingDirectories>$(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<ClCompile>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_WINRT_DLL;_CRT_SECURE_NO_WARNINGS;HAVE_CU_GET_SUITE;IN_LINPHONE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<CompileAsWinRT>false</CompileAsWinRT>
<AdditionalUsingDirectories>$(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
<AdditionalIncludeDirectories>$(ProjectDir)..\..\..\..\belle-sip\include;$(ProjectDir)..\..\..\..\oRTP\include;$(ProjectDir)..\..\..\..\mediastreamer2\include;$(ProjectDIr)..\..\..\..\tunnel\include;$(ProjectDir)..\..\..\coreapi;$(ProjectDir)..\..\..\include;$(ProjectDir)..\..\..\..\cunit\build\windows\cunit\$(Platform)\$(Configuration);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<IgnoreSpecificDefaultLibraries>ole32.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<AdditionalLibraryDirectories>$(SolutionDir)$(Platform)\$(Configuration)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<ClCompile>
<PreprocessorDefinitions>_USRDLL;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<CompileAsWinRT>false</CompileAsWinRT>
<AdditionalUsingDirectories>$(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<Reference Include="Windows" Condition="'$(Platform)'=='ARM'">
<IsWinMDFile>true</IsWinMDFile>
</Reference>
<Reference Include="platform.winmd">
<IsWinMDFile>true</IsWinMDFile>
<Private>false</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\tester\call_tester.c" />
<ClCompile Include="..\..\..\tester\liblinphone_tester.c" />
<ClCompile Include="..\..\..\tester\message_tester.c" />
<ClCompile Include="..\..\..\tester\presence_tester.c" />
<ClCompile Include="..\..\..\tester\register_tester.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\tester\liblinphone_tester.h" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\cunit\build\windows\cunit\cunit.vcxproj">
<Project>{902daf1d-ebf1-4d03-b598-143500a50ab4}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\..\mediastreamer2\build\vsx\mediastreamer2\mediastreamer2\mediastreamer2.vcxproj">
<Project>{027bad0e-9179-48c1-9733-7aa7e2c2ec70}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\..\oRTP\build\vsx\oRTP\oRTP\oRTP.vcxproj">
<Project>{ffc7b532-0502-4d88-ac98-9e89071cbc97}</Project>
</ProjectReference>
<ProjectReference Include="..\LibLinphone\LibLinphone.vcxproj">
<Project>{08dd0d38-d9b5-4626-b60d-b4d76b571142}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsPhone\v$(TargetPlatformVersion)\Microsoft.Cpp.WindowsPhone.$(TargetPlatformVersion).targets" Condition="'$(Platform)'=='ARM'" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\tester\call_tester.c" />
<ClCompile Include="..\..\..\tester\liblinphone_tester.c" />
<ClCompile Include="..\..\..\tester\message_tester.c" />
<ClCompile Include="..\..\..\tester\presence_tester.c" />
<ClCompile Include="..\..\..\tester\register_tester.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\tester\liblinphone_tester.h" />
</ItemGroup>
</Project>
\ No newline at end of file
This diff is collapsed.
......@@ -117,7 +117,7 @@ LinphoneFriend * linphone_friend_new();
* @param addr a buddy address, must be a sip uri like sip:joe@sip.linphone.org
* @return a new #LinphoneFriend with \link linphone_friend_get_address() address initialized \endlink
*/
LinphoneFriend *linphone_friend_new_with_addr(const char *addr);
LINPHONE_PUBLIC LinphoneFriend *linphone_friend_new_with_addr(const char *addr);
/**
* Destructor
......@@ -137,7 +137,7 @@ int linphone_friend_set_addr(LinphoneFriend *fr, const LinphoneAddress* address)
* @param lf #LinphoneFriend object
* @return #LinphoneAddress
*/
const LinphoneAddress *linphone_friend_get_address(const LinphoneFriend *lf);
LINPHONE_PUBLIC const LinphoneAddress *linphone_friend_get_address(const LinphoneFriend *lf);
/**
* get subscription flag value
* @param lf #LinphoneFriend object
......@@ -153,7 +153,7 @@ bool_t linphone_friend_subscribes_enabled(const LinphoneFriend *lf);
* @param val if TRUE this friend will receive subscription message
*/
int linphone_friend_enable_subscribes(LinphoneFriend *fr, bool_t val);
LINPHONE_PUBLIC int linphone_friend_enable_subscribes(LinphoneFriend *fr, bool_t val);
#define linphone_friend_send_subscribe linphone_friend_enable_subscribes
/**
......@@ -179,12 +179,12 @@ LinphoneSubscribePolicy linphone_friend_get_inc_subscribe_policy(const LinphoneF
* Once the modifications are done, then the application must call
* linphone_friend_done() to commit the changes.
**/
void linphone_friend_edit(LinphoneFriend *fr);
LINPHONE_PUBLIC void linphone_friend_edit(LinphoneFriend *fr);
/**
* Commits modification made to the friend configuration.
* @param fr #LinphoneFriend object
**/
void linphone_friend_done(LinphoneFriend *fr);
LINPHONE_PUBLIC void linphone_friend_done(LinphoneFriend *fr);
......@@ -229,7 +229,7 @@ void linphone_core_interpret_friend_uri(LinphoneCore *lc, const char *uri, char
* @param lc #LinphoneCore object
* @param fr #LinphoneFriend to add
*/
void linphone_core_add_friend(LinphoneCore *lc, LinphoneFriend *fr);
LINPHONE_PUBLIC void linphone_core_add_friend(LinphoneCore *lc, LinphoneFriend *fr);
/**
* remove a friend from the buddy list
* @param lc #LinphoneCore object
......@@ -246,7 +246,7 @@ void linphone_core_reject_subscriber(LinphoneCore *lc, LinphoneFriend *lf);
* get Buddy list of LinphoneFriend
* @param lc #LinphoneCore object
* */
const MSList * linphone_core_get_friend_list(const LinphoneCore *lc);
LINPHONE_PUBLIC const MSList * linphone_core_get_friend_list(const LinphoneCore *lc);
/**
* notify all friends that have subscribed
* @param lc #LinphoneCore object
......
......@@ -29,6 +29,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "mediastreamer2/mscommon.h"
#include "ortp/ortp_srtp.h"
#ifdef LIBLINPHONE_EXPORTS
#define LINPHONE_PUBLIC __declspec(dllexport)
#else
#define LINPHONE_PUBLIC __declspec(dllimport)
#endif
/*Dirty hack, keep in sync with mediastreamer2/include/mediastream.h */
#ifndef PAYLOAD_TYPE_FLAG_CAN_RECV
#define PAYLOAD_TYPE_FLAG_CAN_RECV PAYLOAD_TYPE_USER_FLAG_1
......@@ -513,9 +519,9 @@ void __sal_op_free(SalOp *b);
/*test api*/
/*0 for no error*/
void sal_set_send_error(Sal *sal,int value);
LINPHONE_PUBLIC void sal_set_send_error(Sal *sal,int value);
/*1 for no error*/
void sal_set_recv_error(Sal *sal,int value);
LINPHONE_PUBLIC void sal_set_recv_error(Sal *sal,int value);
/*enable contact fixing*/
void sal_nat_helper_enable(Sal *sal,bool_t enable);
bool_t sal_nat_helper_enabled(Sal *sal);
......
......@@ -32,11 +32,11 @@ static int uninit(void) {
void call_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *msg){
char* to=linphone_address_as_string(linphone_call_get_call_log(call)->to);
char* from=linphone_address_as_string(linphone_call_get_call_log(call)->from);
stats* counters;
ms_message("call from [%s] to [%s], new state is [%s]",from,to,linphone_call_state_to_string(cstate));
ms_free(to);
ms_free(from);
stats* counters = (stats*)linphone_core_get_user_data(lc);
counters = (stats*)linphone_core_get_user_data(lc);
switch (cstate) {
case LinphoneCallIncomingReceived:counters->number_of_LinphoneCallIncomingReceived++;break;
case LinphoneCallOutgoingInit :counters->number_of_LinphoneCallOutgoingInit++;break;
......@@ -63,12 +63,12 @@ void call_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState
void linphone_transfer_state_changed(LinphoneCore *lc, LinphoneCall *transfered, LinphoneCallState new_call_state) {
char* to=linphone_address_as_string(linphone_call_get_call_log(transfered)->to);
char* from=linphone_address_as_string(linphone_call_get_call_log(transfered)->from);
stats* counters;
ms_message("Transferred call from [%s] to [%s], new state is [%s]",from,to,linphone_call_state_to_string(new_call_state));
ms_free(to);
ms_free(from);
stats* counters = (stats*)linphone_core_get_user_data(lc);
counters = (stats*)linphone_core_get_user_data(lc);
switch (new_call_state) {
case LinphoneCallOutgoingInit :counters->number_of_LinphoneTransferCallOutgoingInit++;break;
case LinphoneCallOutgoingProgress :counters->number_of_LinphoneTransfertCallOutgoingProgress++;break;
......@@ -83,19 +83,21 @@ void linphone_transfer_state_changed(LinphoneCore *lc, LinphoneCall *transfered,
static void linphone_call_cb(LinphoneCall *call,void * user_data) {
char* to=linphone_address_as_string(linphone_call_get_call_log(call)->to);
char* from=linphone_address_as_string(linphone_call_get_call_log(call)->from);
stats* counters;
LinphoneCore* lc=(LinphoneCore*)user_data;
ms_message("call from [%s] to [%s] receive iFrame",from,to);
ms_free(to);
ms_free(from);
stats* counters = (stats*)linphone_core_get_user_data(lc);
counters = (stats*)linphone_core_get_user_data(lc);
counters->number_of_IframeDecoded++;
}
static bool_t call(LinphoneCoreManager* caller_mgr,LinphoneCoreManager* callee_mgr) {
LinphoneProxyConfig* proxy;
linphone_core_get_default_proxy(callee_mgr->lc,&proxy);
int retry=0;
stats initial_caller=caller_mgr->stat;
stats initial_callee=callee_mgr->stat;
LinphoneAddress* identity;
linphone_core_get_default_proxy(callee_mgr->lc,&proxy);
CU_ASSERT_PTR_NOT_NULL_FATAL(proxy);
......@@ -126,7 +128,7 @@ static bool_t call(LinphoneCoreManager* caller_mgr,LinphoneCoreManager* callee_m
linphone_core_get_default_proxy(caller_mgr->lc,&proxy);
CU_ASSERT_PTR_NOT_NULL_FATAL(proxy);
LinphoneAddress* identity = linphone_address_new(linphone_proxy_config_get_identity(proxy));
identity = linphone_address_new(linphone_proxy_config_get_identity(proxy));
CU_ASSERT_TRUE(linphone_address_weak_equal(identity,linphone_core_get_current_call_remote_address(callee_mgr->lc)));
linphone_address_destroy(identity);
......@@ -148,7 +150,8 @@ static void simple_call() {
LinphoneCore* lc_pauline=pauline->lc;
stats* stat_marie=&marie->stat;
stats* stat_pauline=&pauline->stat;
LinphoneProxyConfig* proxy;
LinphoneAddress* identity;
linphone_core_invite(lc_marie,"pauline");
......@@ -158,10 +161,9 @@ static void simple_call() {
CU_ASSERT_EQUAL(stat_marie->number_of_LinphoneCallOutgoingProgress,1);
CU_ASSERT_TRUE_FATAL(wait_for(lc_pauline,lc_marie,&stat_marie->number_of_LinphoneCallOutgoingRinging,1));
LinphoneProxyConfig* proxy;
linphone_core_get_default_proxy(lc_marie,&proxy);
CU_ASSERT_PTR_NOT_NULL_FATAL(proxy);
LinphoneAddress* identity = linphone_address_new(linphone_proxy_config_get_identity(proxy));
identity = linphone_address_new(linphone_proxy_config_get_identity(proxy));
CU_ASSERT_TRUE(linphone_address_weak_equal(identity,linphone_core_get_current_call_remote_address(lc_pauline)));
linphone_address_destroy(identity);
......@@ -218,11 +220,11 @@ static void call_ringing_canceled() {
static void call_early_declined() {
LinphoneCoreManager* marie = linphone_core_manager_new("./tester/marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new("./tester/pauline_rc");
LinphoneCall* in_call;
LinphoneCall* out_call = linphone_core_invite(pauline->lc,"marie");
linphone_call_ref(out_call);
CU_ASSERT_TRUE_FATAL(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallIncomingReceived,1));
LinphoneCall* in_call=linphone_core_get_current_call(marie->lc);
in_call=linphone_core_get_current_call(marie->lc);
linphone_call_ref(in_call);
linphone_core_terminate_call(marie->lc,in_call);
......@@ -318,9 +320,9 @@ static void call_with_video_added() {
LinphoneCoreManager* pauline = linphone_core_manager_new("./tester/pauline_rc");
LinphoneCall* call_obj;
LinphoneVideoPolicy pauline_policy;
LinphoneCallParams* marie_params;
pauline_policy.automatically_accept=TRUE;
pauline_policy.automatically_initiate=TRUE;
LinphoneCallParams* marie_params;
CU_ASSERT_TRUE(call(pauline,marie));
......@@ -363,14 +365,14 @@ static void simple_conference() {
LinphoneCoreManager* pauline = linphone_core_manager_new("./tester/pauline_rc");
LinphoneCoreManager* laure = linphone_core_manager_new("./tester/laure_rc");
MSList* lcs=ms_list_append(NULL,marie->lc);
lcs=ms_list_append(lcs,pauline->lc);
lcs=ms_list_append(lcs,laure->lc);
LinphoneCall* marie_call_pauline;
LinphoneCall* pauline_called_by_marie;
LinphoneCall* marie_call_laure;
MSList* lcs=ms_list_append(NULL,marie->lc);
lcs=ms_list_append(lcs,pauline->lc);
lcs=ms_list_append(lcs,laure->lc);
CU_ASSERT_TRUE(call(marie,pauline));
marie_call_pauline=linphone_core_get_current_call(marie->lc);
pauline_called_by_marie=linphone_core_get_current_call(pauline->lc);
......@@ -457,14 +459,14 @@ static void simple_call_transfer() {
LinphoneCoreManager* pauline = linphone_core_manager_new("./tester/pauline_rc");
LinphoneCoreManager* laure = linphone_core_manager_new("./tester/laure_rc");
LinphoneCall* marie_call_pauline;
LinphoneCall* pauline_called_by_marie;
char* laure_identity=linphone_address_as_string(laure->identity);
MSList* lcs=ms_list_append(NULL,marie->lc);
lcs=ms_list_append(lcs,pauline->lc);
lcs=ms_list_append(lcs,laure->lc);
LinphoneCall* marie_call_pauline;
LinphoneCall* pauline_called_by_marie;
CU_ASSERT_TRUE(call(marie,pauline));
marie_call_pauline=linphone_core_get_current_call(marie->lc);
......@@ -509,15 +511,16 @@ static void call_transfer_existing_call_outgoing_call() {
LinphoneCoreManager* pauline = linphone_core_manager_new("./tester/pauline_rc");
LinphoneCoreManager* laure = linphone_core_manager_new("./tester/laure_rc");
MSList* lcs=ms_list_append(NULL,marie->lc);
const MSList* calls;
lcs=ms_list_append(lcs,pauline->lc);
lcs=ms_list_append(lcs,laure->lc);
LinphoneCall* marie_call_pauline;
LinphoneCall* pauline_called_by_marie;
LinphoneCall* marie_call_laure;
LinphoneCall* laure_called_by_marie;
LinphoneCall* lcall;
MSList* lcs=ms_list_append(NULL,marie->lc);
const MSList* calls;
lcs=ms_list_append(lcs,pauline->lc);
lcs=ms_list_append(lcs,laure->lc);
/*marie call pauline*/
CU_ASSERT_TRUE(call(marie,pauline));
......@@ -553,10 +556,10 @@ static void call_transfer_existing_call_outgoing_call() {
/*laure accept call*/
for(calls=linphone_core_get_calls(laure->lc);calls!=NULL;calls=calls->next) {
LinphoneCall* call = (LinphoneCall*)calls->data;
if (linphone_call_get_state(call) == LinphoneCallIncomingReceived) {
CU_ASSERT_EQUAL(linphone_call_get_replaced_call(call),laure_called_by_marie);
linphone_core_accept_call(laure->lc,call);
lcall = (LinphoneCall*)calls->data;
if (linphone_call_get_state(lcall) == LinphoneCallIncomingReceived) {
CU_ASSERT_EQUAL(linphone_call_get_replaced_call(lcall),laure_called_by_marie);
linphone_core_accept_call(laure->lc,lcall);
break;
}
}
......@@ -606,9 +609,11 @@ int call_test_suite () {
if (NULL == CU_add_test(pSuite, "call_srtp", call_srtp)) {
return CU_get_error();
}
#ifdef VIDEO_ENABLED
if (NULL == CU_add_test(pSuite, "call_with_video_added", call_with_video_added)) {
return CU_get_error();
}
#endif
if (NULL == CU_add_test(pSuite, "simple_conference", simple_conference)) {
return CU_get_error();
}
......
......@@ -35,8 +35,9 @@ static int uninit(void) {
}
static void core_init_test(void) {
LinphoneCoreVTable v_table;
LinphoneCore* lc;
memset (&v_table,0,sizeof(v_table));
LinphoneCore* lc = linphone_core_new(&v_table,NULL,NULL,NULL);
lc = linphone_core_new(&v_table,NULL,NULL,NULL);
CU_ASSERT_PTR_NOT_NULL_FATAL(lc);
linphone_core_destroy(lc);
}
......@@ -63,12 +64,14 @@ static stats global_stat;
void auth_info_requested(LinphoneCore *lc, const char *realm, const char *username) {
stats* counters;
LinphoneAuthInfo *info;
ms_message("Auth info requested for user id [%s] at realm [%s]\n"
,username
,realm);
stats* counters = (stats*)linphone_core_get_user_data(lc);
counters = (stats*)linphone_core_get_user_data(lc);
counters->number_of_auth_info_requested++;
LinphoneAuthInfo *info=linphone_auth_info_new(test_username,NULL,test_password,NULL,auth_domain); /*create authentication structure from identity*/
info=linphone_auth_info_new(test_username,NULL,test_password,NULL,auth_domain); /*create authentication structure from identity*/
linphone_core_add_auth_info(lc,info); /*add authentication info to LinphoneCore*/
}
......@@ -93,9 +96,10 @@ void reset_counters( stats* counters) {
LinphoneCore* configure_lc_from(LinphoneCoreVTable* v_table, const char* file,int proxy_count) {
LinphoneCore* lc;
int retry=0;
lc = linphone_core_new(v_table,NULL,file,NULL);
stats* counters;
lc = linphone_core_new(v_table,NULL,file,NULL);
linphone_core_set_user_data(lc,&global_stat);
stats* counters = (stats*)linphone_core_get_user_data(lc);
counters = (stats*)linphone_core_get_user_data(lc);
linphone_core_set_ring(lc,"./share/rings/oldphone.wav");
linphone_core_set_ringback(lc,"./share/ringback.wav");
......@@ -114,9 +118,9 @@ LinphoneCore* configure_lc_from(LinphoneCoreVTable* v_table, const char* file,in
bool_t wait_for(LinphoneCore* lc_1, LinphoneCore* lc_2,int* counter,int value) {
MSList* lcs=NULL;
bool_t result;
if (lc_1)
lcs=ms_list_append(lcs,lc_1);
bool_t result;
if (lc_2)
lcs=ms_list_append(lcs,lc_2);
result=wait_for_list(lcs,counter,value,2000);
......@@ -138,10 +142,10 @@ bool_t wait_for_list(MSList* lcs,int* counter,int value,int timeout_ms) {
static void enable_codec(LinphoneCore* lc,const char* type,int rate) {
MSList* codecs=ms_list_copy(linphone_core_get_audio_codecs(lc));
MSList* codecs_it;
PayloadType* pt;
for (codecs_it=codecs;codecs_it!=NULL;codecs_it=codecs_it->next) {
linphone_core_enable_payload_type(lc,(PayloadType*)codecs_it->data,0);
}
PayloadType* pt;
if((pt = linphone_core_find_payload_type(lc,type,rate,1))) {
linphone_core_enable_payload_type(lc,pt, 1);
}
......
......@@ -27,11 +27,12 @@ void text_message_received(LinphoneCore *lc, LinphoneChatRoom *room, const Linph
}
void message_received(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage* message) {
char* from=linphone_address_as_string(linphone_chat_message_get_from(message));
stats* counters;
ms_message("Message from [%s] is [%s] , external URL [%s]",from
,linphone_chat_message_get_text(message)
,linphone_chat_message_get_external_body_url(message));
ms_free(from);
stats* counters = (stats*)linphone_core_get_user_data(lc);
counters = (stats*)linphone_core_get_user_data(lc);
counters->number_of_LinphoneMessageReceived++;
if (linphone_chat_message_get_external_body_url(message))
counters->number_of_LinphoneMessageExtBodyReceived++;
......
......@@ -24,18 +24,20 @@
void new_subscribtion_request(LinphoneCore *lc, LinphoneFriend *lf, const char *url){
char* from=linphone_address_as_string(linphone_friend_get_address(lf));
stats* counters;
ms_message("New subscription request from [%s] url [%s]",from,url);
ms_free(from);
stats* counters = (stats*)linphone_core_get_user_data(lc);
counters = (stats*)linphone_core_get_user_data(lc);
counters->number_of_NewSubscriptionRequest++;
linphone_core_add_friend(lc,lf); /*accept subscription*/
}
void notify_presence_received(LinphoneCore *lc, LinphoneFriend * lf) {
stats* counters;
char* from=linphone_address_as_string(linphone_friend_get_address(lf));
ms_message("New Notify request from [%s] ",from);
ms_free(from);
stats* counters = (stats*)linphone_core_get_user_data(lc);
counters = (stats*)linphone_core_get_user_data(lc);
counters->number_of_NotifyReceived++;
}
......@@ -55,8 +57,9 @@ static void simple_subscribe() {
LinphoneCoreManager* marie = linphone_core_manager_new("./tester/marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new("./tester/pauline_rc");
const MSList* marie_friends = linphone_core_get_friend_list(marie->lc);
LinphoneFriend* friend;
CU_ASSERT_PTR_NOT_NULL_FATAL(marie_friends);
LinphoneFriend* friend = (LinphoneFriend*) marie_friends->data;
friend = (LinphoneFriend*) marie_friends->data;
linphone_friend_edit(friend);
linphone_friend_enable_subscribes(friend,TRUE);
linphone_friend_done(friend);
......
......@@ -29,11 +29,12 @@ static LinphoneCore* create_lc() {
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));
stats* counters = (stats*)linphone_core_get_user_data(lc);
counters = (stats*)linphone_core_get_user_data(lc);
switch (cstate) {
case LinphoneRegistrationNone:counters->number_of_LinphoneRegistrationNone++;break;
case LinphoneRegistrationProgress:counters->number_of_LinphoneRegistrationProgress++;break;
......@@ -49,19 +50,24 @@ static void register_with_refresh_base_2(LinphoneCore* lc, bool_t refresh,const
int retry=0;
LCSipTransports transport = {5070,5070,0,5071};
char* addr;
LinphoneProxyConfig* proxy_cfg;
stats* counters;
LinphoneAddress *from;
const char* server_addr;
LinphoneAuthInfo *info;
CU_ASSERT_PTR_NOT_NULL_FATAL(lc);
stats* counters = (stats*)linphone_core_get_user_data(lc);
counters = (stats*)linphone_core_get_user_data(lc);
reset_counters(counters);
linphone_core_set_sip_transports(lc,&transport);
LinphoneProxyConfig* proxy_cfg;
proxy_cfg = linphone_proxy_config_new();
LinphoneAddress *from = create_linphone_address(domain);
from = create_linphone_address(domain);
linphone_proxy_config_set_identity(proxy_cfg,addr=linphone_address_as_string(from));
ms_free(addr);
const char* server_addr = linphone_address_get_domain(from);
server_addr = linphone_address_get_domain(from);
linphone_proxy_config_enable_register(proxy_cfg,TRUE);
linphone_proxy_config_expires(proxy_cfg,1);
......@@ -79,7 +85,7 @@ static void register_with_refresh_base_2(LinphoneCore* lc, bool_t refresh,const
while (counters->number_of_LinphoneRegistrationOk<1+(refresh!=0) && retry++ <310) {
linphone_core_iterate(lc);
if (counters->number_of_auth_info_requested>0 && late_auth_info) {
LinphoneAuthInfo *info=linphone_auth_info_new(test_username,NULL,test_password,NULL,auth_domain); /*create authentication structure from identity*/
info=linphone_auth_info_new(test_username,NULL,test_password,NULL,auth_domain); /*create authentication structure from identity*/
linphone_core_add_auth_info(lc,info); /*add authentication info to LinphoneCore*/
}
ms_usleep(100000);
......@@ -149,22 +155,25 @@ static void simple_auth_register_with_refresh() {
static void simple_tcp_register(){
char route[256];
LinphoneCore* lc;
sprintf(route,"sip:%s;transport=tcp",test_domain);
LinphoneCore* lc = create_lc();
lc = create_lc();
register_with_refresh(lc,FALSE,NULL,route);
}
static void simple_tls_register(){
char route[256];
LinphoneCore* lc;
sprintf(route,"sip:%s;transport=tls",test_domain);
LinphoneCore* lc = create_lc();
lc = create_lc();
register_with_refresh(lc,FALSE,NULL,route);
}
static void simple_authenticated_register(){
stats* counters;
LinphoneCore* lc = create_lc();
LinphoneAuthInfo *info=linphone_auth_info_new(test_username,NULL,test_password,NULL,auth_domain); /*create authentication structure from identity*/
linphone_core_add_auth_info(lc,info); /*add authentication info to LinphoneCore*/
stats* counters = (stats*)linphone_core_get_user_data(lc);
counters = (stats*)linphone_core_get_user_data(lc);
register_with_refresh(lc,FALSE,auth_domain,NULL);
CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,0);
}
......@@ -173,21 +182,23 @@ static void authenticated_register_with_no_initial_credentials(){
LinphoneCoreVTable v_table;
LinphoneCore* lc;
stats stat;
stats* counters;
memset (&v_table,0,sizeof(v_table));
v_table.registration_state_changed=registration_state_changed;
v_table.auth_info_requested=auth_info_requested;
lc = linphone_core_new(&v_table,NULL,NULL,NULL);
lc = linphone_core_new(&v_table,NULL,NULL,NULL);
linphone_core_set_user_data(lc,&stat);
stats* counters = (stats*)linphone_core_get_user_data(lc);
counters= (stats*)linphone_core_get_user_data(lc);
counters->number_of_auth_info_requested=0;
register_with_refresh(lc,FALSE,auth_domain,NULL);
CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,1);
}
static void auth_info_requested2(LinphoneCore *lc, const char *realm, const char *username) {
stats* counters;
ms_message("Auth info requested for user id [%s] at realm [%s]\n"
,username
,realm);
stats* counters = (stats*)linphone_core_get_user_data(lc);
counters = (stats*)linphone_core_get_user_data(lc);
counters->number_of_auth_info_requested++;
}
......@@ -195,12 +206,13 @@ static void authenticated_register_with_late_credentials(){
LinphoneCoreVTable v_table;
LinphoneCore* lc;
stats stat;
stats* counters;
memset (&v_table,0,sizeof(v_table));
v_table.registration_state_changed=registration_state_changed;
v_table.auth_info_requested=auth_info_requested2;
lc = linphone_core_new(&v_table,NULL,NULL,NULL);
linphone_core_set_user_data(lc,&stat);
stats* counters = (stats*)linphone_core_get_user_data(lc);
counters = (stats*)linphone_core_get_user_data(lc);
register_with_refresh_base_2(lc,FALSE,auth_domain,NULL,TRUE);
CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,1);
linphone_core_destroy(lc);
......
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