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
60c72c84
Commit
60c72c84
authored
May 11, 2017
by
jehan
Browse files
add nat_policy ref to calls to make sure nat policy is used from proxy config if exist
parent
cbebf254
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
32 additions
and
24 deletions
+32
-24
coreapi/account_creator.c
coreapi/account_creator.c
+2
-5
coreapi/friend.c
coreapi/friend.c
+1
-0
coreapi/linphonecall.c
coreapi/linphonecall.c
+20
-12
coreapi/linphonecore.c
coreapi/linphonecore.c
+2
-2
coreapi/misc.c
coreapi/misc.c
+2
-4
coreapi/private.h
coreapi/private.h
+1
-0
coreapi/proxy.c
coreapi/proxy.c
+4
-1
No files found.
coreapi/account_creator.c
View file @
60c72c84
...
...
@@ -122,9 +122,11 @@ LinphoneProxyConfig * linphone_account_creator_create_proxy_config(const Linphon
if
(
creator
->
display_name
)
{
linphone_address_set_display_name
(
identity
,
creator
->
display_name
);
}
/*deprecated, use default proxy config instead*/
if
(
creator
->
route
)
{
route
=
ms_strdup_printf
(
"%s"
,
creator
->
route
);
}
/*deprecated, use default proxy config instead*/
if
(
creator
->
domain
)
{
domain
=
ms_strdup_printf
(
"%s;transport=%s"
,
creator
->
domain
,
linphone_transport_to_string
(
creator
->
transport
));
}
...
...
@@ -137,12 +139,7 @@ LinphoneProxyConfig * linphone_account_creator_create_proxy_config(const Linphon
snprintf
(
buff
,
sizeof
(
buff
),
"%d"
,
dial_prefix_number
);
linphone_proxy_config_set_dial_prefix
(
cfg
,
buff
);
}
if
(
linphone_proxy_config_get_server_addr
(
cfg
)
==
NULL
)
linphone_proxy_config_set_server_addr
(
cfg
,
domain
);
if
(
linphone_proxy_config_get_route
(
cfg
)
==
NULL
)
linphone_proxy_config_set_route
(
cfg
,
route
);
linphone_proxy_config_enable_publish
(
cfg
,
FALSE
);
linphone_proxy_config_enable_register
(
cfg
,
TRUE
);
info
=
linphone_auth_info_new
(
linphone_address_get_username
(
identity
),
// username
...
...
coreapi/friend.c
View file @
60c72c84
...
...
@@ -1160,6 +1160,7 @@ bool_t linphone_friend_create_vcard(LinphoneFriend *fr, const char *name) {
}
linphone_vcard_set_full_name
(
vcard
,
name
);
linphone_friend_set_vcard
(
fr
,
vcard
);
linphone_vcard_unref
(
vcard
);
return
TRUE
;
}
...
...
coreapi/linphonecall.c
View file @
60c72c84
...
...
@@ -1109,6 +1109,20 @@ static void linphone_call_init_common(LinphoneCall *call, LinphoneAddress *from,
linphone_call_init_stats
(
call
->
audio_stats
,
LINPHONE_CALL_STATS_AUDIO
);
linphone_call_init_stats
(
call
->
video_stats
,
LINPHONE_CALL_STATS_VIDEO
);
linphone_call_init_stats
(
call
->
text_stats
,
LINPHONE_CALL_STATS_TEXT
);
if
(
call
->
dest_proxy
==
NULL
)
{
/* Try to define the destination proxy if it has not already been done to have a correct contact field in the SIP messages */
call
->
dest_proxy
=
linphone_core_lookup_known_proxy
(
call
->
core
,
call
->
log
->
to
);
}
if
(
call
->
dest_proxy
!=
NULL
)
call
->
nat_policy
=
linphone_proxy_config_get_nat_policy
(
call
->
dest_proxy
);
if
(
call
->
nat_policy
==
NULL
)
call
->
nat_policy
=
linphone_core_get_nat_policy
(
call
->
core
);
linphone_nat_policy_ref
(
call
->
nat_policy
);
}
void
linphone_call_init_stats
(
LinphoneCallStats
*
stats
,
int
type
)
{
...
...
@@ -1283,7 +1297,7 @@ void linphone_call_fill_media_multicast_addr(LinphoneCall *call) {
void
linphone_call_check_ice_session
(
LinphoneCall
*
call
,
IceRole
role
,
bool_t
is_reinvite
){
if
(
call
->
ice_session
)
return
;
/*already created*/
if
(
!
linphone_nat_policy_ice_enabled
(
linphone_core_get_nat_policy
(
call
->
core
)
)){
if
(
!
linphone_nat_policy_ice_enabled
(
call
->
nat_policy
)){
return
;
}
...
...
@@ -1321,7 +1335,7 @@ LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddr
linphone_call_check_ice_session
(
call
,
IR_Controlling
,
FALSE
);
if
(
linphone_
core_get_firewall_policy
(
call
->
core
)
==
LinphonePolicyUseStun
)
{
if
(
linphone_
nat_policy_ice_enabled
(
call
->
nat_policy
)
)
{
call
->
ping_time
=
linphone_core_run_stun_tests
(
call
->
core
,
call
);
}
#ifdef BUILD_UPNP
...
...
@@ -1566,8 +1580,6 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro
}
}
if
(
call
->
dest_proxy
!=
NULL
)
nat_policy
=
linphone_proxy_config_get_nat_policy
(
call
->
dest_proxy
);
if
(
nat_policy
==
NULL
)
nat_policy
=
linphone_core_get_nat_policy
(
call
->
core
);
if
((
nat_policy
!=
NULL
)
&&
linphone_nat_policy_ice_enabled
(
nat_policy
))
{
/* Create the ice session now if ICE is required */
if
(
md
){
...
...
@@ -1958,6 +1970,8 @@ static void linphone_call_destroy(LinphoneCall *obj){
if
(
obj
->
onhold_file
)
ms_free
(
obj
->
onhold_file
);
if
(
obj
->
ei
)
linphone_error_info_unref
(
obj
->
ei
);
if
(
obj
->
nat_policy
)
linphone_nat_policy_unref
(
obj
->
nat_policy
);
}
LinphoneCall
*
linphone_call_ref
(
LinphoneCall
*
obj
){
...
...
@@ -2380,7 +2394,7 @@ static void port_config_set_random_choosed(LinphoneCall *call, int stream_index,
static
void
_linphone_call_prepare_ice_for_stream
(
LinphoneCall
*
call
,
int
stream_index
,
bool_t
create_checklist
){
MediaStream
*
ms
=
stream_index
==
call
->
main_audio_stream_index
?
(
MediaStream
*
)
call
->
audiostream
:
stream_index
==
call
->
main_video_stream_index
?
(
MediaStream
*
)
call
->
videostream
:
(
MediaStream
*
)
call
->
textstream
;
if
(
(
linphone_
core_get_firewall_policy
(
call
->
core
)
==
LinphonePolicyUseIce
)
&&
(
call
->
ice_session
!=
NULL
)){
if
(
linphone_
nat_policy_ice_enabled
(
call
->
nat_policy
)
&&
(
call
->
ice_session
!=
NULL
)){
IceCheckList
*
cl
;
rtp_session_set_pktinfo
(
ms
->
sessions
.
rtp_session
,
TRUE
);
cl
=
ice_session_check_list
(
call
->
ice_session
,
stream_index
);
...
...
@@ -2400,7 +2414,7 @@ int linphone_call_prepare_ice(LinphoneCall *call, bool_t incoming_offer){
int
err
;
bool_t
has_video
=
FALSE
;
if
(
(
linphone_
core_get_firewall_policy
(
call
->
core
)
==
LinphonePolicyUseIce
)
&&
(
call
->
ice_session
!=
NULL
)){
if
(
linphone_
nat_policy_ice_enabled
(
call
->
nat_policy
)
&&
(
call
->
ice_session
!=
NULL
)){
if
(
incoming_offer
){
remote
=
sal_call_get_remote_media_description
(
call
->
op
);
has_video
=
linphone_core_video_enabled
(
call
->
core
)
&&
linphone_core_media_description_contains_video_stream
(
remote
);
...
...
@@ -4918,12 +4932,6 @@ static LinphoneAddress *get_fixed_contact(LinphoneCore *lc, LinphoneCall *call ,
void
linphone_call_set_contact_op
(
LinphoneCall
*
call
)
{
LinphoneAddress
*
contact
;
if
(
call
->
dest_proxy
==
NULL
)
{
/* Try to define the destination proxy if it has not already been done to have a correct contact field in the SIP messages */
call
->
dest_proxy
=
linphone_core_lookup_known_proxy
(
call
->
core
,
call
->
log
->
to
);
}
contact
=
get_fixed_contact
(
call
->
core
,
call
,
call
->
dest_proxy
);
if
(
contact
){
SalTransport
tport
=
sal_address_get_transport
((
SalAddress
*
)
contact
);
...
...
coreapi/linphonecore.c
View file @
60c72c84
...
...
@@ -3164,7 +3164,7 @@ void linphone_core_iterate(LinphoneCore *lc){
/*start the call even if the OPTIONS reply did not arrive*/
if
(
call
->
ice_session
!=
NULL
)
{
ms_warning
(
"ICE candidates gathering from [%s] has not finished yet, proceed with the call without ICE anyway."
,
linphone_
core
_get_stun_server
(
l
c
));
,
linphone_
nat_policy
_get_stun_server
(
c
all
->
nat_policy
));
linphone_call_delete_ice_session
(
call
);
linphone_call_stop_media_streams_for_ice_gathering
(
call
);
}
...
...
@@ -3517,7 +3517,7 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const
call
->
log
->
start_date_time
=
ms_time
(
NULL
);
linphone_call_init_media_streams
(
call
);
if
(
linphone_
core_get_firewall_policy
(
call
->
core
)
==
LinphonePolicyUseIce
)
{
if
(
linphone_
nat_policy_ice_enabled
(
call
->
nat_policy
)
)
{
if
(
lc
->
sip_conf
.
sdp_200_ack
){
ms_warning
(
"ICE is not supported when sending INVITE without SDP"
);
}
else
{
...
...
coreapi/misc.c
View file @
60c72c84
...
...
@@ -517,7 +517,7 @@ static void stun_auth_requested_cb(LinphoneCall *call, const char *realm, const
if
(
nat_policy
!=
NULL
)
{
user
=
linphone_nat_policy_get_stun_server_username
(
nat_policy
);
}
else
{
nat_policy
=
linphone_core_get_nat_policy
(
call
->
core
)
;
nat_policy
=
call
->
nat_policy
;
if
(
nat_policy
!=
NULL
)
{
user
=
linphone_nat_policy_get_stun_server_username
(
nat_policy
);
}
...
...
@@ -598,11 +598,9 @@ int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call){
IceCheckList
*
audio_cl
;
IceCheckList
*
video_cl
;
IceCheckList
*
text_cl
;
LinphoneNatPolicy
*
nat_policy
=
NULL
;
LinphoneNatPolicy
*
nat_policy
=
call
->
nat_policy
;
const
char
*
server
=
NULL
;
if
(
call
->
dest_proxy
!=
NULL
)
nat_policy
=
linphone_proxy_config_get_nat_policy
(
call
->
dest_proxy
);
if
(
nat_policy
==
NULL
)
nat_policy
=
linphone_core_get_nat_policy
(
lc
);
if
(
nat_policy
!=
NULL
)
server
=
linphone_nat_policy_get_stun_server
(
nat_policy
);
if
(
call
->
ice_session
==
NULL
)
return
-
1
;
...
...
coreapi/private.h
View file @
60c72c84
...
...
@@ -400,6 +400,7 @@ struct _LinphoneCall{
bctbx_list_t
*
callbacks
;
/* A list of LinphoneCallCbs object */
LinphoneCallCbs
*
current_cbs
;
/* The current LinphoneCallCbs object used to call a callback */
LinphoneNatPolicy
*
nat_policy
;
/*nat policy for this call, either from proxy nor from core*/
};
BELLE_SIP_DECLARE_VPTR_NO_EXPORT
(
LinphoneCall
);
...
...
coreapi/proxy.c
View file @
60c72c84
...
...
@@ -1454,7 +1454,10 @@ LinphoneNatPolicy * linphone_proxy_config_get_nat_policy(const LinphoneProxyConf
}
void
linphone_proxy_config_set_nat_policy
(
LinphoneProxyConfig
*
cfg
,
LinphoneNatPolicy
*
policy
)
{
if
(
policy
!=
NULL
)
policy
=
linphone_nat_policy_ref
(
policy
);
/* Prevent object destruction if the same policy is used */
if
(
policy
!=
NULL
)
{
policy
=
linphone_nat_policy_ref
(
policy
);
/* Prevent object destruction if the same policy is used */
policy
->
lc
=
cfg
->
lc
;
}
if
(
cfg
->
nat_policy
!=
NULL
)
linphone_nat_policy_unref
(
cfg
->
nat_policy
);
cfg
->
nat_policy
=
policy
;
}
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