Commit 24ead1f2 authored by Sylvain Berfini's avatar Sylvain Berfini

Added option to remove provisioning uri once it has been successfully applied

parent 9915ab66
......@@ -1270,6 +1270,11 @@ void linphone_configuring_terminated(LinphoneCore *lc, LinphoneConfiguringState
if (lc->vtable.configuring_status)
lc->vtable.configuring_status(lc, state, message);
if (state == LinphoneConfiguringSuccessful) {
if (linphone_core_is_provisioning_transient(lc) == TRUE)
linphone_core_set_provisioning_uri(lc, NULL);
}
linphone_core_start(lc);
}
......
......@@ -2309,6 +2309,12 @@ LINPHONE_PUBLIC void linphone_core_set_provisioning_uri(LinphoneCore *lc, const
**/
LINPHONE_PUBLIC const char* linphone_core_get_provisioning_uri(const LinphoneCore *lc);
/**
* Gets if the provisioning URI should be removed after it's been applied successfully
* @param lc the linphone core
* @return TRUE if the provisioning URI should be removed, FALSE otherwise
*/
LINPHONE_PUBLIC bool_t linphone_core_is_provisioning_transient(LinphoneCore *lc);
LINPHONE_PUBLIC int linphone_core_migrate_to_multi_transport(LinphoneCore *lc);
#ifdef __cplusplus
......
......@@ -99,12 +99,14 @@ int linphone_remote_provisioning_download_and_apply(LinphoneCore *lc, const char
return 0;
}
void linphone_core_set_provisioning_uri(LinphoneCore *lc, const char*uri){
if (linphone_core_ready(lc)){
lp_config_set_string(lc->config,"misc","config-uri",uri);
}
void linphone_core_set_provisioning_uri(LinphoneCore *lc, const char *uri) {
lp_config_set_string(lc->config,"misc","config-uri",uri);
}
const char*linphone_core_get_provisioning_uri(const LinphoneCore *lc){
return lp_config_get_string(lc->config,"misc","config-uri",NULL);
}
bool_t linphone_core_is_provisioning_transient(LinphoneCore *lc) {
return lp_config_get_int(lc->config, "misc", "transient_provisioning", 0) == 1;
}
[misc]
config-uri=http://smtp.linphone.org/marie_transient_xml
......@@ -48,6 +48,15 @@ static void remote_provisioning_http(void) {
linphone_core_manager_destroy(marie);
}
static void remote_provisioning_transient(void) {
LinphoneCoreManager* marie = linphone_core_manager_new2("marie_transient_remote_rc", FALSE);
CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSuccessful,1));
CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneRegistrationOk,1));
CU_ASSERT_TRUE(linphone_core_is_provisioning_transient(marie->lc) == TRUE);
CU_ASSERT_TRUE(linphone_core_get_provisioning_uri(marie->lc) == NULL);
linphone_core_manager_destroy(marie);
}
static void remote_provisioning_https(void) {
LinphoneCoreManager* marie = linphone_core_manager_new2("marie_remote_https_rc", FALSE);
CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSuccessful,1));
......@@ -72,7 +81,8 @@ test_t remote_provisioning_tests[] = {
{ "Remote provisioning successful behind http", remote_provisioning_http },
{ "Remote provisioning successful behind https", remote_provisioning_https },
{ "Remote provisioning 404 not found", remote_provisioning_not_found },
{ "Remote provisioning invalid", remote_provisioning_invalid }
{ "Remote provisioning invalid", remote_provisioning_invalid },
{ "Remote provisioning transient successful", remote_provisioning_transient }
};
test_suite_t remote_provisioning_test_suite = {
......
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