Merge remote-tracking branch 'origin' into dev_codec_downloader

This commit is contained in:
Erwan Croze 2016-06-30 12:03:01 +02:00
commit 171ada8a32
46 changed files with 926 additions and 238 deletions

View file

@ -184,6 +184,11 @@ if(UNIX AND NOT APPLE)
check_include_files(libudev.h HAVE_LIBUDEV_H)
endif()
set(LINPHONE_LDFLAGS "${BELLESIP_LDFLAGS} ${MEDIASTREAMER2_LDFLAGS}")
if(BELCARD_FOUND AND APPLE)
set(LINPHONE_LDFLAGS "${LINPHONE_LDFLAGS} -stdlib=libc++")
endif()
# include_directories must be called only UNDER THIS LINE in order to use our
# projects submodules first (we do NOT want to have system headers in first position)
include_directories(

View file

@ -161,7 +161,7 @@ zip:
make gtk-cherrypick
make other-cherrypick
cp -f $(top_srcdir)/gtk/gtkrc $(INSTALLDIR_WITH_PREFIX)/.
cp -f $(top_srcdir)/README $(INSTALLDIR_WITH_PREFIX)/.
cp -f $(top_srcdir)/README.md $(INSTALLDIR_WITH_PREFIX)/.
cp -f $(top_srcdir)/COPYING $(INSTALLDIR_WITH_PREFIX)/.
cd $(INSTALLDIR_WITH_PREFIX) && zip -r $(ZIPFILE) *
@ -173,7 +173,7 @@ sdk:
# remove unwanted stuff (gtk interface)
cd $(INSTALLDIR_WITH_PREFIX) && rm -rf $(SDK_EXCLUDED)
make other-cherrypick
cp -f $(top_srcdir)/README $(INSTALLDIR_WITH_PREFIX)/.
cp -f $(top_srcdir)/README.md $(INSTALLDIR_WITH_PREFIX)/.
cp -f $(top_srcdir)/COPYING $(INSTALLDIR_WITH_PREFIX)/.
cd $(INSTALLDIR_WITH_PREFIX) && zip -r $(SDK_ZIPFILE) *

View file

@ -23,7 +23,7 @@ In order to enable generation of bundle for older MacOS version, it is recommend
##### Linphone library (liblinphone)
sudo port install automake autoconf libtool pkgconfig intltool wget cunit \
sudo port install automake autoconf libtool pkgconfig intltool wget bcunit \
antlr3 speex readline sqlite3 openldap libupnp \
ffmpeg-devel -gpl2

View file

@ -1,7 +1,12 @@
This is Linphone, a free (GPL) video softphone based on the SIP protocol.
# Warning
******************Building linphone ***********************************
Unless you exactly know what you are doing, you should take at look at [linphone-desktop](https://github.com/BelledonneCommunications/linphone-desktop).
# Otherwise…
## Building Linphone
- Install build time dependencies
- libtool
@ -59,7 +64,7 @@ For windows compilation see README.mingw.
For macOS X, see README.macos
******************************** Notes for developers *****************************
## Notes for developers
Here is a short description of the content of the source tree.

View file

@ -49,7 +49,7 @@ endif
LOCAL_STATIC_LIBRARIES := bctoolbox_tester
LOCAL_SHARED_LIBRARIES := cunit liblinphone
LOCAL_SHARED_LIBRARIES := bcunit liblinphone
include $(BUILD_SHARED_LIBRARY)
#end

View file

@ -50,7 +50,7 @@
<ItemDefinitionGroup>
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<AdditionalIncludeDirectories>$(ProjectDir)..\..\..\..\belle-sip\include;$(ProjectDir)..\..\..\oRTP\include;$(ProjectDir)..\..\..\mediastreamer2\include;$(ProjectDir)..\..\..\tester;$(ProjectDir)..\..\..\coreapi;$(ProjectDir)..\..\..\include;$(ProjectDir)..\..\..\..\cunit\build\wp8\cunit\$(Platform)\$(Configuration);$(SolutionDir)$(Platform)\$(Configuration)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir)..\..\..\..\belle-sip\include;$(ProjectDir)..\..\..\oRTP\include;$(ProjectDir)..\..\..\mediastreamer2\include;$(ProjectDir)..\..\..\tester;$(ProjectDir)..\..\..\coreapi;$(ProjectDir)..\..\..\include;$(ProjectDir)..\..\..\..\bcunit\build\wp8\bcunit\$(Platform)\$(Configuration);$(SolutionDir)$(Platform)\$(Configuration)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINDOWS;_WINRT_DLL;_CRT_SECURE_NO_WARNINGS;HAVE_CU_GET_SUITE;IN_LINPHONE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
@ -124,7 +124,7 @@
<ProjectReference Include="..\..\..\..\belle-sip\build\wp8\belle-sip\belle-sip.vcxproj">
<Project>{4c225a82-800b-427b-ba7b-61686a9b347f}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\..\cunit\build\wp8\cunit\cunit.vcxproj">
<ProjectReference Include="..\..\..\..\bcunit\build\wp8\bcunit\bcunit.vcxproj">
<Project>{902daf1d-ebf1-4d03-b598-143500a50ab4}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\..\msamr\build\wp8\msamr\msamr.vcxproj">

View file

@ -2,7 +2,7 @@
#include "linphone-tester-native.h"
#include "ortp/logging.h"
#include "cunit/Util.h"
#include "bcunit/Util.h"
using namespace linphone_tester_native;
@ -52,7 +52,7 @@ static void LinphoneNativeVerboseOutputTraceHandler(OrtpLogLevel lev, const char
LinphoneNativeGenericOutputTraceHandler(lev, fmt, args);
}
static void CUnitNativeOutputTraceHandler(int lev, const char *fmt, va_list args)
static void BCUnitNativeOutputTraceHandler(int lev, const char *fmt, va_list args)
{
nativeOutputTraceHandler(Raw, fmt, args);
}
@ -87,7 +87,7 @@ void LinphoneTesterNative::run(Platform::String^ suiteName, Platform::String^ ca
} else {
linphone_core_enable_logs_with_cb(LinphoneNativeOutputTraceHandler);
}
CU_set_trace_handler(CUnitNativeOutputTraceHandler);
CU_set_trace_handler(BCUnitNativeOutputTraceHandler);
liblinphone_tester_run_tests(wssuitename == all ? 0 : csuitename, wscasename == all ? 0 : ccasename);
}

View file

@ -39,7 +39,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "speex", "..\..\..\..\speex\
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "speexdsp", "..\..\..\..\speex\build\wp8\speex\speexdsp.vcxproj", "{6BD78980-9C71-4341-8775-AD19E9EC7305}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cunit", "..\..\..\..\cunit\build\wp8\cunit\cunit.vcxproj", "{902DAF1D-EBF1-4D03-B598-143500A50AB4}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bcunit", "..\..\..\..\bcunit\build\wp8\bcunit\bcunit.vcxproj", "{902DAF1D-EBF1-4D03-B598-143500A50AB4}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmswasapi", "..\..\..\..\mswasapi\mswasapi\mswasapi.vcxproj", "{D22BD217-D0F8-4274-9B3A-F3F35F46482C}"
ProjectSection(ProjectDependencies) = postProject

View file

@ -37,21 +37,21 @@ if(MSVC)
endif()
add_executable(linphonec ${LINPHONEC_SOURCE_FILES})
target_link_libraries(linphonec linphone ${BCTOOLBOX_LIBRARIES} ${ORTP_LIBRARIES} ${MEDIASTREAMER2_LIBRARIES})
target_link_libraries(linphonec ${LINPHONE_LIBS_FOR_TOOLS} ${BCTOOLBOX_CORE_LIBRARIES} ${ORTP_LIBRARIES} ${MEDIASTREAMER2_LIBRARIES})
if(INTL_FOUND)
target_link_libraries(linphonec ${INTL_LIBRARIES})
endif()
if(WIN32)
add_executable(linphoned WIN32 ${LINPHONEC_SOURCE_FILES})
target_link_libraries(linphoned linphone ${BCTOOLBOX_LIBRARIES} ${ORTP_LIBRARIES} ${MEDIASTREAMER2_LIBRARIES})
target_link_libraries(linphoned ${LINPHONE_LIBS_FOR_TOOLS} ${BCTOOLBOX_CORE_LIBRARIES} ${ORTP_LIBRARIES} ${MEDIASTREAMER2_LIBRARIES})
if(INTL_FOUND)
target_link_libraries(linphoned ${INTL_LIBRARIES})
endif()
endif()
add_executable(linphonecsh ${LINPHONECSH_SOURCE_FILES})
target_link_libraries(linphonecsh linphone ${ORTP_LIBRARIES})
target_link_libraries(linphonecsh ${LINPHONE_LIBS_FOR_TOOLS} ${ORTP_LIBRARIES})
set(INSTALL_TARGETS linphonec linphonecsh)
if(WIN32)

View file

@ -220,8 +220,8 @@ if(ENABLE_SHARED)
if(BELCARD_FOUND)
if(APPLE)
set_target_properties(linphone PROPERTIES LINK_FLAGS "-stdlib=libc++")
endif()
set_target_properties(linphone PROPERTIES LINK_FLAGS "-stdlib=libc++")
endif()
endif()
set_target_properties(linphone PROPERTIES LINKER_LANGUAGE CXX)

View file

@ -102,16 +102,20 @@ static int find_matching_friend(LinphoneFriend *lf1, LinphoneFriend *lf2) {
}
static void linphone_carddav_response_free(LinphoneCardDavResponse *response) {
if (response->etag) ms_free(response->etag);
if (response->url) ms_free(response->url);
if (response->vcard) ms_free(response->vcard);
ms_free(response);
}
static void linphone_carddav_vcards_pulled(LinphoneCardDavContext *cdc, bctbx_list_t *vCards) {
bctbx_list_t *vCards_remember = vCards;
if (vCards != NULL && bctbx_list_size(vCards) > 0) {
bctbx_list_t *friends = cdc->friend_list->friends;
while (vCards) {
LinphoneCardDavResponse *vCard = (LinphoneCardDavResponse *)vCards->data;
if (vCard) {
LinphoneVcard *lvc = linphone_vcard_new_from_vcard4_buffer(vCard->vcard);
LinphoneVcard *lvc = linphone_vcard_new_from_vcard4_buffer(cdc->friend_list->lc->vcard_context, vCard->vcard);
LinphoneFriend *lf = NULL;
bctbx_list_t *local_friend = NULL;
@ -158,7 +162,7 @@ static void linphone_carddav_vcards_pulled(LinphoneCardDavContext *cdc, bctbx_li
}
vCards = bctbx_list_next(vCards);
}
bctbx_list_free_with_data(vCards, (void (*)(void *))linphone_carddav_response_free);
bctbx_list_free_with_data(vCards_remember, (void (*)(void *))linphone_carddav_response_free);
}
linphone_carddav_server_to_client_sync_done(cdc, TRUE, NULL);
}
@ -190,6 +194,9 @@ static bctbx_list_t* parse_vcards_from_xml_response(const char *body) {
response->vcard = ms_strdup(vcard);
result = bctbx_list_append(result, response);
ms_debug("Added vCard object with eTag %s, URL %s and vCard %s", etag, url, vcard);
linphone_free_xml_text_content(etag);
linphone_free_xml_text_content(url);
linphone_free_xml_text_content(vcard);
}
}
}
@ -281,6 +288,8 @@ static bctbx_list_t* parse_vcards_etags_from_xml_response(const char *body) {
response->url = ms_strdup(url);
result = bctbx_list_append(result, response);
ms_debug("Added vCard object with eTag %s and URL %s", etag, url);
linphone_free_xml_text_content(etag);
linphone_free_xml_text_content(url);
}
}
}
@ -337,6 +346,13 @@ static void linphone_carddav_query_free(LinphoneCardDavQuery *query) {
// Context will be freed later (in sync_done)
query->context = NULL;
if (query->url) {
ms_free(query->url);
}
if (query->body) {
ms_free(query->body);
}
ms_free(query);
}
@ -398,7 +414,7 @@ static void process_response_from_carddav_request(void *data, const belle_http_r
// We need to do a GET on the vCard to get the correct one
bctbx_list_t *vcard = NULL;
LinphoneCardDavResponse *response = (LinphoneCardDavResponse *)ms_new0(LinphoneCardDavResponse, 1);
response->url = linphone_vcard_get_url(lvc);
response->url = ms_strdup(linphone_vcard_get_url(lvc));
vcard = bctbx_list_append(vcard, response);
linphone_carddav_pull_vcards(query->context, vcard);
bctbx_list_free_with_data(vcard, (void (*)(void *))linphone_carddav_response_free);
@ -545,9 +561,9 @@ static LinphoneCardDavQuery* linphone_carddav_create_put_query(LinphoneCardDavCo
query->context = cdc;
query->depth = NULL;
query->ifmatch = linphone_vcard_get_etag(lvc);
query->body = linphone_vcard_as_vcard4_string(lvc);
query->body = ms_strdup(linphone_vcard_as_vcard4_string(lvc));
query->method = "PUT";
query->url = linphone_vcard_get_url(lvc);
query->url = ms_strdup(linphone_vcard_get_url(lvc));
query->type = LinphoneCardDavQueryTypePut;
return query;
}
@ -619,7 +635,7 @@ static LinphoneCardDavQuery* linphone_carddav_create_delete_query(LinphoneCardDa
query->ifmatch = linphone_vcard_get_etag(lvc);
query->body = NULL;
query->method = "DELETE";
query->url = linphone_vcard_get_url(lvc);
query->url = ms_strdup(linphone_vcard_get_url(lvc));
query->type = LinphoneCardDavQueryTypeDelete;
return query;
}
@ -687,9 +703,9 @@ static LinphoneCardDavQuery* linphone_carddav_create_propfind_query(LinphoneCard
query->context = cdc;
query->depth = "0";
query->ifmatch = NULL;
query->body = "<d:propfind xmlns:d=\"DAV:\" xmlns:cs=\"http://calendarserver.org/ns/\"><d:prop><cs:getctag /></d:prop></d:propfind>";
query->body = ms_strdup("<d:propfind xmlns:d=\"DAV:\" xmlns:cs=\"http://calendarserver.org/ns/\"><d:prop><cs:getctag /></d:prop></d:propfind>");
query->method = "PROPFIND";
query->url = cdc->friend_list->uri;
query->url = ms_strdup(cdc->friend_list->uri);
query->type = LinphoneCardDavQueryTypePropfind;
return query;
}
@ -704,9 +720,9 @@ static LinphoneCardDavQuery* linphone_carddav_create_addressbook_query(LinphoneC
query->context = cdc;
query->depth = "1";
query->ifmatch = NULL;
query->body = "<card:addressbook-query xmlns:d=\"DAV:\" xmlns:card=\"urn:ietf:params:xml:ns:carddav\"><d:prop><d:getetag /></d:prop><card:filter></card:filter></card:addressbook-query>";
query->body = ms_strdup("<card:addressbook-query xmlns:d=\"DAV:\" xmlns:card=\"urn:ietf:params:xml:ns:carddav\"><d:prop><d:getetag /></d:prop><card:filter></card:filter></card:addressbook-query>");
query->method = "REPORT";
query->url = cdc->friend_list->uri;
query->url = ms_strdup(cdc->friend_list->uri);
query->type = LinphoneCardDavQueryTypeAddressbookQuery;
return query;
}
@ -725,7 +741,7 @@ static LinphoneCardDavQuery* linphone_carddav_create_addressbook_multiget_query(
query->depth = "1";
query->ifmatch = NULL;
query->method = "REPORT";
query->url = cdc->friend_list->uri;
query->url = ms_strdup(cdc->friend_list->uri);
query->type = LinphoneCardDavQueryTypeAddressbookMultiget;
sprintf(body, "%s", "<card:addressbook-multiget xmlns:d=\"DAV:\" xmlns:card=\"urn:ietf:params:xml:ns:carddav\"><d:prop><d:getetag /><card:address-data content-type='text/vcard' version='4.0'/></d:prop>");
@ -734,11 +750,11 @@ static LinphoneCardDavQuery* linphone_carddav_create_addressbook_multiget_query(
if (response) {
char temp_body[300];
snprintf(temp_body, sizeof(temp_body), "<d:href>%s</d:href>", response->url);
sprintf(body, "%s%s", body, temp_body);
strcat(body, temp_body);
iterator = bctbx_list_next(iterator);
}
}
sprintf(body, "%s%s", body, "</card:addressbook-multiget>");
strcat(body, "</card:addressbook-multiget>");
query->body = ms_strdup(body);
ms_free(body);

View file

@ -470,7 +470,7 @@ void _linphone_chat_room_send_message(LinphoneChatRoom *cr, LinphoneChatMessage
if (call && call->op == op) {
/*In this case, chat delivery status is not notified, so unrefing chat message right now*/
/*Might be better fixed by delivering status, but too costly for now*/
msg->chat_room->transient_messages = ms_list_remove(msg->chat_room->transient_messages, msg);
msg->chat_room->transient_messages = bctbx_list_remove(msg->chat_room->transient_messages, msg);
linphone_chat_message_unref(msg);
linphone_chat_message_unref(msg);
return;

View file

@ -218,9 +218,11 @@ int linphone_friend_set_address(LinphoneFriend *lf, const LinphoneAddress *addr)
if (lf->uri != NULL) linphone_address_unref(lf->uri);
lf->uri = fr;
vcard = linphone_friend_get_vcard(lf);
vcard = lf->vcard;
if (vcard) {
linphone_vcard_edit_main_sip_address(vcard, linphone_address_as_string_uri_only(fr));
char *address = linphone_address_as_string_uri_only(fr);
linphone_vcard_edit_main_sip_address(vcard, address);
ms_free(address);
}
return 0;
@ -228,6 +230,8 @@ int linphone_friend_set_address(LinphoneFriend *lf, const LinphoneAddress *addr)
void linphone_friend_add_address(LinphoneFriend *lf, const LinphoneAddress *addr) {
LinphoneVcard *vcard = NULL;
char *address = NULL;
if (!lf || !addr) {
return;
}
@ -237,12 +241,14 @@ void linphone_friend_add_address(LinphoneFriend *lf, const LinphoneAddress *addr
lf->uri = fr;
}
vcard = linphone_friend_get_vcard(lf);
vcard = lf->vcard;
if (!vcard) {
return;
}
linphone_vcard_add_sip_address(vcard, linphone_address_as_string_uri_only(addr));
address = linphone_address_as_string_uri_only(addr);
linphone_vcard_add_sip_address(vcard, address);
ms_free(address);
}
bctbx_list_t* linphone_friend_get_addresses(LinphoneFriend *lf) {
@ -255,7 +261,7 @@ bctbx_list_t* linphone_friend_get_addresses(LinphoneFriend *lf) {
return NULL;
}
vcard = linphone_friend_get_vcard(lf);
vcard = lf->vcard;
if (!vcard) {
return lf->uri ? bctbx_list_append(addresses, lf->uri) : NULL;
}
@ -276,16 +282,19 @@ bctbx_list_t* linphone_friend_get_addresses(LinphoneFriend *lf) {
void linphone_friend_remove_address(LinphoneFriend *lf, const LinphoneAddress *addr) {
LinphoneVcard *vcard = NULL;
char * address = NULL;
if (!lf || !addr) {
return;
}
vcard = linphone_friend_get_vcard(lf);
vcard = lf->vcard;
if (!vcard) {
return;
}
linphone_vcard_remove_sip_address(vcard, linphone_address_as_string_uri_only(addr));
address = linphone_address_as_string_uri_only(addr);
linphone_vcard_remove_sip_address(vcard, address);
ms_free(address);
}
void linphone_friend_add_phone_number(LinphoneFriend *lf, const char *phone) {
@ -294,7 +303,7 @@ void linphone_friend_add_phone_number(LinphoneFriend *lf, const char *phone) {
return;
}
vcard = linphone_friend_get_vcard(lf);
vcard = lf->vcard;
if (!vcard) {
return;
}
@ -309,7 +318,7 @@ bctbx_list_t* linphone_friend_get_phone_numbers(LinphoneFriend *lf) {
return NULL;
}
vcard = linphone_friend_get_vcard(lf);
vcard = lf->vcard;
if (!vcard) {
return NULL;
}
@ -323,7 +332,7 @@ void linphone_friend_remove_phone_number(LinphoneFriend *lf, const char *phone)
return;
}
vcard = linphone_friend_get_vcard(lf);
vcard = lf->vcard;
if (!vcard) {
return;
}
@ -336,16 +345,18 @@ int linphone_friend_set_name(LinphoneFriend *lf, const char *name){
LinphoneVcard *vcard = NULL;
bool_t vcard_created = FALSE;
vcard = linphone_friend_get_vcard(lf);
vcard = lf->vcard;
if (!vcard) {
linphone_friend_create_vcard(lf, name);
vcard = linphone_friend_get_vcard(lf);
vcard = lf->vcard;
vcard_created = TRUE;
}
if (vcard) {
linphone_vcard_set_full_name(vcard, name);
if (fr && vcard_created) { // SIP address wasn't set yet, let's do it
linphone_vcard_edit_main_sip_address(vcard, linphone_address_as_string_uri_only(fr));
char *address = linphone_address_as_string_uri_only(fr);
linphone_vcard_edit_main_sip_address(vcard, address);
ms_free(address);
}
}
@ -442,6 +453,7 @@ static void _linphone_friend_destroy(LinphoneFriend *lf){
if (lf->uri!=NULL) linphone_address_unref(lf->uri);
if (lf->info!=NULL) buddy_info_free(lf->info);
if (lf->vcard != NULL) linphone_vcard_free(lf->vcard);
if (lf->refkey != NULL) ms_free(lf->refkey);
}
static belle_sip_error_code _linphone_friend_marshall(belle_sip_object_t *obj, char* buff, size_t buff_size, size_t *offset) {
@ -1056,14 +1068,14 @@ bool_t linphone_friend_create_vcard(LinphoneFriend *fr, const char *name) {
LinphoneFriend *linphone_friend_new_from_vcard(LinphoneVcard *vcard) {
LinphoneAddress* linphone_address = NULL;
LinphoneFriend *fr;
const char *name = NULL;
char *name = NULL;
bctbx_list_t *sipAddresses = NULL;
if (vcard == NULL) {
ms_error("Cannot create friend from null vcard");
return NULL;
}
name = linphone_vcard_get_full_name(vcard);
name = ms_strdup(linphone_vcard_get_full_name(vcard));
sipAddresses = linphone_vcard_get_sip_addresses(vcard);
fr = linphone_friend_new();
@ -1078,12 +1090,13 @@ LinphoneFriend *linphone_friend_new_from_vcard(LinphoneVcard *vcard) {
linphone_friend_set_address(fr, linphone_address);
linphone_address_unref(linphone_address);
}
ms_free(sipAddresses);
bctbx_list_free(sipAddresses);
}
fr->vcard = vcard;
if (name) {
linphone_friend_set_name(fr, name);
}
fr->vcard = vcard;
ms_free(name);
return fr;
}
@ -1237,12 +1250,13 @@ static int create_friend_list(void *data, int argc, char **argv, char **colName)
* | 9 | presence_received
*/
static int create_friend(void *data, int argc, char **argv, char **colName) {
bctbx_list_t **list = (bctbx_list_t **)data;
LinphoneVcardContext *context = (LinphoneVcardContext *)data;
bctbx_list_t **list = (bctbx_list_t **)linphone_vcard_context_get_user_data(context);
LinphoneFriend *lf = NULL;
LinphoneVcard *vcard = NULL;
unsigned int storage_id = (unsigned int)atoi(argv[0]);
vcard = linphone_vcard_new_from_vcard4_buffer(argv[6]);
vcard = linphone_vcard_new_from_vcard4_buffer(context, argv[6]);
if (vcard) {
linphone_vcard_set_etag(vcard, argv[7]);
linphone_vcard_set_url(vcard, argv[8]);
@ -1268,10 +1282,10 @@ static int create_friend(void *data, int argc, char **argv, char **colName) {
#pragma GCC diagnostic pop
#endif
static int linphone_sql_request_friend(sqlite3* db, const char *stmt, bctbx_list_t **list) {
static int linphone_sql_request_friend(sqlite3* db, const char *stmt, LinphoneVcardContext *context) {
char* errmsg = NULL;
int ret;
ret = sqlite3_exec(db, stmt, create_friend, list, &errmsg);
ret = sqlite3_exec(db, stmt, create_friend, context, &errmsg);
if (ret != SQLITE_OK) {
ms_error("linphone_sql_request: statement %s -> error sqlite3_exec(): %s.", stmt, errmsg);
sqlite3_free(errmsg);
@ -1306,6 +1320,7 @@ void linphone_core_store_friend_in_db(LinphoneCore *lc, LinphoneFriend *lf) {
char *buf;
int store_friends = lp_config_get_int(lc->config, "misc", "store_friends", 1);
LinphoneVcard *vcard = linphone_friend_get_vcard(lf);
char *address = NULL;
if (!store_friends) {
return;
@ -1321,10 +1336,11 @@ void linphone_core_store_friend_in_db(LinphoneCore *lc, LinphoneFriend *lf) {
linphone_core_store_friends_list_in_db(lc, lf->friend_list);
}
address = linphone_address_as_string(linphone_friend_get_address(lf));
if (lf->storage_id > 0) {
buf = sqlite3_mprintf("UPDATE friends SET friend_list_id=%u,sip_uri=%Q,subscribe_policy=%i,send_subscribe=%i,ref_key=%Q,vCard=%Q,vCard_etag=%Q,vCard_url=%Q,presence_received=%i WHERE (id = %u);",
lf->friend_list->storage_id,
linphone_address_as_string(linphone_friend_get_address(lf)),
address,
lf->pol,
lf->subscribe,
lf->refkey,
@ -1337,7 +1353,7 @@ void linphone_core_store_friend_in_db(LinphoneCore *lc, LinphoneFriend *lf) {
} else {
buf = sqlite3_mprintf("INSERT INTO friends VALUES(NULL,%u,%Q,%i,%i,%Q,%Q,%Q,%Q,%i);",
lf->friend_list->storage_id,
linphone_address_as_string(linphone_friend_get_address(lf)),
address,
lf->pol,
lf->subscribe,
lf->refkey,
@ -1347,6 +1363,7 @@ void linphone_core_store_friend_in_db(LinphoneCore *lc, LinphoneFriend *lf) {
lf->presence_received
);
}
ms_free(address);
linphone_sql_request_generic(lc->friends_db, buf);
sqlite3_free(buf);
@ -1432,11 +1449,13 @@ bctbx_list_t* linphone_core_fetch_friends_from_db(LinphoneCore *lc, LinphoneFrie
ms_warning("Either lc (or list) is NULL or friends database wasn't initialized with linphone_core_friends_storage_init() yet");
return NULL;
}
linphone_vcard_context_set_user_data(lc->vcard_context, &result);
buf = sqlite3_mprintf("SELECT * FROM friends WHERE friend_list_id = %u ORDER BY id", list->storage_id);
begin = ortp_get_cur_time_ms();
linphone_sql_request_friend(lc->friends_db, buf, &result);
linphone_sql_request_friend(lc->friends_db, buf, lc->vcard_context);
end = ortp_get_cur_time_ms();
ms_message("%s(): %u results fetched, completed in %i ms",__FUNCTION__, (unsigned int)bctbx_list_size(result), (int)(end-begin));
sqlite3_free(buf);
@ -1446,6 +1465,7 @@ bctbx_list_t* linphone_core_fetch_friends_from_db(LinphoneCore *lc, LinphoneFrie
lf->lc = lc;
lf->friend_list = list;
}
linphone_vcard_context_set_user_data(lc->vcard_context, NULL);
return result;
}
@ -1557,15 +1577,18 @@ void linphone_core_migrate_friends_from_rc_to_db(LinphoneCore *lc) {
const LinphoneAddress *addr = linphone_friend_get_address(lf);
if (addr) {
const char *displayName = linphone_address_get_display_name(addr);
char *address = NULL;
if (!displayName) {
displayName = linphone_address_get_username(addr);
}
address = linphone_address_as_string(addr);
if (!linphone_friend_create_vcard(lf, displayName)) {
ms_warning("Couldn't create vCard for friend %s", linphone_address_as_string(addr));
ms_warning("Couldn't create vCard for friend %s", address);
} else {
linphone_vcard_add_sip_address(linphone_friend_get_vcard(lf), linphone_address_as_string_uri_only(addr));
linphone_vcard_add_sip_address(linphone_friend_get_vcard(lf), address);
}
ms_free(address);
linphone_friend_list_add_friend(lfl, lf);
linphone_friend_unref(lf);

View file

@ -781,7 +781,7 @@ int linphone_friend_list_import_friends_from_vcard4_file(LinphoneFriendList *lis
return -1;
}
vcards = linphone_vcard_list_from_vcard4_file(vcard_file);
vcards = linphone_vcard_list_from_vcard4_file(list->lc->vcard_context, vcard_file);
vcards_iterator = vcards;
if (!vcards) {
ms_error("Failed to parse the file %s", vcard_file);
@ -820,7 +820,7 @@ int linphone_friend_list_import_friends_from_vcard4_buffer(LinphoneFriendList *l
return -1;
}
vcards = linphone_vcard_list_from_vcard4_buffer(vcard_buffer);
vcards = linphone_vcard_list_from_vcard4_buffer(list->lc->vcard_context, vcard_buffer);
vcards_iterator = vcards;
if (!vcards) {
ms_error("Failed to parse the buffer");

View file

@ -1826,6 +1826,8 @@ static void linphone_core_init(LinphoneCore * lc, const LinphoneCoreVTable *vtab
sqlite3_bctbx_vfs_register(0);
#endif
lc->vcard_context = linphone_vcard_context_new();
remote_provisioning_uri = linphone_core_get_provisioning_uri(lc);
if (remote_provisioning_uri == NULL) {
linphone_configuring_terminated(lc, LinphoneConfiguringSkipped, NULL);
@ -6488,6 +6490,10 @@ void sip_config_uninit(LinphoneCore *lc)
}
#endif
if (lc->vcard_context) {
linphone_vcard_context_destroy(lc->vcard_context);
}
sal_reset_transports(lc->sal);
sal_unlisten_ports(lc->sal); /*to make sure no new messages are received*/
if (lc->http_provider) {

View file

@ -840,6 +840,9 @@ public:
if (msg) {
env->DeleteLocalRef(msg);
}
if (jproxy) {
env->DeleteLocalRef(jproxy);
}
}
static void callStateChange(LinphoneCore *lc, LinphoneCall* call,LinphoneCallState state,const char* message) {
@ -956,6 +959,8 @@ public:
return;
}
jobject jmsg;
jobject jroom;
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
LinphoneCoreVTable *table = linphone_core_get_current_vtable(lc);
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_v_table_get_user_data(table);
@ -963,9 +968,16 @@ public:
env->CallVoidMethod(lcData->listener
,ljb->messageReceivedId
,lcData->core
,getChatRoom(env, room)
,getChatMessage(env, msg));
,(jroom = getChatRoom(env, room))
,(jmsg = getChatMessage(env, msg)));
handle_possible_java_exception(env, lcData->listener);
if (jmsg) {
env->DeleteLocalRef(jmsg);
}
if (jroom) {
env->DeleteLocalRef(jroom);
}
}
static void is_composing_received(LinphoneCore *lc, LinphoneChatRoom *room) {
JNIEnv *env = 0;
@ -975,14 +987,19 @@ public:
return;
}
jobject jroom;
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
LinphoneCoreVTable *table = linphone_core_get_current_vtable(lc);
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_v_table_get_user_data(table);
env->CallVoidMethod(lcData->listener
,ljb->isComposingReceivedId
,lcData->core
,getChatRoom(env, room));
,(jroom = getChatRoom(env, room)));
handle_possible_java_exception(env, lcData->listener);
if (jroom) {
env->DeleteLocalRef(jroom);
}
}
static void ecCalibrationStatus(LinphoneCore *lc, LinphoneEcCalibratorStatus status, int delay_ms, void *data) {
JNIEnv *env = 0;
@ -1190,6 +1207,9 @@ public:
if (jcontent) {
env->DeleteLocalRef(jcontent);
}
if (jmsg) {
env->DeleteLocalRef(jmsg);
}
handle_possible_java_exception(env, lcData->listener);
}
@ -1221,6 +1241,9 @@ public:
if (jbuffer) {
env->DeleteLocalRef(jbuffer);
}
if (jmsg) {
env->DeleteLocalRef(jmsg);
}
handle_possible_java_exception(env, lcData->listener);
}
@ -1251,6 +1274,9 @@ public:
if (jcontent) {
env->DeleteLocalRef(jcontent);
}
if (jmsg) {
env->DeleteLocalRef(jmsg);
}
handle_possible_java_exception(env, lcData->listener);
}
static void logCollectionUploadProgressIndication(LinphoneCore *lc, size_t offset, size_t total) {
@ -1318,14 +1344,19 @@ public:
return;
}
jobject jfriendlist;
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
LinphoneCoreVTable *table = linphone_core_get_current_vtable(lc);
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_v_table_get_user_data(table);
env->CallVoidMethod(lcData->listener
,ljb->friendListRemovedId
,lcData->core
,getFriendList(env, list));
,(jfriendlist = getFriendList(env, list)));
handle_possible_java_exception(env, lcData->listener);
if (jfriendlist) {
env->DeleteLocalRef(jfriendlist);
}
}
private:
@ -3302,6 +3333,9 @@ static void contact_created(LinphoneFriendList *list, LinphoneFriend *lf) {
env->DeleteLocalRef(clazz);
env->CallVoidMethod(listener, method, jlist, jfriend);
env->DeleteLocalRef(jfriend);
if (jlist) {
env->DeleteLocalRef(jlist);
}
}
static void contact_updated(LinphoneFriendList *list, LinphoneFriend *lf_new, LinphoneFriend *lf_old) {
@ -3328,6 +3362,9 @@ static void contact_updated(LinphoneFriendList *list, LinphoneFriend *lf_new, Li
env->CallVoidMethod(listener, method, jlist, jfriend_new, jfriend_old);
env->DeleteLocalRef(jfriend_new);
env->DeleteLocalRef(jfriend_old);
if (jlist) {
env->DeleteLocalRef(jlist);
}
}
static void contact_removed(LinphoneFriendList *list, LinphoneFriend *lf) {
@ -3352,6 +3389,9 @@ static void contact_removed(LinphoneFriendList *list, LinphoneFriend *lf) {
env->DeleteLocalRef(clazz);
env->CallVoidMethod(listener, method, jlist, jfriend);
env->DeleteLocalRef(jfriend);
if (jlist) {
env->DeleteLocalRef(jlist);
}
}
static void sync_status_changed(LinphoneFriendList *list, LinphoneFriendListSyncStatus status, const char *message) {
@ -3381,6 +3421,9 @@ static void sync_status_changed(LinphoneFriendList *list, LinphoneFriendListSync
if (msg) {
env->DeleteLocalRef(msg);
}
if (jlist) {
env->DeleteLocalRef(jlist);
}
}
extern "C" void Java_org_linphone_core_LinphoneFriendListImpl_setListener(JNIEnv* env, jobject thiz, jlong ptr, jobject jlistener) {
@ -4039,6 +4082,9 @@ static void message_state_changed(LinphoneChatMessage* msg, LinphoneChatMessageS
env->DeleteGlobalRef(listener);
msg->message_state_changed_user_data = NULL;
}
if (jmessage) {
env->DeleteLocalRef(jmessage);
}
}
static void file_transfer_progress_indication(LinphoneChatMessage *msg, const LinphoneContent* content, size_t offset, size_t total) {
@ -4059,6 +4105,9 @@ static void file_transfer_progress_indication(LinphoneChatMessage *msg, const Li
if (jcontent) {
env->DeleteLocalRef(jcontent);
}
if (jmessage) {
env->DeleteLocalRef(jmessage);
}
}
static void file_transfer_recv(LinphoneChatMessage *msg, const LinphoneContent* content, const LinphoneBuffer *buffer) {
@ -4084,6 +4133,9 @@ static void file_transfer_recv(LinphoneChatMessage *msg, const LinphoneContent*
if (jcontent) {
env->DeleteLocalRef(jcontent);
}
if (jmessage) {
env->DeleteLocalRef(jmessage);
}
}
static LinphoneBuffer* file_transfer_send(LinphoneChatMessage *msg, const LinphoneContent* content, size_t offset, size_t size) {
@ -4107,6 +4159,9 @@ static LinphoneBuffer* file_transfer_send(LinphoneChatMessage *msg, const Linph
if (jcontent) {
env->DeleteLocalRef(jcontent);
}
if (jmessage) {
env->DeleteLocalRef(jmessage);
}
buffer = create_c_linphone_buffer_from_java_linphone_buffer(env, jbuffer);
env->DeleteLocalRef(jbuffer);

View file

@ -793,7 +793,6 @@ void lp_section_write(LpSection *sec,LpConfig *lpconfig){
}
int lp_config_sync(LpConfig *lpconfig){
int fd = -1;
bctbx_vfs_file_t *pFile = NULL;
if (lpconfig->filename==NULL) return -1;
if (lpconfig->readonly) return 0;
@ -804,8 +803,7 @@ int lp_config_sync(LpConfig *lpconfig){
#endif
pFile = bctbx_file_open(lpconfig->g_bctbx_vfs,lpconfig->tmpfilename, "w");
lpconfig->pFile = pFile;
fd = pFile->fd;
if (fd == -1 ){
if (pFile == NULL){
ms_warning("Could not write %s ! Maybe it is read-only. Configuration will not be saved.",lpconfig->filename);
lpconfig->readonly=1;
return -1;

View file

@ -29,10 +29,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _WIN32
#if !defined(__QNXNTO__)
# include <langinfo.h>
# include <locale.h>
# include <iconv.h>
# include <string.h>
#include <langinfo.h>
#include <locale.h>
#include <iconv.h>
#include <string.h>
#endif
#else
#include <Windows.h>
@ -50,19 +50,25 @@ static char *utf8_convert(const char *filename){
wchar_t db_file_utf16[MAX_PATH_SIZE]={0};
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, filename, -1, db_file_utf16, MAX_PATH_SIZE);
WideCharToMultiByte(CP_UTF8, 0, db_file_utf16, -1, db_file_utf8, sizeof(db_file_utf8), NULL, NULL);
#elif defined(__QNXNTO__)
strncpy(db_file_utf8, filename, MAX_PATH_SIZE - 1);
#else
char db_file_locale[MAX_PATH_SIZE] = {'\0'};
char *inbuf=db_file_locale, *outbuf=db_file_utf8;
size_t inbyteleft = MAX_PATH_SIZE, outbyteleft = MAX_PATH_SIZE;
iconv_t cb;
strncpy(db_file_locale, filename, MAX_PATH_SIZE-1);
cb = iconv_open("UTF-8", nl_langinfo(CODESET));
if(cb != (iconv_t)-1) {
int ret;
ret = iconv(cb, &inbuf, &inbyteleft, &outbuf, &outbyteleft);
if(ret == -1) db_file_utf8[0] = '\0';
iconv_close(cb);
if (strcasecmp("UTF-8", nl_langinfo(CODESET)) == 0) {
strncpy(db_file_utf8, filename, MAX_PATH_SIZE - 1);
} else {
strncpy(db_file_locale, filename, MAX_PATH_SIZE-1);
cb = iconv_open("UTF-8", nl_langinfo(CODESET));
if (cb != (iconv_t)-1) {
int ret;
ret = iconv(cb, &inbuf, &inbyteleft, &outbuf, &outbyteleft);
if(ret == -1) db_file_utf8[0] = '\0';
iconv_close(cb);
}
}
#endif
return ms_strdup(db_file_utf8);
@ -83,8 +89,7 @@ int _linphone_sqlite3_open(const char *db_file, sqlite3 **db) {
/*since we plug our vfs into sqlite, we convert to UTF-8.
* On Windows, the filename has to be converted back to windows native charset.*/
char *utf8_filename = utf8_convert(db_file);
//ret = sqlite3_open_v2(utf8_filename, db, flags, LINPHONE_SQLITE3_VFS);
ret = sqlite3_open_v2(utf8_filename, db, flags, NULL); // Do not use VFS until all issues are resolved
ret = sqlite3_open_v2(utf8_filename, db, flags, LINPHONE_SQLITE3_VFS);
ms_free(utf8_filename);
if (ret != SQLITE_OK) return ret;

View file

@ -743,12 +743,13 @@ int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call){
}
if ((ai != NULL) && (nat_policy != NULL)
&& (linphone_nat_policy_stun_enabled(nat_policy) || linphone_nat_policy_turn_enabled(nat_policy))) {
bool_t gathering_in_progress;
ms_message("ICE: gathering candidate from [%s] using %s", server, linphone_nat_policy_turn_enabled(nat_policy) ? "TURN" : "STUN");
/* Gather local srflx candidates. */
ice_session_enable_turn(call->ice_session, linphone_nat_policy_turn_enabled(nat_policy));
ice_session_set_stun_auth_requested_cb(call->ice_session, (MSStunAuthRequestedCb)stun_auth_requested_cb, call);
ice_session_gather_candidates(call->ice_session, ai->ai_addr, (socklen_t)ai->ai_addrlen);
return 1;
gathering_in_progress = ice_session_gather_candidates(call->ice_session, ai->ai_addr, (socklen_t)ai->ai_addrlen);
return (gathering_in_progress == FALSE) ? 0 : 1;
} else {
ms_message("ICE: bypass candidates gathering");
ice_session_compute_candidates_foundations(call->ice_session);

View file

@ -1025,6 +1025,7 @@ struct _LinphoneCore
jmethodID multicast_lock_acquire_id;
jmethodID multicast_lock_release_id;
#endif
LinphoneVcardContext *vcard_context;
};
@ -1308,9 +1309,9 @@ struct _LinphoneCardDavContext {
struct _LinphoneCardDavQuery {
LinphoneCardDavContext *context;
const char *url;
char *url;
const char *method;
const char *body;
char *body;
const char *depth;
const char *ifmatch;
belle_http_request_listener_t *http_request_listener;
@ -1319,9 +1320,9 @@ struct _LinphoneCardDavQuery {
};
struct _LinphoneCardDavResponse {
const char *etag;
const char *url;
const char *vcard;
char *etag;
char *url;
char *vcard;
};
/*****************************************************************************
@ -1493,7 +1494,7 @@ SalStreamDir sal_dir_from_call_params_dir(LinphoneMediaDirection cpdir);
* @param[in] content LinphoneContent object.
* @return The key to encrypt/decrypt the file associated to this content.
*/
const char *linphone_content_get_key(const LinphoneContent *content);
LINPHONE_PUBLIC const char *linphone_content_get_key(const LinphoneContent *content);
/**
* Get the size of key associated with a RCS file transfer message if encrypted
@ -1554,6 +1555,11 @@ char *linphone_presence_model_to_xml(LinphonePresenceModel *model) ;
void linphone_call_check_ice_session(LinphoneCall *call, IceRole role, bool_t is_reinvite);
LinphoneVcardContext* linphone_vcard_context_new(void);
void linphone_vcard_context_destroy(LinphoneVcardContext *context);
void* linphone_vcard_context_get_user_data(LinphoneVcardContext *context);
void linphone_vcard_context_set_user_data(LinphoneVcardContext *context, void *data);
#ifdef __cplusplus
}
#endif

View file

@ -259,6 +259,8 @@ static char* ConvertFromUtf8Filename(const char* fName){
}
bctbx_free(wideFilename);
return convertedFilename;
#elif defined(__QNXNTO__)
return bctbx_strdup(fName);
#else
#define MAX_PATH_SIZE 1024
char db_file_utf8[MAX_PATH_SIZE] = {'\0'};
@ -267,18 +269,20 @@ static char* ConvertFromUtf8Filename(const char* fName){
size_t inbyteleft = MAX_PATH_SIZE, outbyteleft = MAX_PATH_SIZE;
iconv_t cb;
strncpy(db_file_utf8, fName, MAX_PATH_SIZE-1);
cb = iconv_open(nl_langinfo(CODESET), "UTF-8");
if(cb != (iconv_t)-1) {
int ret;
ret = iconv(cb, &inbuf, &inbyteleft, &outbuf, &outbyteleft);
if(ret == -1) db_file_locale[0] = '\0';
iconv_close(cb);
if (strcasecmp("UTF-8", nl_langinfo(CODESET)) == 0) {
strncpy(db_file_locale, fName, MAX_PATH_SIZE - 1);
} else {
strncpy(db_file_utf8, fName, MAX_PATH_SIZE-1);
cb = iconv_open(nl_langinfo(CODESET), "UTF-8");
if (cb != (iconv_t)-1) {
int ret;
ret = iconv(cb, &inbuf, &inbyteleft, &outbuf, &outbyteleft);
if(ret == -1) db_file_locale[0] = '\0';
iconv_close(cb);
}
}
return bctbx_strdup(db_file_locale);
#endif
}
#endif
/**

View file

@ -23,6 +23,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "sal/sal.h"
#include <bctoolbox/crypto.h>
struct _LinphoneVcardContext {
belcard::BelCardParser *parser;
void *user_data;
};
struct _LinphoneVcard {
shared_ptr<belcard::BelCard> belCard;
char *etag;
@ -34,6 +39,29 @@ struct _LinphoneVcard {
extern "C" {
#endif
LinphoneVcardContext* linphone_vcard_context_new(void) {
LinphoneVcardContext* context = ms_new0(LinphoneVcardContext, 1);
context->parser = new belcard::BelCardParser();
context->user_data = NULL;
return context;
}
void linphone_vcard_context_destroy(LinphoneVcardContext *context) {
if (context) {
if (context->parser) delete context->parser;
ms_free(context);
}
}
void* linphone_vcard_context_get_user_data(LinphoneVcardContext *context) {
return context ? context->user_data : NULL;
}
void linphone_vcard_context_set_user_data(LinphoneVcardContext *context, void *data) {
if (context) context->user_data = data;
}
LinphoneVcard* linphone_vcard_new(void) {
LinphoneVcard* vCard = (LinphoneVcard*) ms_new0(LinphoneVcard, 1);
vCard->belCard = belcard::BelCardGeneric::create<belcard::BelCard>();
@ -48,16 +76,17 @@ static LinphoneVcard* linphone_vcard_new_from_belcard(shared_ptr<belcard::BelCar
void linphone_vcard_free(LinphoneVcard *vCard) {
if (!vCard) return;
if (vCard->etag) ms_free(vCard->etag);
if (vCard->url) ms_free(vCard->url);
vCard->belCard.reset();
ms_free(vCard);
}
bctbx_list_t* linphone_vcard_list_from_vcard4_file(const char *filename) {
bctbx_list_t* linphone_vcard_list_from_vcard4_file(LinphoneVcardContext *context, const char *filename) {
bctbx_list_t *result = NULL;
if (filename) {
belcard::BelCardParser parser = belcard::BelCardParser::getInstance();
shared_ptr<belcard::BelCardList> belCards = parser.parseFile(filename);
if (context && filename) {
belcard::BelCardParser *parser = context->parser;
shared_ptr<belcard::BelCardList> belCards = parser->parseFile(filename);
if (belCards) {
for (auto it = belCards->getCards().begin(); it != belCards->getCards().end(); ++it) {
shared_ptr<belcard::BelCard> belCard = (*it);
@ -69,11 +98,11 @@ bctbx_list_t* linphone_vcard_list_from_vcard4_file(const char *filename) {
return result;
}
bctbx_list_t* linphone_vcard_list_from_vcard4_buffer(const char *buffer) {
bctbx_list_t* linphone_vcard_list_from_vcard4_buffer(LinphoneVcardContext *context, const char *buffer) {
bctbx_list_t *result = NULL;
if (buffer) {
belcard::BelCardParser parser = belcard::BelCardParser::getInstance();
shared_ptr<belcard::BelCardList> belCards = parser.parse(buffer);
if (context && buffer) {
belcard::BelCardParser *parser = context->parser;
shared_ptr<belcard::BelCardList> belCards = parser->parse(buffer);
if (belCards) {
for (auto it = belCards->getCards().begin(); it != belCards->getCards().end(); ++it) {
shared_ptr<belcard::BelCard> belCard = (*it);
@ -85,11 +114,11 @@ bctbx_list_t* linphone_vcard_list_from_vcard4_buffer(const char *buffer) {
return result;
}
LinphoneVcard* linphone_vcard_new_from_vcard4_buffer(const char *buffer) {
LinphoneVcard* linphone_vcard_new_from_vcard4_buffer(LinphoneVcardContext *context, const char *buffer) {
LinphoneVcard *vCard = NULL;
if (buffer) {
belcard::BelCardParser parser = belcard::BelCardParser::getInstance();
shared_ptr<belcard::BelCard> belCard = parser.parseOne(buffer);
if (context && buffer) {
belcard::BelCardParser *parser = context->parser;
shared_ptr<belcard::BelCard> belCard = parser->parseOne(buffer);
if (belCard) {
vCard = linphone_vcard_new_from_belcard(belCard);
} else {
@ -131,13 +160,17 @@ void linphone_vcard_add_sip_address(LinphoneVcard *vCard, const char *sip_addres
void linphone_vcard_remove_sip_address(LinphoneVcard *vCard, const char *sip_address) {
if (!vCard) return;
shared_ptr<belcard::BelCardImpp> impp;
for (auto it = vCard->belCard->getImpp().begin(); it != vCard->belCard->getImpp().end(); ++it) {
const char *value = (*it)->getValue().c_str();
if (strcmp(value, sip_address) == 0) {
vCard->belCard->removeImpp(*it);
impp = *it;
break;
}
}
if (impp) {
vCard->belCard->removeImpp(impp);
}
}
void linphone_vcard_edit_main_sip_address(LinphoneVcard *vCard, const char *sip_address) {
@ -177,13 +210,17 @@ void linphone_vcard_add_phone_number(LinphoneVcard *vCard, const char *phone) {
void linphone_vcard_remove_phone_number(LinphoneVcard *vCard, const char *phone) {
if (!vCard) return;
shared_ptr<belcard::BelCardPhoneNumber> tel;
for (auto it = vCard->belCard->getPhoneNumbers().begin(); it != vCard->belCard->getPhoneNumbers().end(); ++it) {
const char *value = (*it)->getValue().c_str();
if (strcmp(value, phone) == 0) {
vCard->belCard->removePhoneNumber(*it);
tel = *it;
break;
}
}
if (tel) {
vCard->belCard->removePhoneNumber(tel);
}
}
bctbx_list_t* linphone_vcard_get_phone_numbers(const LinphoneVcard *vCard) {
@ -229,7 +266,7 @@ bool_t linphone_vcard_generate_unique_id(LinphoneVcard *vCard) {
if (sal_generate_uuid(uuid, sizeof(uuid)) == 0) {
char vcard_uuid[sizeof(uuid)+4];
snprintf(vcard_uuid, sizeof(vcard_uuid), "urn:%s", uuid);
linphone_vcard_set_uid(vCard, ms_strdup(vcard_uuid));
linphone_vcard_set_uid(vCard, vcard_uuid);
return TRUE;
}
}
@ -257,6 +294,7 @@ void linphone_vcard_set_etag(LinphoneVcard *vCard, const char * etag) {
}
if (vCard->etag) {
ms_free(vCard->etag);
vCard->etag = NULL;
}
vCard->etag = ms_strdup(etag);
}
@ -272,6 +310,7 @@ void linphone_vcard_set_url(LinphoneVcard *vCard, const char * url) {
}
if (vCard->url) {
ms_free(vCard->url);
vCard->url = NULL;
}
vCard->url = ms_strdup(url);
}

View file

@ -36,6 +36,11 @@ extern "C"
* @{
*/
/**
* Linphone vCard context object.
*/
typedef struct _LinphoneVcardContext LinphoneVcardContext;
/**
* The LinphoneVcard object.
*/
@ -57,21 +62,21 @@ LINPHONE_PUBLIC void linphone_vcard_free(LinphoneVcard *vCard);
* @param[in] file the path to the file to parse
* @return \mslist{LinphoneVcard}
*/
LINPHONE_PUBLIC bctbx_list_t* linphone_vcard_list_from_vcard4_file(const char *file);
LINPHONE_PUBLIC bctbx_list_t* linphone_vcard_list_from_vcard4_file(LinphoneVcardContext *context, const char *file);
/**
* Uses belcard to parse the content of a buffer and returns all the vcards it contains as LinphoneVcards, or NULL if it contains none.
* @param[in] buffer the buffer to parse
* @return \mslist{LinphoneVcard}
*/
LINPHONE_PUBLIC bctbx_list_t* linphone_vcard_list_from_vcard4_buffer(const char *buffer);
LINPHONE_PUBLIC bctbx_list_t* linphone_vcard_list_from_vcard4_buffer(LinphoneVcardContext *context, const char *buffer);
/**
* Uses belcard to parse the content of a buffer and returns one vCard if possible, or NULL otherwise.
* @param[in] buffer the buffer to parse
* @return a LinphoneVcard if one could be parsed, or NULL otherwise
*/
LINPHONE_PUBLIC LinphoneVcard* linphone_vcard_new_from_vcard4_buffer(const char *buffer);
LINPHONE_PUBLIC LinphoneVcard* linphone_vcard_new_from_vcard4_buffer(LinphoneVcardContext *context, const char *buffer);
/**
* Returns the vCard4 representation of the LinphoneVcard.

View file

@ -19,6 +19,30 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "vcard.h"
struct _LinphoneVcardContext {
void *user_data;
};
LinphoneVcardContext* linphone_vcard_context_new(void) {
LinphoneVcardContext* context = ms_new0(LinphoneVcardContext, 1);
context->user_data = NULL;
return context;
}
void linphone_vcard_context_destroy(LinphoneVcardContext *context) {
if (context) {
ms_free(context);
}
}
void* linphone_vcard_context_get_user_data(LinphoneVcardContext *context) {
return context ? context->user_data : NULL;
}
void linphone_vcard_context_set_user_data(LinphoneVcardContext *context, void *data) {
if (context) context->user_data = data;
}
struct _LinphoneVcard {
void *dummy;
};
@ -31,15 +55,15 @@ void linphone_vcard_free(LinphoneVcard *vCard) {
}
MSList* linphone_vcard_list_from_vcard4_file(const char *filename) {
MSList* linphone_vcard_list_from_vcard4_file(LinphoneVcardContext *context, const char *filename) {
return NULL;
}
MSList* linphone_vcard_list_from_vcard4_buffer(const char *buffer) {
MSList* linphone_vcard_list_from_vcard4_buffer(LinphoneVcardContext *context, const char *buffer) {
return NULL;
}
LinphoneVcard* linphone_vcard_new_from_vcard4_buffer(const char *buffer) {
LinphoneVcard* linphone_vcard_new_from_vcard4_buffer(LinphoneVcardContext *context, const char *buffer) {
return NULL;
}

View file

@ -114,10 +114,10 @@ apply_compile_flags(DAEMON_PIPETEST_SOURCE_FILES "CPP" "C")
add_executable(linphone-daemon ${DAEMON_SOURCE_FILES})
target_include_directories(linphone-daemon PRIVATE ${CMAKE_CURRENT_LIST_DIR})
target_link_libraries(linphone-daemon linphone ${MEDIASTREAMER2_LIBRARIES})
target_link_libraries(linphone-daemon ${LINPHONE_LIBS_FOR_TOOLS} ${MEDIASTREAMER2_LIBRARIES})
add_executable(linphone-daemon-pipetest ${DAEMON_PIPETEST_SOURCE_FILES})
target_link_libraries(linphone-daemon-pipetest linphone ${ORTP_LIBRARIES})
target_link_libraries(linphone-daemon-pipetest ${LINPHONE_LIBS_FOR_TOOLS} ${ORTP_LIBRARIES})
set(INSTALL_TARGETS linphone-daemon linphone-daemon-pipetest)

View file

@ -94,7 +94,7 @@ else()
endif()
set_target_properties(linphone-gtk PROPERTIES OUTPUT_NAME linphone LINKER_LANGUAGE CXX)
target_include_directories(linphone-gtk PUBLIC ${GTK2_INCLUDE_DIRS} ${INTL_INCLUDE_DIRS})
target_link_libraries(linphone-gtk linphone ${GTK2_LIBRARIES} ${BCTOOLBOX_LIBRARIES} ${ORTP_LIBRARIES} ${MEDIASTREAMER2_LIBRARIES})
target_link_libraries(linphone-gtk ${LINPHONE_LIBS_FOR_TOOLS} ${GTK2_LIBRARIES} ${BCTOOLBOX_CORE_LIBRARIES} ${ORTP_LIBRARIES} ${MEDIASTREAMER2_LIBRARIES})
if(INTL_FOUND)
target_link_libraries(linphone-gtk ${INTL_LIBRARIES})
endif()

View file

@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define F_OK 00 /*visual studio does not define F_OK*/
#endif
#define NB_MSG_HIST 250
#define NB_MSG_HIST 250000
#define CONFIG_FILE ".linphone-history.db"
@ -133,11 +133,9 @@ void update_chat_header(GtkNotebook *notebook, GtkWidget *chat_view, LinphoneCha
static gboolean scroll_to_end(GtkTextView *w){
GtkTextBuffer *buffer=gtk_text_view_get_buffer(w);
GtkTextMark *mark;
GtkTextIter iter;
gtk_text_buffer_get_end_iter(buffer,&iter);
mark=gtk_text_buffer_create_mark(buffer,NULL,&iter,FALSE);
gtk_text_view_scroll_mark_onscreen(w,mark);
gtk_text_view_scroll_to_iter (GTK_TEXT_VIEW (w), &iter, 0.0, FALSE, 0, 0);
return FALSE;
}

View file

@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "linphone.h"
#include <bctoolbox/bc_vfs.h>
#include <gdk/gdkkeysyms.h>
static GtkWidget *linphone_gtk_create_contact_menu(GtkWidget *contact_list);
@ -139,6 +140,60 @@ void linphone_gtk_remove_contact(GtkWidget *button){
}
}
gboolean linphone_gtk_on_key_press(GtkWidget *widget, GdkEvent *event, gpointer user_data) {
if (event->type == GDK_KEY_PRESS && ((GdkEventKey*)event)->state & GDK_CONTROL_MASK) {
int cpt;
int key = -1;
static int key_map[9] = {0};
if (key_map[0] == 0) {
GdkKeymapKey *keys = NULL;
gint n_keys = 0;
for (cpt = 0; cpt < 9; cpt++) {
if (gdk_keymap_get_entries_for_keyval(gdk_keymap_get_default(),
GDK_KEY_1+cpt, &keys, &n_keys))
key_map[cpt] = keys->keycode;
}
}
for(cpt = 0; cpt < 9 ; cpt++) {
if (key_map[cpt] == (((GdkEventKey*)event)->hardware_keycode)) {
key = cpt;
break;
}
}
if (key != -1) {
GtkWidget *main_window = linphone_gtk_get_main_window();
GtkWidget *friendlist = linphone_gtk_get_widget(main_window,"contact_list");
GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(friendlist));
GtkTreeIter iter;
if (gtk_tree_model_get_iter_first(model, &iter)) {
int index = 0;
LinphoneFriend *lf = NULL;
LinphoneChatRoom *cr;
do{
if (index == key) {
const LinphoneAddress *uri;
gtk_tree_model_get (model, &iter,FRIEND_CHATROOM , &cr, -1);
gtk_tree_model_get (model, &iter,FRIEND_ID , &lf, -1);
uri = linphone_friend_get_address(lf);
if (lf != NULL) linphone_gtk_friend_list_set_chat_conversation(uri);
if (cr != NULL){
linphone_gtk_mark_chat_read(cr);
linphone_gtk_friend_list_update_button_display(GTK_TREE_VIEW(friendlist));
}
return TRUE;
}
index++;
}while(gtk_tree_model_iter_next(model,&iter) && index <= 9);
}
}
}
return FALSE;
}
void linphone_gtk_delete_history(GtkWidget *button){
GtkWidget *w=linphone_gtk_get_main_window();
GtkTreeSelection *select;
@ -218,13 +273,15 @@ void linphone_gtk_friend_list_update_button_display(GtkTreeView *friendlist){
icon_name = "linphone-chat-nothing";
}
}
if ((selected_path && gtk_tree_path_compare(path, selected_path) == 0)
|| (hovered_row && gtk_tree_path_compare(path, hovered_row) == 0)){
show_chat_button = TRUE;
show_call_button = TRUE;
}
gtk_list_store_set(GTK_LIST_STORE(model),&iter,FRIEND_CHAT,icon_name,
FRIEND_CHAT_BUTTON_VISIBLE, show_chat_button, -1);
FRIEND_CHAT_BUTTON_VISIBLE, show_chat_button, -1);
gtk_list_store_set(GTK_LIST_STORE(model), &iter, FRIEND_CALL_BUTTON_VISIBLE, show_call_button, -1);
gtk_tree_path_free(path);
@ -702,11 +759,13 @@ void linphone_gtk_show_friends(void){
gtk_list_store_set(store,&iter,FRIEND_NAME, display,FRIEND_ID,lf,
FRIEND_PRESENCE_IMG, send_subscribe ? status_to_icon_name(linphone_friend_get_status(lf)) : NULL,
FRIEND_CHAT,"linphone-chat-nothing", -1);
cr=linphone_gtk_create_chatroom(f_uri);
gtk_list_store_set(store,&iter,FRIEND_CHATROOM,cr,-1);
nbmsg=linphone_chat_room_get_unread_messages_count(cr);
if(nbmsg != 0){
gtk_list_store_set(store,&iter,FRIEND_CHAT,"linphone-chat-new-message",-1);
gtk_list_store_set(store,&iter,FRIEND_CHAT,"linphone-chat-new-message",
FRIEND_CHAT_BUTTON_VISIBLE, TRUE, -1);
}
escaped=g_markup_escape_text(uri,-1);
gtk_list_store_set(store,&iter,FRIEND_SIP_ADDRESS,escaped,-1);

View file

@ -509,7 +509,7 @@ void linphone_gtk_remove_in_call_view(LinphoneCall *call){
GtkWidget *w=(GtkWidget*)linphone_call_get_user_pointer (call);
GtkWidget *main_window=linphone_gtk_get_main_window ();
GtkWidget *nb=linphone_gtk_get_widget(main_window,"viewswitch");
int idx;
int idx,id_current_page;
g_return_if_fail(w!=NULL);
idx=gtk_notebook_page_num(GTK_NOTEBOOK(nb),w);
if (linphone_gtk_call_is_in_conference_view(call)){
@ -518,15 +518,21 @@ void linphone_gtk_remove_in_call_view(LinphoneCall *call){
linphone_call_set_user_pointer (call,NULL);
linphone_call_unref(call);
call=linphone_core_get_current_call(linphone_gtk_get_core());
if (call==NULL){
if (linphone_core_is_in_conference(linphone_gtk_get_core())){
/*show the conference*/
id_current_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(nb));
if (id_current_page == idx) {
if (call==NULL){
if (linphone_core_is_in_conference(linphone_gtk_get_core())){
/*show the conference*/
gtk_notebook_set_current_page(GTK_NOTEBOOK(nb),gtk_notebook_page_num(GTK_NOTEBOOK(nb),
g_object_get_data(G_OBJECT(main_window),"conf_frame")));
} else {
gtk_notebook_set_current_page(GTK_NOTEBOOK(nb),0);
}
}else{
/*show the active call*/
gtk_notebook_set_current_page(GTK_NOTEBOOK(nb),gtk_notebook_page_num(GTK_NOTEBOOK(nb),
g_object_get_data(G_OBJECT(main_window),"conf_frame")));
}else gtk_notebook_prev_page(GTK_NOTEBOOK(nb));
}else{
/*show the active call*/
gtk_notebook_set_current_page(GTK_NOTEBOOK(nb),gtk_notebook_page_num(GTK_NOTEBOOK(nb), linphone_call_get_user_pointer(call)));
linphone_call_get_user_pointer(call)));
}
}
gtk_notebook_remove_page (GTK_NOTEBOOK(nb),idx);
gtk_widget_destroy(w);
@ -865,6 +871,7 @@ void linphone_gtk_in_call_view_terminate(LinphoneCall *call, const char *error_m
gtk_label_set_markup(GTK_LABEL(status),msg);
g_free(msg);
}
linphone_gtk_in_call_set_animation_image(callview, linphone_gtk_get_ui_config("stop_call_icon_name","linphone-stop-call"));
linphone_gtk_in_call_view_hide_encryption(call);

View file

@ -367,7 +367,12 @@ LINPHONE_PUBLIC gboolean linphone_gtk_auto_answer_enabled(void);
LINPHONE_PUBLIC void linphone_gtk_update_status_bar_icons(void);
LINPHONE_PUBLIC void linphone_gtk_enable_auto_answer(GtkToggleButton *checkbox, gpointer user_data);
LINPHONE_PUBLIC void linphone_gtk_import_contacts(void);
LINPHONE_PUBLIC void linphone_gtk_export_contacts(void);
LINPHONE_PUBLIC void linphone_gtk_mark_chat_read(LinphoneChatRoom *cr);
#ifdef __APPLE__
LINPHONE_PUBLIC void linphone_gtk_update_badge_count();
#endif
LINPHONE_PUBLIC gboolean linphone_gtk_on_key_press(GtkWidget *widget, GdkEvent *event, gpointer user_data);

View file

@ -1031,6 +1031,21 @@ void on_proxy_refresh_button_clicked(GtkWidget *w){
}
}
static gboolean grab_focus(GtkWidget *w){
gtk_widget_grab_focus(w);
return FALSE;
}
void linphone_gtk_viewswitch_changed(GtkNotebook *notebook, GtkWidget *page, guint page_num, gpointer user_data){
GtkWidget *main_window = linphone_gtk_get_main_window();
GtkWidget *friendlist = linphone_gtk_get_widget(main_window,"contact_list");
GtkWidget *w = (GtkWidget*)g_object_get_data(G_OBJECT(friendlist),"chatview");
if (page_num == gtk_notebook_page_num(GTK_NOTEBOOK(notebook),w)) {
g_idle_add((GSourceFunc)grab_focus,linphone_gtk_get_widget(page,"text_entry"));
}
}
static void linphone_gtk_notify_recv(LinphoneCore *lc, LinphoneFriend * fid){
linphone_gtk_show_friends();
}
@ -2248,6 +2263,7 @@ core_start:
the_ui=linphone_gtk_create_window("main", NULL);
g_object_set_data(G_OBJECT(the_ui),"is_created",GINT_TO_POINTER(FALSE));
g_signal_connect(G_OBJECT (the_ui), "key_press_event", G_CALLBACK (linphone_gtk_on_key_press), NULL);
linphone_gtk_create_log_window();
linphone_core_enable_logs_with_cb(linphone_gtk_log_handler);

View file

@ -167,8 +167,8 @@
<property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<signal name="activate" handler="linphone_gtk_show_parameters" swapped="no"/>
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/>
<signal name="activate" handler="linphone_gtk_show_parameters" swapped="no"/>
</object>
</child>
<child>
@ -650,6 +650,7 @@
<object class="GtkNotebook" id="viewswitch">
<property name="visible">True</property>
<property name="can_focus">True</property>
<signal name="switch-page" handler="linphone_gtk_viewswitch_changed" swapped="no"/>
<child>
<placeholder/>
</child>

View file

@ -1187,6 +1187,8 @@ static LangCodes supported_langs[]={
{ "sr" , N_("Serbian") },
{ "ar" , N_("Arabic") },
{ "tr" , N_("Turkish") },
{ "fi" , N_("Finnish") },
{ "lt" , N_("Lithuanian") },
{ NULL , NULL }
};

View file

@ -8,7 +8,7 @@ AppUpdatesURL=http://www.linphone.org
DefaultDirName={pf}\Linphone
DefaultGroupName=Linphone
LicenseFile=COPYING
;InfoBeforeFile=README
;InfoBeforeFile=README.md
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes

View file

@ -23,15 +23,15 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: i686
%endif
BuildRequires: gtk2-devel
BuildRequires: belle-sip-devel speex-devel gettext
BuildRequires: intltool gettext-devel
BuildRequires: gtk2-devel
BuildRequires: belle-sip-devel speex-devel gettext
BuildRequires: intltool gettext-devel
%if %{video}
BuildRequires: ffmpeg-devel SDL-devel
%endif
%description
Linphone is a SIP compliant audio & video phone. It can be used to run calls
Linphone is a SIP compliant audio & video phone. It can be used to run calls
over the internet. It has a gtk+ and console interface.
%package devel
@ -79,7 +79,7 @@ rm -rf $RPM_BUILD_ROOT
%files -f %{name}.lang
%defattr(-,root,root)
%doc AUTHORS ChangeLog COPYING NEWS README TODO
%doc AUTHORS ChangeLog COPYING NEWS README.md TODO
%{_bindir}/linphone
%{_bindir}/linphonec
%{_bindir}/linphonecsh

@ -1 +1 @@
Subproject commit 0aec61e0871fc2dc5972ff7a4ccd86e7bae11c46
Subproject commit ea379434c6c725a734b418449b799d5ef8a030c2

2
oRTP

@ -1 +1 @@
Subproject commit 6a8d5ab7cb5de50c76b5b06478b1594f28b6119f
Subproject commit 96f89c62589f9fb84c78be2a092dc94a016ec775

View file

@ -6,11 +6,11 @@
# * | (__| |_| | _ <| |___
# * \___|\___/|_| \_\_____|
# *
# * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
# * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
# *
# * This software is licensed as described in the file COPYING, which
# * you should have received as part of this distribution. The terms
# * are also available at http://curl.haxx.se/docs/copyright.html.
# * are also available at https://curl.haxx.se/docs/copyright.html.
# *
# * You may opt to use, copy, modify, merge, publish, distribute and/or sell
# * copies of the Software, and permit persons to whom the Software is
@ -34,40 +34,143 @@ use Getopt::Std;
use MIME::Base64;
use LWP::UserAgent;
use strict;
use vars qw($opt_b $opt_f $opt_h $opt_i $opt_l $opt_n $opt_q $opt_t $opt_u $opt_v $opt_w);
use vars qw($opt_b $opt_d $opt_f $opt_h $opt_i $opt_l $opt_n $opt_p $opt_q $opt_s $opt_t $opt_u $opt_v $opt_w);
use List::Util;
use Text::Wrap;
my $MOD_SHA = "Digest::SHA";
eval "require $MOD_SHA";
if ($@) {
$MOD_SHA = "Digest::SHA::PurePerl";
eval "require $MOD_SHA";
}
my %urls = (
'nss' =>
'http://hg.mozilla.org/projects/nss/raw-file/tip/lib/ckfw/builtins/certdata.txt',
'central' =>
'http://hg.mozilla.org/mozilla-central/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt',
'aurora' =>
'http://hg.mozilla.org/releases/mozilla-aurora/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt',
'beta' =>
'http://hg.mozilla.org/releases/mozilla-beta/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt',
'release' =>
'http://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt',
);
$opt_d = 'release';
my $url = 'https://mxr.mozilla.org/mozilla/source/security/nss/lib/ckfw/builtins/certdata.txt?raw=1';
# If the OpenSSL commandline is not in search path you can configure it here!
my $openssl = 'openssl';
my $version = '1.18';
my $version = '1.25';
$opt_w = 76; # default base64 encoded lines length
# default cert types to include in the output (default is to include CAs which may issue SSL server certs)
my $default_mozilla_trust_purposes = "SERVER_AUTH";
my $default_mozilla_trust_levels = "TRUSTED_DELEGATOR";
$opt_p = $default_mozilla_trust_purposes . ":" . $default_mozilla_trust_levels;
my @valid_mozilla_trust_purposes = (
"DIGITAL_SIGNATURE",
"NON_REPUDIATION",
"KEY_ENCIPHERMENT",
"DATA_ENCIPHERMENT",
"KEY_AGREEMENT",
"KEY_CERT_SIGN",
"CRL_SIGN",
"SERVER_AUTH",
"CLIENT_AUTH",
"CODE_SIGNING",
"EMAIL_PROTECTION",
"IPSEC_END_SYSTEM",
"IPSEC_TUNNEL",
"IPSEC_USER",
"TIME_STAMPING",
"STEP_UP_APPROVED"
);
my @valid_mozilla_trust_levels = (
"TRUSTED_DELEGATOR", # CAs
"NOT_TRUSTED", # Don't trust these certs.
"MUST_VERIFY_TRUST", # This explicitly tells us that it ISN'T a CA but is otherwise ok. In other words, this should tell the app to ignore any other sources that claim this is a CA.
"TRUSTED" # This cert is trusted, but only for itself and not for delegates (i.e. it is not a CA).
);
my $default_signature_algorithms = $opt_s = "MD5";
my @valid_signature_algorithms = (
"MD5",
"SHA1",
"SHA256",
"SHA384",
"SHA512"
);
$0 =~ s@.*(/|\\)@@;
$Getopt::Std::STANDARD_HELP_VERSION = 1;
getopts('bfhilnqtuvw:');
getopts('bd:fhilnp:qs:tuvw:');
if(!defined($opt_d)) {
# to make plain "-d" use not cause warnings, and actually still work
$opt_d = 'release';
}
# Use predefined URL or else custom URL specified on command line.
my $url = ( defined( $urls{$opt_d} ) ) ? $urls{$opt_d} : $opt_d;
my $curl = `curl -V`;
if ($opt_i) {
print ("=" x 78 . "\n");
print "Script Version : $version\n";
print "Perl Version : $]\n";
print "Operating System Name : $^O\n";
print "Getopt::Std.pm Version : ${Getopt::Std::VERSION}\n";
print "MIME::Base64.pm Version : ${MIME::Base64::VERSION}\n";
print "LWP::UserAgent.pm Version : ${LWP::UserAgent::VERSION}\n";
print "LWP.pm Version : ${LWP::VERSION}\n";
print "Script Version : $version\n";
print "Perl Version : $]\n";
print "Operating System Name : $^O\n";
print "Getopt::Std.pm Version : ${Getopt::Std::VERSION}\n";
print "MIME::Base64.pm Version : ${MIME::Base64::VERSION}\n";
print "LWP::UserAgent.pm Version : ${LWP::UserAgent::VERSION}\n";
print "LWP.pm Version : ${LWP::VERSION}\n";
print "Digest::SHA.pm Version : ${Digest::SHA::VERSION}\n" if ($Digest::SHA::VERSION);
print "Digest::SHA::PurePerl.pm Version : ${Digest::SHA::PurePerl::VERSION}\n" if ($Digest::SHA::PurePerl::VERSION);
print ("=" x 78 . "\n");
}
sub warning_message() {
if ( $opt_d =~ m/^risk$/i ) { # Long Form Warning and Exit
print "Warning: Use of this script may pose some risk:\n";
print "\n";
print " 1) Using http is subject to man in the middle attack of certdata content\n";
print " 2) Default to 'release', but more recent updates may be found in other trees\n";
print " 3) certdata.txt file format may change, lag time to update this script\n";
print " 4) Generally unwise to blindly trust CAs without manual review & verification\n";
print " 5) Mozilla apps use additional security checks aren't represented in certdata\n";
print " 6) Use of this script will make a security engineer grind his teeth and\n";
print " swear at you. ;)\n";
exit;
} else { # Short Form Warning
print "Warning: Use of this script may pose some risk, -d risk for more details.\n";
}
}
sub HELP_MESSAGE() {
print "Usage:\t${0} [-b] [-f] [-i] [-l] [-n] [-q] [-t] [-u] [-v] [-w<l>] [<outputfile>]\n";
print "Usage:\t${0} [-b] [-d<certdata>] [-f] [-i] [-l] [-n] [-p<purposes:levels>] [-q] [-s<algorithms>] [-t] [-u] [-v] [-w<l>] [<outputfile>]\n";
print "\t-b\tbackup an existing version of ca-bundle.crt\n";
print "\t-d\tspecify Mozilla tree to pull certdata.txt or custom URL\n";
print "\t\t Valid names are:\n";
print "\t\t ", join( ", ", map { ( $_ =~ m/$opt_d/ ) ? "$_ (default)" : "$_" } sort keys %urls ), "\n";
print "\t-f\tforce rebuild even if certdata.txt is current\n";
print "\t-i\tprint version info about used modules\n";
print "\t-l\tprint license info about certdata.txt\n";
print "\t-n\tno download of certdata.txt (to use existing)\n";
print wrap("\t","\t\t", "-p\tlist of Mozilla trust purposes and levels for certificates to include in output. Takes the form of a comma separated list of purposes, a colon, and a comma separated list of levels. (default: $default_mozilla_trust_purposes:$default_mozilla_trust_levels)"), "\n";
print "\t\t Valid purposes are:\n";
print wrap("\t\t ","\t\t ", join( ", ", "ALL", @valid_mozilla_trust_purposes ) ), "\n";
print "\t\t Valid levels are:\n";
print wrap("\t\t ","\t\t ", join( ", ", "ALL", @valid_mozilla_trust_levels ) ), "\n";
print "\t-q\tbe really quiet (no progress output at all)\n";
print wrap("\t","\t\t", "-s\tcomma separated list of certificate signatures/hashes to output in plain text mode. (default: $default_signature_algorithms)\n");
print "\t\t Valid signature algorithms are:\n";
print wrap("\t\t ","\t\t ", join( ", ", "ALL", @valid_signature_algorithms ) ), "\n";
print "\t-t\tinclude plain text listing of certificates\n";
print "\t-u\tunlink (remove) certdata.txt after processing\n";
print "\t-v\tbe verbose and print out processed CAs\n";
@ -79,8 +182,99 @@ sub VERSION_MESSAGE() {
print "${0} version ${version} running Perl ${]} on ${^O}\n";
}
warning_message() unless ($opt_q || $url =~ m/^(ht|f)tps:/i );
HELP_MESSAGE() if ($opt_h);
sub report($@) {
my $output = shift;
print STDERR $output . "\n" unless $opt_q;
}
sub is_in_list($@) {
my $target = shift;
return defined(List::Util::first { $target eq $_ } @_);
}
# Parses $param_string as a case insensitive comma separated list with optional whitespace
# validates that only allowed parameters are supplied
sub parse_csv_param($$@) {
my $description = shift;
my $param_string = shift;
my @valid_values = @_;
my @values = map {
s/^\s+//; # strip leading spaces
s/\s+$//; # strip trailing spaces
uc $_ # return the modified string as upper case
} split( ',', $param_string );
# Find all values which are not in the list of valid values or "ALL"
my @invalid = grep { !is_in_list($_,"ALL",@valid_values) } @values;
if ( scalar(@invalid) > 0 ) {
# Tell the user which parameters were invalid and print the standard help message which will exit
print "Error: Invalid ", $description, scalar(@invalid) == 1 ? ": " : "s: ", join( ", ", map { "\"$_\"" } @invalid ), "\n";
HELP_MESSAGE();
}
@values = @valid_values if ( is_in_list("ALL",@values) );
return @values;
}
sub sha1 {
my $result;
if ($Digest::SHA::VERSION || $Digest::SHA::PurePerl::VERSION) {
open(FILE, $_[0]) or die "Can't open '$_[0]': $!";
binmode(FILE);
$result = $MOD_SHA->new(1)->addfile(*FILE)->hexdigest;
close(FILE);
} else {
# Use OpenSSL command if Perl Digest::SHA modules not available
$result = (split(/ |\r|\n/,`$openssl dgst -sha1 $_[0]`))[1];
}
return $result;
}
sub oldsha1 {
my $sha1 = "";
open(C, "<$_[0]") || return 0;
while(<C>) {
chomp;
if($_ =~ /^\#\# SHA1: (.*)/) {
$sha1 = $1;
last;
}
}
close(C);
return $sha1;
}
if ( $opt_p !~ m/:/ ) {
print "Error: Mozilla trust identifier list must include both purposes and levels\n";
HELP_MESSAGE();
}
(my $included_mozilla_trust_purposes_string, my $included_mozilla_trust_levels_string) = split( ':', $opt_p );
my @included_mozilla_trust_purposes = parse_csv_param( "trust purpose", $included_mozilla_trust_purposes_string, @valid_mozilla_trust_purposes );
my @included_mozilla_trust_levels = parse_csv_param( "trust level", $included_mozilla_trust_levels_string, @valid_mozilla_trust_levels );
my @included_signature_algorithms = parse_csv_param( "signature algorithm", $opt_s, @valid_signature_algorithms );
sub should_output_cert(%) {
my %trust_purposes_by_level = @_;
foreach my $level (@included_mozilla_trust_levels) {
# for each level we want to output, see if any of our desired purposes are included
return 1 if ( defined( List::Util::first { is_in_list( $_, @included_mozilla_trust_purposes ) } @{$trust_purposes_by_level{$level}} ) );
}
return 0;
}
my $crt = $ARGV[0] || 'ca-bundle.crt';
(my $txt = $url) =~ s@(.*/|\?.*)@@g;
@ -88,26 +282,61 @@ my $stdout = $crt eq '-';
my $resp;
my $fetched;
unless ($opt_n and -e $txt) {
print STDERR "Downloading '$txt' ...\n" if (!$opt_q);
my $oldsha1 = oldsha1($crt);
report "SHA1 of old file: $oldsha1";
report "Downloading '$txt' ...";
if($curl && !$opt_n) {
my $https = $url;
$https =~ s/^http:/https:/;
report "Get certdata over HTTPS with curl!";
my $quiet = $opt_q ? "-s" : "";
my @out = `curl -w %{response_code} $quiet -O $https`;
if(@out && $out[0] == 200) {
$fetched = 1;
} else {
report "Failed downloading HTTPS with curl, trying HTTP with LWP";
}
}
unless ($fetched || ($opt_n and -e $txt)) {
my $ua = new LWP::UserAgent(agent => "$0/$version");
$ua->env_proxy();
$resp = $ua->mirror($url, $txt);
if ($resp && $resp->code eq '304') {
print STDERR "Not modified\n" unless $opt_q;
report "Not modified";
exit 0 if -e $crt && !$opt_f;
} else {
$fetched = 1;
}
if( !$resp || $resp->code !~ /^(?:200|304)$/ ) {
print STDERR "Unable to download latest data: "
. ($resp? $resp->code . ' - ' . $resp->message : "LWP failed") . "\n"
unless $opt_q;
report "Unable to download latest data: "
. ($resp? $resp->code . ' - ' . $resp->message : "LWP failed");
exit 1 if -e $crt || ! -r $txt;
}
}
my $currentdate = scalar gmtime($fetched ? $resp->last_modified : (stat($txt))[9]);
my $filedate = $resp ? $resp->last_modified : (stat($txt))[9];
my $datesrc = "as of";
if(!$filedate) {
# mxr.mozilla.org gave us a time, hg.mozilla.org does not!
$filedate = time();
$datesrc="downloaded on";
}
# get the hash from the download file
my $newsha1= sha1($txt);
if(!$opt_f && $oldsha1 eq $newsha1) {
report "Downloaded file identical to previous run\'s source file. Exiting";
exit;
}
report "SHA1 of new file: $newsha1";
my $currentdate = scalar gmtime($filedate);
my $format = $opt_t ? "plain text and " : "";
if( $stdout ) {
@ -117,9 +346,9 @@ if( $stdout ) {
}
print CRT <<EOT;
##
## $crt -- Bundle of CA Root Certificates
## Bundle of CA Root Certificates
##
## Certificate data from Mozilla as of: ${currentdate}
## Certificate data from Mozilla ${datesrc}: ${currentdate}
##
## This is a bundle of X.509 certificates of public Certificate Authorities
## (CA). These were automatically extracted from Mozilla's root certificates
@ -131,10 +360,13 @@ print CRT <<EOT;
## an Apache+mod_ssl webserver for SSL client authentication.
## Just configure this file as the SSLCACertificateFile.
##
## Conversion done with mk-ca-bundle.pl version $version.
## SHA1: $newsha1
##
EOT
print STDERR "Processing '$txt' ...\n" if (!$opt_q);
report "Processing '$txt' ...";
my $caname;
my $certnum = 0;
my $skipnum = 0;
@ -164,7 +396,7 @@ while (<TXT>) {
if ($start_of_cert && /^CKA_LABEL UTF8 \"(.*)\"/) {
$caname = $1;
}
my $untrusted = 0;
my %trust_purposes_by_level;
if ($start_of_cert && /^CKA_VALUE MULTILINE_OCTAL/) {
my $data;
while (<TXT>) {
@ -181,15 +413,21 @@ while (<TXT>) {
last if (/^CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST/);
chomp;
}
# now scan the trust part for untrusted certs
# now scan the trust part to determine how we should trust this cert
while (<TXT>) {
last if (/^#/);
if (/^CKA_TRUST_SERVER_AUTH\s+CK_TRUST\s+CKT_NSS_NOT_TRUSTED$/
or /^CKA_TRUST_SERVER_AUTH\s+CK_TRUST\s+CKT_NSS_TRUST_UNKNOWN$/) {
$untrusted = 1;
if (/^CKA_TRUST_([A-Z_]+)\s+CK_TRUST\s+CKT_NSS_([A-Z_]+)\s*$/) {
if ( !is_in_list($1,@valid_mozilla_trust_purposes) ) {
report "Warning: Unrecognized trust purpose for cert: $caname. Trust purpose: $1. Trust Level: $2";
} elsif ( !is_in_list($2,@valid_mozilla_trust_levels) ) {
report "Warning: Unrecognized trust level for cert: $caname. Trust purpose: $1. Trust Level: $2";
} else {
push @{$trust_purposes_by_level{$2}}, $1;
}
}
}
if ($untrusted) {
if ( !should_output_cert(%trust_purposes_by_level) ) {
$skipnum ++;
} else {
my $encoded = MIME::Base64::encode_base64($data, '');
@ -198,11 +436,34 @@ while (<TXT>) {
. $encoded
. "-----END CERTIFICATE-----\n";
print CRT "\n$caname\n";
print CRT ("=" x length($caname) . "\n");
my $maxStringLength = length($caname);
if ($opt_t) {
foreach my $key (keys %trust_purposes_by_level) {
my $string = $key . ": " . join(", ", @{$trust_purposes_by_level{$key}});
$maxStringLength = List::Util::max( length($string), $maxStringLength );
print CRT $string . "\n";
}
}
print CRT ("=" x $maxStringLength . "\n");
if (!$opt_t) {
print CRT $pem;
} else {
my $pipe = "|$openssl x509 -md5 -fingerprint -text -inform PEM";
my $pipe = "";
foreach my $hash (@included_signature_algorithms) {
$pipe = "|$openssl x509 -" . $hash . " -fingerprint -noout -inform PEM";
if (!$stdout) {
$pipe .= " >> $crt.~";
close(CRT) or die "Couldn't close $crt.~: $!";
}
open(TMP, $pipe) or die "Couldn't open openssl pipe: $!";
print TMP $pem;
close(TMP) or die "Couldn't close openssl pipe: $!";
if (!$stdout) {
open(CRT, ">>$crt.~") or die "Couldn't open $crt.~: $!";
}
}
$pipe = "|$openssl x509 -text -inform PEM";
if (!$stdout) {
$pipe .= " >> $crt.~";
close(CRT) or die "Couldn't close $crt.~: $!";
@ -214,7 +475,7 @@ while (<TXT>) {
open(CRT, ">>$crt.~") or die "Couldn't open $crt.~: $!";
}
}
print STDERR "Parsing: $caname\n" if ($opt_v);
report "Parsing: $caname" if ($opt_v);
$certnum ++;
$start_of_cert = 0;
}
@ -222,11 +483,6 @@ while (<TXT>) {
}
close(TXT) or die "Couldn't close $txt: $!\n";
close(CRT) or die "Couldn't close $crt.~: $!\n";
# this may happen if website is in maintenance - 200 OK is returned but it returns
# a HTML maintenance page instead of expected file
die "No certs processed (invalid input file?)!" if ($certnum == 0 and $skipnum == 0);
unless( $stdout ) {
if ($opt_b && -e $crt) {
my $bk = 1;
@ -240,8 +496,4 @@ unless( $stdout ) {
rename "$crt.~", $crt or die "Failed to rename $crt.~ to $crt: $!\n";
}
unlink $txt if ($opt_u);
print STDERR "Done ($certnum CA certs processed, $skipnum untrusted skipped).\n" if (!$opt_q);
exit;
report "Done ($certnum CA certs processed, $skipnum skipped).";

View file

@ -20,7 +20,7 @@
#
############################################################################
set(OTHER_LIBS_FOR_TESTER ${BCTOOLBOX_LIBRARIES} ${BCTOOLBOX_TESTER_LIBRARIES} ${ORTP_LIBRARIES} ${MEDIASTREAMER2_LIBRARIES} ${BELLESIP_LIBRARIES} ${XML2_LIBRARIES})
set(OTHER_LIBS_FOR_TESTER ${BCTOOLBOX_LIBRARIES} ${ORTP_LIBRARIES} ${MEDIASTREAMER2_LIBRARIES} ${BELLESIP_LIBRARIES} ${XML2_LIBRARIES})
if(INTL_FOUND)
list(APPEND OTHER_LIBS_FOR_TESTER ${INTL_LIBRARIES})
endif()
@ -31,21 +31,140 @@ if(ZLIB_FOUND)
list(APPEND OTHER_LIBS_FOR_TESTER ${ZLIB_LIBRARIES})
endif()
set(RESOURCES_FILES
certificates
flexisip
images
local_tester_hosts
set(SOUND_FILES
sounds/ahbahouaismaisbon.wav
sounds/hello44100.wav
sounds/hello8000.mkv
sounds/hello8000_mkv_ref.wav
sounds/hello8000.wav
sounds/oldphone.wav
sounds/ringback.wav
sounds/sintel_trailer_opus_h264.mkv
sounds/sintel_trailer_opus_vp8.mkv
sounds/sintel_trailer_pcmu_h264.mkv
sounds/vrroom.wav
)
set(SIPP_FILES
sipp/call_invite_200ok_without_contact_header.xml
sipp/call_with_audio_mline_before_video_in_sdp.xml
sipp/call_with_multiple_audio_mline_in_sdp.xml
sipp/call_with_multiple_video_mline_in_sdp.xml
sipp/call_with_video_mline_before_audio_in_sdp.xml
sipp/sip_update_within_icoming_reinvite_with_no_sdp.xml
)
set(CERTIFICATE_ALT_FILES
certificates/altname/agent.pem
certificates/altname/cafile.pem
certificates/altname/openssl-altname.cnf
)
set(CERTIFICATE_CN_FILES
certificates/cn/agent.pem
certificates/cn/cafile.pem
certificates/cn/openssl-cn.cnf
)
set(CERTIFICATE_FILES ${CERTIFICATE_ALT_FILES} ${CERTIFICATE_CN_FILES})
set(RC_FILES
rcfiles/carddav_rc
rcfiles/empty_rc
rcfiles/friends_rc
rcfiles/laure_call_logs_rc
rcfiles/laure_rc_udp
rcfiles/marie_early_rc
rcfiles/marie_h264_rc
rcfiles/marie_quality_reporting_rc
rcfiles/marie_rc
rcfiles/marie_rc_rtcp_xr
rcfiles/marie_remote_404_rc
rcfiles/marie_remote_default_values_rc
rcfiles/marie_remote_https_rc
rcfiles/marie_remote_invalid_rc
rcfiles/marie_remote_invalid_uri_rc
rcfiles/marie_remote_localfile2_rc
rcfiles/marie_remote_localfile_android_rc
rcfiles/marie_remote_localfile_rc
rcfiles/marie_remote_localfile_win10_rc
rcfiles/marie_remote_rc
rcfiles/marie_sips_rc
rcfiles/marie_transient_remote_rc
rcfiles/marie_zrtp_aes256_rc
rcfiles/marie_zrtp_b256_rc
rcfiles/marie_zrtp_srtpsuite_aes256_rc
rcfiles/michelle_rc_udp
rcfiles/multi_account_rc
rcfiles/pauline_alt_rc
rcfiles/pauline_h264_rc
rcfiles/pauline_rc
rcfiles/pauline_rc_rtcp_xr
rcfiles/pauline_sips_rc
rcfiles/pauline_tcp_rc
rcfiles/pauline_wild_rc
rcfiles/pauline_zrtp_aes256_rc
rcfiles/pauline_zrtp_b256_rc
rcfiles/pauline_zrtp_srtpsuite_aes256_rc
rcfiles/remote_zero_length_params_rc
rcfiles/stun_rc
rcfiles/upnp_rc
rcfiles/zero_length_params_rc
)
set(IMAGE_FILES images/nowebcamCIF.jpg)
set(VCARD_FILES
vcards/thousand_vcards.vcf
vcards/vcards.vcf
)
set(OTHER_FILES
tester_hosts
messages.db
)
set(IOS_RESOURCES_FILES
${OTHER_FILES}
certificates
images
rcfiles
sipp
sounds
tester_hosts
vcards
)
file(GLOB SOURCE_FILES_C "*_tester.c")
list(APPEND SOURCE_FILES_C accountmanager.c tester.c)
set(SOURCE_FILES_C
accountmanager.c
audio_bypass_tester.c
call_multicast_tester.c
call_multi_tester.c
call_single_tester.c
call_video_tester.c
complex_sip_case_tester.c
dtmf_tester.c
eventapi_tester.c
flexisip_tester.c
liblinphone_tester.c
liblinphone_tester.h
log_collection_tester.c
message_tester.c
offeranswer_tester.c
player_tester.c
presence_server_tester.c
presence_tester.c
proxy_config_tester.c
quality_reporting_tester.c
register_tester.c
remote_provisioning_tester.c
setup_tester.c
stun_tester.c
tester.c
tunnel_tester.c
upnp_tester.c
vcard_tester.c
video_tester.c
)
set(SOURCE_FILES_OBJC )
if(APPLE)
@ -127,12 +246,12 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
endif()
endif()
# on iOS though, we also build the exectuable so that one can compile it from Xcode and run it directly
# on iOS though, we also build the executable so that one can compile it from Xcode and run it directly
if (NOT ANDROID AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
if (IOS)
set_source_files_properties(${RESOURCES_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
add_executable(liblinphone_tester MACOSX_BUNDLE ${RESOURCES_FILES} ${SOURCE_FILES_C} ${SOURCE_FILES_OBJC})
set_target_properties(liblinphone_tester PROPERTIES LINK_FLAGS "${MEDIASTREAMER2_LDFLAGS}")
if(IOS)
set_source_files_properties(${IOS_RESOURCES_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
add_executable(liblinphone_tester MACOSX_BUNDLE ${IOS_RESOURCES_FILES} ${SOURCE_FILES_C} ${SOURCE_FILES_OBJC})
set_target_properties(liblinphone_tester PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}")
else()
add_executable(liblinphone_tester ${SOURCE_FILES_C} ${SOURCE_FILES_OBJC})
endif()
@ -148,4 +267,21 @@ if (NOT ANDROID AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
target_link_libraries(liblinphone_tester ${GTKMACINTEGRATION_LIBRARIES})
endif()
endif()
if(NOT IOS)
install(TARGETS liblinphone_tester
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
)
install(FILES ${OTHER_FILES} DESTINATION "${CMAKE_INSTALL_DATADIR}/liblinphone_tester")
install(FILES ${SOUND_FILES} DESTINATION "${CMAKE_INSTALL_DATADIR}/liblinphone_tester/sounds")
install(FILES ${SIPP_FILES} DESTINATION "${CMAKE_INSTALL_DATADIR}/liblinphone_tester/sipp")
install(FILES ${CERTIFICATE_ALT_FILES} DESTINATION "${CMAKE_INSTALL_DATADIR}/liblinphone_tester/certificates/altname")
install(FILES ${CERTIFICATE_CN_FILES} DESTINATION "${CMAKE_INSTALL_DATADIR}/liblinphone_tester/certificates/cn")
install(FILES ${RC_FILES} DESTINATION "${CMAKE_INSTALL_DATADIR}/liblinphone_tester/rcfiles")
install(FILES ${IMAGE_FILES} DESTINATION "${CMAKE_INSTALL_DATADIR}/liblinphone_tester/images")
install(FILES ${VCARD_FILES} DESTINATION "${CMAKE_INSTALL_DATADIR}/liblinphone_tester/vcards")
endif()
endif()

View file

@ -260,6 +260,10 @@ bool_t call_with_params2(LinphoneCoreManager* caller_mgr
LinphoneCall *callee_call=NULL;
LinphoneCall *caller_call=NULL;
/* TODO: This should be handled correctly inside the liblinphone library but meanwhile handle this here. */
linphone_core_manager_wait_for_stun_resolution(caller_mgr);
linphone_core_manager_wait_for_stun_resolution(callee_mgr);
setup_sdp_handling(caller_test_params, caller_mgr);
setup_sdp_handling(callee_test_params, callee_mgr);

View file

@ -100,7 +100,7 @@ static void liblinphone_android_bctbx_log_handler(const char *domain, BctbxLogLe
liblinphone_android_log_handler(prio, fmt, args);
}
void cunit_android_trace_handler(int level, const char *fmt, va_list args) {
void bcunit_android_trace_handler(int level, const char *fmt, va_list args) {
char buffer[CALLBACK_BUFFER_SIZE];
jstring javaString;
jclass cls;
@ -130,7 +130,7 @@ JNIEXPORT jint JNICALL Java_org_linphone_tester_Tester_run(JNIEnv *env, jobject
}
current_env = env;
current_obj = obj;
bc_set_trace_handler(cunit_android_trace_handler);
bc_set_trace_handler(bcunit_android_trace_handler);
ret = main(argc, argv);
current_env = NULL;
bc_set_trace_handler(NULL);
@ -159,7 +159,7 @@ static void log_handler(int lev, const char *fmt, va_list args) {
va_copy(cap,args);
#ifdef ANDROID
/* IMPORTANT: needed by liblinphone tester to retrieve suite list...*/
cunit_android_trace_handler(lev == ORTP_ERROR, fmt, cap);
bcunit_android_trace_handler(lev == ORTP_ERROR, fmt, cap);
#else
/* Otherwise, we must use stdio to avoid log formatting (for autocompletion etc.) */
vfprintf(lev == ORTP_ERROR ? stderr : stdout, fmt, cap);

View file

@ -261,7 +261,7 @@ typedef struct _LinphoneCoreManager {
LinphoneAddress* identity;
LinphoneEvent *lev;
bool_t decline_subscribe;
int number_of_cunit_error_at_creation;
int number_of_bcunit_error_at_creation;
} LinphoneCoreManager;
typedef struct _LinphoneConferenceServer {
@ -286,6 +286,7 @@ LinphoneCoreManager* linphone_core_manager_new2(const char* rc_file, int check_f
LinphoneCoreManager* linphone_core_manager_new(const char* rc_file);
void linphone_core_manager_stop(LinphoneCoreManager *mgr);
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 reset_counters( stats* counters);

View file

@ -43,7 +43,7 @@ static void* _apple_main(void* data) {
bc_tester_set_writable_dir_prefix(documentPath.UTF8String);
liblinphone_tester_init(NULL);
bc_tester_start("toto");
bc_tester_start(NULL);
liblinphone_tester_uninit();
[bundlePath release];

View file

@ -280,7 +280,7 @@ bool_t transport_supported(LinphoneTransportType transport) {
void linphone_core_manager_init(LinphoneCoreManager *mgr, const char* rc_file) {
char *rc_path = NULL;
char *hellopath = bc_tester_res("sounds/hello8000.wav");
mgr->number_of_cunit_error_at_creation = bc_get_number_of_failures();
mgr->number_of_bcunit_error_at_creation = bc_get_number_of_failures();
mgr->v_table.registration_state_changed=registration_state_changed;
mgr->v_table.auth_info_requested=auth_info_requested;
mgr->v_table.call_state_changed=call_state_changed;
@ -354,7 +354,6 @@ void linphone_core_manager_init(LinphoneCoreManager *mgr, const char* rc_file) {
void linphone_core_manager_start(LinphoneCoreManager *mgr, int check_for_proxies) {
LinphoneProxyConfig* proxy;
LinphoneNatPolicy *nat_policy;
int proxy_count;
/*BC_ASSERT_EQUAL(bctbx_list_size(linphone_core_get_proxy_config_list(lc)),proxy_count, int, "%d");*/
@ -386,16 +385,7 @@ void linphone_core_manager_start(LinphoneCoreManager *mgr, int check_for_proxies
linphone_address_clean(mgr->identity);
}
nat_policy = linphone_core_get_nat_policy(mgr->lc);
if ((nat_policy != NULL) && (linphone_nat_policy_get_stun_server(nat_policy) != NULL) &&
(linphone_nat_policy_stun_enabled(nat_policy) || linphone_nat_policy_turn_enabled(nat_policy))) {
/*before we go, ensure that the stun server is resolved, otherwise all ice related test will fail*/
const char **tags = bc_tester_current_test_tags();
int ice_test = (tags && ((tags[0] && !strcmp(tags[0], "ICE")) || (tags[1] && !strcmp(tags[1], "ICE"))));
if (ice_test) {
BC_ASSERT_TRUE(wait_for_stun_resolution(mgr));
}
}
linphone_core_manager_wait_for_stun_resolution(mgr);
if (!check_for_proxies){
/*now that stun server resolution is done, we can start registering*/
linphone_core_set_network_reachable(mgr->lc, TRUE);
@ -430,16 +420,19 @@ void linphone_core_manager_uninit(LinphoneCoreManager *mgr) {
if (mgr->stat.last_received_info_message) linphone_info_message_destroy(mgr->stat.last_received_info_message);
if (mgr->lc){
const char *record_file=linphone_core_get_record_file(mgr->lc);
const char *chatdb = linphone_core_get_chat_database_path(mgr->lc);
char *chatdb = ms_strdup(linphone_core_get_chat_database_path(mgr->lc));
if (!liblinphone_tester_keep_record_files && record_file){
if ((bc_get_number_of_failures()-mgr->number_of_cunit_error_at_creation)>0) {
if ((bc_get_number_of_failures()-mgr->number_of_bcunit_error_at_creation)>0) {
ms_message ("Test has failed, keeping recorded file [%s]",record_file);
} else {
unlink(record_file);
}
}
linphone_core_destroy(mgr->lc);
if (chatdb) unlink(chatdb);
if (chatdb) {
unlink(chatdb);
ms_free(chatdb);
}
}
if (mgr->identity) {
linphone_address_destroy(mgr->identity);
@ -448,6 +441,16 @@ void linphone_core_manager_uninit(LinphoneCoreManager *mgr) {
manager_count--;
}
void linphone_core_manager_wait_for_stun_resolution(LinphoneCoreManager *mgr) {
LinphoneNatPolicy *nat_policy = linphone_core_get_nat_policy(mgr->lc);
if ((nat_policy != NULL) && (linphone_nat_policy_get_stun_server(nat_policy) != NULL) &&
(linphone_nat_policy_stun_enabled(nat_policy) || linphone_nat_policy_turn_enabled(nat_policy)) &&
(linphone_nat_policy_ice_enabled(nat_policy))) {
/*before we go, ensure that the stun server is resolved, otherwise all ice related test will fail*/
BC_ASSERT_TRUE(wait_for_stun_resolution(mgr));
}
}
void linphone_core_manager_destroy(LinphoneCoreManager* mgr) {
linphone_core_manager_uninit(mgr);
ms_free(mgr);

View file

@ -84,9 +84,10 @@ static void linphone_vcard_import_a_lot_of_friends_test(void) {
fseek(infile, 0L, SEEK_END);
numbytes = ftell(infile);
fseek(infile, 0L, SEEK_SET);
buffer = (char*)ms_malloc(numbytes * sizeof(char));
buffer = (char*)ms_malloc((numbytes + 1) * sizeof(char));
numbytes = fread(buffer, sizeof(char), numbytes, infile);
fclose(infile);
buffer[numbytes] = '\0';
start = clock();
linphone_friend_list_import_friends_from_vcard4_buffer(lfl, buffer);
@ -136,7 +137,8 @@ static void linphone_vcard_update_existing_friends_test(void) {
#endif
static void linphone_vcard_phone_numbers_and_sip_addresses(void) {
LinphoneVcard *lvc = linphone_vcard_new_from_vcard4_buffer("BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Sylvain Berfini\r\nIMPP:sip:sberfini@sip.linphone.org\r\nIMPP;TYPE=home:sip:sylvain@sip.linphone.org\r\nTEL;TYPE=work:0952636505\r\nEND:VCARD\r\n");
LinphoneCoreManager* manager = linphone_core_manager_new2("empty_rc", FALSE);
LinphoneVcard *lvc = linphone_vcard_new_from_vcard4_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Sylvain Berfini\r\nIMPP:sip:sberfini@sip.linphone.org\r\nIMPP;TYPE=home:sip:sylvain@sip.linphone.org\r\nTEL;TYPE=work:0952636505\r\nEND:VCARD\r\n");
LinphoneFriend *lf = linphone_friend_new_from_vcard(lvc);
bctbx_list_t *sip_addresses = linphone_friend_get_addresses(lf);
bctbx_list_t *phone_numbers = linphone_friend_get_phone_numbers(lf);
@ -148,7 +150,7 @@ static void linphone_vcard_phone_numbers_and_sip_addresses(void) {
if (phone_numbers) bctbx_list_free(phone_numbers);
linphone_friend_unref(lf);
lvc = linphone_vcard_new_from_vcard4_buffer("BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Sylvain Berfini\r\nTEL;TYPE=work:0952636505\r\nTEL:0476010203\r\nEND:VCARD\r\n");
lvc = linphone_vcard_new_from_vcard4_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Sylvain Berfini\r\nTEL;TYPE=work:0952636505\r\nTEL:0476010203\r\nEND:VCARD\r\n");
lf = linphone_friend_new_from_vcard(lvc);
sip_addresses = linphone_friend_get_addresses(lf);
phone_numbers = linphone_friend_get_phone_numbers(lf);
@ -190,6 +192,7 @@ static void linphone_vcard_phone_numbers_and_sip_addresses(void) {
linphone_friend_unref(lf);
lf = NULL;
lvc = NULL;
linphone_core_manager_destroy(manager);
}
#ifdef SQLITE_STORAGE_ENABLED
@ -273,6 +276,7 @@ static void friends_sqlite_storage(void) {
bctbx_list_t *friends_lists_from_db = NULL;
char *friends_db = bc_tester_file("friends.db");
LinphoneFriendListStats *stats = (LinphoneFriendListStats *)ms_new0(LinphoneFriendListStats, 1);
char *address = NULL, *address2 = NULL;
v_table->friend_list_created = friend_list_created_cb;
v_table->friend_list_removed = friend_list_removed_cb;
@ -325,7 +329,11 @@ static void friends_sqlite_storage(void) {
BC_ASSERT_EQUAL(lf2->storage_id, lf->storage_id, unsigned int, "%u");
BC_ASSERT_STRING_EQUAL(linphone_vcard_get_etag(linphone_friend_get_vcard(lf2)), linphone_vcard_get_etag(linphone_friend_get_vcard(lf)));
BC_ASSERT_STRING_EQUAL(linphone_vcard_get_url(linphone_friend_get_vcard(lf2)), linphone_vcard_get_url(linphone_friend_get_vcard(lf)));
BC_ASSERT_STRING_EQUAL(linphone_address_as_string(linphone_friend_get_address(lf2)), linphone_address_as_string(linphone_friend_get_address(lf)));
address = linphone_address_as_string(linphone_friend_get_address(lf));
address2 = linphone_address_as_string(linphone_friend_get_address(lf2));
BC_ASSERT_STRING_EQUAL(address2, address);
ms_free(address);
ms_free(address2);
linphone_friend_edit(lf);
linphone_friend_set_name(lf, "Margaux");
@ -356,6 +364,7 @@ end:
ms_free(friends_db);
linphone_address_unref(addr);
linphone_core_destroy(lc);
linphone_core_v_table_destroy(v_table);
}
#endif
@ -464,7 +473,7 @@ static void carddav_sync_2(void) {
static void carddav_sync_3(void) {
LinphoneCoreManager *manager = linphone_core_manager_new2("carddav_rc", FALSE);
LinphoneCardDAVStats *stats = (LinphoneCardDAVStats *)ms_new0(LinphoneCardDAVStats, 1);
LinphoneVcard *lvc = linphone_vcard_new_from_vcard4_buffer("BEGIN:VCARD\r\nVERSION:4.0\r\nUID:1f08dd48-29ac-4097-8e48-8596d7776283\r\nFN:Sylvain Berfini\r\nIMPP;TYPE=work:sip:sylvain@sip.linphone.org\r\nEND:VCARD\r\n");
LinphoneVcard *lvc = linphone_vcard_new_from_vcard4_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nUID:1f08dd48-29ac-4097-8e48-8596d7776283\r\nFN:Sylvain Berfini\r\nIMPP;TYPE=work:sip:sylvain@sip.linphone.org\r\nEND:VCARD\r\n");
LinphoneFriend *lf = linphone_friend_new_from_vcard(lvc);
char *friends_db = bc_tester_file("friends.db");
LinphoneFriendList *lfl = linphone_core_create_friend_list(manager->lc);
@ -505,7 +514,7 @@ static void carddav_sync_3(void) {
static void carddav_sync_4(void) {
LinphoneCoreManager *manager = linphone_core_manager_new2("carddav_rc", FALSE);
LinphoneCardDAVStats *stats = (LinphoneCardDAVStats *)ms_new0(LinphoneCardDAVStats, 1);
LinphoneVcard *lvc = linphone_vcard_new_from_vcard4_buffer("BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Margaux Clerc\r\nIMPP;TYPE=work:sip:margaux@sip.linphone.org\r\nEND:VCARD\r\n");
LinphoneVcard *lvc = linphone_vcard_new_from_vcard4_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Margaux Clerc\r\nIMPP;TYPE=work:sip:margaux@sip.linphone.org\r\nEND:VCARD\r\n");
LinphoneFriend *lf = linphone_friend_new_from_vcard(lvc);
LinphoneFriendList *lfl = linphone_core_create_friend_list(manager->lc);
LinphoneCardDavContext *c = NULL;
@ -566,13 +575,14 @@ static void carddav_sync_status_changed(LinphoneFriendList *list, LinphoneFriend
static void carddav_integration(void) {
LinphoneCoreManager *manager = linphone_core_manager_new2("carddav_rc", FALSE);
LinphoneFriendList *lfl = linphone_core_create_friend_list(manager->lc);
LinphoneVcard *lvc = linphone_vcard_new_from_vcard4_buffer("BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Margaux Clerc\r\nIMPP;TYPE=work:sip:margaux@sip.linphone.org\r\nEND:VCARD\r\n");
LinphoneVcard *lvc = linphone_vcard_new_from_vcard4_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Margaux Clerc\r\nIMPP;TYPE=work:sip:margaux@sip.linphone.org\r\nEND:VCARD\r\n");
LinphoneFriend *lf = linphone_friend_new_from_vcard(lvc);
LinphoneVcard *lvc2 = NULL;
LinphoneFriend *lf2 = NULL;
LinphoneFriendListCbs *cbs = NULL;
LinphoneCardDAVStats *stats = (LinphoneCardDAVStats *)ms_new0(LinphoneCardDAVStats, 1);
const char *refkey = "toto";
char *address = NULL;
linphone_friend_list_set_uri(lfl, CARDDAV_SERVER);
cbs = linphone_friend_list_get_callbacks(lfl);
@ -598,12 +608,12 @@ static void carddav_integration(void) {
linphone_friend_unref(lf);
lf = NULL;
lvc = linphone_vcard_new_from_vcard4_buffer("BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Ghislain Mary\r\nIMPP;TYPE=work:sip:ghislain@sip.linphone.org\r\nEND:VCARD\r\n");
lvc = linphone_vcard_new_from_vcard4_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Ghislain Mary\r\nIMPP;TYPE=work:sip:ghislain@sip.linphone.org\r\nEND:VCARD\r\n");
lf = linphone_friend_new_from_vcard(lvc);
BC_ASSERT_EQUAL(linphone_friend_list_add_local_friend(lfl, lf), LinphoneFriendListOK, int, "%d");
linphone_friend_unref(lf);
lvc2 = linphone_vcard_new_from_vcard4_buffer("BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Sylvain Berfini\r\nIMPP:sip:sberfini@sip.linphone.org\r\nUID:1f08dd48-29ac-4097-8e48-8596d7776283\r\nEND:VCARD\r\n");
lvc2 = linphone_vcard_new_from_vcard4_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Sylvain Berfini\r\nIMPP:sip:sberfini@sip.linphone.org\r\nUID:1f08dd48-29ac-4097-8e48-8596d7776283\r\nEND:VCARD\r\n");
linphone_vcard_set_url(lvc2, "/card.php/addressbooks/tester/default/me.vcf");
lf2 = linphone_friend_new_from_vcard(lvc2);
linphone_friend_set_ref_key(lf2, refkey);
@ -626,7 +636,9 @@ static void carddav_integration(void) {
BC_ASSERT_STRING_EQUAL(lf->refkey, refkey);
BC_ASSERT_EQUAL(lf->storage_id, lf2->storage_id, unsigned int, "%u");
linphone_friend_unref(lf2);
BC_ASSERT_STRING_EQUAL(linphone_address_as_string_uri_only(lf->uri), "sip:sylvain@sip.linphone.org");
address = linphone_address_as_string_uri_only(lf->uri);
BC_ASSERT_STRING_EQUAL(address, "sip:sylvain@sip.linphone.org");
ms_free(address);
linphone_friend_edit(lf);
linphone_friend_done(lf);
@ -679,7 +691,7 @@ static void carddav_clean(void) { // This is to ensure the content of the test
}
bctbx_list_free(friends);
lvc = linphone_vcard_new_from_vcard4_buffer("BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Sylvain Berfini\r\nIMPP:sip:sylvain@sip.linphone.org\r\nUID:1f08dd48-29ac-4097-8e48-8596d7776283\r\nEND:VCARD\r\n");
lvc = linphone_vcard_new_from_vcard4_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Sylvain Berfini\r\nIMPP:sip:sylvain@sip.linphone.org\r\nUID:1f08dd48-29ac-4097-8e48-8596d7776283\r\nEND:VCARD\r\n");
linphone_vcard_set_url(lvc, "http://dav.linphone.org/card.php/addressbooks/tester/default/me.vcf");
lf = linphone_friend_new_from_vcard(lvc);
linphone_friend_list_add_friend(lfl, lf);
@ -727,9 +739,9 @@ static void carddav_server_to_client_and_client_to_sever_sync(void) {
LinphoneFriendList *lfl = linphone_core_create_friend_list(manager->lc);
LinphoneFriendListCbs *cbs = linphone_friend_list_get_callbacks(lfl);
LinphoneCardDAVStats *stats = (LinphoneCardDAVStats *)ms_new0(LinphoneCardDAVStats, 1);
LinphoneVcard *lvc1 = linphone_vcard_new_from_vcard4_buffer("BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Margaux Clerc\r\nIMPP;TYPE=work:sip:margaux@sip.linphone.org\r\nEND:VCARD\r\n");
LinphoneVcard *lvc1 = linphone_vcard_new_from_vcard4_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Margaux Clerc\r\nIMPP;TYPE=work:sip:margaux@sip.linphone.org\r\nEND:VCARD\r\n");
LinphoneFriend *lf1 = linphone_friend_new_from_vcard(lvc1);
LinphoneVcard *lvc2 = linphone_vcard_new_from_vcard4_buffer("BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Ghislain Mary\r\nIMPP;TYPE=work:sip:ghislain@sip.linphone.org\r\nEND:VCARD\r\n");
LinphoneVcard *lvc2 = linphone_vcard_new_from_vcard4_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Ghislain Mary\r\nIMPP;TYPE=work:sip:ghislain@sip.linphone.org\r\nEND:VCARD\r\n");
LinphoneFriend *lf2 = linphone_friend_new_from_vcard(lvc2);
bctbx_list_t *friends = NULL, *friends_iterator = NULL;

View file

@ -53,13 +53,13 @@ set(LP_AUTO_ANSWER_SOURCE_FILES auto_answer.c)
apply_compile_flags(LP_AUTO_ANSWER_SOURCE_FILES "CPP" "C")
add_executable(lp-auto-answer ${USE_BUNDLE} ${LP_AUTO_ANSWER_SOURCE_FILES})
target_link_libraries(lp-auto-answer ${LINPHONE_LIBS_FOR_TOOLS} ${MEDIASTREAMER2_LIBRARIES})
set_target_properties(lp-auto-answer PROPERTIES LINK_FLAGS "${MEDIASTREAMER2_LDFLAGS}")
set_target_properties(lp-auto-answer PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}")
set(LP_SENDMSG_SOURCE_FILES lpsendmsg.c)
apply_compile_flags(LP_SENDMSG_SOURCE_FILES "CPP" "C")
add_executable(lp-sendmsg ${USE_BUNDLE} ${LP_SENDMSG_SOURCE_FILES})
target_link_libraries(lp-sendmsg ${LINPHONE_LIBS_FOR_TOOLS} ${ORTP_LIBRARIES} ${MEDIASTREAMER2_LIBRARIES})
set_target_properties(lp-sendmsg PROPERTIES LINK_FLAGS "${MEDIASTREAMER2_LDFLAGS}")
set_target_properties(lp-sendmsg PROPERTIES LINK_FLAGS "${LINPHONE_LDFLAGS}")
if (NOT IOS)
install(TARGETS lp-gen-wrappers