Merge branch 'master' into dev_rtcpmux

This commit is contained in:
Simon Morlat 2015-11-07 13:20:33 +01:00
commit 85a9b9f016
26 changed files with 392 additions and 113 deletions

View file

@ -46,6 +46,7 @@ option(ENABLE_LIME "Enable Instant Messaging Encryption." NO)
option(ENABLE_MSG_STORAGE "Turn on compilation of message storage." YES)
cmake_dependent_option(ENABLE_NOTIFY "Enable libnotify support." YES "ENABLE_GTK_UI" NO)
option(ENABLE_RELATIVE_PREFIX "Find resources relatively to the installation directory." NO)
option(ENABLE_STRICT "Build with strict compile options." YES)
option(ENABLE_TOOLS "Turn on or off compilation of tools." YES)
option(ENABLE_TUNNEL "Turn on compilation of tunnel support." NO)
option(ENABLE_TUTORIALS "Enable compilation of tutorials." YES)
@ -58,6 +59,22 @@ option(ENABLE_NLS "Build with internationalisation support" YES)
option(ENABLE_CALL_LOGS_STORAGE "Turn on compilation of call logs storage." YES)
macro(apply_compile_flags SOURCE_FILES)
if(${SOURCE_FILES})
set(options "")
foreach(a ${ARGV})
if(STRICT_OPTIONS_${a})
string(REPLACE ";" " " options_${a} "${STRICT_OPTIONS_${a}}")
set(options "${options} ${options_${a}}")
endif()
endforeach()
if(options)
set_source_files_properties(${${SOURCE_FILES}} PROPERTIES COMPILE_FLAGS "${options}")
endif()
endif()
endmacro()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(CheckSymbolExists)
@ -197,22 +214,27 @@ if(ENABLE_DEBUG_LOGS)
add_definitions("-DDEBUG")
endif()
if(MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wuninitialized -Wdeclaration-after-statement -fno-strict-aliasing -Werror")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wuninitialized -Werror")
set(STRICT_OPTIONS_CPP )
set(STRICT_OPTIONS_C )
set(STRICT_OPTIONS_OBJC )
if(NOT MSVC)
list(APPEND STRICT_OPTIONS_CPP "-Wall" "-Wuninitialized")
list(APPEND STRICT_OPTIONS_C "-Wdeclaration-after-statement")
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Qunused-arguments -Wno-array-bounds")
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments -Wno-array-bounds")
list(APPEND STRICT_OPTIONS_CPP "-Qunused-arguments" "-Wno-array-bounds")
endif()
if(APPLE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=unknown-warning-option -Wno-tautological-compare -Wno-unused-function")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=unknown-warning-option -Wno-tautological-compare -Wno-unused-function")
list(APPEND STRICT_OPTIONS_CPP "-Wno-error=unknown-warning-option" "-Qunused-arguments" "-Wno-tautological-compare" "-Wno-unused-function" "-Wno-array-bounds")
endif()
if(ENABLE_STRICT)
list(APPEND STRICT_OPTIONS_CPP "-Werror" "-fno-strict-aliasing")
endif()
endif()
if(STRICT_OPTIONS_CPP)
list(REMOVE_DUPLICATES STRICT_OPTIONS_CPP)
endif()
if(STRICT_OPTIONS_C)
list(REMOVE_DUPLICATES STRICT_OPTIONS_C)
endif()

16
NEWS
View file

@ -28,7 +28,7 @@ linphone-3.8.2 -- May 7th, 2015
* add support of the StatusNotifierItem standard to display a status icon on KDE5
* auto-answering can be set through the preferences panel
* bug fixes
Liblinphone level improvements:
* fix audio bug with opus codec
* fix ICE corner case not properly handled and resulting bad final ice status
@ -76,14 +76,14 @@ linphone-3.7.0 -- February 20th, 2014
* Keyboard can be used for DTMF input
* Faster and higly responsive UI thanks to fully asynchronous operation of the liblinphone.
* Addon of opus codec
* Possibility to specify a remote provisionning http URI for configuration
* Possibility to specify a remote provisioning http URI for configuration
* LDAP search integration for Linux and MacOSX
* is-composing notification in chat area
* is-composing notification in chat area
Liblinphone level improvements thanks to new "belle-sip" SIP stack:
* multiple SIP transports simultaneously now allowed
* IP dual stack: can use IPv6 and IPv4 simultaneously
* fully asynchronous behavior: no more lengthly DNS or connections
* fully asynchronous behavior: no more lengthly DNS or connections
* +sip.instance parameter (RFC5626)
* alias parameter (RFC5923)
* better management of network disconnections
@ -101,7 +101,7 @@ linphone-3.7.0 -- February 20th, 2014
linphone-3.6.1 -- June 17, 2013
* fix memory leak with some video cameras on windows.
Requires: mediastreamer2 = 2.9.1 and ortp = 0.22.0
linphone-3.6.0 -- May 27, 2013
@ -166,9 +166,9 @@ linphone-3.4.1 -- February 17th, 2011
Requires mediastreamer-2.7.1
linphone-3.4.0 -- February 7th, 2011
* implement multiple calls feature:
* implement multiple calls feature:
- call hold (with possibility to play a music file)
- call resume
- call resume
- acceptance of 2nd call while putting the others on hold
- creation of another outgoing call while already in call
- blind call transfer
@ -339,7 +339,7 @@ linphone-1.4.1 -- September 18, 2006
* do not change mixer settings at startup
linphone-1.4.0 -- September 11, 2006
* no more glib dependency at all
* no more glib dependency at all
* new mediastreamer2 framework for audio/video streaming
* stable video support with H.263-1998
* echo cancelation

View file

@ -29,6 +29,7 @@ set(LINPHONECSH_SOURCE_FILES
shell.c
)
apply_compile_flags(LINPHONEC_SOURCE_FILES "CPP" "C")
add_executable(linphonec ${LINPHONEC_SOURCE_FILES})
target_link_libraries(linphonec linphone)

View file

