Commit 85a9b9f0 authored by Simon Morlat's avatar Simon Morlat
Browse files

Merge branch 'master' into dev_rtcpmux

parents 2cd6f5f4 c4a883b7
......@@ -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,23 +214,28 @@ 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()
set(GETTEXT_PACKAGE "linphone")
......
......@@ -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
......
......@@ -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)
......
......@@ -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)
......
......@@ -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) {
......
......@@ -36,18 +36,27 @@ extern "C" {
* Enum describing the status of a LinphoneAccountCreator operation.
**/
typedef enum _LinphoneAccountCreatorStatus {
LinphoneAccountCreatorOk = 0,
LinphoneAccountCreatorFailed = 1 << 0,
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,
LinphoneAccountCreatorOK,
LinphoneAccountCreatorReqFailed,
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);
......
......@@ -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.");
......
......@@ -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.
......
......@@ -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);
}
......@@ -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);
}