Commit a0646a0f authored by Simon Morlat's avatar Simon Morlat
Browse files

add method to configure dns servers

parent db89a5c6
......@@ -816,6 +816,7 @@ bool_t sal_nat_helper_enabled(Sal *sal) {
void sal_set_dns_timeout(Sal* sal,int timeout) {
belle_sip_stack_set_dns_timeout(sal->stack, timeout);
int sal_get_dns_timeout(const Sal* sal) {
return belle_sip_stack_get_dns_timeout(sal->stack);
......@@ -823,12 +824,26 @@ int sal_get_dns_timeout(const Sal* sal) {
void sal_set_transport_timeout(Sal* sal,int timeout) {
belle_sip_stack_set_transport_timeout(sal->stack, timeout);
int sal_get_transport_timeout(const Sal* sal) {
return belle_sip_stack_get_transport_timeout(sal->stack);
void sal_set_dns_servers(Sal *sal, const MSList *servers){
belle_sip_list_t *l = NULL;
/*we have to convert the MSList into a belle_sip_list_t first*/
for (; servers != NULL; servers = servers->next){
l = belle_sip_list_append(l, servers->data);
belle_sip_stack_set_dns_servers(sal->stack, l);
void sal_enable_dns_srv(Sal *sal, bool_t enable) {
belle_sip_stack_enable_dns_srv(sal->stack, (unsigned char)enable);
bool_t sal_dns_srv_enabled(const Sal *sal) {
return (bool_t)belle_sip_stack_dns_srv_enabled(sal->stack);
......@@ -1442,6 +1442,10 @@ int linphone_core_get_sip_transport_timeout(LinphoneCore *lc) {
return sal_get_transport_timeout(lc->sal);
void linphone_core_set_dns_servers(LinphoneCore *lc, const MSList *servers){
sal_set_dns_servers(lc->sal, servers);
void linphone_core_enable_dns_srv(LinphoneCore *lc, bool_t enable) {
sal_enable_dns_srv(lc->sal, enable);
if (linphone_core_ready(lc))
......@@ -2720,6 +2720,16 @@ LINPHONE_PUBLIC void linphone_core_enable_dns_srv(LinphoneCore *lc, bool_t enabl
LINPHONE_PUBLIC bool_t linphone_core_dns_srv_enabled(const LinphoneCore *lc);
* Forces liblinphone to use the supplied list of dns servers, instead of system's ones.
* @param[in] lc #LinphoneCore object.
* @param[in] a #MSList 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(LinphoneCore *lc, const MSList *servers);
* Returns the list of available audio codecs.
* @param[in] lc The LinphoneCore object
......@@ -850,6 +850,7 @@ LINPHONE_PUBLIC void sal_set_dns_timeout(Sal* sal,int timeout);
LINPHONE_PUBLIC int sal_get_dns_timeout(const Sal* sal);
LINPHONE_PUBLIC void sal_set_transport_timeout(Sal* sal,int timeout);
LINPHONE_PUBLIC int sal_get_transport_timeout(const Sal* sal);
void sal_set_dns_servers(Sal *sal, const MSList *servers);
LINPHONE_PUBLIC void sal_enable_dns_srv(Sal *sal, bool_t enable);
LINPHONE_PUBLIC bool_t sal_dns_srv_enabled(const Sal *sal);
LINPHONE_PUBLIC void sal_set_dns_user_hosts_file(Sal *sal, const char *hosts_file);
......@@ -2274,4 +2274,10 @@ public interface LinphoneCore {
org.linphone.mediastream.Factory getMSFactory();
* Overrides the list of DNS servers to use.
* Passing null restores the default behaviour, which is to use the dns server list provided by the system.
public void setDnsServers(String servers[]);
......@@ -1625,4 +1625,9 @@ class LinphoneCoreImpl implements LinphoneCore {
public org.linphone.mediastream.Factory getMSFactory(){
return (org.linphone.mediastream.Factory) getMSFactory(nativePtr);
private native void setDnsServers(long nativePtr, String servers[]);
public void setDnsServers(String servers[]){
setDnsServers(nativePtr, servers);
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