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
c01c9b5e
Commit
c01c9b5e
authored
Sep 25, 2012
by
Simon Morlat
Browse files
fix contact address bug with ice
fix edge detection with ice
parent
13a3f5fe
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
40 deletions
+38
-40
coreapi/callbacks.c
coreapi/callbacks.c
+1
-1
coreapi/linphonecall.c
coreapi/linphonecall.c
+9
-17
coreapi/linphonecore.c
coreapi/linphonecore.c
+15
-14
coreapi/private.h
coreapi/private.h
+13
-8
No files found.
coreapi/callbacks.c
View file @
c01c9b5e
...
...
@@ -534,7 +534,7 @@ static void call_failure(SalOp *op, SalError error, SalReason sr, const char *de
call
->
localdesc
->
streams
[
i
].
proto
=
SalProtoRtpAvp
;
memset
(
call
->
localdesc
->
streams
[
i
].
crypto
,
0
,
sizeof
(
call
->
localdesc
->
streams
[
i
].
crypto
));
}
linphone_core_start_invite
(
lc
,
call
,
NULL
);
linphone_core_start_invite
(
lc
,
call
);
}
return
;
}
...
...
coreapi/linphonecall.c
View file @
c01c9b5e
...
...
@@ -217,6 +217,10 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li
LinphoneAddress
*
addr
=
linphone_address_new
(
me
);
const
char
*
username
=
linphone_address_get_username
(
addr
);
SalMediaDescription
*
md
=
sal_media_description_new
();
if
(
call
->
ping_time
>
0
)
{
linphone_core_adapt_to_network
(
lc
,
call
->
ping_time
,
&
call
->
params
);
}
md
->
session_id
=
session_id
;
md
->
session_ver
=
session_ver
;
...
...
@@ -360,7 +364,6 @@ static void discover_mtu(LinphoneCore *lc, const char *remote){
LinphoneCall
*
linphone_call_new_outgoing
(
struct
_LinphoneCore
*
lc
,
LinphoneAddress
*
from
,
LinphoneAddress
*
to
,
const
LinphoneCallParams
*
params
)
{
LinphoneCall
*
call
=
ms_new0
(
LinphoneCall
,
1
);
int
ping_time
=-
1
;
call
->
dir
=
LinphoneCallOutgoing
;
call
->
op
=
sal_op_new
(
lc
->
sal
);
sal_op_set_user_pointer
(
call
->
op
,
call
);
...
...
@@ -373,10 +376,7 @@ LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddr
ice_session_set_role
(
call
->
ice_session
,
IR_Controlling
);
}
if
(
linphone_core_get_firewall_policy
(
call
->
core
)
==
LinphonePolicyUseStun
)
{
ping_time
=
linphone_core_run_stun_tests
(
call
->
core
,
call
);
}
if
(
ping_time
>=
0
)
{
linphone_core_adapt_to_network
(
lc
,
ping_time
,
&
call
->
params
);
call
->
ping_time
=
linphone_core_run_stun_tests
(
call
->
core
,
call
);
}
call
->
camera_active
=
params
->
has_video
;
...
...
@@ -391,7 +391,6 @@ LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddr
LinphoneCall
*
linphone_call_new_incoming
(
LinphoneCore
*
lc
,
LinphoneAddress
*
from
,
LinphoneAddress
*
to
,
SalOp
*
op
){
LinphoneCall
*
call
=
ms_new0
(
LinphoneCall
,
1
);
char
*
from_str
;
int
ping_time
=-
1
;
call
->
dir
=
LinphoneCallIncoming
;
sal_op_set_user_pointer
(
op
,
call
);
...
...
@@ -430,14 +429,11 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro
}
break
;
case
LinphonePolicyUseStun
:
ping_time
=
linphone_core_run_stun_tests
(
call
->
core
,
call
);
call
->
ping_time
=
linphone_core_run_stun_tests
(
call
->
core
,
call
);
/* No break to also destroy ice session in this case. */
default:
break
;
}
if
(
ping_time
>=
0
)
{
linphone_core_adapt_to_network
(
lc
,
ping_time
,
&
call
->
params
);
};
call
->
camera_active
=
call
->
params
.
has_video
;
discover_mtu
(
lc
,
linphone_address_get_domain
(
from
));
...
...
@@ -1767,6 +1763,7 @@ static void linphone_core_disconnected(LinphoneCore *lc, LinphoneCall *call){
static
void
handle_ice_events
(
LinphoneCall
*
call
,
OrtpEvent
*
ev
){
OrtpEventType
evt
=
ortp_event_get_type
(
ev
);
OrtpEventData
*
evd
=
ortp_event_get_data
(
ev
);
int
ping_time
;
if
(
evt
==
ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED
)
{
switch
(
ice_session_state
(
call
->
ice_session
))
{
...
...
@@ -1790,7 +1787,7 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){
}
linphone_core_update_ice_state_in_call_stats
(
call
);
}
else
if
(
evt
==
ORTP_EVENT_ICE_GATHERING_FINISHED
)
{
int
ping_time
=
-
1
;
if
(
evd
->
info
.
ice_processing_successful
==
TRUE
)
{
ice_session_compute_candidates_foundations
(
call
->
ice_session
);
ice_session_eliminate_redundant_candidates
(
call
->
ice_session
);
...
...
@@ -1798,6 +1795,7 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){
ping_time
=
ice_session_gathering_duration
(
call
->
ice_session
);
if
(
ping_time
>=
0
)
{
ping_time
/=
ice_session_nb_check_lists
(
call
->
ice_session
);
call
->
ping_time
=
ping_time
;
}
}
else
{
ms_warning
(
"No STUN answer from [%s], disabling ICE"
,
linphone_core_get_stun_server
(
call
->
core
));
...
...
@@ -1811,16 +1809,10 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){
linphone_core_start_accept_call_update
(
call
->
core
,
call
);
break
;
case
LinphoneCallOutgoingInit
:
if
(
ping_time
>=
0
)
{
linphone_core_adapt_to_network
(
call
->
core
,
ping_time
,
&
call
->
params
);
}
linphone_call_stop_media_streams
(
call
);
linphone_core_proceed_with_invite_if_ready
(
call
->
core
,
call
,
NULL
);
break
;
default:
if
(
ping_time
>=
0
)
{
linphone_core_adapt_to_network
(
call
->
core
,
ping_time
,
&
call
->
params
);
}
linphone_call_stop_media_streams
(
call
);
linphone_core_notify_incoming_call
(
call
->
core
,
call
);
break
;
...
...
coreapi/linphonecore.c
View file @
c01c9b5e
...
...
@@ -1910,7 +1910,7 @@ void linphone_core_iterate(LinphoneCore *lc){
linphone_call_delete_ice_session
(
call
);
linphone_call_stop_media_streams
(
call
);
}
linphone_core_start_invite
(
lc
,
call
,
NULL
);
linphone_core_start_invite
(
lc
,
call
);
}
if
(
call
->
state
==
LinphoneCallIncomingReceived
){
elapsed
=
curtime
-
call
->
start_time
;
...
...
@@ -2174,16 +2174,17 @@ int linphone_core_proceed_with_invite_if_ready(LinphoneCore *lc, LinphoneCall *c
}
if
((
ice_ready
==
TRUE
)
&&
(
ping_ready
==
TRUE
))
{
return
linphone_core_start_invite
(
lc
,
call
,
dest_proxy
);
return
linphone_core_start_invite
(
lc
,
call
);
}
return
0
;
}
int
linphone_core_start_invite
(
LinphoneCore
*
lc
,
LinphoneCall
*
call
,
LinphoneProxyConfig
*
dest_proxy
){
int
linphone_core_start_invite
(
LinphoneCore
*
lc
,
LinphoneCall
*
call
){
int
err
;
char
*
contact
;
char
*
real_url
,
*
barmsg
;
char
*
from
;
LinphoneProxyConfig
*
dest_proxy
=
call
->
dest_proxy
;
/*try to be best-effort in giving real local or routable contact address */
contact
=
get_fixed_contact
(
lc
,
call
,
dest_proxy
);
...
...
@@ -2315,10 +2316,9 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const
{
const
char
*
route
=
NULL
;
const
char
*
from
=
NULL
;
LinphoneProxyConfig
*
proxy
=
NULL
;
LinphoneProxyConfig
*
proxy
=
NULL
,
*
dest_proxy
=
NULL
;
LinphoneAddress
*
parsed_url2
=
NULL
;
char
*
real_url
=
NULL
;
LinphoneProxyConfig
*
dest_proxy
=
NULL
;
LinphoneCall
*
call
;
bool_t
use_ice
=
FALSE
;
...
...
@@ -2351,6 +2351,7 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const
parsed_url2
=
linphone_address_new
(
from
);
call
=
linphone_call_new_outgoing
(
lc
,
parsed_url2
,
linphone_address_clone
(
addr
),
params
);
call
->
dest_proxy
=
dest_proxy
;
sal_op_set_route
(
call
->
op
,
route
);
if
(
linphone_core_add_call
(
lc
,
call
)
!=
0
)
...
...
@@ -2376,7 +2377,7 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const
}
}
if
(
dest_proxy
==
NULL
&&
lc
->
sip_conf
.
ping_with_options
==
TRUE
){
if
(
call
->
dest_proxy
==
NULL
&&
lc
->
sip_conf
.
ping_with_options
==
TRUE
){
/*defer the start of the call after the OPTIONS ping*/
call
->
ping_replied
=
FALSE
;
call
->
ping_op
=
sal_op_new
(
lc
->
sal
);
...
...
@@ -2384,7 +2385,7 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const
sal_op_set_user_pointer
(
call
->
ping_op
,
call
);
call
->
start_time
=
time
(
NULL
);
}
else
{
if
(
use_ice
==
FALSE
)
linphone_core_start_invite
(
lc
,
call
,
dest_proxy
);
if
(
use_ice
==
FALSE
)
linphone_core_start_invite
(
lc
,
call
);
}
if
(
real_url
!=
NULL
)
ms_free
(
real_url
);
...
...
@@ -2718,7 +2719,7 @@ int linphone_core_accept_call(LinphoneCore *lc, LinphoneCall *call){
**/
int
linphone_core_accept_call_with_params
(
LinphoneCore
*
lc
,
LinphoneCall
*
call
,
const
LinphoneCallParams
*
params
)
{
LinphoneProxyConfig
*
cfg
=
NULL
,
*
dest_proxy
=
NULL
;
LinphoneProxyConfig
*
cfg
=
NULL
;
const
char
*
contact
=
NULL
;
SalOp
*
replaced
;
SalMediaDescription
*
new_md
;
...
...
@@ -2766,15 +2767,15 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call,
}
linphone_core_get_default_proxy
(
lc
,
&
cfg
);
dest_proxy
=
cfg
;
dest_proxy
=
linphone_core_lookup_known_proxy
(
lc
,
call
->
log
->
to
);
call
->
dest_proxy
=
cfg
;
call
->
dest_proxy
=
linphone_core_lookup_known_proxy
(
lc
,
call
->
log
->
to
);
if
(
cfg
!=
dest_proxy
&&
dest_proxy
!=
NULL
)
{
if
(
cfg
!=
call
->
dest_proxy
&&
call
->
dest_proxy
!=
NULL
)
{
ms_message
(
"Overriding default proxy setting for this call:"
);
ms_message
(
"The used identity will be %s"
,
linphone_proxy_config_get_identity
(
dest_proxy
));
ms_message
(
"The used identity will be %s"
,
linphone_proxy_config_get_identity
(
call
->
dest_proxy
));
}
/*try to be best-effort in giving real local or routable contact address*/
contact
=
get_fixed_contact
(
lc
,
call
,
dest_proxy
);
contact
=
get_fixed_contact
(
lc
,
call
,
call
->
dest_proxy
);
if
(
contact
)
sal_op_set_contact
(
call
->
op
,
contact
);
...
...
@@ -5084,7 +5085,7 @@ void linphone_core_set_media_encryption_mandatory(LinphoneCore *lc, bool_t m) {
void
linphone_core_init_default_params
(
LinphoneCore
*
lc
,
LinphoneCallParams
*
params
)
{
params
->
has_video
=
linphone_core_video_enabled
(
lc
)
&&
lc
->
video_policy
.
automatically_initiate
;
params
->
media_encryption
=
linphone_core_get_media_encryption
(
lc
);
params
->
media_encryption
=
linphone_core_get_media_encryption
(
lc
);
params
->
in_conference
=
FALSE
;
}
...
...
coreapi/private.h
View file @
c01c9b5e
...
...
@@ -125,6 +125,7 @@ struct _LinphoneCall
LinphoneCallState
state
;
LinphoneCallState
transfer_state
;
/*idle if no transfer*/
LinphoneReason
reason
;
LinphoneProxyConfig
*
dest_proxy
;
int
refcnt
;
void
*
user_pointer
;
int
audio_port
;
...
...
@@ -139,27 +140,31 @@ struct _LinphoneCall
LinphoneCallParams
remote_params
;
int
up_bw
;
/*upload bandwidth setting at the time the call is started. Used to detect if it changes during a call */
int
audio_bw
;
/*upload bandwidth used by audio */
OrtpEvQueue
*
audiostream_app_evq
;
char
*
auth_token
;
OrtpEvQueue
*
videostream_app_evq
;
CallCallbackObj
nextVideoFrameDecoded
;
LinphoneCallStats
stats
[
2
];
IceSession
*
ice_session
;
LinphoneChatMessage
*
pending_message
;
int
ping_time
;
bool_t
refer_pending
;
bool_t
media_pending
;
bool_t
audio_muted
;
bool_t
camera_active
;
bool_t
all_muted
;
/*this flag is set during early medias*/
bool_t
playing_ringbacktone
;
bool_t
owns_call_log
;
bool_t
ringing_beep
;
/* whether this call is ringing through an already existent current call*/
OrtpEvQueue
*
audiostream_app_evq
;
char
*
auth_token
;
OrtpEvQueue
*
videostream_app_evq
;
bool_t
videostream_encrypted
;
bool_t
audiostream_encrypted
;
bool_t
auth_token_verified
;
bool_t
defer_update
;
bool_t
was_automatically_paused
;
bool_t
ping_replied
;
CallCallbackObj
nextVideoFrameDecoded
;
LinphoneCallStats
stats
[
2
];
IceSession
*
ice_session
;
LinphoneChatMessage
*
pending_message
;
};
...
...
@@ -285,7 +290,7 @@ void linphone_core_update_progress(LinphoneCore *lc, const char *purpose, float
void
linphone_core_stop_waiting
(
LinphoneCore
*
lc
);
int
linphone_core_proceed_with_invite_if_ready
(
LinphoneCore
*
lc
,
LinphoneCall
*
call
,
LinphoneProxyConfig
*
dest_proxy
);
int
linphone_core_start_invite
(
LinphoneCore
*
lc
,
LinphoneCall
*
call
,
LinphoneProxyConfig
*
dest_proxy
);
int
linphone_core_start_invite
(
LinphoneCore
*
lc
,
LinphoneCall
*
call
);
int
linphone_core_start_update_call
(
LinphoneCore
*
lc
,
LinphoneCall
*
call
);
int
linphone_core_start_accept_call_update
(
LinphoneCore
*
lc
,
LinphoneCall
*
call
);
void
linphone_core_start_refered_call
(
LinphoneCore
*
lc
,
LinphoneCall
*
call
);
...
...
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