When applying a remote provisioning config, if it is setting a proxy config...

When applying a remote provisioning config, if it is setting a proxy config and none is currently the default one, this proxy config will be the default one
parent bc4060f5
......@@ -999,10 +999,10 @@ static void video_config_read(LinphoneCore *lc){
linphone_core_set_preferred_video_size_by_name(lc,
lp_config_get_string(lc->config,"video","size","cif"));
linphone_core_set_preview_video_size_by_name(lc,
lp_config_get_string(lc->config,"video","preview_size",NULL));
linphone_core_set_preferred_framerate(lc,lp_config_get_float(lc->config,"video","framerate",0));
#ifdef VIDEO_ENABLED
......@@ -1417,7 +1417,7 @@ static void linphone_core_init(LinphoneCore * lc, const LinphoneCoreVTable *vtab
remote_provisioning_uri = linphone_core_get_provisioning_uri(lc);
if (remote_provisioning_uri == NULL) {
linphone_configuring_terminated(lc, LinphoneConfiguringSkipped, NULL);
} // else linphone_core_start will be called after the remote provisioining (see linphone_core_iterate)
} // else linphone_core_start will be called after the remote provisioning (see linphone_core_iterate)
}
/**
......
......@@ -36,20 +36,28 @@ static void xml2lpc_callback(void *ctx, xml2lpc_log_level level, const char *fmt
static void linphone_remote_provisioning_apply(LinphoneCore *lc, const char *xml) {
xml2lpc_context *context = xml2lpc_context_new(xml2lpc_callback, lc);
int result = xml2lpc_set_xml_string(context, xml);
char * error_msg = NULL;
if (result == 0) {
result = xml2lpc_convert(context, linphone_core_get_config(lc));
LpConfig * lpc = linphone_core_get_config(lc);
result = xml2lpc_convert(context, lpc);
if (result == 0) {
lp_config_sync(linphone_core_get_config(lc));
xml2lpc_context_destroy(context);
linphone_configuring_terminated(lc, LinphoneConfiguringSuccessful, NULL);
// if the remote provisioning added a proxy config and none was set before, set it
if (lp_config_has_section(lpc, "proxy_0") && lp_config_get_int(lpc, "sip", "default_proxy", -1) == -1){
lp_config_set_int(lpc, "sip", "default_proxy", 0);
}
lp_config_sync(lpc);
} else {
xml2lpc_context_destroy(context);
linphone_configuring_terminated(lc, LinphoneConfiguringFailed, "xml to lpc failed");
error_msg = "xml to lpc failed";
}
} else {
xml2lpc_context_destroy(context);
linphone_configuring_terminated(lc, LinphoneConfiguringFailed, "invalid xml");
error_msg = "invalid xml";
}
xml2lpc_context_destroy(context);
linphone_configuring_terminated(lc
,error_msg ? LinphoneConfiguringFailed : LinphoneConfiguringSuccessful
, error_msg);
}
static int linphone_remote_provisioning_load_file( LinphoneCore* lc, const char* file_path){
......
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