diff --git a/coreapi/bellesip_sal/sal_impl.c b/coreapi/bellesip_sal/sal_impl.c index abff14e99..7f55d453c 100644 --- a/coreapi/bellesip_sal/sal_impl.c +++ b/coreapi/bellesip_sal/sal_impl.c @@ -704,6 +704,12 @@ void sal_set_dns_timeout(Sal* sal,int timeout) { int sal_get_dns_timeout(const Sal* sal) { return belle_sip_stack_get_dns_timeout(sal->stack); } +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); +} void sal_set_dns_user_hosts_file(Sal *sal, const char *hosts_file) { belle_sip_stack_set_dns_user_hosts_file(sal->stack, hosts_file); diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index e05ecc6ce..f52283cb6 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -499,6 +499,8 @@ static void net_config_read (LinphoneCore *lc) /*legacy parameter*/ linphone_core_set_download_ptime(lc,tmp); } + tmp = lp_config_get_int(lc->config, "net", "dns_srv_enabled", 1); + linphone_core_enable_dns_srv(lc, tmp); /* This is to filter out unsupported firewall policies */ linphone_core_set_firewall_policy(lc, linphone_core_get_firewall_policy(lc)); @@ -1069,6 +1071,16 @@ void linphone_core_set_upload_bandwidth(LinphoneCore *lc, int bw){ if (linphone_core_ready(lc)) lp_config_set_int(lc->config,"net","upload_bw",bw); } +void linphone_core_enable_dns_srv(LinphoneCore *lc, bool_t enable) { + sal_enable_dns_srv(lc->sal, enable); + if (linphone_core_ready(lc)) + lp_config_set_int(lc->config, "net", "dns_srv_enabled", enable ? 1 : 0); +} + +bool_t linphone_core_dns_srv_enabled(const LinphoneCore *lc) { + return sal_dns_srv_enabled(lc->sal); +} + /** * Retrieve the maximum available download bandwidth. * This value was set by linphone_core_set_download_bandwidth(). diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index d45ad7f85..9f57d1ce3 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -1400,6 +1400,22 @@ LINPHONE_PUBLIC void linphone_core_set_upload_ptime(LinphoneCore *lc, int ptime) LINPHONE_PUBLIC int linphone_core_get_upload_ptime(LinphoneCore *lc); +/** + * Enable or disable DNS SRV resolution. + * @param[in] lc #LinphoneCore object. + * @param[in] enable TRUE to enable DNS SRV resolution, FALSE to disable it. + * @ingroup media_parameters + */ +LINPHONE_PUBLIC void linphone_core_enable_dns_srv(LinphoneCore *lc, bool_t enable); + +/** + * Tells whether DNS SRV resolution is enabled. + * @param[in] lc #LinphoneCore object. + * @returns TRUE if DNS SRV resolution is enabled, FALSE if disabled. + * @ingroup media_parameters + */ +LINPHONE_PUBLIC bool_t linphone_core_dns_srv_enabled(const LinphoneCore *lc); + /* returns a MSList of PayloadType */ LINPHONE_PUBLIC const MSList *linphone_core_get_audio_codecs(const LinphoneCore *lc); diff --git a/include/sal/sal.h b/include/sal/sal.h index 6374e2a08..655613661 100644 --- a/include/sal/sal.h +++ b/include/sal/sal.h @@ -685,6 +685,8 @@ bool_t sal_nat_helper_enabled(Sal *sal); 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_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); LINPHONE_PUBLIC const char *sal_get_dns_user_hosts_file(const Sal *sal); unsigned char * sal_get_random_bytes(unsigned char *ret, size_t size);