Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
BC
public
liblinphone
Commits
b3df86ba
Commit
b3df86ba
authored
Apr 24, 2017
by
Erwan Croze
👋🏻
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix remote provisioning
parent
a17e2be2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
17 deletions
+43
-17
coreapi/lpconfig.c
coreapi/lpconfig.c
+32
-16
coreapi/remote_provisioning.c
coreapi/remote_provisioning.c
+1
-1
include/linphone/lpconfig.h
include/linphone/lpconfig.h
+10
-0
No files found.
coreapi/lpconfig.c
View file @
b3df86ba
...
...
@@ -481,29 +481,45 @@ LinphoneStatus linphone_config_read_file(LpConfig *lpconfig, const char *filenam
return
-
1
;
}
static
char
*
_linphone_config_xml_convert
(
LpConfig
*
lpc
,
xml2lpc_context
*
context
,
int
result
)
{
char
*
error_msg
=
NULL
;
if
(
result
==
0
)
{
result
=
xml2lpc_convert
(
context
,
lpc
);
if
(
result
==
0
)
{
// 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
{
error_msg
=
"xml to lpc failed"
;
}
}
else
{
error_msg
=
"invalid xml"
;
}
return
error_msg
;
}
char
*
linphone_config_load_from_xml_file
(
LpConfig
*
lpc
,
const
char
*
filename
,
void
*
lc
,
void
*
ctx
)
{
xml2lpc_context
*
context
=
NULL
;
char
*
path
=
lp_realpath
(
filename
,
NULL
);
char
*
error_msg
=
NULL
;
if
(
path
)
{
int
result
=
-
1
;
context
=
xml2lpc_context_new
(
ctx
,
lc
);
result
=
xml2lpc_set_xml_file
(
context
,
path
);
if
(
result
==
0
)
{
result
=
xml2lpc_convert
(
context
,
lpc
);
if
(
result
==
0
)
{
// 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
{
error_msg
=
"xml to lpc failed"
;
}
}
else
{
error_msg
=
"invalid xml"
;
}
error_msg
=
_linphone_config_xml_convert
(
lpc
,
context
,
xml2lpc_set_xml_file
(
context
,
path
));
}
if
(
context
)
xml2lpc_context_destroy
(
context
);
return
error_msg
;
}
char
*
linphone_config_load_from_xml_string
(
LpConfig
*
lpc
,
const
char
*
buffer
,
void
*
lc
,
void
*
ctx
)
{
xml2lpc_context
*
context
=
NULL
;
char
*
error_msg
=
NULL
;
if
(
buffer
!=
NULL
)
{
context
=
xml2lpc_context_new
(
ctx
,
lc
);
error_msg
=
_linphone_config_xml_convert
(
lpc
,
context
,
xml2lpc_set_xml_string
(
context
,
buffer
));
}
if
(
context
)
xml2lpc_context_destroy
(
context
);
return
error_msg
;
...
...
coreapi/remote_provisioning.c
View file @
b3df86ba
...
...
@@ -35,7 +35,7 @@ static void xml2lpc_callback(void *ctx, xml2lpc_log_level level, const char *fmt
}
static
void
linphone_remote_provisioning_apply
(
LinphoneCore
*
lc
,
const
char
*
xml
)
{
char
*
error_msg
=
linphone_config_load_from_xml_
file
(
linphone_core_get_config
(
lc
),
xml
,
lc
,
xml2lpc_callback
);
char
*
error_msg
=
linphone_config_load_from_xml_
string
(
linphone_core_get_config
(
lc
),
xml
,
lc
,
xml2lpc_callback
);
linphone_configuring_terminated
(
lc
,
error_msg
?
LinphoneConfiguringFailed
:
LinphoneConfiguringSuccessful
...
...
include/linphone/lpconfig.h
View file @
b3df86ba
...
...
@@ -92,6 +92,16 @@ LINPHONE_PUBLIC LinphoneStatus linphone_config_read_file(LinphoneConfig *lpconfi
*/
LINPHONE_PUBLIC
char
*
linphone_config_load_from_xml_file
(
LpConfig
*
lpc
,
const
char
*
filename
,
void
*
lc
,
void
*
ctx
);
/**
* Reads a xml config string and fill the LinphoneConfig with the read config dynamic values.
* @ingroup misc
* @param lpconfig The LinphoneConfig object to fill with the content of the file
* @param buffer The string of the config file to fill the LinphoneConfig
* @param lc LinphoneCore to share with xml2lpc
* @param ctx The context given to xml2lpc callback
*/
LINPHONE_PUBLIC
char
*
linphone_config_load_from_xml_string
(
LpConfig
*
lpc
,
const
char
*
buffer
,
void
*
lc
,
void
*
ctx
);
/**
* Retrieves a configuration item as a string, given its section, key, and default value.
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment