Commit fa40c432 authored by Erwan Croze's avatar Erwan Croze 👋🏻

Not setting dns automatically in core if an app has set it

parent 1a2e1206
......@@ -1861,6 +1861,15 @@ int linphone_core_get_sip_transport_timeout(LinphoneCore *lc) {
return lc->sal->get_transport_timeout();
}
bool_t linphone_core_get_dns_set_by_app(LinphoneCore *lc) {
return lc->dns_set_by_app;
}
void linphone_core_set_dns_servers_app(LinphoneCore *lc, const bctbx_list_t *servers){
lc->dns_set_by_app = (servers != NULL);
linphone_core_set_dns_servers(lc, servers);
}
void linphone_core_set_dns_servers(LinphoneCore *lc, const bctbx_list_t *servers){
lc->sal->set_dns_servers(servers);
}
......
......@@ -4909,7 +4909,7 @@ extern "C" void Java_org_linphone_core_LinphoneChatRoomImpl_sendChatMessage(JNIE
,jlong chatroom_ptr
,jobject message
,jlong messagePtr) {
linphone_chat_room_send_chat_message_2((LinphoneChatRoom*)chatroom_ptr, (LinphoneChatMessage*)messagePtr);
}
......@@ -7693,7 +7693,7 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setDnsServers(JNIEnv *e
}
}
}
linphone_core_set_dns_servers((LinphoneCore*)lc, l);
linphone_core_set_dns_servers_app((LinphoneCore*)lc, l);
bctbx_list_free_with_data(l, ms_free);
}
......@@ -7792,7 +7792,7 @@ JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCallImpl_setListener(JNIEn
linphone_call_cbs_set_user_data(cbs, env->NewWeakGlobalRef(jlistener));
linphone_call_cbs_set_tmmbr_received(cbs, _on_tmmbr_received);
linphone_call_add_callbacks(call, cbs);
linphone_call_set_next_video_frame_decoded_callback(call, _next_video_frame_decoded_callback, env->NewWeakGlobalRef(jlistener));
}
......
......@@ -127,7 +127,6 @@
#define STRING_SET(field, value) do{ if (field){bctbx_free(field);field=NULL;}; field=bctbx_strdup(value); }while(0)
#define STRING_TRANSFER(field, newvalue) do{ if (field){bctbx_free(field);field=NULL;}; field=newvalue; }while(0)
#ifdef __cplusplus
#define getPlatformHelpers(lc) static_cast<LinphonePrivate::PlatformHelpers*>(lc->platform_helper)
#endif
......
......@@ -822,6 +822,7 @@ namespace LinphonePrivate {
char *update_check_current_version; \
bctbx_list_t *chat_rooms; \
bctbx_list_t *callsCache; \
bool_t dns_set_by_app; \
#ifdef SQLITE_STORAGE_ENABLED
#define LINPHONE_CORE_STRUCT_FIELDS \
......
......@@ -183,8 +183,7 @@ typedef struct _LinphoneCoreVTable{
LinphoneCoreSubscriptionStateChangedCb subscription_state_changed; /**<Notifies subscription state change */
LinphoneCoreNotifyReceivedCb notify_received; /**< Notifies a an event notification, see linphone_core_subscribe() */
LinphoneCorePublishStateChangedCb publish_state_changed;/**Notifies publish state change (only from #LinphoneEvent api)*/
LinphoneCoreConfiguringStatusCb configuring_status; /**< Notifies configuring status changes
@deprecated Deprecated since 2015-11-19. */
LinphoneCoreConfiguringStatusCb configuring_status; /** Notifies configuring status changes */
LINPHONE_DEPRECATED LinphoneCoreTextMessageReceivedCb text_received; /**< @brief A text message has been received.
@deprecated Use #message_received instead. Deprecated since 2015-11-19. */
LINPHONE_DEPRECATED LinphoneCoreFileTransferRecvCb file_transfer_recv; /**< @brief Callback to store file received attached to a #LinphoneChatMessage.
......@@ -1045,10 +1044,12 @@ LINPHONE_PUBLIC void linphone_core_set_user_agent(LinphoneCore *lc, const char *
LINPHONE_PUBLIC LinphoneAddress * linphone_core_interpret_url(LinphoneCore *lc, const char *url);
/**
* Initiates an outgoing call
* The application doesn't own a reference to the returned #LinphoneCall object.
* Use linphone_call_ref() to safely keep the #LinphoneCall pointer valid within your application.
* @param[in] lc #LinphoneCore object
* @brief Initiates an outgoing call.
*
* The application doesn't own a reference to the returned LinphoneCall object.
* Use linphone_call_ref() to safely keep the LinphoneCall pointer valid within your application.
*
* @param[in] lc LinphoneCore object
* @param[in] url The destination of the call (sip address, or phone number).
* @return A #LinphoneCall object or NULL in case of failure
* @ingroup call_control
......@@ -1235,8 +1236,8 @@ LINPHONE_PUBLIC LINPHONE_DEPRECATED LinphoneStatus linphone_core_accept_early_me
/**
* @brief Terminates a call.
*
* @param[in] lc #LinphoneCore object
* @param[in] call The #LinphoneCall object representing the call to be terminated
* @param[in] lc LinphoneCore object
* @param[in] call The LinphoneCall object representing the call to be terminated
* @return 0 on success, -1 on failure
* @ingroup call_control
* @deprecated Use #linphone_call_terminate() instead. Deprecated since 2017-02-13.
......@@ -1675,6 +1676,25 @@ LINPHONE_PUBLIC void linphone_core_enable_dns_search(LinphoneCore *lc, bool_t en
*/
LINPHONE_PUBLIC bool_t linphone_core_dns_search_enabled(const LinphoneCore *lc);
/**
* Tells if the DNS was set by an application
* @param[in] lc #LinphoneCore object.
* @return TRUE if DNS was set by app, FALSE otherwise.
*@ingroup media_parameters
*/
LINPHONE_PUBLIC bool_t linphone_core_get_dns_set_by_app(LinphoneCore *lc);
/**
* Forces liblinphone to use the supplied list of dns servers, instead of system's ones
* and set dns_set_by_app at true or false according to value of servers list.
* @param[in] lc #LinphoneCore object.
* @param[in] servers \bctbx_list{const char *} A list of strings containing the IP addresses of DNS servers to be used.
* Setting to NULL restores default behaviour, which is to use the DNS server list provided by the system.
* The list is copied internally.
* @ingroup media_parameters
*/
LINPHONE_PUBLIC void linphone_core_set_dns_servers_app(LinphoneCore *lc, const bctbx_list_t *servers);
/**
* Forces liblinphone to use the supplied list of dns servers, instead of system's ones.
* @param[in] lc #LinphoneCore object.
......
......@@ -123,7 +123,7 @@ AndroidPlatformHelpers::~AndroidPlatformHelpers () {
}
void AndroidPlatformHelpers::setDnsServers () {
if (!mJavaHelper) {
if (!mJavaHelper || linphone_core_get_dns_set_by_app(mCore)) {
lError() << "AndroidPlatformHelpers' mJavaHelper is null.";
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment