Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
b105e0b3
Commit
b105e0b3
authored
Apr 05, 2016
by
Gautier Pelloux-Prayer
Browse files
proxy: add linphone_proxy_config_set_ref_key and linphone_proxy_config_get_ref_key
parent
1537a522
Changes
3
Hide whitespace changes
Inline
Side-by-side
coreapi/linphone_proxy_config.h
View file @
b105e0b3
...
...
@@ -524,6 +524,29 @@ LINPHONE_PUBLIC void linphone_proxy_config_set_custom_header(LinphoneProxyConfig
**/
LINPHONE_PUBLIC
const
LinphoneAuthInfo
*
linphone_proxy_config_find_auth_info
(
const
LinphoneProxyConfig
*
cfg
);
/**
* Get the persistent reference key associated to the proxy config.
*
* The reference key can be for example an id to an external database.
* It is stored in the config file, thus can survive to process exits/restarts.
*
* @param[in] cfg #LinphoneProxyConfig object.
* @return The reference key string that has been associated to the proxy config, or NULL if none has been associated.
**/
LINPHONE_PUBLIC
const
char
*
linphone_proxy_config_get_ref_key
(
const
LinphoneProxyConfig
*
cfg
);
/**
* Associate a persistent reference key to the proxy config.
*
* The reference key can be for example an id to an external database.
* It is stored in the config file, thus can survive to process exits/restarts.
*
* @param[in] cfg #LinphoneProxyConfig object.
* @param[in] refkey The reference key string to associate to the proxy config.
**/
LINPHONE_PUBLIC
void
linphone_proxy_config_set_ref_key
(
LinphoneProxyConfig
*
cfg
,
const
char
*
refkey
);
/**
* @}
*/
...
...
coreapi/private.h
View file @
b105e0b3
...
...
@@ -631,6 +631,7 @@ struct _LinphoneProxyConfig
LinphoneEvent
*
long_term_event
;
unsigned
long
long
previous_publish_config_hash
[
2
];
char
*
refkey
;
};
BELLE_SIP_DECLARE_VPTR
(
LinphoneProxyConfig
);
...
...
coreapi/proxy.c
View file @
b105e0b3
...
...
@@ -105,7 +105,7 @@ static void linphone_proxy_config_init(LinphoneCore* lc, LinphoneProxyConfig *cf
const
char
*
quality_reporting_collector
=
lc
?
lp_config_get_default_string
(
lc
->
config
,
"proxy"
,
"quality_reporting_collector"
,
NULL
)
:
NULL
;
const
char
*
contact_params
=
lc
?
lp_config_get_default_string
(
lc
->
config
,
"proxy"
,
"contact_parameters"
,
NULL
)
:
NULL
;
const
char
*
contact_uri_params
=
lc
?
lp_config_get_default_string
(
lc
->
config
,
"proxy"
,
"contact_uri_parameters"
,
NULL
)
:
NULL
;
const
char
*
refkey
=
lc
?
lp_config_get_default_string
(
lc
->
config
,
"proxy"
,
"refkey"
,
NULL
)
:
NULL
;
cfg
->
expires
=
lc
?
lp_config_get_default_int
(
lc
->
config
,
"proxy"
,
"reg_expires"
,
3600
)
:
3600
;
cfg
->
reg_sendregister
=
lc
?
lp_config_get_default_int
(
lc
->
config
,
"proxy"
,
"reg_sendregister"
,
1
)
:
1
;
cfg
->
dial_prefix
=
dial_prefix
?
ms_strdup
(
dial_prefix
)
:
NULL
;
...
...
@@ -124,6 +124,7 @@ static void linphone_proxy_config_init(LinphoneCore* lc, LinphoneProxyConfig *cf
cfg
->
avpf_mode
=
lc
?
lp_config_get_default_int
(
lc
->
config
,
"proxy"
,
"avpf"
,
LinphoneAVPFDefault
)
:
LinphoneAVPFDefault
;
cfg
->
avpf_rr_interval
=
lc
?
lp_config_get_default_int
(
lc
->
config
,
"proxy"
,
"avpf_rr_interval"
,
5
)
:
5
;
cfg
->
publish_expires
=-
1
;
cfg
->
refkey
=
refkey
?
ms_strdup
(
refkey
)
:
NULL
;
}
LinphoneProxyConfig
*
linphone_proxy_config_new
()
{
...
...
@@ -218,6 +219,7 @@ void _linphone_proxy_config_destroy(LinphoneProxyConfig *cfg){
if
(
cfg
->
saved_identity
!=
NULL
)
linphone_address_destroy
(
cfg
->
saved_identity
);
if
(
cfg
->
sent_headers
!=
NULL
)
sal_custom_header_free
(
cfg
->
sent_headers
);
if
(
cfg
->
pending_contact
)
linphone_address_unref
(
cfg
->
pending_contact
);
if
(
cfg
->
refkey
)
ms_free
(
cfg
->
refkey
);
_linphone_proxy_config_release_ops
(
cfg
);
}
...
...
@@ -1334,6 +1336,7 @@ void linphone_proxy_config_write_to_config_file(LpConfig *config, LinphoneProxyC
lp_config_set_int
(
config
,
key
,
"dial_escape_plus"
,
cfg
->
dial_escape_plus
);
lp_config_set_string
(
config
,
key
,
"dial_prefix"
,
cfg
->
dial_prefix
);
lp_config_set_int
(
config
,
key
,
"privacy"
,
cfg
->
privacy
);
if
(
cfg
->
refkey
)
lp_config_set_string
(
config
,
key
,
"refkey"
,
cfg
->
refkey
);
}
...
...
@@ -1390,6 +1393,9 @@ LinphoneProxyConfig *linphone_proxy_config_new_from_config_file(LinphoneCore* lc
if
(
tmp
!=
NULL
&&
strlen
(
tmp
)
>
0
)
linphone_proxy_config_set_sip_setup
(
cfg
,
tmp
);
CONFIGURE_INT_VALUE
(
cfg
,
config
,
key
,
privacy
,
"privacy"
)
CONFIGURE_STRING_VALUE
(
cfg
,
config
,
key
,
ref_key
,
"refkey"
)
return
cfg
;
}
...
...
@@ -1640,3 +1646,15 @@ const struct _LinphoneAuthInfo* linphone_proxy_config_find_auth_info(const Linph
const
char
*
domain
=
cfg
->
identity_address
?
linphone_address_get_domain
(
cfg
->
identity_address
)
:
NULL
;
return
_linphone_core_find_auth_info
(
cfg
->
lc
,
cfg
->
realm
,
username
,
domain
,
TRUE
);
}
const
char
*
linphone_proxy_config_get_ref_key
(
const
LinphoneProxyConfig
*
cfg
)
{
return
cfg
->
refkey
;
}
void
linphone_proxy_config_set_ref_key
(
LinphoneProxyConfig
*
cfg
,
const
char
*
refkey
)
{
if
(
cfg
->
refkey
!=
NULL
){
ms_free
(
cfg
->
refkey
);
cfg
->
refkey
=
NULL
;
}
if
(
refkey
)
cfg
->
refkey
=
ms_strdup
(
refkey
);
}
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