@ -50,7 +50,7 @@ set(LINPHONE_HEADER_FILES
xmlrpc.h
)
set(LINPHONE_SOURCE_FILES
set(LINPHONE_SOURCE_FILES_C
account_creator.c
address.c
authentication.c
@ -111,15 +111,16 @@ set(LINPHONE_SOURCE_FILES
xmlrpc.c
vtables.c
)
set(LINPHONE_SOURCE_FILES_CXX )
if(ENABLE_TUNNEL)
list(APPEND LINPHONE_SOURCE_FILES
list(APPEND LINPHONE_SOURCE_FILES_CXX
linphone_tunnel.cc
TunnelManager.cc
)
add_definitions(-DTUNNEL_ENABLED)
else()
list(APPEND LINPHONE_SOURCE_FILES linphone_tunnel_stubs.c)
list(APPEND LINPHONE_SOURCE_FILES_C linphone_tunnel_stubs.c)
endif()
find_package(Git)
@ -133,6 +134,9 @@ add_definitions(
-DLIBLINPHONE_EXPORTS
)
apply_compile_flags(LINPHONE_SOURCE_FILES_C "CPP" "C")
apply_compile_flags(LINPHONE_SOURCE_FILES_CXX "CPP" "CXX")
set(LIBS
${BELLESIP_LIBRARIES}
${MEDIASTREAMER2_LIBRARIES}
@ -161,10 +165,10 @@ if(INTL_FOUND)
endif()
if(ENABLE_STATIC)
add_library(linphone STATIC ${LINPHONE_HEADER_FILES} ${LINPHONE_SOURCE_FILES})
add_library(linphone STATIC ${LINPHONE_HEADER_FILES} ${LINPHONE_SOURCE_FILES_C} ${LINPHONE_SOURCE_FILES_CXX})
target_link_libraries(linphone ${LIBS})
else()
add_library(linphone SHARED ${LINPHONE_HEADER_FILES} ${LINPHONE_SOURCE_FILES})
add_library(linphone SHARED ${LINPHONE_HEADER_FILES} ${LINPHONE_SOURCE_FILES_C} ${LINPHONE_SOURCE_FILES_CXX})
set_target_properties(linphone PROPERTIES VERSION ${LINPHONE_SO_VERSION} LINKER_LANGUAGE CXX)
target_link_libraries(linphone ${LIBS})
if(MSVC)

View file

@ -162,7 +162,7 @@ static LinphoneAccountCreatorStatus validate_uri(const char* username, const cha
}
linphone_address_unref(addr);
return LinphoneAccountCreatorOk;
return LinphoneAccountCreatorOK;
}
static bool_t is_matching_regex(const char *entry, const char* regex) {
@ -198,11 +198,11 @@ LinphoneAccountCreatorStatus linphone_account_creator_set_username(LinphoneAccou
return LinphoneAccountCreatorUsernameInvalid;
} else if (regex && !is_matching_regex(username, regex)) {
return LinphoneAccountCreatorUsernameInvalid;
} else if ((status = validate_uri(username, NULL, NULL, NULL)) != LinphoneAccountCreatorOk) {
} else if ((status = validate_uri(username, NULL, NULL, NULL)) != LinphoneAccountCreatorOK) {
return status;
}
set_string(&creator->username, username, TRUE);
return LinphoneAccountCreatorOk;
return LinphoneAccountCreatorOK;
}
const char * linphone_account_creator_get_username(const LinphoneAccountCreator *creator) {
@ -215,7 +215,7 @@ LinphoneAccountCreatorStatus linphone_account_creator_set_password(LinphoneAccou
return LinphoneAccountCreatorPasswordTooShort;
}
set_string(&creator->password, password, FALSE);
return LinphoneAccountCreatorOk;
return LinphoneAccountCreatorOK;
}
const char * linphone_account_creator_get_password(const LinphoneAccountCreator *creator) {
@ -227,7 +227,7 @@ LinphoneAccountCreatorStatus linphone_account_creator_set_transport(LinphoneAcco
return LinphoneAccountCreatorTransportNotSupported;
}
creator->transport = transport;
return LinphoneAccountCreatorOk;
return LinphoneAccountCreatorOK;
}
LinphoneTransportType linphone_account_creator_get_transport(const LinphoneAccountCreator *creator) {
@ -239,7 +239,7 @@ LinphoneAccountCreatorStatus linphone_account_creator_set_domain(LinphoneAccount
return LinphoneAccountCreatorDomainInvalid;
}
set_string(&creator->domain, domain, TRUE);
return LinphoneAccountCreatorOk;
return LinphoneAccountCreatorOK;
}
const char * linphone_account_creator_get_domain(const LinphoneAccountCreator *creator) {
@ -251,7 +251,7 @@ LinphoneAccountCreatorStatus linphone_account_creator_set_route(LinphoneAccountC
return LinphoneAccountCreatorRouteInvalid;
}
set_string(&creator->route, route, TRUE);
return LinphoneAccountCreatorOk;
return LinphoneAccountCreatorOK;
}
const char * linphone_account_creator_get_route(const LinphoneAccountCreator *creator) {
@ -263,7 +263,7 @@ LinphoneAccountCreatorStatus linphone_account_creator_set_display_name(LinphoneA
return LinphoneAccountCreatorDisplayNameInvalid;
}
set_string(&creator->display_name, display_name, FALSE);
return LinphoneAccountCreatorOk;
return LinphoneAccountCreatorOK;
}
const char * linphone_account_creator_get_display_name(const LinphoneAccountCreator *creator) {
@ -275,7 +275,7 @@ LinphoneAccountCreatorStatus linphone_account_creator_set_email(LinphoneAccountC
return LinphoneAccountCreatorEmailInvalid;
}
set_string(&creator->email, email, TRUE);
return LinphoneAccountCreatorOk;
return LinphoneAccountCreatorOK;
}
const char * linphone_account_creator_get_email(const LinphoneAccountCreator *creator) {
@ -297,10 +297,10 @@ LinphoneAccountCreatorCbs * linphone_account_creator_get_callbacks(const Linphon
static void _test_existence_cb(LinphoneXmlRpcRequest *request) {
LinphoneAccountCreator *creator = (LinphoneAccountCreator *)linphone_xml_rpc_request_get_user_data(request);
if (creator->callbacks->existence_tested != NULL) {
LinphoneAccountCreatorStatus status = LinphoneAccountCreatorFailed;
if ((linphone_xml_rpc_request_get_status(request) == LinphoneXmlRpcStatusOk)
&& (linphone_xml_rpc_request_get_int_response(request) == 0)) {
status = LinphoneAccountCreatorOk;
LinphoneAccountCreatorStatus status = LinphoneAccountCreatorReqFailed;
if (linphone_xml_rpc_request_get_status(request) == LinphoneXmlRpcStatusOk) {
int resp = linphone_xml_rpc_request_get_int_response(request);
status = (resp == 0) ? LinphoneAccountCreatorAccountNotExist : LinphoneAccountCreatorAccountExist;
}
creator->callbacks->existence_tested(creator, status);
}
@ -312,9 +312,9 @@ LinphoneAccountCreatorStatus linphone_account_creator_test_existence(LinphoneAcc
if (!creator->username || !creator->domain) {
if (creator->callbacks->existence_tested != NULL) {
creator->callbacks->existence_tested(creator, LinphoneAccountCreatorFailed);
creator->callbacks->existence_tested(creator, LinphoneAccountCreatorReqFailed);
}
return LinphoneAccountCreatorFailed;
return LinphoneAccountCreatorReqFailed;
}
identity = ms_strdup_printf("%s@%s", creator->username, creator->domain);
request = linphone_xml_rpc_request_new_with_args("check_account", LinphoneXmlRpcArgInt,
@ -325,16 +325,16 @@ LinphoneAccountCreatorStatus linphone_account_creator_test_existence(LinphoneAcc
linphone_xml_rpc_session_send_request(creator->xmlrpc_session, request);
linphone_xml_rpc_request_unref(request);
ms_free(identity);
return LinphoneAccountCreatorOk;
return LinphoneAccountCreatorOK;
}
static void _test_validation_cb(LinphoneXmlRpcRequest *request) {
LinphoneAccountCreator *creator = (LinphoneAccountCreator *)linphone_xml_rpc_request_get_user_data(request);
if (creator->callbacks->validation_tested != NULL) {
LinphoneAccountCreatorStatus status = LinphoneAccountCreatorFailed;
if ((linphone_xml_rpc_request_get_status(request) == LinphoneXmlRpcStatusOk)
&& (linphone_xml_rpc_request_get_int_response(request) == 1)) {
status = LinphoneAccountCreatorOk;
LinphoneAccountCreatorStatus status = LinphoneAccountCreatorReqFailed;
if (linphone_xml_rpc_request_get_status(request) == LinphoneXmlRpcStatusOk) {
int resp = linphone_xml_rpc_request_get_int_response(request);
status = (resp == 0) ? LinphoneAccountCreatorAccountNotValidated : LinphoneAccountCreatorAccountValidated;
}
creator->callbacks->validation_tested(creator, status);
}
@ -346,9 +346,9 @@ LinphoneAccountCreatorStatus linphone_account_creator_test_validation(LinphoneAc
if (!creator->username || !creator->domain) {
if (creator->callbacks->validation_tested != NULL) {
creator->callbacks->validation_tested(creator, LinphoneAccountCreatorFailed);
creator->callbacks->validation_tested(creator, LinphoneAccountCreatorReqFailed);
}
return LinphoneAccountCreatorFailed;
return LinphoneAccountCreatorReqFailed;
}
identity = ms_strdup_printf("%s@%s", creator->username, creator->domain);
@ -360,16 +360,16 @@ LinphoneAccountCreatorStatus linphone_account_creator_test_validation(LinphoneAc
linphone_xml_rpc_session_send_request(creator->xmlrpc_session, request);
linphone_xml_rpc_request_unref(request);
ms_free(identity);
return LinphoneAccountCreatorOk;
return LinphoneAccountCreatorOK;
}
static void _create_account_cb(LinphoneXmlRpcRequest *request) {
LinphoneAccountCreator *creator = (LinphoneAccountCreator *)linphone_xml_rpc_request_get_user_data(request);
if (creator->callbacks->create_account != NULL) {
LinphoneAccountCreatorStatus status = LinphoneAccountCreatorFailed;
if ((linphone_xml_rpc_request_get_status(request) == LinphoneXmlRpcStatusOk)
&& (linphone_xml_rpc_request_get_int_response(request) == 0)) {
status = LinphoneAccountCreatorOk;
LinphoneAccountCreatorStatus status = LinphoneAccountCreatorReqFailed;
if (linphone_xml_rpc_request_get_status(request) == LinphoneXmlRpcStatusOk) {
int resp = linphone_xml_rpc_request_get_int_response(request);
status = (resp == 0) ? LinphoneAccountCreatorAccountCreated : LinphoneAccountCreatorAccountNotCreated;
}
creator->callbacks->create_account(creator, status);
}
@ -379,11 +379,11 @@ LinphoneAccountCreatorStatus linphone_account_creator_create_account(LinphoneAcc
LinphoneXmlRpcRequest *request;
char *identity;
if (!creator->username || !creator->domain) {
if (!creator->username || !creator->domain || !creator->email) {
if (creator->callbacks->create_account != NULL) {
creator->callbacks->create_account(creator, LinphoneAccountCreatorFailed);
creator->callbacks->create_account(creator, LinphoneAccountCreatorReqFailed);
}
return LinphoneAccountCreatorFailed;
return LinphoneAccountCreatorReqFailed;
}
identity = ms_strdup_printf("%s@%s", creator->username, creator->domain);
@ -398,7 +398,7 @@ LinphoneAccountCreatorStatus linphone_account_creator_create_account(LinphoneAcc
linphone_xml_rpc_session_send_request(creator->xmlrpc_session, request);
linphone_xml_rpc_request_unref(request);
ms_free(identity);
return LinphoneAccountCreatorOk;
return LinphoneAccountCreatorOK;
}
LinphoneProxyConfig * linphone_account_creator_configure(const LinphoneAccountCreator *creator) {

View file

@ -36,18 +36,27 @@ extern "C" {
* Enum describing the status of a LinphoneAccountCreator operation.
**/
typedef enum _LinphoneAccountCreatorStatus {
LinphoneAccountCreatorOk = 0,
LinphoneAccountCreatorFailed = 1 << 0,
LinphoneAccountCreatorOK,
LinphoneAccountCreatorReqFailed,
LinphoneAccountCreatorEmailInvalid = 1 << 1,
LinphoneAccountCreatorUsernameInvalid = 1 << 2,
LinphoneAccountCreatorUsernameTooShort = 1 << 3,
LinphoneAccountCreatorUsernameInvalidSize = 1 << 4,
LinphoneAccountCreatorPasswordTooShort = 1 << 5,
LinphoneAccountCreatorDomainInvalid = 1 << 6,
LinphoneAccountCreatorRouteInvalid = 1 << 7,
LinphoneAccountCreatorDisplayNameInvalid = 1 << 8,
LinphoneAccountCreatorTransportNotSupported = 1 << 9,
LinphoneAccountCreatorAccountCreated,
LinphoneAccountCreatorAccountNotCreated,
LinphoneAccountCreatorAccountExist,
LinphoneAccountCreatorAccountNotExist,
LinphoneAccountCreatorAccountValidated,
LinphoneAccountCreatorAccountNotValidated,
LinphoneAccountCreatorEmailInvalid,
LinphoneAccountCreatorUsernameInvalid,
LinphoneAccountCreatorUsernameTooShort,
LinphoneAccountCreatorUsernameInvalidSize,
LinphoneAccountCreatorPasswordTooShort,
LinphoneAccountCreatorDomainInvalid,
LinphoneAccountCreatorRouteInvalid,
LinphoneAccountCreatorDisplayNameInvalid,
LinphoneAccountCreatorTransportNotSupported,
} LinphoneAccountCreatorStatus;
/**
@ -245,21 +254,21 @@ LINPHONE_PUBLIC LinphoneAccountCreatorCbs * linphone_account_creator_get_callbac
/**
* Send an XML-RPC request to test the existence of a Linphone account.
* @param[in] creator LinphoneAccountCreator object
* @return LinphoneAccountCreatorOk if the request has been sent, LinphoneAccountCreatorFailed otherwise
* @return LinphoneAccountCreatorOk if the request has been sent, LinphoneAccountCreatorReqFailed otherwise
**/
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_test_existence(LinphoneAccountCreator *creator);
/**
* Send an XML-RPC request to test the validation of a Linphone account.
* @param[in] creator LinphoneAccountCreator object
* @return LinphoneAccountCreatorOk if the request has been sent, LinphoneAccountCreatorFailed otherwise
* @return LinphoneAccountCreatorOk if the request has been sent, LinphoneAccountCreatorReqFailed otherwise
**/
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_test_validation(LinphoneAccountCreator *creator);
/**
* Send an XML-RPC request to create a Linphone account.
* @param[in] creator LinphoneAccountCreator object
* @return LinphoneAccountCreatorOk if the request has been sent, LinphoneAccountCreatorFailed otherwise
* @return LinphoneAccountCreatorOk if the request has been sent, LinphoneAccountCreatorReqFailed otherwise
**/
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_create_account(LinphoneAccountCreator *creator);

View file

@ -33,8 +33,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static char *create_enum_domain(const char *number){
size_t len=strlen(number);
char *domain=ms_malloc((len*2)+10);
size_t i,j;
long i,j;
for (i=0,j=len-1;j>=0;j--){
domain[i]=number[j];
i++;
@ -105,11 +105,11 @@ int enum_lookup(const char *enum_domain, enum_lookup_res_t **res){
/*
ns_msg handle;
int count;
memset(&handle,0,sizeof(handle));
*res=NULL;
ms_message("Resolving %s...",enum_domain);
err=res_search(enum_domain,ns_c_in,ns_t_naptr,dns_answer,DNS_ANSWER_MAX_SIZE);
if (err<0){
ms_warning("Error resolving enum:",herror(h_errno));
@ -117,7 +117,7 @@ int enum_lookup(const char *enum_domain, enum_lookup_res_t **res){
}
ns_initparse(dns_answer,DNS_ANSWER_MAX_SIZE,&handle);
count=ns_msg_count(handle,ns_s_an);
for(i=0;i<count;i++){
ns_rr rr;
memset(&rr,0,sizeof(rr));
@ -136,9 +136,9 @@ int enum_lookup(const char *enum_domain, enum_lookup_res_t **res){
}else{
ms_warning("Could not spawn the \'host\' command.");
return -1;
}
}
ms_message("Answer received from dns (err=%i): %s",err,host_result);
begin=strstr(host_result,"sip:");
if (begin==0) {
ms_warning("No sip address found in dns naptr answer.");

View file

@ -3926,10 +3926,11 @@ typedef void (*ContactSearchCallback)( LinphoneContactSearch* id, MSList* friend
* Calling this function does not load the configuration. It will write the value into configuration so that configuration
* from remote URI will take place at next LinphoneCore start.
* @param lc the linphone core
* @param uri the http or https uri to use in order to download the configuration.
* @param uri the http or https uri to use in order to download the configuration. Passing NULL will disable remote provisioning.
* @return -1 if uri could not be parsed, 0 otherwise. Note that this does not check validity of URI endpoint nor scheme and download may still fail.
* @ingroup initializing
**/
LINPHONE_PUBLIC void linphone_core_set_provisioning_uri(LinphoneCore *lc, const char*uri);
LINPHONE_PUBLIC int linphone_core_set_provisioning_uri(LinphoneCore *lc, const char*uri);
/**
* Get provisioning URI.

View file

@ -659,6 +659,15 @@ public:
env->DeleteLocalRef(d);
}
}
static void setCoreIfNotDone(JNIEnv *env, jobject jcore, LinphoneCore *lc){
jclass objClass = env->GetObjectClass(jcore);
jfieldID myFieldID = env->GetFieldID(objClass, "nativePtr", "J");
jlong fieldVal = env->GetLongField(jcore, myFieldID);
if (fieldVal == 0){
env->SetLongField(jcore, myFieldID, (jlong)lc);
}
}
static void globalStateChange(LinphoneCore *lc, LinphoneGlobalState gstate,const char* message) {
JNIEnv *env = 0;
jint result = jvm->AttachCurrentThread(&env,NULL);
@ -668,6 +677,11 @@ public:
}
LinphoneCoreVTable *table = linphone_core_get_current_vtable(lc);
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_v_table_get_user_data(table);
jobject jcore = lcData->core;
/*at this stage, the java object may not be aware of its C object, because linphone_core_new() hasn't returned yet.*/
setCoreIfNotDone(env,jcore, lc);
jstring msg = message ? env->NewStringUTF(message) : NULL;
env->CallVoidMethod(lcData->listener
,lcData->globalStateId
@ -6465,3 +6479,72 @@ JNIEXPORT void JNICALL Java_org_linphone_core_TunnelConfigImpl_destroy(JNIEnv *e
}
/*
* Class: org_linphone_core_LinphoneCallLogImpl
* Method: getCallId
* Signature: (J)I
*/
JNIEXPORT jstring JNICALL Java_org_linphone_core_LinphoneCallLogImpl_getCallId(JNIEnv *env, jobject jobj, jlong pcl){
const char *str = linphone_call_log_get_call_id((LinphoneCallLog*)pcl);
return str ? env->NewStringUTF(str) : NULL;
}
/*
* Class: org_linphone_core_LinphoneCoreImpl
* Method: setHttpProxyHost
* Signature: (JLjava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_setHttpProxyHost(JNIEnv *env, jobject jobj, jlong core, jstring jhost){
const char *host = jhost ? env->GetStringUTFChars(jhost, NULL) : NULL;
linphone_core_set_http_proxy_host((LinphoneCore*)core, host);
if (host) env->ReleaseStringUTFChars(jhost, host);
}
/*
* Class: org_linphone_core_LinphoneCoreImpl
* Method: setHttpProxyPort
* Signature: (JI)V
*/
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_setHttpProxyPort(JNIEnv *env, jobject jobj, jlong core, jint port){
linphone_core_set_http_proxy_port((LinphoneCore*)core, port);
}
/*
* Class: org_linphone_core_LinphoneCoreImpl
* Method: getHttpProxyHost
* Signature: (J)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_linphone_core_LinphoneCoreImpl_getHttpProxyHost(JNIEnv *env , jobject jobj, jlong core){
const char * host = linphone_core_get_http_proxy_host((LinphoneCore *)core);
return host ? env->NewStringUTF(host) : NULL;
}
/*
* Class: org_linphone_core_LinphoneCoreImpl
* Method: getHttpProxyPort
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_linphone_core_LinphoneCoreImpl_getHttpProxyPort(JNIEnv *env, jobject jobj, jlong core){
return linphone_core_get_http_proxy_port((LinphoneCore *)core);
}
/*
* Class: org_linphone_core_LinphoneCoreImpl
* Method: setSipTransportTimeout
* Signature: (JI)V
*/
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_setSipTransportTimeout(JNIEnv *env, jobject jobj, jlong pcore, jint timeout){
linphone_core_set_sip_transport_timeout((LinphoneCore*)pcore, timeout);
}
/*
* Class: org_linphone_core_LinphoneCoreImpl
* Method: getSipTransportTimeout
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_linphone_core_LinphoneCoreImpl_getSipTransportTimeout(JNIEnv *env, jobject jobj, jlong pcore){
return linphone_core_get_sip_transport_timeout((LinphoneCore*)pcore);
}

View file

@ -868,7 +868,7 @@ char* linphone_proxy_config_normalize_phone_number(LinphoneProxyConfig *proxy, c
if (linphone_proxy_config_is_phone_number(tmpproxy, username)){
dial_plan_t dialplan = {0};
char * flatten=flatten_number(username);
ms_debug("Flattened number is '%s'",flatten);
ms_debug("Flattened number is '%s' for '%s'",flatten, username);
/*if proxy has a dial prefix, modify phonenumber accordingly*/
if (tmpproxy->dial_prefix!=NULL && tmpproxy->dial_prefix[0]!='\0'){
@ -884,15 +884,17 @@ char* linphone_proxy_config_normalize_phone_number(LinphoneProxyConfig *proxy, c
}
}else{
/*0. keep at most national number significant digits */
char* flatten_start = flatten + MAX(0, strlen(flatten) - dialplan.nnl);
char* flatten_start = flatten + MAX(0, (int)strlen(flatten) - (int)dialplan.nnl);
ms_debug("Prefix not present. Keeping at most %d digits: %s", dialplan.nnl, flatten_start);
/*1. First prepend international calling prefix or +*/
/*2. Second add prefix*/
/*3. Finally add user digits */
result = ms_strdup_printf("%s%s%s"
, tmpproxy->dial_escape_plus ? dialplan.icp : "+"
, dialplan.ccc
, flatten_start);
ms_debug("Prepended prefix resulted in %s", result);
}
}
if (result==NULL) {
@ -1149,6 +1151,8 @@ void linphone_core_remove_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *cf
linphone_proxy_config_enable_register(cfg,FALSE);
linphone_proxy_config_done(cfg);
linphone_proxy_config_update(cfg);
} else if (cfg->state != LinphoneRegistrationNone) {
linphone_proxy_config_set_state(cfg, LinphoneRegistrationNone,"Registration disabled");
}
linphone_proxy_config_write_all_to_config_file(lc);
}

View file

@ -108,8 +108,10 @@ int linphone_remote_provisioning_download_and_apply(LinphoneCore *lc, const char
if( scheme && (strcmp(scheme,"file") == 0) ){
// We allow for 'local remote-provisioning' in case the file is to be opened from the hard drive.
const char* file_path = remote_provisioning_uri + strlen("file://"); // skip scheme
if (uri) {
belle_sip_object_unref(uri);
}
return linphone_remote_provisioning_load_file(lc, file_path);
} else if( scheme && strncmp(scheme, "http", 4) == 0 && host && strlen(host) > 0) {
belle_http_request_listener_callbacks_t belle_request_listener={0};
belle_http_request_t *request;
@ -122,15 +124,29 @@ int linphone_remote_provisioning_download_and_apply(LinphoneCore *lc, const char
lc->provisioning_http_listener = belle_http_request_listener_create_from_callbacks(&belle_request_listener, lc);
request=belle_http_request_create("GET",uri, NULL);
return belle_http_provider_send_request(lc->http_provider, request, lc->provisioning_http_listener);
} else {
ms_error("Invalid provisioning URI [%s] (missing scheme or host ?)",remote_provisioning_uri);
if (uri) {
belle_sip_object_unref(uri);
}
return -1;
}
}
void linphone_core_set_provisioning_uri(LinphoneCore *lc, const char *uri) {
lp_config_set_string(lc->config,"misc","config-uri",uri);
int linphone_core_set_provisioning_uri(LinphoneCore *lc, const char *remote_provisioning_uri) {
belle_generic_uri_t *uri=remote_provisioning_uri?belle_generic_uri_parse(remote_provisioning_uri):NULL;
if (!remote_provisioning_uri||uri) {
lp_config_set_string(lc->config,"misc","config-uri",remote_provisioning_uri);
if (uri) {
belle_sip_object_unref(uri);
}
return 0;
}
ms_error("Invalid provisioning URI [%s] (could not be parsed)",remote_provisioning_uri);
return -1;
}
const char*linphone_core_get_provisioning_uri(const LinphoneCore *lc){

View file

@ -78,6 +78,7 @@ if(WIN32)
list(APPEND SOURCE_FILES linphone.rc)
endif()
apply_compile_flags(SOURCE_FILES "CPP" "C")
if(WIN32)
add_executable(linphone-gtk WIN32 ${SOURCE_FILES})
else()

View file

@ -349,3 +349,4 @@ LINPHONE_PUBLIC void linphone_gtk_reload_video_devices(void);
LINPHONE_PUBLIC bool_t linphone_gtk_is_friend(LinphoneCore *lc, const char *contact);
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);

View file

@ -171,7 +171,7 @@
</object>
</child>
<child>
<object class="GtkMenuItem" id="provisionning_item">
<object class="GtkMenuItem" id="provisioning_item">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Set configuration URI</property>

View file

@ -28,6 +28,9 @@
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<object class="GtkLabel" id="page0">
<property name="visible">True</property>
@ -715,7 +718,6 @@ Please go back and try again.</property>
</object>
<packing>
<property name="title" translatable="yes">Error</property>
<property name="complete">True</property>
</packing>
</child>
<child>

View file

@ -33,7 +33,7 @@ static LinphoneAccountCreator * linphone_gtk_assistant_get_creator(GtkWidget *w)
static void linphone_gtk_create_account_cb(LinphoneAccountCreator *creator, LinphoneAccountCreatorStatus status) {
GtkWidget *assistant = (GtkWidget *)linphone_account_creator_get_user_data(creator);
if (status == LinphoneAccountCreatorOk) {
if (status == LinphoneAccountCreatorAccountCreated) {
// Go to page_6_linphone_account_validation_wait
gtk_assistant_set_current_page(GTK_ASSISTANT(assistant), 6);
} else { // Error when attempting to create the account
@ -50,7 +50,7 @@ static void create_account(GtkWidget *assistant) {
static void linphone_gtk_test_account_validation_cb(LinphoneAccountCreator *creator, LinphoneAccountCreatorStatus status) {
GtkWidget *assistant = (GtkWidget *)linphone_account_creator_get_user_data(creator);
if (status == LinphoneAccountCreatorOk) {
if (status == LinphoneAccountCreatorAccountValidated) {
// Go to page_9_finish
gtk_assistant_set_current_page(GTK_ASSISTANT(assistant), 9);
} else {
@ -209,14 +209,18 @@ static gboolean update_interface_with_username_availability(GtkWidget *page) {
GtkWidget *assistant = gtk_widget_get_toplevel(page);
GtkImage* isUsernameOk = GTK_IMAGE(linphone_gtk_get_widget(assistant, "p4_image_username_ok"));
GtkLabel* usernameError = GTK_LABEL(linphone_gtk_get_widget(assistant, "p4_label_error"));
int account_existing = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(page), "is_username_used"));
int account_status = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(page), "is_username_used"));
if (account_existing == 0) {
if (account_status == LinphoneAccountCreatorAccountNotExist) {
g_object_set_data(G_OBJECT(page), "is_username_available", GINT_TO_POINTER(1));
gtk_image_set_from_stock(isUsernameOk, GTK_STOCK_OK, GTK_ICON_SIZE_LARGE_TOOLBAR);
gtk_label_set_text(usernameError, "");
} else if (account_status == LinphoneAccountCreatorAccountExist) {
gtk_label_set_text(usernameError, _("Username is already in use!"));
g_object_set_data(G_OBJECT(page), "is_username_available", GINT_TO_POINTER(0));
gtk_image_set_from_stock(isUsernameOk, GTK_STOCK_NO, GTK_ICON_SIZE_LARGE_TOOLBAR);
} else {
gtk_label_set_text(usernameError, "Username is already in use!");
gtk_label_set_text(usernameError, _("Failed to check username availability. Please try again later."));
g_object_set_data(G_OBJECT(page), "is_username_available", GINT_TO_POINTER(0));
gtk_image_set_from_stock(isUsernameOk, GTK_STOCK_NO, GTK_ICON_SIZE_LARGE_TOOLBAR);
}
@ -227,8 +231,7 @@ static gboolean update_interface_with_username_availability(GtkWidget *page) {
static void linphone_gtk_test_account_existence_cb(LinphoneAccountCreator *creator, LinphoneAccountCreatorStatus status) {
GtkWidget *assistant = (GtkWidget *)linphone_account_creator_get_user_data(creator);
GtkWidget *page = gtk_assistant_get_nth_page(GTK_ASSISTANT(assistant), gtk_assistant_get_current_page(GTK_ASSISTANT(assistant)));
gboolean account_existing = (status != LinphoneAccountCreatorOk);
g_object_set_data(G_OBJECT(page), "is_username_used", GINT_TO_POINTER(account_existing));
g_object_set_data(G_OBJECT(page), "is_username_used", GINT_TO_POINTER(status));
gdk_threads_add_idle((GSourceFunc)update_interface_with_username_availability, page);
}
@ -323,7 +326,7 @@ static void linphone_gtk_assistant_init(GtkWidget *w) {
linphone_account_creator_cbs_set_validation_tested(cbs, linphone_gtk_test_account_validation_cb);
linphone_account_creator_cbs_set_create_account(cbs, linphone_gtk_create_account_cb);
g_object_set_data(G_OBJECT(w), "creator", creator);
gtk_assistant_set_forward_page_func(GTK_ASSISTANT(w), linphone_gtk_assistant_forward, w, NULL);
}

View file

@ -118,7 +118,7 @@ public interface LinphoneCallLog {
public int getCallDuration();
/**
* Call id from signaling
* @return int
* @return the SIP call-id.
*/
public int getCallId();
public String getCallId();
}

View file

@ -959,6 +959,18 @@ public interface LinphoneCore {
*/
void setSipDscp(int dscp);
/**
* Set the timeout in milliseconds for SIP transport (TCP or TLS connection establishment maximum time).
* @param timeout_ms
**/
void setSipTransportTimeout(int timeout_ms);
/**
* Get the current SIP transport timeout.
* @param timeout_ms
**/
int getSipTransportTimeout();
/**
* Get DSCP used for SIP socket.
* @return the DSCP value used for the SIP socket.
@ -2179,4 +2191,22 @@ public interface LinphoneCore {
* Get the provisioning URI previously set.
**/
public String getProvisioningUri();
/**
* Set an http proxy hostname or IP address to use for SIP connection.
*/
public void setHttpProxyHost(String host);
/**
* Set an http proxy port to use for SIP connection.
*/
public void setHttpProxyPort(int port);
/**
* Get the http proxy host previously set.
**/
public String getHttpProxyHost();
/**
* Get the http proxy port previously set.
**/
public int getHttpProxyPort();
}

View file

@ -29,7 +29,7 @@ class LinphoneCallLogImpl implements LinphoneCallLog {
private native int getStatus(long nativePtr);
private native String getStartDate(long nativePtr);
private native int getCallDuration(long nativePtr);
private native int getCallId(long nativePtr);
private native String getCallId(long nativePtr);
private native long getTimestamp(long nativePtr);
LinphoneCallLogImpl(long aNativePtr) {
@ -62,7 +62,7 @@ class LinphoneCallLogImpl implements LinphoneCallLog {
public int getCallDuration() {
return getCallDuration(nativePtr);
}
public int getCallId() {
public String getCallId() {
return getCallId(nativePtr);
}

View file

@ -1535,4 +1535,39 @@ class LinphoneCoreImpl implements LinphoneCore {
public GlobalState getGlobalState(){
return GlobalState.fromInt(getGlobalState(nativePtr));
}
private native void setHttpProxyHost(long nativePtr, String host);
@Override
public void setHttpProxyHost(String host){
setHttpProxyHost(nativePtr, host);
}
private native void setHttpProxyPort(long nativePtr, int port);
@Override
public void setHttpProxyPort(int port){
setHttpProxyPort(nativePtr, port);
}
private native String getHttpProxyHost(long nativePtr);
@Override
public String getHttpProxyHost(){
return getHttpProxyHost(nativePtr);
}
private native int getHttpProxyPort(long nativePtr);
@Override
public int getHttpProxyPort(){
return getHttpProxyPort(nativePtr);
}
private native void setSipTransportTimeout(long nativePtr, int timeout_ms);
@Override
public void setSipTransportTimeout(int timeout_ms){
setSipTransportTimeout(nativePtr, timeout_ms);
}
private native int getSipTransportTimeout(long nativePtr);
@Override
public int getSipTransportTimeout(){
return getSipTransportTimeout(nativePtr);
}
}

2
oRTP

@ -1 +1 @@
Subproject commit cb4f9f5ce7d984b81d6a71416abc77bda2f82bdb
Subproject commit f590eac0e77e918b3cf035a864e86c083723e65b

View file

@ -46,7 +46,9 @@ set(SOURCE_FILES
tunnel_tester.c
upnp_tester.c
video_tester.c
)
)
apply_compile_flags(SOURCE_FILES "CPP" "C")
#executable must be available on root path, not host one
find_program(SIPP_PROGRAM NAMES sipp sipp.exe ONLY_CMAKE_FIND_ROOT_PATH)

View file

@ -4871,8 +4871,8 @@ end:
typedef struct _RtpTransportModifierData {
uint64_t packetSentCount;
uint64_t packetReceivedCount;
mblk_t *msg_to_send;
mblk_t *msg_to_recv;
MSQueue to_send;
MSQueue to_recv;
} RtpTransportModifierData;
const char *XOR_KEY = "BELLEDONNECOMMUNICATIONS";
@ -4889,7 +4889,7 @@ static int rtptm_on_send(RtpTransportModifier *rtptm, mblk_t *msg) {
}
data->packetSentCount += 1;
data->msg_to_send = dupmsg(msg);
ms_queue_put(&data->to_send, dupmsg(msg));
return 0; // Return 0 to drop the packet, it will be injected later
}
@ -4905,15 +4905,15 @@ static int rtptm_on_receive(RtpTransportModifier *rtptm, mblk_t *msg) {
}
data->packetReceivedCount += 1;
data->msg_to_recv = dupmsg(msg);
ms_queue_put(&data->to_recv, dupmsg(msg));
return 0; // Return 0 to drop the packet, it will be injected later
}
static void rtptm_on_schedule(RtpTransportModifier *rtptm) {
RtpTransportModifierData *data = rtptm->data;
mblk_t *msg = NULL;
if (data->msg_to_send != NULL) {
mblk_t *msg = data->msg_to_send;
while ((msg = ms_queue_get(&data->to_send)) != NULL) {
int size = 0;
unsigned char *src;
int i = 0;
@ -4931,11 +4931,10 @@ static void rtptm_on_schedule(RtpTransportModifier *rtptm) {
}
meta_rtp_transport_modifier_inject_packet_to_send(rtptm->transport, rtptm, msg, 0);
data->msg_to_send = NULL;
}
if (data->msg_to_recv != NULL) {
mblk_t *msg = data->msg_to_recv;
msg = NULL;
while ((msg = ms_queue_get(&data->to_recv)) != NULL) {
int size = 0;
unsigned char *src;
int i = 0;
@ -4950,7 +4949,6 @@ static void rtptm_on_schedule(RtpTransportModifier *rtptm) {
}
meta_rtp_transport_modifier_inject_packet_to_recv(rtptm->transport, rtptm, msg, 0);
data->msg_to_recv = NULL;
}
}
@ -4969,6 +4967,8 @@ void static call_state_changed_4(LinphoneCore *lc, LinphoneCall *call, LinphoneC
RtpTransport *rtpt = NULL;
RtpTransportModifierData *data = ms_new0(RtpTransportModifierData, 1);
RtpTransportModifier *rtptm = ms_new0(RtpTransportModifier, 1);
ms_queue_init(&data->to_send);
ms_queue_init(&data->to_recv);
rtptm->data = data;
rtptm->t_process_on_send = rtptm_on_send;
rtptm->t_process_on_receive = rtptm_on_receive;
@ -5133,7 +5133,8 @@ static void custom_rtp_modifier(bool_t pauseResumeTest, bool_t recordTest) {
ms_message("Pauline sent %i RTP packets and received %i (for real)", (int)pauline_rtp_stats.packet_sent, (int)pauline_rtp_stats.packet_recv);
BC_ASSERT_TRUE(data_marie->packetReceivedCount == marie_rtp_stats.packet_recv);
BC_ASSERT_TRUE(data_marie->packetSentCount == marie_rtp_stats.packet_sent);
BC_ASSERT_TRUE(data_pauline->packetReceivedCount == pauline_rtp_stats.packet_recv);
// There can be a small difference between the number of packets received in the modifier and the number processed in reception because the processing is asynchronous
BC_ASSERT_TRUE(data_pauline->packetReceivedCount - pauline_rtp_stats.packet_recv < 20);
BC_ASSERT_TRUE(data_pauline->packetSentCount == pauline_rtp_stats.packet_sent);
}

View file

@ -1557,7 +1557,7 @@ static void real_time_text_message_accented_chars() {
BC_ASSERT_EQUAL(linphone_chat_room_get_char(marie_chat_room), message[i], unsigned long, "%lu");
}
_linphone_chat_room_send_message(pauline_chat_room, rtt_message);
linphone_chat_room_send_chat_message(pauline_chat_room, rtt_message);
BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneMessageReceived, 1));
BC_ASSERT_EQUAL(strcmp(marie->stat.last_received_chat_message->message, "ãæçéîøùÿ"), 0, int, "%i");
}

View file

@ -41,6 +41,18 @@ static void phone_normalization_without_proxy(void) {
BC_ASSERT_STRING_EQUAL(phone_normalization(NULL, "+3301234567891"), "+3301234567891");
BC_ASSERT_STRING_EQUAL(phone_normalization(NULL, "+33 01234567891"), "+3301234567891");
BC_ASSERT_PTR_NULL(phone_normalization(NULL, "I_AM_NOT_A_NUMBER")); // invalid phone number
BC_ASSERT_STRING_EQUAL(phone_normalization(NULL, "0"), "0");
BC_ASSERT_STRING_EQUAL(phone_normalization(NULL, "01"), "01");
BC_ASSERT_STRING_EQUAL(phone_normalization(NULL, "012"), "012");
BC_ASSERT_STRING_EQUAL(phone_normalization(NULL, "0123"), "0123");
BC_ASSERT_STRING_EQUAL(phone_normalization(NULL, "01234"), "01234");
BC_ASSERT_STRING_EQUAL(phone_normalization(NULL, "012345"), "012345");
BC_ASSERT_STRING_EQUAL(phone_normalization(NULL, "0123456"), "0123456");
BC_ASSERT_STRING_EQUAL(phone_normalization(NULL, "01234567"), "01234567");
BC_ASSERT_STRING_EQUAL(phone_normalization(NULL, "012345678"), "012345678");
BC_ASSERT_STRING_EQUAL(phone_normalization(NULL, "0123456789"), "0123456789");
BC_ASSERT_STRING_EQUAL(phone_normalization(NULL, "01234567890"), "01234567890");
}
static void phone_normalization_with_proxy(void) {
@ -70,8 +82,45 @@ static void phone_normalization_with_proxy(void) {
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "0033952636505"), "+33952636505");
BC_ASSERT_PTR_NULL(phone_normalization(proxy, "toto"));
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "0"), "+330");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "01"), "+3301");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "012"), "+33012");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "0123"), "+330123");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "01234"), "+3301234");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "012345"), "+33012345");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "0123456"), "+330123456");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "01234567"), "+3301234567");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "012345678"), "+33012345678");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "0123456789"), "+33123456789");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "01234567890"), "+33234567890");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "+330"), "+330");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "+3301"), "+3301");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "+33012"), "+33012");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "+330123"), "+330123");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "+3301234"), "+3301234");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "+33012345"), "+33012345");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "+330123456"), "+330123456");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "+3301234567"), "+3301234567");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "+33012345678"), "+33012345678");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "+330123456789"), "+330123456789");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "+3301234567890"), "+3301234567890");
// invalid prefix - use a generic dialplan with 10 max length
linphone_proxy_config_set_dial_prefix(proxy, "99");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "0012345678"), "+12345678");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "0"), "+990");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "01"), "+9901");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "012"), "+99012");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "0123"), "+990123");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "01234"), "+9901234");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "012345"), "+99012345");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "0123456"), "+990123456");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "01234567"), "+9901234567");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "012345678"), "+99012345678");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "0123456789"), "+990123456789");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "01234567890"), "+991234567890");
linphone_proxy_config_destroy(proxy);
}
@ -83,6 +132,20 @@ static void phone_normalization_with_dial_escape_plus(void){
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "0033952636505"), "0033952636505");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "0952636505"), "0033952636505");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "+34952636505"), "0034952636505");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "0"), "00330");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "01"), "003301");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "012"), "0033012");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "0123"), "00330123");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "01234"), "003301234");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "012345"), "0033012345");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "0123456"), "00330123456");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "01234567"), "003301234567");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "012345678"), "0033012345678");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "0123456789"), "0033123456789");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "01234567890"), "0033234567890");
linphone_proxy_config_destroy(proxy);
}

View file

@ -43,6 +43,7 @@ set(LP_GEN_WRAPPERS_LIBS
${XML2_LIBRARIES}
)
apply_compile_flags(LP_GEN_WRAPPERS_SOURCE_FILES "CPP" "CXX")
add_executable(lp-gen-wrappers ${LP_GEN_WRAPPERS_SOURCE_FILES})
target_link_libraries(lp-gen-wrappers ${LP_GEN_WRAPPERS_LIBS})